Course contentsShow
← Security
Lesson 1131 of 3,05223. Web Security - Modern Web AttacksFree lesson

Subdomain Takeover Vulnerabilities

Identifying and exploiting dangling DNS records pointing to unclaimed cloud resources to hijack subdomains.

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

  1. The Dangling DNS Record: Your DNS has a CNAME record: blog.example.com → myblog.cloudprovider.com
  2. The Abandoned Resource: You deleted the myblog bucket/project at cloudprovider.com but forgot to remove the DNS entry
  3. The Takeover: An attacker creates their own account and registers myblog.cloudprovider.com
  4. The Impact: Now blog.example.com serves 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.