Dangling DNS: What It Is, How to Find It, and How to Fix It

Dangling DNS is a DNS record that still points at a resource you no longer control. The record is valid and it resolves, but the thing on the other end has been deleted, released or allowed to expire. Whoever claims that resource next inherits the hostname on your domain, along with the trust that comes with it.

It is one of the most common DNS security problems precisely because nothing breaks. No alert fires when a cloud app is deleted and its CNAME is left behind. The record sits in the zone, harmless, until someone goes looking for it.

How DNS Records End Up Dangling

Every dangling record has the same origin: the resource was removed and the DNS record was not. The common forms are:

  • A CNAME to a deleted cloud resource. A hostname such as shop.example.com points at an app, storage bucket, CDN endpoint or hosted site that has since been deleted. This is the classic case, and the one behind most subdomain takeovers.

  • An A or AAAA record to a released IP address. A cloud server is shut down and its address returns to the provider's pool. The next customer to be assigned that address receives your traffic.

  • An NS delegation to a zone that no longer exists. A subdomain is delegated to nameservers at a provider where the zone was deleted, or to nameservers on a domain that has expired. Whoever recreates the zone controls every record under that subdomain.

  • An MX record to a lapsed mail service or domain. Mail for the hostname is delivered to whoever now operates the target.

  • Any record that targets a domain you let expire. If the target domain can be registered by someone else, every record pointing into it is theirs to answer.

The pattern behind all of them is a missing step in decommissioning. Teams remember to delete the server. Fewer remember that DNS was pointing at it.

Why Dangling DNS Is Dangerous

A dangling record lets an outsider serve content, or receive mail, on a hostname under your domain. That is called a subdomain takeover, and it is more serious than hosting a rude page:

  • Visitors and browsers trust the hostname because it is yours. A login page on it is a convincing phishing page.

  • Cookies scoped to the parent domain can be sent to the hijacked subdomain, which can expose sessions.

  • The attacker can usually obtain a valid TLS certificate for the hostname, because they control what it serves.

  • Allow-lists, content security policies and single sign-on redirects that trust your subdomains now trust the attacker.

  • If the hostname appears in your SPF record or receives mail, it can be used to send or intercept email as you.

Takeovers are also cheap. An attacker does not need to break into anything. They scan for hostnames whose targets return a tell-tale "no such app" response, then create that app themselves.

How to Find Dangling DNS Records

Finding dangling records is an inventory problem first and a checking problem second.

  1. Get the complete record list. Export every zone from your DNS provider. Guessing at hostnames from the outside will miss the old, forgotten ones, which are exactly the ones at risk.

  2. Resolve every CNAME target. A target that returns NXDOMAIN, or a provider error page saying the app, bucket or site does not exist, is dangling.

  3. Compare A and AAAA records with what you actually run. Any address that is not in your current inventory of servers and load balancers needs an owner or needs deleting.

  4. Check every delegation. For each NS record on a subdomain, confirm the named servers answer authoritatively for it.

  5. Check the registration of target domains. A record pointing into a domain that has expired or is about to is a takeover waiting for a buyer.

Doing this once is an audit. The records that dangle next year do not exist yet, which is why the check has to repeat.

How to Fix a Dangling Record

  • If the hostname is no longer needed, delete the record. This is the right answer most of the time.

  • If it is still needed, reclaim or recreate the resource under your own account, then confirm the hostname serves what you expect.

  • If you suspect it was already taken over, remove the record first, then treat it as an incident: check for certificates issued for the hostname, review where it was trusted, and rotate anything it could have exposed.

How to Prevent Dangling DNS

  • Remove DNS first. When retiring a service, delete its DNS records before deleting the resource, not after.

  • Give every record an owner. A record nobody claims is a record nobody removes.

  • Manage DNS and infrastructure together. When records are created by the same automation as the resources, they are removed by it too.

  • Use your provider's protections. Several cloud platforms offer alias records tied to the life of the resource, or domain verification that stops another customer claiming your hostname.

  • Monitor continuously. Check targets on a schedule so a record that starts dangling is found in hours instead of at the next annual review.

How DNS Spy Helps

DNS Spy checks every CNAME on a monitored domain for targets that no longer resolve or that match known takeover fingerprints, as part of the Security Center. The details of that check are in Subdomain Takeover and Dangling CNAME Detection. Because it can import your complete record list through a read-only DNS provider connection, it sees the forgotten hostnames that outside discovery misses, and it alerts you when a record changes or a check starts failing.

To see where a domain stands today, run the free DNS scan. It checks the records on every authoritative nameserver and runs the full set of security checks in about a minute, with no account. For the wider picture, see our guide to DNS monitoring.

Frequently Asked Questions

What is a dangling DNS record?

A dangling DNS record is a record that points at a resource its owner no longer controls, such as a deleted cloud app, a released IP address or an expired domain. The record still resolves, so anyone who claims the resource controls that hostname.

Is dangling DNS the same as subdomain takeover?

Dangling DNS is the weakness and subdomain takeover is the attack that uses it. A dangling record becomes a takeover when someone else claims the resource it points to.

Are dangling CNAME records the only kind?

No. CNAME records are the most common because so many cloud services are reached through one, but A, AAAA, NS and MX records can dangle too.

How often should I check for dangling DNS?

Continuously, or at least whenever infrastructure is retired. A record starts dangling at the moment its target is removed, and attackers scan for these constantly.