Domain health guide
Subdomain takeover and dangling DNS records
A subdomain takeover needs no break-in. It happens when a DNS record still points to a cloud resource that has been deleted, and someone else registers that resource name. From then on they serve content on your subdomain.
How it happens
A team launches a campaign site on a hosted platform and adds a CNAME from promo.example.com to the platform's hostname. Months later the campaign ends and the site is deleted on the platform. The CNAME stays in DNS, because removing it was nobody's task.
The record now points at a name that no longer exists on the platform. If the platform lets any customer claim that name, whoever claims it receives the traffic for promo.example.com, on your domain, often with a valid certificate issued to them.
Why it matters
Content served from your subdomain inherits your reputation. Visitors and mail filters trust it, and browsers may send it cookies scoped to the parent domain. It is a convincing place to host a login page.
The risk is not theoretical or rare: it is a routine finding in security reviews precisely because it is created by ordinary cleanup, not by a mistake in configuration.
Which records are at risk
Any record that delegates a name to something you can stop controlling is a candidate.
- CNAME records pointing to cloud storage, app hosting, CDN or SaaS hostnames.
- A and AAAA records pointing to cloud IP addresses that have been released and can be reassigned.
- NS records delegating a subdomain to a DNS zone that no longer exists.
- MX records pointing to a mail service the organisation has left.
How to find dangling records
Start from the DNS zone, not from a list of sites you remember.
- Export every record in the zone.
- For each CNAME, resolve the target. A target that does not resolve, or resolves to a provider's not-found page, needs a closer look.
- Confirm in the provider's console that the resource exists and belongs to your account.
- Delete records whose target you cannot account for.
- Repeat on a schedule, because new records become dangling as projects end.
What a check can and cannot conclude
From outside, a check can see that a CNAME target does not resolve or matches a pattern known to be claimable. It cannot see inside your provider account, so it cannot prove a resource is yours. A finding is a prompt to verify, not a verdict. CloudSpex reports the dangling targets it can measure and states when a target could not be assessed.
Prevention
The fix is an order of operations: remove the DNS record first, then delete the cloud resource. Make DNS cleanup a step in the decommissioning checklist, give each record an owner, and avoid wildcard records that send every unknown subdomain to a third party.
What a dangling record looks like
The record itself is unremarkable, which is why it is overlooked. It is a normal CNAME whose target no longer leads anywhere. Looking it up shows the alias and then nothing, or an address that answers with the platform's generic page for a site that does not exist.
dig promo.example.com CNAME +short
example-promo.hosting-platform.example.
dig example-promo.hosting-platform.example A +short
(no answer)The sequence of a takeover
Understanding the steps makes it clear why no credentials are needed and why the owner sees nothing.
- A subdomain is pointed at a resource on a hosted platform, identified by a name the customer chose.
- The resource is deleted. The name becomes available on the platform again.
- The DNS record remains, still pointing at that name.
- Someone finds the record, for example by going through public lists of subdomains, and sees that the target is unclaimed.
- They create a resource with the same name in their own account on the platform.
- The platform now routes traffic for your subdomain to their content.
What an attacker gains
The subdomain is a real part of your domain, so everything that trusts the domain trusts it. A login page hosted there has an address that passes every check a careful user has been taught to make. Cookies that your main site sets for the whole domain are sent to it. If your content security policy or cross-origin rules allow your own subdomains, scripts served from it are trusted by your application.
The attacker can usually obtain a valid certificate for the name, since they control what it serves and can complete domain validation. And if your domain has a good sending reputation and loosely scoped mail authentication, the name can be used to make phishing mail more convincing.
The nameserver variant
The same problem exists one level up, and it is more serious. If a subdomain is delegated with NS records to a DNS provider and the zone is later deleted there, anyone who can create a zone with the same name at that provider, on the same nameservers, controls every record under that subdomain. That includes MX records, so they can receive mail for it, and TXT records, so they can pass domain validation for certificates.
Check NS delegations for subdomains with the same care as CNAME records. A delegation to nameservers that return REFUSED or SERVFAIL for the zone is a lame delegation and a candidate for takeover.
dig dev.example.com NS +short
ns-101.dns-provider.example.
dig dev.example.com SOA @ns-101.dns-provider.example
;; status: REFUSEDReleased IP addresses
A and AAAA records can dangle too. A cloud server is shut down, its public IP address returns to the provider's pool, and the DNS record keeps pointing at it. The address is later assigned to another customer. Getting a specific released address on purpose is harder than claiming a name, so this variant is less often exploited deliberately, but the result is the same: your subdomain serves someone else's content. Use reserved addresses for anything with a DNS record, and remove the record when the server goes.
Mail records
An MX record pointing to a mail service the organisation has left is a quieter version of the same issue. If the target hostname lapses or can be claimed, mail for that domain or subdomain can be received by someone else, including password reset messages for accounts registered with addresses there. The same applies to SPF: an include that names a domain which has since expired authorises whoever registers that domain to send mail as yours.
An audit you can repeat
The audit starts from the zone, because the records you have forgotten are the ones at risk.
- Export every record from the DNS provider, including zones for old brand and campaign domains.
- List all CNAME records and resolve each target. Flag any that fail to resolve.
- For targets that do resolve, fetch the site and flag any that return the platform's default not-found page.
- List all NS delegations for subdomains and query each nameserver for the zone's SOA record.
- List A and AAAA records pointing to cloud address ranges and confirm each address is still assigned to you.
- For each flagged record, confirm in the provider's console whether the resource exists in an account you control.
- Delete what you cannot account for. A missing subdomain is an inconvenience; a hijacked one is an incident.
while read name; do
target=$(dig +short "$name" CNAME)
[ -n "$target" ] && [ -z "$(dig +short "$target")" ] && echo "DANGLING: $name -> $target"
done < subdomains.txtFinding subdomains you do not know about
The zone export covers the DNS provider you know. Records also exist at previous providers, in zones created by other teams, and for domains bought for a campaign and never consolidated. Certificate transparency logs help here: every publicly trusted certificate is logged with the names it covers, so a search for your domain lists hostnames that had a certificate at some point, including ones nobody remembers.
Treat that list as a set of leads. Each name either still resolves and is yours, no longer resolves and can be ignored, or resolves to something you do not recognise.
If a subdomain has already been taken over
Remove or correct the DNS record first; that ends the attacker's control immediately, subject to caching. Then work through the consequences. Find out what was served and for how long. Check certificate transparency logs for certificates issued for the name during that period and ask the issuing authority to revoke them. If the main site sets cookies for the whole domain, consider sessions exposed and invalidate them. Finally, report the resource to the hosting platform.
Making it a routine
A one-off audit finds today's dangling records. New ones appear every time a project ends. Two habits prevent most of them: make removing the DNS record the first step of decommissioning, before the resource is deleted, and give every record an owner and a reason in the DNS provider's notes field. Continuous monitoring covers what the habits miss. CloudSpex checks the subdomains it can measure for targets that no longer resolve, reports them as findings to verify, and says so when a target could not be assessed.
Frequently asked questions
Is a CNAME to a deleted resource always exploitable?
No. It depends on whether the provider lets another customer claim the same name. It should still be removed, because the conditions can change.
Can a takeover get a valid HTTPS certificate?
Often yes. If an attacker controls what the subdomain serves, they can usually complete domain validation for that hostname. A CAA record limits which authorities may issue, but does not prevent the takeover.
How often should DNS be reviewed for dangling records?
On a schedule and whenever a service is decommissioned. Continuous monitoring catches the cases a periodic review misses.
Does a wildcard DNS record make takeover easier?
A wildcard that points every unknown subdomain at a third-party platform means any name can be claimed there, not just ones you created. Avoid wildcards that target services where customers choose their own hostnames.
Do platforms protect against this?
Some require proof of domain ownership before a custom hostname can be attached, which prevents most takeovers. Others do not, and protections differ between products of the same provider.
Is deleting the DNS record enough?
It ends the exposure for that name. If the subdomain was actually taken over, also review issued certificates, cookies scoped to the parent domain and anything that trusted the subdomain.
Use public checks as a starting point
CloudSpex reads limited public-facing signals. It does not change DNS, website, certificate, or email settings. Confirm the responsible provider and test relevant changes before applying a remediation.
Editorial details
Author and reviewer: CloudSpex. Sources: public technical standards and provider documentation relevant to the topic. Last reviewed: November 10, 2026. We update guides when the product behavior or the underlying guidance changes.