Skip to main content
LowDNSOWASP A05:2021CWE-1104

How to fix: CNAME chain longer than three hops

Resolving the scanned hostname follows more than three CNAME hops before reaching an address record.

Why it matters

Every hop is another name whose registration, zone, and provider account have to stay under someone's control. A single link that expires, gets deleted, or points at a decommissioned service is a subdomain-takeover opportunity, and the deeper the chain the more likely one link belongs to a team that has forgotten it exists. Each hop also adds a resolution round trip to every cold lookup.

Long chains grow through migrations: a vendor is replaced with another vendor, and rather than repointing the original record, a new CNAME is appended to the end. Some resolvers cap chain following, commonly at eight or sixteen, and return a failure past the limit, so a chain that works today can break when one more hop is added by a vendor you do not control.

How to fix it

  1. 1Collapse the chain by pointing the first record directly at the final target.
  2. 2Check ownership of every intermediate name; any that no longer resolves, or points at an unclaimed service, is a takeover risk.
  3. 3Where an intermediate belongs to a vendor, confirm the account behind it is still active and monitored.

Code examples

Follow the chain

bash
dig www.example.com +noall +answer
# each CNAME line is one hop; the final A/AAAA ends the chain

Check each hop for a dangling target

bash
for h in a.example.net b.vendor.io c.cdn.example; do
  printf '%s -> ' "$h"; dig +short "$h" | tail -1
done

References

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

See every dns check

Questions

How severe is CNAME chain longer than three hops?
VulnRadar rates this low 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-cname-chain-too-long, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does CNAME chain longer than three hops map to?
It maps to CWE-1104. 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 cname chain longer than three hops

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

How to fix: CNAME chain longer than three hops | VulnRadar