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 (Hacker's Log 2025). OWASP WSTG scopes the test across record types, not just CNAME (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 (BBOT 3.1.0).
  • Exploitability preconditions (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 (sh.consulting SPF typo).
  • Supply of candidates keeps growing because preview URLs, demo pages and temporary microservices get deleted while their DNS records stay (Hacker's Log 2025). Keep unresolved names from passive sources, because they can be historical or dangling assets (dreamsoftragedy recon methodology).

Techniques / payloads

Detection pipeline

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: Hacker's Log, Ultimate Guide to Recon. Nuclei ships takeover templates (Install Nuclei). reconFTW exposes SUBTAKEOVER=true and ZONETRANSFER=true, and its -s mode runs enumeration, probing and takeover checks together (reconFTW).

Fingerprint tools produce false positives because of provider-specific restrictions. can-i-take-over-xyz is the canonical per-provider status list (0xpatrik, 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 (ShadowSaaS v1.1).

Manual verification fingerprints (0xpatrik)

ProviderCNAME regexResponse fingerprintClaim
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.htmlheroku 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
http -b GET http://sub.example.com | grep -E -q '<Code>NoSuchBucket</Code>|<li>Code: NoSuchBucket</li>' && echo "may be possible"

Sources: 0xpatrik PoC creation, 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 (0xpatrik, Intigriti).

Escalation (raises severity beyond “content on subdomain”)

From 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 (Hacker's Log, 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 (sh.consulting).

Defenses

  • Decommission in order: remove the DNS record first, then delete the cloud resource (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 (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 (sh.consulting).
  • Avoid wildcard DNS where it isn’t needed, scan continuously with Nuclei or baddns, and tie cloud-resource lifecycle to DNS (Hacker's Log).
  • Shrink the blast radius: host-only cookies, exact-match OAuth redirect URIs, explicit CORS and CSP origins instead of *.example.com.

Sources