# Subdomain Takeover
> A DNS record for a target subdomain still points at a third-party resource (bucket, PaaS app, SaaS page, zone) that was deleted. Anyone who can re-claim that resource name on the provider then serves content on the target's origin.
## How it works
- **Dangling CNAME** is the classic case: `dev.company.com CNAME example-app.vercel.app`, the Vercel app is deleted, the record stays, and an attacker registers `example-app` ([[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log 2025]]). OWASP WSTG scopes the test across record types, not just CNAME ([[raw/owasp.org/owasp-test-for-subdomain-takeover-4873|OWASP WSTG]]). BBOT's baddns also flags dangling delegations on `_acme-challenge`, `_dmarc` and 15 common DKIM selectors, plus **NS lame delegation** at HIGH/CONFIRMED ([[raw/github.com/bbot-3-1-0-faster-dns-brute-forcing-and-new-passive-subdomain-sources-14515|BBOT 3.1.0]]).
- **Exploitability preconditions** ([[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Intigriti]]):
1. The provider does **not** require domain-ownership verification.
2. You can **choose** the resource name. If the provider auto-generates a random hostname for the CNAME, takeover is usually off.
- Not vulnerable: **HubSpot** binds the primary domain to the account, so a stale record isn't claimable until the domain is removed. **Atlassian Statuspage** requires a TXT verification first.
- The same "stale pointer" root cause shows up in mail records. A mistyped SPF `include:amzonses.com` (Amazon SES) on a .gov domain authorized 32,066 snowshoe-spam IPs that passed SPF and DMARC. In a scan of 25,964 government domains, 43 referenced expired, mistyped or repurposed domains ([[raw/sh.consulting/ip-snowshoeing-under-us-gov-email-via-a-whitelisted-amazonses-typo-in-13949|sh.consulting SPF typo]]).
- Supply of candidates keeps growing because preview URLs, demo pages and temporary microservices get deleted while their DNS records stay ([[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log 2025]]). Keep unresolved names from passive sources, because they can be historical or dangling assets ([[raw/dreamsoftragedy.com/recon-methodology-14090|dreamsoftragedy recon methodology]]).
## Techniques / payloads
### Detection pipeline
```bash
subfinder -d target.com -o subs.txt
dnsx -l subs.txt -a -cname -resp # who points where
httpx -l subs.txt -mc 404,403,301,302 -title -server -tech-detect
subzy run --targets resolved.txt --output subzy.txt --hide_fails
subjack -w resolved.txt -t 20 -timeout 30 -o subjack.txt
```
Sources: [[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log]], [[raw/medium.com/the-ultimate-guide-to-reconnaissance-for-bug-bounty-hunting-14814|Ultimate Guide to Recon]]. Nuclei ships takeover templates ([[raw/github.com/install-nuclei-5845|Install Nuclei]]). reconFTW exposes `SUBTAKEOVER=true` and `ZONETRANSFER=true`, and its `-s` mode runs enumeration, probing and takeover checks together ([[raw/github.com/reconftw-automated-recon-tool-4279|reconFTW]]).
Fingerprint tools produce false positives because of provider-specific restrictions. **can-i-take-over-xyz** is the canonical per-provider status list ([[raw/0xpatrik.com/subdomain-takeover-proof-creation-for-bug-bounties-4868|0xpatrik]], [[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Intigriti]]). **ShadowSaaS Surface Scanner** is deliberately conservative: it needs several independent signals before calling a takeover. v1.1 adds validated `http/https/socks5/socks5h` proxying and reports explicitly when a transport failure makes a target's result untrustworthy, so "zero findings" can't hide a misrouted scan ([[raw/secureideas.com/shadowsaas-surface-scanner-v1-1-subdomain-takeover-recon-with-proxy-su-14106|ShadowSaaS v1.1]]).
### Manual verification fingerprints (0xpatrik)
| Provider | CNAME regex | Response fingerprint | Claim |
|---|---|---|---|
| S3 | `^[a-z0-9\.\-]{0,63}\.?s3.amazonaws\.com
, also `s3-website[.-]<region>`, `s3.dualstack.<region>` | `<Code>NoSuchBucket</Code>` | create bucket named **exactly the source hostname**, upload `poc` with public-read + correct `Content-Type`, enable static website hosting if the record targets `s3-website` |
| GitHub Pages | `^[a-z0-9\.\-]{0,70}\.?github\.io
| `There isn't a GitHub Pages site here.` | repo named after the CNAME target, enable Pages, set custom domain to the source host |
| Heroku | `^[a-z0-9\.\-]{2,70}\.herokudns\.com
| `//www.herokucdn.com/error-pages/no-such-app.html` | `heroku create x && heroku domains:add dev.company.com` |
| Readme.io | `^[a-z0-9\.\-]{2,70}\.readme\.io
| `Project doesnt exist... yet!` | any project, set Custom Domain to source host |
```bash
http -b GET http://sub.example.com | grep -E -q '<Code>NoSuchBucket</Code>|<li>Code: NoSuchBucket</li>' && echo "may be possible"
```
Sources: [[raw/0xpatrik.com/subdomain-takeover-proof-creation-for-bug-bounties-4868|0xpatrik PoC creation]], [[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log]].
**PoC etiquette:** most programs reject theoretical reports, so claim the resource and serve a hidden, uniquely named page (not `index.html`), then stop ([[raw/0xpatrik.com/subdomain-takeover-proof-creation-for-bug-bounties-4868|0xpatrik]], [[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Intigriti]]).
### Escalation (raises severity beyond "content on subdomain")
From [[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Intigriti]]:
- **OAuth/SSO token theft**: if `redirect_uri` allows any `*.example.com`, tokens in query or fragment land on your host. See [[OAuth 2.0 Vulnerabilities]] and [[Account Takeover]].
- **Cookie theft**: cookies scoped `Domain=.example.com` are sent to the hijacked host, so session cookies can be read.
- **CSRF**: the taken-over host is same-site, so default `SameSite=Lax` cookies ride along. See [[SameSite Cookies]] and [[CSRF Token Bypasses]].
- **CORS**: read authenticated data cross-origin when the app trusts all subdomains in `Access-Control-Allow-Origin`.
- **CSP bypass**: when the host is allowlisted in the main app's `script-src`. See [[Content Security Policy]].
- **Supply chain**: when the main site loads JS from the hijacked CDN or bucket host, you get stored XSS on every page.
- **Phishing**: a trusted origin for credential pages and malware downloads, and a way past internal allowlists ([[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log]], [[raw/medium.com/spear-phishing-and-subdomains-takeover-6083|Spear Phishing and Subdomain Takeover]]).
## Notable cases
- Abusix documented a group taking over dangling CNAMEs on universities, major brands and a Connecticut state government site. The same group runs the `amzonses.com` SPF-typo snowshoe operation, whose include chain rotates every 3–8 days ([[raw/sh.consulting/ip-snowshoeing-under-us-gov-email-via-a-whitelisted-amazonses-typo-in-13949|sh.consulting]]).
## Defenses
- Decommission in order: **remove the DNS record first**, then delete the cloud resource ([[raw/medium.com/dns-pentesting-guide-for-beginners-what-port-53-leaks-and-how-to-test-15374|DNS pentesting guide]]).
- On a schedule, resolve every subdomain, check that each CNAME target still exists *and is still yours*, and delete "just in case" records ([[raw/dev.to/the-riskiest-server-is-the-one-nobody-remembers-a-checklist-for-forgot-13627|Forgotten-server checklist]]).
- Audit SPF `include`, MX and NS for expired or mistyped domains. A backup MX hides a broken one, so only audits catch these ([[raw/sh.consulting/ip-snowshoeing-under-us-gov-email-via-a-whitelisted-amazonses-typo-in-13949|sh.consulting]]).
- Avoid wildcard DNS where it isn't needed, scan continuously with Nuclei or baddns, and tie cloud-resource lifecycle to DNS ([[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Hacker's Log]]).
- Shrink the blast radius: host-only cookies, exact-match OAuth redirect URIs, explicit CORS and CSP origins instead of `*.example.com`.
## Related
- [[Reconnaissance]] (hub)
- [[Subdomain Enumeration]] · [[Asset Discovery]] · [[Google Dorking]]
- [[Account Takeover]] · [[OAuth 2.0 Vulnerabilities]] · [[Content Security Policy]] · [[SameSite Cookies]]
- [[Domain and Infrastructure OSINT]] · [[Bug Bounty Methodology]]
## Sources
- [[raw/0xpatrik.com/subdomain-takeover-proof-creation-for-bug-bounties-4868|Subdomain Takeover: Proof Creation for Bug Bounties (0xpatrik)]]
- [[raw/owasp.org/owasp-test-for-subdomain-takeover-4873|OWASP Test for Subdomain Takeover]]
- [[raw/intigriti.com/hunting-down-subdomain-takeover-vulnerabilities-4870|Hunting down subdomain takeover vulnerabilities (Intigriti)]]
- [[raw/thehackerslog.substack.com/subdomain-takeover-in-2025-new-methods-and-tools-4281|Subdomain Takeover in 2025: New Methods and Tools]]
- [[raw/secureideas.com/shadowsaas-surface-scanner-v1-1-subdomain-takeover-recon-with-proxy-su-14106|ShadowSaaS Surface Scanner v1.1]]
- [[raw/medium.com/spear-phishing-and-subdomains-takeover-6083|Spear Phishing And Subdomains Takeover]]
- [[raw/github.com/bbot-3-1-0-faster-dns-brute-forcing-and-new-passive-subdomain-sources-14515|BBOT 3.1.0 release notes]]
- [[raw/sh.consulting/ip-snowshoeing-under-us-gov-email-via-a-whitelisted-amazonses-typo-in-13949|IP snowshoeing via AmazonSES typo in SPF]]
- [[raw/dev.to/the-riskiest-server-is-the-one-nobody-remembers-a-checklist-for-forgot-13627|Checklist for forgotten internet-facing servers]]
- [[raw/medium.com/dns-pentesting-guide-for-beginners-what-port-53-leaks-and-how-to-test-15374|DNS Pentesting Guide: What Port 53 Leaks]]
- [[raw/medium.com/the-ultimate-guide-to-reconnaissance-for-bug-bounty-hunting-14814|The Ultimate Guide to Reconnaissance for Bug Bounty Hunting]]
- [[raw/github.com/reconftw-automated-recon-tool-4279|reconFTW]]
- [[raw/github.com/install-nuclei-5845|Install Nuclei]]
- [[raw/dreamsoftragedy.com/recon-methodology-14090|Recon methodology (dreamsoftragedy)]]