Subdomain takeover
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"]
Threat model
Section titled “Threat model”- Highly credible phishing on the real domain.
- Cookie theft if
Domainis broad (.company.tld). - Trust bypass: subdomains in OAuth
redirect_uriallow-lists, CORS, CSP or cookies (see headers and CORS). - Reputation abuse (email sending, malware distribution from the domain).
Anatomy
Section titled “Anatomy”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.
Variants
Section titled “Variants”- 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.
Red Team
Section titled “Red Team”Process
Section titled “Process”- Enumerate subdomains (see subdomain recon) and resolve their records.
- Find those pointing to third-party services giving an “unclaimed” page (the provider’s typical error).
- Claim the resource at that provider (create the bucket/app/page with that name).
- Publish a harmless PoC (a page with your mark) to prove control.
# Enumerate and resolve, flagging third-party CNAMEssubfinder -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 listcut -d' ' -f1 cnames.txt | sort -u > hosts.txt# Hunt takeover fingerprints at scalenuclei -l hosts.txt -tags takeoverCommon fingerprints
Section titled “Common fingerprints”| 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).
Tooling
Section titled “Tooling”subjack, nuclei (takeover templates), dnsx/httpx/subfinder, and the reference
list can-i-take-over-xyz.
Impact and chaining
Section titled “Impact and chaining”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.
Blue Team
Section titled “Blue Team”Detection
Section titled “Detection”- Continuous DNS inventory:
CNAME/A/NSrecords to third-party services; alert on those returning “not claimed”. - Monitoring of subdomain responses (“resource doesn’t exist” fingerprints).
Telemetry and sources
Section titled “Telemetry and sources”DNS zones (periodic export), nuclei/takeover scanner results in CI, and cloud provider
records (deleted resources still having DNS pointed at them).
Hardening
Section titled “Hardening”- Decommission process: when removing a service, remove the DNS record first.
- Automated monitoring of DNS and subdomains (nuclei/takeover in CI).
- Ownership verification and, where possible, preventive resource claiming.
Response
Section titled “Response”Remove/fix the DNS record, claim the resource to take it from the attacker, and review abuse (phishing, stolen cookies, spoofed email).
CVEs and real-world cases
Section titled “CVEs and real-world cases”- 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).
Testing checklist
Section titled “Testing checklist”- 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).