Articles / Security

  • subdomain-takeover
  • dns
  • vulnerability-disclosure
  • computer-misuse-act
  • appsec
  • cloud

How to Prove a Subdomain Takeover Without Taking Anything Over

The most convincing proof of a subdomain takeover is to take over the subdomain. It is also the step most likely to turn a helpful report into an awkward conversation. You can get very close without it, if you collect the right evidence and are honest about the gap that remains.

The bug is simple. shop.example.com has a CNAME pointing at something hosted elsewhere, and that something has been deleted. If a stranger can create a new resource under the old name, they get to serve content on example.com's subdomain.

Why claiming it is the wrong default

Without permission, do not register the resource. The moment you do, real visitors, old links and API clients may start talking to your server. Cookies scoped to the parent domain can arrive with them, and controlling HTTP on the name is enough to request a certificate for it.

In the UK there is also the Computer Misuse Act 1990. Section 1 covers knowingly seeking unauthorised access to programs or data, and section 17 defines "unauthorised" around entitlement and consent. Good intentions are not part of either test.

Whether claiming an abandoned cloud name is an offence will depend on what you did and what reached you. That is my reading, not a court's, and I would not volunteer to settle it. If a bug bounty policy explicitly allows a harmless claim, follow its terms exactly. If it says nothing, treat that as no.

Four facts make the case

You are building a chain, and each link needs its own evidence:

  1. The owner's authoritative DNS still publishes the record.
  2. The answer is specific to that name, or you know it comes from a wildcard.
  3. The target is missing, according to DNS or the provider's own error response.
  4. The provider's rules would let somebody else create it.

Most scanner output stops at the third. The fourth is where the false positives live.

Capture DNS and HTTP in one timestamped run

This script makes a few DNS queries and one ordinary HTTP request. It creates nothing. The first argument is the suspect name, the second is the DNS zone holding its record.

#!/usr/bin/env bash
# usage: ./dangling.sh shop.example.com example.com
set -u
host=${1:?hostname} zone=${2:?zone that holds the record}
ns=$(dig +short NS "$zone" | head -n 1)
[ -n "$ns" ] || { echo "no NS found for $zone" >&2; exit 1; }

run() { printf '\n$ %s\n' "$*"; "$@" 2>&1; }

date -u +%Y-%m-%dT%H:%M:%SZ
run dig "@$ns" "$host" CNAME +norecurse +noall +comments +answer
run dig "@$ns" "nx-$RANDOM$RANDOM.${host#*.}" CNAME +norecurse +noall +comments +answer
run dig "$host" A
run curl -sS -i --max-time 10 "http://$host/"

Save it with ./dangling.sh shop.example.com example.com | tee evidence.txt, then read it in order:

  • The first query should show the CNAME, with aa (authoritative answer) in the flags. This rules out a stale resolver cache.
  • The second asks for a made-up sibling. If it returns the same CNAME, you are probably looking at a wildcard, and the report should say so.
  • The third shows where the chain ends up through your normal resolver.
  • The fourth records what the provider says when asked for that hostname.

Quick detour: whose NXDOMAIN is it?

The third query can show a CNAME in the answer and status: NXDOMAIN at the same time. That looks contradictory: the name has a record, yet does not exist?

RFC 6604 settles it. The response code describes the end of the alias chain rather than the name you asked about. So your subdomain exists, and its target does not. Put both lines in the report.

A fingerprint is a lead, not a verdict

The community list can-i-take-over-xyz records error strings and NXDOMAIN patterns by service. It is a good index, but check the provider's current rules before believing any row.

Elastic Beanstalk will tell you directly

AWS has a check-dns-availability call, which asks about a CNAME prefix without reserving it. Run it with your own credentials. For a target of acme-shop.eu-west-2.elasticbeanstalk.com:

aws elasticbeanstalk check-dns-availability \
  --region eu-west-2 \
  --cname-prefix acme-shop

"Available": true is about as good as no-claim evidence gets. It still does not show that every later step would succeed, so report it as the provider saying the name was available at that time.

S3 cares what the hostname is

The list's S3 fingerprint is The specified bucket does not exist. For a website served straight from S3 through a CNAME, S3 uses the request's hostname to find the bucket, so the error body should name the bucket it wanted. Record that name and the region in the endpoint.

Do not lean on a bare status code from aws s3api head-bucket. AWS documents its failures as generic 400, 403 or 404 responses with no message body.

GitHub Pages can look broken and be protected

There isn't a GitHub Pages site here. is the famous string, yet the list marks GitHub as an edge case. An owner who has verified the domain stops other users publishing on it, and verification covers immediate subdomains too.

The error page alone cannot tell you which case you have. Unless you can establish that the domain is unverified, say that claimability is unknown.

Azure has a record worth checking

For App Service, look for a TXT record with dig TXT asuid.shop.example.com. Microsoft's takeover guidance says that when it exists, other subscriptions cannot validate that custom domain.

The subtle bit is that, according to the same page, the record does not stop someone creating an app with the old name. If your CNAME points at the default Azure hostname, assess those two things separately.

Write the claim no bigger than the evidence

"I can take over your subdomain" is a statement you have not tested. You can defend "This record is dangling and appears claimable". A report can be short:

Title: Dangling CNAME on shop.example.com, appears claimable

Observed (UTC time and full command output attached):
- Authoritative DNS: CNAME to acme-shop.eu-west-2.elasticbeanstalk.com
- Target: NXDOMAIN
- Provider availability check: "Available": true

Not tested: I have not created, reserved or claimed any resource.

Possible impact if claimed: content served on your subdomain, and
receipt of any cookies scoped to .example.com.

Fix: remove the CNAME, or recreate the resource under your account.

Only list impact that applies. If you have not seen a parent-domain cookie, keep "any" and the conditional wording, and do not promote it to session theft.

Send it through the organisation's published disclosure route (try /.well-known/security.txt). Attach the raw output instead of a cropped screenshot of a scary error page.

If they want a live demonstration, get it in writing

Some triagers will not accept anything short of a claimed resource. You have two reasonable answers:

  • They create the resource under their own account, which tests claimability and fixes the dangling name at once.
  • They authorise you in writing, naming the hostname, the provider, what you may publish, how long you may hold it and how you hand it back.

The first is much nicer, because the owner never has to trust a stranger with their hostname. It may not test whether an unrelated account is blocked, but it usually gets the problem closed.

With written permission, serve one harmless static file at an unguessable path, collect no request data you can avoid, and leave the front page without a banner announcing your triumph. Check the permission comes from someone entitled to give it.

And if you own the zone, fix the order of your teardown: remove the DNS record, allow its TTL to expire, then delete the cloud resource. Deleting the resource first is how shop ends up pointing at an empty space three years after anyone remembers what it sold.