- A takeover needs no exploit, only a DNS record that points at a resource you no longer control.
- Whoever claims that resource publishes content under your name, can often get a valid certificate for it, and may receive cookies scoped to your parent domain.
- Remove DNS records before you delete what they point to, create them after the resource exists, and compare DNS between scans.
What a subdomain takeover is
A subdomain takeover happens when a DNS record under your domain points at an external resource that no longer exists, or no longer belongs to you, and someone else can create a resource at that address. The usual root cause is a dangling CNAME: shop.example.com is an alias for a hosted service, the service is canceled, and the alias stays in the zone.
shop.example.com. 3600 IN CNAME example-shop.hosting.example.net.
$ dig +short A example-shop.hosting.example.net
(no answer: the provider has nothing configured under that name)Depending on the provider, the target name either stops resolving altogether, as above, or still reaches the provider, which answers with an error page that says, in effect, “nothing is configured here”. Either way, if the provider lets any customer claim that name without proving they own your domain, an attacker signs up, creates a resource with the same name and starts serving content on your subdomain. No exploit, malware or phishing e-mail is needed to set it up, which is why takeovers are a favorite of bug bounty hunters and attackers alike.
Common dangling DNS patterns
- CNAME to a deleted cloud resource: an app on a hosting platform, a storage bucket configured as a website, a CDN distribution or a load balancer that was removed.
- CNAME to a SaaS custom domain: help centers, status pages, landing-page builders, online stores and documentation hosts that let customers map their own domain.
- A record to a released IP address: cloud providers recycle public addresses. When yours goes back to the pool, whoever receives it next receives your traffic.
- NS delegation to a zone that no longer exists: a subdomain delegated to a DNS hosting account that was closed. Whoever recreates the zone controls every name under it.
- MX record to a mail service you left: rarer, but it can expose inbound mail for that name.
Whether a given provider can be claimed this way changes over time, and many now require a verification record before they accept a custom domain. Treat any record that points at a resource you cannot find in your own accounts as a problem, whatever the provider.
What an attacker can do with it
- Phishing on a trusted name. Your domain is in the address bar, so users, mail filters and password managers treat the page as yours.
- A valid certificate. Certificate authorities that validate domain control over HTTP will issue a certificate to whoever serves content at that name, and many hosting platforms request one automatically, so the padlock appears too.
- Cookie theft. Cookies set for the parent domain (
Domain=example.com) are sent to every subdomain, including the hijacked one. - Abuse of trust lists. OAuth redirect URIs, CORS policies, Content Security Policy rules and allowlists that trust
*.example.comnow trust the attacker as well. - Reputation damage. Malware or spam served from your name can get the whole domain onto blocklists.
How attackers find candidates
The same way defenders should, only usually sooner:
- Enumerate subdomains from certificate-transparency logs and passive DNS (the subdomain discovery guide walks through the sources).
- Resolve each name and follow CNAME chains to the final target.
- Flag targets that do not resolve, and responses that match a provider’s “unclaimed resource” page. The security community maintains public collections of these service fingerprints.
- Re-run regularly. A record that was fine last month can dangle tomorrow, the day a subscription ends.
How to check your own domains
- List your subdomains from passive sources and from your own DNS zones.
- For each name, follow the CNAME chain. An alias whose target has no answer, or returns NXDOMAIN, is a strong candidate.
dig +short CNAME shop.example.com
dig +short A example-shop.hosting.example.net- Fetch the page and compare it with the provider’s error page for unconfigured names.
curl -sI https://shop.example.com
curl -s https://shop.example.com | head -n 20- Confirm in the provider’s console whether a resource with that name exists in your account. If it does not, the record is dangling, whatever the response looks like.
- Automate the comparison with takeover detection checks, which match responses against fingerprints of services known to be claimable.
If you find a candidate, the fix is to delete or repoint the record. Claiming the resource in your own provider account works as a stopgap, but do that only for your own domain.
Prevention: the order of operations
- Decommission in this order: remove the DNS record first, then delete the resource.
- Provision in the reverse order: create the resource first, then the DNS record that points at it.
- Prefer providers that verify ownership of a custom domain, usually with a TXT record, and keep those verification records in place.
- Keep a list of every record that points outside your own infrastructure, with an owner for each.
- Put DNS on the offboarding checklist for vendors, projects and campaigns.
- Avoid wildcard CNAMEs that send every unknown name under a zone to a third-party platform.
Watching for new dangling records
Takeover risk appears when something changes: a subscription lapses, a project closes, a resource is deleted. Comparing DNS from one scan to the next turns those moments into review items instead of surprises.
Response playbook
- Confirm. Check the provider account and the live response, and keep a screenshot for the record.
- Remove or repoint the DNS record. This is the fix; everything after it is cleanup.
- If someone already claimed it: note what was served and since when; search certificate-transparency logs for certificates issued for that name and ask the issuing authority to revoke them; rotate sessions whose cookies are scoped to the parent domain; review the OAuth redirect URIs, CORS and CSP rules that trusted the name.
- Look for siblings. The same pattern often exists on other subdomains: same provider, same project, same team.
- Fix the process that left the record behind, such as the offboarding checklist or the provisioning order.
Dangling DNS is one of the few serious exposures that is cheap to prevent and quick to fix. The hard part is noticing it, which is a job for repeated discovery rather than memory.
Not sure how many of your subdomains point at third-party services? Request a demo and we will look at your DNS with you.
- External attack surface management — subdomains, DNS and hosts for each domain
- Reading findings — severity, evidence and how takeover candidates appear
- Your attack surface is bigger than you think — where forgotten assets come from
Filed under Attack surface · DNS