AI pentesting guides / Vulnerability classes

Dangling DNS

Subdomain takeover testing

Subdomain takeover testing finds DNS records, usually CNAMEs, that still point at a cloud or SaaS resource the organisation has deleted, so an attacker could register that resource and serve content on your subdomain. The flaw is an asset-management failure rather than a coding bug: a forgotten DNS entry outlives the service behind it.

There is no dedicated CWE for subdomain takeover; reports commonly map it to OWASP Top 10 2021 A05: Security Misconfiguration or, for APIs, API9:2023 Improper Inventory Management. The impact is real: a taken-over subdomain can host phishing pages, receive cookies scoped to the parent domain and satisfy trust checks that allow any subdomain.

Classification

  • No dedicated CWE; some programmes use broader entries such as CWE-284 Improper Access Control.
  • OWASP Top 10 2021: A05 Security Misconfiguration.
  • OWASP API Security Top 10 2023: API9 Improper Inventory Management, where forgotten API hosts are involved.

How it is found

Enumerate subdomains from certificate transparency, passive DNS and brute force. Resolve each and record CNAME chains. Look for targets on services that allow anyone to claim a name, such as some static-site hosts, cloud storage buckets and SaaS platforms, and for service-specific error pages indicating the resource does not exist. NS delegations to deleted DNS zones are a rarer and more severe variant. The community 'can-i-take-over-xyz' project tracks which services are vulnerable and how they respond.

Safe proof

The fingerprint (a dangling CNAME plus the provider's not-found response) is strong evidence. Full proof means claiming the resource and serving a harmless, clearly labelled file on the subdomain, which should only be done with explicit permission and released immediately afterwards. Many bug bounty programmes accept the fingerprint with a claim and ask you not to serve content.

Remediation

Delete DNS records before or at the same time as deprovisioning the resource, as part of the decommissioning process. Inventory DNS regularly and alert on records pointing at non-existent resources. Prefer provider features that verify domain ownership. Avoid trusting all subdomains in CORS, cookies and CSP.

With Pentest-Swarm

What Pentest-Swarm covers for subdomain takeover

Pentest-Swarm does not currently prove subdomain takeover automatically. Its external-asm playbook does the discovery that takeover testing starts from.

  • Subdomain enumeration with subfinder and amass, and DNS resolution with dnsx.
  • Live-host probing with httpx to find hosts returning provider error pages.
  • nuclei, in the arsenal, has community takeover-detection templates, but those results are not oracle-verified and should be confirmed manually.
  • Scope enforcement keeps discovery to the domains you authorise.

Where it falls short

For ongoing protection, a DNS-aware attack surface management tool or a scheduled script that checks for dangling records is a better fit than periodic pentests, because takeovers become possible the moment a resource is deleted. Confirm candidates manually against the provider's current behaviour, and never claim a resource on a domain you are not authorised to test.

Questions

Is a dangling CNAME always takeover-able?

No. It depends on whether the provider lets anyone claim that name and whether it verifies domain ownership. Check provider-specific guidance.

Why is subdomain takeover serious?

The attacker serves content on your domain, which can enable phishing, cookie theft for parent-domain cookies and bypass of policies that trust subdomains.

How do I prevent subdomain takeover?

Remove DNS records as part of deprovisioning, and monitor DNS for records pointing at resources that no longer exist.

Sources

  1. can-i-take-over-xyz
  2. OWASP API9:2023 Improper Inventory Management