What is a subdomain takeover?

Definition

A subdomain takeover happens when a subdomain still points, usually through a CNAME record, to an external service that is no longer in use, such as a deleted cloud storage bucket or a removed hosting account. Anyone who claims that resource on the service then controls the content served on the organization's subdomain.

How it happens

  1. A team points promo.example.com at an external service, for example with a CNAME to a cloud storage bucket, a static hosting site or a platform-as-a-service app.
  2. The campaign ends and the resource on the service is deleted.
  3. Nobody removes the DNS record. promo.example.com now points at a name the service considers free. This is called a dangling DNS record.
  4. Someone else creates a resource with that same name on the service. Their content is now served on promo.example.com.

Why it's serious

The attacker's page is on your domain, with your name in the address bar. That makes it a good base for phishing. Depending on how your sites are set up, it can also be used to read cookies scoped to the parent domain or to get past checks that trust any subdomain of yours.

Which services are affected

Any service where the resource name is chosen by the customer and freed when the resource is deleted. Cloud storage buckets, static site hosting and app platforms are the usual cases. Services differ in whether they verify domain ownership, and some have added checks over time, so the list of vulnerable services changes. The community-maintained "can-i-take-over-xyz" project on GitHub tracks which ones are currently exploitable.

How to prevent it

  • Remove or update the DNS record before deleting the external resource, not after.
  • Keep an inventory of subdomains and what each one points to.
  • Check regularly for records pointing to services or resources that no longer exist.
  • Where the service supports it, use its domain verification.

The inventory is the hard part. Subdomain discovery in EASMcore lists every subdomain it finds on each scan and labels those hosted on shared platforms, which is where dangling records tend to hide.

Frequently asked questions

What is a dangling DNS record?

A DNS record that points to a resource that no longer exists, such as a CNAME to a deleted cloud storage bucket or hosting account. It's the precondition for a subdomain takeover.

How can I check my domains for subdomain takeover?

List all your subdomains, see where each one points (especially CNAME records to external services), and check whether the target resource still exists and still belongs to you. Repeat after every change, since decommissioning a service is when records are usually left behind.