caon.io

Subdomain Takeover

A DNS record still points at a provider resource nobody owns any more. Register it and the name is yours.

1 · THE DANGLE shop.target.com CNAME target-shop.s3.amazonaws.com 404 NoSuchBucket gone 2 · THE CLAIM shop.target.com unchanged you register the same name You now serve content on the victim's origin — same-site cookies, CSP allow-lists, OAuth redirect_uri allow-lists and CORS trust all follow the name, not the owner.
The record never changed. Only the owner of the target did.

Find the dangle

# resolve everything, keep what still has a CNAME
dnsx -l subs.txt -cname -resp -silent

# https://github.com/haccer/subjack
subjack -w subs.txt -t 100 -timeout 30 -ssl -c fingerprints.json -v

# https://github.com/projectdiscovery/nuclei
nuclei -l subs.txt -t http/takeovers/ -silent
# NXDOMAIN on the CNAME target is the strongest signal
dig +short shop.target.com CNAME
dig +short target-shop.s3.amazonaws.com

Fingerprints

Provider Body
AWS S3 NoSuchBucket
GitHub Pages There isn't a GitHub Pages site here.
Heroku No such app
Azure Web App - Unavailable / NXDOMAIN on *.azurewebsites.net
Shopify Sorry, this shop is currently unavailable.
Fastly Fastly error: unknown domain
Netlify Not Found - Request ID
Zendesk Help Center Closed
Readme.io Project doesnt exist... yet!
Webflow The page you are looking for doesn't exist
Surge.sh project not found

Full list: https://github.com/EdOverflow/can-i-take-over-xyz

Don’t stop at the CNAME

  • NS takeover — a delegated zone on a nameserver you can register. Whole subtree.
  • MX takeover — receive mail for the domain. Password resets.
  • Dangling A record — the elastic IP was released. Rent instances until you get it.
  • _acme-challenge CNAME — lets you issue a valid certificate for the parent.
  • Second-order — a JS/CSS/image the main site loads from a domain that expired.
# what does the main site pull in from elsewhere?
subjs -i urls.txt | unfurl -u domains | sort -u | dnsx -silent

Why it matters more than it looks

Report the consequence, not the takeover:

  • Same-site cookies scoped to .target.com are now readable
  • CSP script-src *.target.com now allows your script
  • OAuth redirect_uri allow-lists on *.target.com leak the code
  • CORS Access-Control-Allow-Origin reflecting *.target.com
  • Session fixation, phishing on a real origin

Proving it

Serve a file with your handle and the report reference. No more.

https://shop.target.com/caon-poc.txt   →   "takeover PoC, report #12345"

Do not serve anything that looks like the real site, do not collect traffic, and hand the resource back once the report is triaged.

Articles

↑↓ navigate↵ openesc close