Skip to content
Pwnversity
WEB-TAKEOVERintermediate · 5 min · upd. 2026-10

Subdomain takeover

OWASP A02:2025CWE-350

When a subdomain points (via CNAME or another DNS record) to an external service that no longer exists or is unclaimed, the attacker can register that resource and serve their own content from the victim’s subdomain. Being a legitimate domain, it inherits its trust: credible phishing, domain-cookie theft, subdomain allow-list bypass (OAuth/CORS/CSP) and reputational damage. The invariant broken is “every name that resolves to our DNS is controlled by us”.

flowchart LR
    A[Attacker] -->|"resolves the DNS"| D["sub.victim.tld CNAME → app.provider.net (deleted)"]
    D -->|"'unclaimed' page"| A
    A -->|"claims app.provider.net"| P[Cloud provider]
    P -->|"serves their content"| S["sub.victim.tld = attacker"]
  • Highly credible phishing on the real domain.
  • Cookie theft if Domain is broad (.company.tld).
  • Trust bypass: subdomains in OAuth redirect_uri allow-lists, CORS, CSP or cookies (see headers and CORS).
  • Reputation abuse (email sending, malware distribution from the domain).

A dangling DNS record: the subdomain has a CNAME (or A/NS) to a provider resource that was deleted but the DNS record remains. The provider lets you claim that resource name (bucket, app, page) → you serve your content. The flaw isn’t a product’s but the decommission order: the resource was removed and the record forgotten.

  • Dangling CNAME — the most common case (S3, GitHub Pages, Heroku, Azure…).
  • A/AAAA to a claimable IP — a released cloud IP you can request again.
  • Dangling NS — the most severe: it delegates the whole zone to a server you can control (takeover of every subdomain under that delegation).
  • MX/others — dangling mail records to intercept or spoof email.
  1. Enumerate subdomains (see subdomain recon) and resolve their records.
  2. Find those pointing to third-party services giving an “unclaimed” page (the provider’s typical error).
  3. Claim the resource at that provider (create the bucket/app/page with that name).
  4. Publish a harmless PoC (a page with your mark) to prove control.
Ventana de terminal
# Enumerate and resolve, flagging third-party CNAMEs
subfinder -silent -d victim.tld | dnsx -silent -cname -resp | tee cnames.txt
# dnsx -resp appends the CNAME on each line; extract just the host for the nuclei list
cut -d' ' -f1 cnames.txt | sort -u > hosts.txt
# Hunt takeover fingerprints at scale
nuclei -l hosts.txt -tags takeover
Provider “Unclaimed” string
AWS S3 NoSuchBucket
GitHub Pages There isn't a GitHub Pages site here
Heroku No such app / herokucdn
Azure 404 Web Site not found (*.azurewebsites.net, *.cloudapp.net)
Fastly Fastly error: unknown domain
Shopify Sorry, this shop is currently unavailable
Zendesk Help Center Closed
Others Readthedocs, Surge, Netlify, Cargo, Tumblr, Unbounce… (see can-i-take-over-xyz)

The can-i-take-over-xyz list is the reference for which services are claimable and how; a fingerprint appearing doesn’t guarantee it’s claimable (some providers already mitigate it by verifying ownership).

subjack, nuclei (takeover templates), dnsx/httpx/subfinder, and the reference list can-i-take-over-xyz.

Phishing, cookie theft, and bypass of controls that trust the subdomain: e.g. if login.company.tld is in the OAuth redirect_uri list, a takeover of another trusted subdomain can chain to ATO. A takeover also serves as a trusted origin for XSS/CORS.

  • Continuous DNS inventory: CNAME/A/NS records to third-party services; alert on those returning “not claimed”.
  • Monitoring of subdomain responses (“resource doesn’t exist” fingerprints).

DNS zones (periodic export), nuclei/takeover scanner results in CI, and cloud provider records (deleted resources still having DNS pointed at them).

  1. Decommission process: when removing a service, remove the DNS record first.
  2. Automated monitoring of DNS and subdomains (nuclei/takeover in CI).
  3. Ownership verification and, where possible, preventive resource claiming.

Remove/fix the DNS record, claim the resource to take it from the attacker, and review abuse (phishing, stolen cookies, spoofed email).

  • Not a product CVE but a DNS configuration issue; one of the most frequent and high-impact bug-bounty findings, with public cases at major brands (documentation, marketing or forgotten old-environment subdomains).

Product advisories in NVD (https://nvd.nist.gov/vuln/search) and GitHub Advisories (https://github.com/advisories).

  • Subdomains enumerated and records (CNAME/A/NS) resolved.
  • Dangling records to claimable services identified (by fingerprint).
  • Confirmed the resource is actually claimable (not just a 404).
  • Takeover demonstrated with a harmless PoC on the subdomain.
  • Chaining evaluated (domain cookies, OAuth/CORS allow-lists).