Dangling CNAMEs and subdomain takeover

When a subdomain points at a cloud service you have stopped using, such as a storage bucket, a hosted site or an app platform, anyone who creates a resource with the same name on that service can serve content on your subdomain, with a valid certificate.

How it happens

  1. promo.example.com is a CNAME to promo-site.cloudhost.example.
  2. The campaign ends and the cloud resource is deleted. The CNAME stays.
  3. Someone registers promo-site on the same cloud service. Your subdomain now shows their page, can set cookies for your domain, and can pass a certificate authority's domain check.

The same applies to NS records delegating a subdomain to a DNS service where the zone was deleted, and to MX records pointing at a mail service you left.

Finding them

Follow every CNAME to its end. A target that returns NXDOMAIN is dangling. A target that resolves but shows the provider's "no such site" page may also be claimable; services publish what that page looks like, and the open-source community keeps a list of known fingerprints.

Certificate transparency logs and old DNS exports help find subdomains you forgot about; DNS itself cannot list them.

Removing them in the right order

Delete or change the DNS record first, then delete the cloud resource. Removing a record is a high-risk change in our product: it always needs a person's approval, and it is verified afterwards by confirming the name no longer points at the old target.