This sub-skill is the decision step inside recon-subdomain-takeover. The parent skill explains takeovers in general and the DNS record analysis sub-skill builds the candidate list. This sub-skill answers the narrower question for each CNAME candidate: is this record truly dangling, which service does it point at, what fingerprint proves the endpoint is unclaimed, and what evidence does a report need? Only analyze names you are authorized to test, and only claim a resource when the program explicitly permits takeover verification.
Quick Workflow
- Take the CNAME map from DNS record analysis as the input, not a fresh guess list.
- Classify every CNAME target by provider and service family.
- Test resolution for each target, and record NXDOMAIN, live, and CNAME chain results separately.
- Fetch each candidate over HTTP and HTTPS and match the response against the service fingerprint for its family.
- Separate the results into dangling and claimable, dangling but not claimable, parked or squatted, and alive, with evidence per row.
- Check passive DNS history for each dangling name, to confirm the service was previously live there.
- Write the takeover evidence pack per candidate and hand it to reporting, without claiming anything the program forbids.
1. Start from the CNAME map and classify by service
Classification first, probing second. The fingerprint to test depends on the service, so an unclassified list wastes probes and misreads results. Group targets by their provider domain suffix.
mkdir -p dangling/example.com
cd dangling/example.com
cp ../../cname-map.txt . 2>/dev/null || cat > cname-map.txt <<'EOF'
blog.example.com example-blog.herokuapp.com.
docs.example.com old-docs.s3-website-us-east-1.amazonaws.com.
shop.example.com shops.myshopify.com.
status.example.com example-status.statuspage.io.
EOF
# Classify CNAME targets by provider suffix
python3 - <<'PY'
families = {
"herokuapp.com": "Heroku app",
"s3-website": "AWS S3 website",
"amazonaws.com": "AWS service",
"azurewebsites.net": "Azure App Service",
"github.io": "GitHub Pages",
"myshopify.com": "Shopify",
"statuspage.io": "Statuspage",
"tumblr.com": "Tumblr",
"wordpress.com": "WordPress.com",
"cloudfront.net": "CloudFront distribution",
}
for line in open("cname-map.txt"):
parts = line.strip().split()
if len(parts) < 2:
continue
host, target = parts[0], parts[1]
family = "unknown"
for suffix, label in families.items():
if suffix in target:
family = label
break
print(f"{host} -> {target} [{family}]")
PY
Unknown families are not cleared. They go into a manual review queue where the target domain is researched against public service fingerprint lists before any verdict. A new platform with a claimable pattern will not match a known suffix, and that is exactly why the unknown bucket exists.
2. Test resolution and record the chain
Resolution has three useful outcomes, and they mean different things. NXDOMAIN on the target means the endpoint name no longer exists in DNS. A live resolution with an unclaimed service page means the name exists but the service slot is empty. A live resolution serving real content means the record is alive, whatever the CNAME suggests.
# Resolution status for every unique CNAME target
cut -d' ' -f2 cname-map.txt | sort -u > cname-targets.txt
while read -r t; do
ip=$(dig +short "$t" A @1.1.1.1 | head -1)
full=$(dig +short "$t" @1.1.1.1 | tr '\n' ' ')
if [ -z "$ip" ]; then
echo "NXDOMAIN_OR_EMPTY $t chain: $full"
else
echo "ALIVE $t -> $ip chain: $full"
fi
done < cname-targets.txt > cname-resolution.txt
cat cname-resolution.txt
Also test the subdomain itself, not just the target. A subdomain whose CNAME target is NXDOMAIN but which itself resolves through a wildcard record is a different case from a subdomain that fully fails to resolve, and the wildcard case needs a note in the evidence so a reviewer does not misread it as a clean dangling record.
3. Fingerprint each candidate by service family
Fetch the candidate and match the body and headers against the known fingerprint for its family. Save the full body for the evidence pack, not just the grep match, because services change their error pages and a reviewer needs the original to re-check.
# Fetch each candidate subdomain and save the body per host
while read -r sub; do
host=$(echo "$sub" | awk '{print $1}')
curl -sk -m 15 "https://$host/" -o "body-$host.html" -w "$host %{http_code}\n"
done < cname-map.txt > fetch-status.txt
cat fetch-status.txt
# Fingerprint matches per family, on the saved bodies
for f in body-*.html; do
echo "--- $f ---"
grep -oiE "no such app|there is nothing here|There isn't a GitHub Pages site here|NoSuchBucket|there's nothing here|not found|page not found" "$f" | sort -u
done
Fingerprint examples to match per family, checked against the current public fingerprint lists at report time, not from memory alone: Heroku serves a "no such app" style page for unclaimed app names, GitHub Pages serves a "there is not a GitHub Pages site here" style page, S3 website endpoints return a NoSuchBucket XML shape with the bucket name, and Shopify and Statuspage unclaimed endpoints return their own branded not-found pages. When a fingerprint does not match, the candidate is undecided, not cleared, and it goes back for resolution evidence and history evidence.
4. Classify the verdict and build the evidence pack
Use four verdicts only, and put every candidate in exactly one:
# Evidence pack format - one file per candidate, plus this index
cat > verdicts.txt <<'EOF'
# subdomain | CNAME target | resolution | fingerprint | verdict | evidence files
# blog.example.com | example-blog.herokuapp.com. | target NXDOMAIN | no such app page | dangling and claimable | cname-resolution.txt, body-blog.example.com.html
# docs.example.com | old-docs.s3-website-us-east-1.amazonaws.com. | target NXDOMAIN | NoSuchBucket | dangling and claimable | cname-resolution.txt, body-docs.example.com.html
# shop.example.com | shops.myshopify.com. | alive | branded store page | alive | body-shop.example.com.html
# status.example.com | example-status.statuspage.io. | alive | parked page, not org branded | parked or squatted | body-status.example.com.html
EOF
cat verdicts.txt
Dangling and claimable means resolution plus fingerprint both point to an empty service slot, and the program's rules decide whether claiming is allowed. Dangling but not claimable means the record points at a gone service that cannot be re-registered in the same way, which is still a finding for DNS hygiene, with a different severity note. Parked or squatted means someone else already serves content there, which is a suspicious content finding, not a takeover to fight over. Alive means the service still serves the organization, and the candidate leaves the takeover queue.
5. Confirm with passive DNS history
History strengthens a dangling verdict and weakens a false one. A name that previously served the organization on the same service, then went dangling, fits the classic decommission pattern. A name with no history of ever serving on that service may be a misconfigured record, a test record, or a record that never pointed at a live service.
# Cross-check dangling candidates against certificate history
for sub in blog.example.com docs.example.com; do
echo "--- $sub ---"
curl -s "https://crt.sh/?q=%25.$sub&output=json" \
| jq -r '.[].name_value' 2>/dev/null | sort -u | head -10
done
Record what history showed, including when it showed nothing. "No certificate history found" is evidence about confidence, not a gap to hide.
6. Safe verification rules
Verification follows the parent skill and the program rules, restated here because this is the step where a mistake becomes an incident: only verify when the program permits it, prefer fingerprint plus NXDOMAIN evidence when the program accepts it without claiming, claim only the exact in-scope name, place only a benign proof file, screenshot it, and release or hand over the resource immediately per the program's instructions. Never deface, never serve phishing content, never keep a claimed resource, and never claim a resource you cannot release. For expired cloud IPs, DNS plus fingerprint evidence usually suffices, and spinning up infrastructure on a former IP is not a verification step to improvise.
Edge cases
- The CNAME target resolves but the service returns a generic error that matches no known fingerprint. Treat it as undecided, check the service's own lookup for the endpoint name where one exists, and check web archives for what previously served there.
- A fingerprint matches but the service says the name is taken. Someone claimed it first. Document the dangling record anyway, because the organization still needs to fix the DNS, and report the squatter content separately if it is malicious.
- The program forbids claiming entirely. Submit with DNS evidence plus fingerprint match. Many programs accept this as a complete report, and claiming anyway can breach the program rules.
- Wildcard DNS plus a dangling CNAME can mask the record. Verify the specific name, not the wildcard, and note the wildcard in the evidence.
- CNAME chains several hops long can end at a different provider from the first hop. Follow the full chain before naming the service family.
- A subdomain can be dangling on one protocol and alive on another, for example HTTP serving a parking page while HTTPS serves the real site, or vice versa. Fetch both, record both, and do not verdict on one protocol alone.
Key references
- MITRE ATT&CK T1590.002 DNS
- subjack documentation: https://github.com/haccer/subjack
- HackerOne takeover guidance: https://docs.hackerone.com
- OWASP Testing Guide: https://owasp.org/www-project-web-security-testing-guide/
- crt.sh documentation: https://crt.sh
