Skip to main content
MediumDNSOWASP A05:2021CWE-350

How to fix: Dangling CNAME Record (Subdomain Takeover Risk)

A CNAME record points to a hostname that no longer resolves. If the target service (e.g., Heroku, AWS, Fastly) is unregistered, an attacker can register it and serve content from your subdomain.

Why it matters

Subdomain takeover lets attackers serve malicious content on your subdomain, steal session cookies scoped to the parent domain, bypass CSP using your origin, and conduct phishing attacks that appear to originate from your domain.

When a CNAME points to an abandoned cloud resource (defunct Heroku app, removed S3 bucket, cancelled Azure CDN), the DNS entry remains while the cloud resource is gone. Anyone who claims that cloud resource now controls what is served from your subdomain.

How to fix it

  1. 1Remove CNAME records that point to decommissioned services.
  2. 2Regularly audit all CNAME records against active cloud resources.
  3. 3Use automated tooling (subjack, nuclei subdomain-takeover templates) for continuous monitoring.

Code examples

Check CNAME resolution

bash
# Check if CNAME target resolves
for sub in staging dev api; do
  target=$(dig +short CNAME ${sub}.example.com)
  [ -n "$target" ] && echo "${sub} -> $target: $(dig +short $target | head -1)"
done

References

Detected automatically by VulnRadar. The check id is dns-dangling-cname, stable across every scan so you can filter or diff on it.

See every dns check

Questions

How severe is Dangling CNAME Record (Subdomain Takeover Risk)?
VulnRadar rates this medium severity in the dns category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id dns-dangling-cname, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Dangling CNAME Record (Subdomain Takeover Risk) map to?
It maps to CWE-350. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for dangling cname record (subdomain takeover risk)

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Dangling CNAME Record (Subdomain Takeover Risk) | VulnRadar