Subdomain Takeover Vulnerabilities
What you'll learn: How attackers can hijack forgotten subdomains by claiming the cloud resources they point to.
The Core Problem
A subdomain takeover happens when a DNS record for a subdomain (like blog.example.com) points to an external service (AWS S3, Azure, GitHub Pages, etc.), but the resource at that service has been deleted or never claimed. An attacker can then register that same resource name and take control of the subdomain.
Think of it like a forwarding address: your company's mailbox label says "Send blog.example.com mail to PO Box 12345 at CloudStorage Inc." But you canceled that PO box without updating the label. Now anyone can rent PO Box 12345 and receive all mail intended for your subdomain.
How It Works
- The Dangling DNS Record: Your DNS has a CNAME record:
blog.example.com→myblog.cloudprovider.com - The Abandoned Resource: You deleted the
myblogbucket/project atcloudprovider.combut forgot to remove the DNS entry - The Takeover: An attacker creates their own account and registers
myblog.cloudprovider.com - The Impact: Now
blog.example.comserves the attacker's content—perfect for phishing, malware distribution, or cookie theft using your trusted domain
Why This Matters
Because the subdomain belongs to your domain, it inherits trust. Users believe content on blog.example.com is legitimate. Session cookies for *.example.com may be sent to the hijacked subdomain. Search engines and reputation systems trust it.
Prevention
- Audit DNS records regularly and remove entries for decommissioned services
- Monitor subdomains for unexpected content
- Use DNS monitoring tools to detect takeovers
- Document all external service dependencies
Key Takeaway: Subdomain takeovers exploit the gap between DNS configuration and cloud resource management—always clean up DNS records when decommissioning external services to prevent attackers from hijacking your trusted subdomains.