What Is a Subdomain Takeover?

On this page
  1. How does it happen?
  2. Why is it dangerous?
  3. How do you prevent it?

A subdomain takeover lets an attacker claim one of your subdomains that points to a service you no longer use. The DNS record still says blog.example.com → someprovider, but you closed that provider account — so the attacker opens it under the same name and now serves content from your subdomain. They inherit its trust: cookies, allowlists, and your brand’s credibility.

How does it happen?#

The root cause is a dangling DNS record — a pointer that outlived its target:

  1. You set docs.example.com as a CNAME to a cloud host or SaaS.
  2. Later you delete the cloud resource but forget the DNS record.
  3. The record now points to an unclaimed name on that provider.
  4. An attacker registers that name, and controls docs.example.com.

The subdomain resolves and works — it just serves the attacker’s content now. Because it is genuinely your domain, browsers, users, and even some security controls trust it.

Why is it dangerous?#

Inherited trustAbuse
Your brand and domainConvincing phishing
Cookies scoped to the domainSession theft in some setups
CORS / allowlist entriesBypass origin-based controls
ReputationMalware hosting under a trusted name

How do you prevent it?#

  • Inventory DNS records and the services they point to.
  • Remove the DNS record first, before decommissioning the underlying service.
  • Scan periodically for records resolving to unclaimed or dangling targets.

Subdomain takeover is an attack-surface and DNS hygiene failure. More at the Web Security hub.

Frequently asked questions#

What is a subdomain takeover?

A subdomain takeover happens when a subdomain’s DNS record points to an external service (a cloud host, CDN, or SaaS) that has been decommissioned, leaving the record "dangling." An attacker registers that service under the same name, and now controls content served from your subdomain — inheriting its trust, cookies, and reputation.

How do you prevent subdomain takeovers?

Maintain an accurate inventory of DNS records and the services they point to, and remove DNS entries as soon as the underlying service is decommissioned — before releasing the service name. Periodically scan for dangling records that resolve to unclaimed services. The root cause is DNS records outliving what they point to.

Sources & further reading