What Is a Dangling CNAME?
A CNAME record (Canonical Name) is a DNS alias: it redirects requests for a subdomain like shop.example.com to another target, for example customer123.cdn-provider.example. As long as the target exists and is reachable, everything works as expected. However, if the target service is cancelled, the cloud hosting removed, or the SaaS platform changed without deleting the corresponding CNAME entry, a dangling CNAME is created: the DNS record points to nothing.
The problem is that the CNAME entry remains active and continues forwarding requests to the non-existent target. Depending on the provider, an attacker can create exactly that target again and thereby gain control over the subdomain. DNS then works as designed, just for the attacker instead of for you.
What makes dangling CNAMEs particularly insidious is that they are not immediately visible from the outside. Visitors see an error page from the provider or, after a takeover, content placed by a stranger. Without regular checks, such orphaned entries often remain undetected for months, as the measurements further down show.
A special case is the wildcard record: a CNAME for *.example.com forwards any name to the same service. The documentation of a large hosting service warns that such records create an immediate takeover risk, even with a verified domain (GitHub Docs).
How Does a Subdomain Takeover Happen?
A subdomain takeover typically follows a predictable sequence:
- Set up service: A company sets up a cloud service and creates a CNAME record pointing the subdomain staging.example.com to customer123.cloud-service.example.
- Cancel service: Months or years later, the cloud service is no longer needed. The account is closed or the resource deleted.
- Forget CNAME: The corresponding CNAME entry stays in DNS. The subdomain now points to a target that no longer exists: the query ends in NXDOMAIN, or the provider answers with an error page.
- Attacker claims the target: An attacker finds the orphaned CNAME, creates the name customer123 again with the same provider and thereby decides what staging.example.com serves.
- Abuse: The subdomain now serves spam pages, phishing or malware, or harvests cookies from the main domain.
The causes are usually mundane: 83% of the subdomains open to takeover in the TU Wien measurement pointed to cancelled third-party services, the remaining 17% to expired domains (TU Wien/Ca' Foscari 2021). In the second case, the CNAME refers to a domain whose registration has lapsed; whoever registers it again decides what your subdomain serves.
Which Cloud Services Are Particularly Vulnerable?
Not every cloud service enables a subdomain takeover. The decisive factor is whether a stranger can create the name your CNAME points to again after it has been deleted. Researchers at the National Research Center for Applied Cybersecurity Athene in Darmstadt and their partners analysed real takeovers and found 20,904 hijacked cloud resources (Athene 2024). The common denominator of the cases was a resource name that the customer can choose freely (Athene 2024); on a large platform with randomly assigned names, they found no abused domain.
Some providers now close the gap themselves, for example with domain verification: before the platform binds a custom domain to an account, it asks for a TXT record with a verification value. A domain verified this way can no longer be used there by any other account (GitHub Docs). Three questions are enough for a first assessment of each service:
- Freely chosen name? If you set the resource name yourself, a stranger can usually create it again after deletion.
- Domain verification? Does the platform require a TXT record, and does the binding persist after the resource is deleted?
- Deleted names? Does a name become available immediately, or does the platform hold it back for the previous account?
Typical candidates are content delivery networks, cloud hosting, landing page builders and SaaS services with custom domains, plus decommissioned staging servers and old campaign pages. If marketing, IT and sales create subdomains independently, abandoned records are quickly forgotten without centralised DNS management.
What Risks Does a Subdomain Takeover Pose?
The consequences of a successful subdomain takeover extend far beyond a single subdomain:
- Search engine spam under your name: In the Athene analysis, spam aimed at manipulating search engines was the most frequent abuse at 75% (Athene 2024). It exploits your domain's reputation and can weigh on your search engine rankings.
- Phishing with a trust advantage: The taken-over subdomain belongs to your legitimate domain. A fake login page under staging.example.com therefore looks credible.
- Session cookie theft: If a cookie applies to the whole domain, the taken-over subdomain receives it too.
- Valid certificates for the attacker: Whoever controls the subdomain can have a TLS certificate issued for it.
- Compliance violations: If personal data is collected there, this can be a reportable data breach.
Cookies: what a taken-over subdomain can read
A cookie without a Domain attribute is only returned by the browser to the server that set it; with Domain=example.com, however, it also goes to www.example.com and every deeper subdomain (RFC 6265). Whoever takes over such a subdomain and runs the server there sees, in the request header, the session cookie of every logged-in visitor whose browser calls the subdomain. HttpOnly only protects against reading by script, that is, only if the attacker can merely upload content, and SameSite does not help because to the browser the subdomain belongs to the same site.
The Athene researchers found 83 authentication cookies in darknet leaks from the period in which the corresponding subdomains had been hijacked (Athene 2024). The remedy is a session cookie without a Domain attribute, ideally with the __Host- prefix, which rules out a Domain attribute. More on this in the article on Secure, HttpOnly and SameSite.
Certificates: why a takeover has lasting effects
During domain validation, the certificate authority only checks whether the applicant currently controls the subdomain, for example via a file on the web server. The certificate then remains valid until it expires, even if you removed the CNAME long ago: Let's Encrypt default certificates are valid for 90 days (Let's Encrypt), and under the rules of the CA/Browser Forum a certificate issued since 15 March 2026 may run for up to 200 days (CA/Browser Forum).
On top of that comes validation reuse: the certificate authority may use a proof once provided for further certificates for a while, currently for 30 days at Let's Encrypt; a reduction to 10 days has been announced (Let's Encrypt). After a takeover, searching the Certificate Transparency logs is therefore essential, see monitoring Certificate Transparency logs.
What Measurements Show About Real Takeovers
Subdomain takeover is not a theoretical scenario. Among the 50,000 most visited domains of the Tranco list, TU Wien and Ca' Foscari University of Venice counted 887 domains with at least one subdomain open to takeover (TU Wien/Ca' Foscari 2021). That is around 1.8% of all domains examined. The risk grows with the number of subdomains: of the domains with more than 50,000 subdomains, around 15% were vulnerable (TU Wien/Ca' Foscari 2021).
How long such gaps stay open is shown by the same team's repeat measurement six months after the first analysis and the notification of the operators (TU Wien/Ca' Foscari 2021). Of the subdomains checked again, only 15% had been fixed (TU Wien/Ca' Foscari 2021).
The Athene analysis observed actual takeovers: more than a third of the abused domains stayed in someone else's hands for longer than 65 days, some for more than a year (Athene 2024). The victims were by no means only small websites; the researchers found abuse at 31% of Fortune 500 companies (Athene 2024). OWASP lists subdomain takeover as a separate test item in its testing guide (OWASP).
Detecting Dangling CNAMEs: Manual and Automated Methods
Manual check in a few queries
A manual check starts with the inventory. Only the zone file at your DNS provider is complete; the free subdomain finder passively adds known names from Certificate Transparency logs. You can check individual records in the DNS lookup or with dig, shown here with two invented examples:
What matters is telling the answers apart. Status NXDOMAIN, response code 3 in the protocol, means that the queried name does not exist (RFC 1035). SERVFAIL or a timeout say nothing about the name; repeat the query via a second resolver. If the target resolves, the provider's answer counts: many platforms answer an unknown host name with their own error page, often with status 404. These very error pages are how attackers spot names they can claim.
| Finding | Meaning | Next step |
|---|---|---|
| CNAME target returns NXDOMAIN | The target name no longer exists; depending on the provider, anyone can create it again | Delete the record immediately or create the name again in your own account |
| Target resolves, provider shows its own error page (often 404) | Resource deleted, the name may be available | Delete the record and check whether the platform requires domain verification |
| SERVFAIL or timeout | No statement about the name | Repeat via a second resolver, do not treat as orphaned yet |
| Target serves foreign content or an unknown certificate | Subdomain may already be taken over | Start the steps for a suspected takeover |
Automated monitoring with XICTRAQ®
A one-off check only shows today's state. Two approaches help over time. First, reachability: every subdomain can be monitored in XICTRAQ® as a separate website, within the website limit of your plan. If the name no longer resolves or the provider returns an error page with a status of 400 or higher, uptime monitoring reports an outage through your notification channels once two of three check nodes have confirmed it and the grace period, by default twice the check interval, has passed.
Second, DNS: DNS and domain monitoring checks the records every 6 hours on paid plans and every 24 hours on the Free plan, and records changes to A, AAAA, MX, NS and TXT records with old and new values in the changelog; a change of the IPv4 or IPv6 address is flagged as a warning. If only the content changes while the address stays the same, for example with a takeover on a shared platform, the screenshot comparison shows the change.
One limit remains: if a taken-over subdomain answers with status 200, it counts as reachable. In that case the screenshot comparison and the certificate inventory of the Certificate Transparency watch (from the Business plan) help, where an unexpected certificate for one of your subdomains shows up.
Worked Example: How Long a Gap Stays Open
Suppose a company runs 40 subdomains and replaces eight services a year where the CNAME is accidentally left behind. Each error occurs on a random day; on average, half the interval passes until the next check:
| Check method | Average open time per case | Open subdomain days per year (8 cases) |
|---|---|---|
| Audit once a year | around 183 days | around 1,460 |
| Quarterly audit | around 46 days | around 365 |
| Monthly audit | around 15 days | around 122 |
| Automated check every 6 hours | around 3 hours | around 1 |
| Decommissioning in a fixed order (DNS first) | no gap as long as the procedure is followed | 0 |
The open time shrinks in proportion to the interval: moving from an annual audit to a quarterly check cuts it to a quarter. Yet even the quarterly audit, at around 46 days, falls within a range in which attackers actually use hijacked subdomains; in the Athene analysis, more than a third of the takeovers lasted longer than 65 days (Athene 2024). The most effective approach is not to let the gap arise in the first place.
Decommissioning Without a Gap: the Fixed Order
The most common mistake is the order: the resource is deleted first, the DNS record is meant to follow later. During this time the name is available at the provider while your CNAME still points to it. A procedure for the team:
- Assign responsibility: Whoever cancels a service reports subdomain, service and date to the person who maintains DNS; one ticket per service is enough.
- Find all records: Besides the CNAME, also A or AAAA records pointing to the provider's addresses and TXT records used for verification.
- Remove the DNS record first: Delete the CNAME or point it to your own placeholder page while the service is still running.
- Wait for the TTL: The TTL defines how long resolvers may cache a record before asking again (RFC 1035). If it was set to 3,600 seconds, wait at least one hour.
- Only now delete the resource and cancel the contract.
- Verify: The next day, confirm with dig that no CNAME remains, and update the inventory and monitoring.
When setting up, the order is reversed: first create the resource and verify the domain there, then set the CNAME. Otherwise your record points for a while to a name that nobody has created yet.
Suspected Takeover: the First Steps
If one of your subdomains shows foreign content, every hour counts. A sensible order for the first steps:
- Remove the record: Delete the CNAME or redirect it to your own page; the foreign content disappears once the TTL has expired.
- Look for certificates: Search the Certificate Transparency logs for certificates for the subdomain that you did not request.
- Request revocation: A certificate issued by someone else can be revoked once you have regained control; Let's Encrypt checks whether you control the names in the certificate (Let's Encrypt).
- Set CAA with account binding: Certificate authorities must check CAA as part of every issuance (CA/Browser Forum); a record that only allows your account therefore usually prevents further certificates for the attacker.
- End sessions: If session cookies applied to the whole domain, invalidate all sessions.
- Check reporting obligations: If personal data was collected via the subdomain, for example credentials via a fake login page, the breach must be reported to the supervisory authority without undue delay and, where feasible, within 72 hours, unless it is unlikely to result in a risk to the people affected (Art. 33 GDPR). In Germany, essential and important entities under NIS2 additionally owe an early initial report within 24 hours of a significant security incident to the joint reporting office set up for this purpose (Section 32 BSIG).
For infringements of the obligations under Articles 25 to 39 of the GDPR, including security of processing and the notification of data breaches, fines of up to 10 million euros or, for undertakings, up to 2% of worldwide annual turnover of the preceding financial year are possible, whichever is higher (Art. 83(4) GDPR). Typical infringements are covered in the article on GDPR fines.
Preventing Subdomain Takeover: Protective Measures
A CAA record alone protects less than often assumed. In the Athene analysis, only 2% of parent domains had a CAA record at all (Athene 2024), and the researchers do not consider CAA without account binding a suitable countermeasure, because an attacker simply creates an account with a permitted authority. The measures are effective in combination:
With every cancellation, remove the DNS record first, then the resource. An inventory lists every CNAME with its service and responsible person.
Monitor every live subdomain for reachability and DNS changes; XICTRAQ® reports when it no longer resolves or returns an error page.
Set session cookies without a Domain attribute, ideally with the __Host- prefix. The browser then does not send them to subdomains.
Only the accounturi parameter binds issuance to your account (RFC 8657); from 15 March 2027, certificate authorities must evaluate it (CA/Browser Forum). Guide: CAA records: DNS hardening and monitoring.
DNS Monitoring as Part of Your Security Strategy
Dangling CNAMEs are one part of DNS security. XICTRAQ® brings reachability, DNS records, certificates and the security scan together in one account; a changed CAA lock and an approaching domain expiry raise an alert there. How attackers redirect name servers and records directly is described in the guide to DNS hijacking; why an expired domain opens the same gap as a forgotten CNAME is explained in the article on domain expiry monitoring.
Checklist: Minimising Subdomain Takeover Risk
- Create DNS inventory: Document all subdomains with CNAME target, service and responsible person
- Define the decommissioning order: Remove the DNS record first, wait for the TTL, only then delete the resource
- Reverse the order when setting up: Create the resource and verify the domain, then set the CNAME
- Monitor live subdomains: Have reachability and DNS changes checked for each subdomain
- Review cookie scoping: Set session cookies without a Domain attribute and use the __Host- prefix
- Configure CAA with account binding: Allow only your certificate authority and your account (accounturi), watch new certificates in the Certificate Transparency logs
- Conduct regular audits: At least quarterly, reconcile all DNS records with the services actually in use
Start with the inventory and then monitor your live subdomains. Registration takes just minutes; beforehand you can explore the free demo or compare the pricing.
What is a dangling CNAME record?
Which cloud services are particularly vulnerable to subdomain takeover?
How do I check myself whether a CNAME points to nothing?
dig +short CNAME) and then the target. NXDOMAIN means the target name does not exist. If the target resolves, an error page from the provider, often with status 404, indicates a deleted resource. SERVFAIL or a timeout are not a finding and should be repeated via a second resolver.In which order should I decommission a service without opening a gap?
Does a CAA record protect against subdomain takeover?
How does XICTRAQ® help with orphaned subdomains?
This article is based on data and texts from: measurement of subdomains open to takeover (TU Wien/Ca' Foscari 2021), analysis of hijacked cloud resources (Athene 2024), domain verification (GitHub Docs), DNS response codes and TTL (RFC 1035), cookie domain (RFC 6265), CAA account binding (RFC 8657), Baseline Requirements (CA/Browser Forum), certificates and revocation (Let's Encrypt), testing guide (OWASP), breach notification and fine levels (Art. 33 GDPR, Art. 83(4) GDPR, Section 32 BSIG).