Monitory
← All guides

Guides

What is a subdomain takeover, and how to prevent it

How a forgotten DNS record lets someone else serve content on your domain, and how to find and remove the dangling records.

What a subdomain takeover is

When a subdomain points to a service you no longer use, such as a deleted Heroku app, Azure site, S3 bucket or Shopify store, anyone can sign up for that service under the same name. They then serve their own content on your subdomain, with your domain's reputation and cookies. Attackers scan for these around the clock.

How it happens

  1. You create shop.example.com with a CNAME to a hosted service.
  2. You cancel the service, but forget the DNS record.
  3. The CNAME now points to a name that no longer exists, and someone else claims it.

Why it is serious

The content appears on your own domain. Visitors trust it, browsers treat it as part of your site and cookies scoped to your domain can be exposed. It is a favourite of phishing campaigns.

Fix and prevent it

  • Remove the CNAME record of every subdomain you no longer use. This is the whole fix.
  • Still using it? Recreate the service at the same target, then fix whatever deleted it.
  • Prevention. When you shut down a service, delete its DNS record first.

Find them automatically

The subdomain takeover check goes through every host name of your domain it knows of, up to 100 found in Certificate Transparency logs, follows each CNAME and fails when the target does not resolve. The report lists every affected subdomain with its target.

Keep reading