Skip to content

Build1 publisher2 min readPublished

A dangling CNAME hands an attacker a hostname the company still owns

When a cloud project is deleted and its DNS record is not, some platforms let the next account claim the same identifier, and the company's own subdomain starts serving that account's content under a valid certificate.

The Engineer · Build desk

Illustration accompanying A dangling CNAME hands an attacker a hostname the company still owns

What happened

  • A dev.to explainer walks through a company whose subdomain blog.company.com starts serving content it never published, while the domain registration and the DNS record both remain under the company's control.
  • The record is a CNAME pointing at a project on an external hosting platform, so the company controls the pointer while the provider owns and operates the infrastructure at the far end of it.
  • Delete the external project and leave the record in place and the result is a dangling DNS record: a valid hostname still pointing at an external destination where nothing is hosted any more.
  • Where a platform lets a new user claim an identifier a previous account used, an attacker can sign up, take the vacated name, and serve content of their choosing under the company's subdomain.
  • The explainer puts impact on a range from reputational damage and phishing risk to more significant issues in some architectures, depending on cookie scope and which services trust the hostname.

Compiled by The EngineerSomething wrong?How this is made

Why it matters

  • constraint Nothing in the zone changes while the attack happens, so a team watching DNS records for unauthorised edits sees a healthy zone throughout.
  • decision Decommissioning acquires an ordering rule, because doing it in the other order leaves a live hostname pointing at an identifier anyone can register.
  • exposure The visitor's usual checks all pass: the company's domain in the address bar, and a certificate that resolves without error because the hostname really is valid.

Two conditions have to hold at the same time, and only one of them sits inside the organization's systems [15]. The pointer is theirs to edit: blog.company.com is a CNAME in a zone they administer [3]. The vacancy is on somebody else's platform, and platforms recycle project names, subdomains and endpoints by design so the identifiers can be reused [8]. A dangling record on its own is not necessarily dangerous, and the dev.to explainer says so before it describes the attack [7].

Ordinary work manufactures the condition. Marketing pages, documentation sites and staging environments get provisioned and later deleted as teams change and projects wind down [4]. The record survives because nobody thinks to remove it and the infrastructure list was not updated [5]. "DNS ownership and resource ownership have separate lifecycles, and only one of them was maintained," the explainer says [14].

So the check that catches this is a comparison, run on a schedule: every external CNAME target in the zone against the resources that still exist in the provider accounts behind them. Reading the zone alone tells you the target is a valid name, not whether anything is hosted there [6]. I would also fix the order of teardown, since it costs nothing: remove the DNS record first, delete the external resource second, and there is no interval when a live hostname points at a claimable identifier [9].

What a takeover is worth depends on the target's configuration. The explainer lists the variables: what the subdomain was used for, how cookies are scoped, whether other services trust that hostname, and what the attacker does with it [12]. It also declines the maximal version. "Subdomain takeover doesn't automatically break session security or compromise parent domain applications. But serving attacker-controlled content under a trusted hostname is still a meaningful security failure," the explainer says [13]. For the session-theft reading to apply to your environment, a cookie would have to be scoped to the parent domain, or another service would have to treat that hostname as trusted [12]. Both are things you can read off a config.

The attack steps in the explainer are reconnaissance and a signup form: find a subdomain pointing at an external platform, notice the resource is inactive, create an account, claim the same identifier [9]. The organization's registrar entry and its DNS record are untouched throughout [10]. Whether a given provider still permits that reclaim is a question to answer vendor by vendor; the explainer describes the behaviour generically and does not name the platforms that allow it [16].

What to watch

  • Whether hosting platforms add ownership verification before letting a new account claim a previously used project name or endpoint.
  • Whether published takeover cases show cookies scoped to the parent domain, which would test the explainer's cautious impact framing.
  • Whether DNS providers start flagging CNAME targets whose destination resource no longer answers.
Loading claim ledger
Loading source directory links
Loading share composer
Loading topic controls
Loading related stories