Subdomain Takeover: How It Happens and How to Prevent It
How dangling DNS records let attackers serve content on your subdomains, how to find them, and the deprovisioning habit that prevents takeovers.
By Jay Dabhi, CISM · Cybersecurity Analyst
Updated
A subdomain takeover happens when a DNS record, usually a CNAME, still points to a cloud resource you've deleted, such as a storage bucket, a hosted app or a static site. An attacker creates a resource with the same name at that provider and starts serving their content on your subdomain. To prevent it, delete the DNS record before (or when) you delete the resource, and regularly check your DNS for records that point at nothing.
How a takeover works
- You host a marketing site on a cloud service and point
promo.yourdomain.comat it with a CNAME. - The campaign ends and you delete the site, but the CNAME stays in DNS.
- An attacker notices the dangling record, creates a new resource at that provider with the same name, and claims your hostname.
promo.yourdomain.comnow serves whatever the attacker wants: a phishing page, malware, or a script that reads cookies scoped to your domain.
Why startups are exposed
Startups spin up and tear down infrastructure quickly: preview environments, landing pages for launches, trial integrations. DNS cleanup is rarely part of the checklist, and nobody owns the DNS zone as a whole.
Step 1: list your subdomains
Start with what's public. Our free subdomain finder lists hostnames from certificate transparency logs without sending any traffic to your servers. Then compare against your DNS provider's full record list, which also includes hostnames that never had a certificate.
Step 2: check every CNAME
For each CNAME (and any A records pointing at cloud IPs), confirm the target still exists and belongs to you. Warning signs:
- The target hostname no longer resolves.
- The page shows the provider's "not found" or "no such app/bucket/site" error instead of your content.
- Nobody on the team recognizes the record.
Step 3: fix and prevent
- Delete dangling records immediately. If nobody knows what a record is for, it probably shouldn't exist.
- Reverse the order when deprovisioning. Remove the DNS record first, then delete the resource.
- Keep an inventory. Note an owner and purpose for every DNS record. A spreadsheet is enough at first.
- Prefer provider-side domain verification when a service offers it, so only your account can attach your hostnames.
- Monitor continuously once you have more than a handful of records. Takeovers are found by automated scanners within days.
Check your work
Run the subdomain finder after cleanup, and add it to your offboarding checklist whenever a project or vendor is retired.
Frequently asked questions
Is a subdomain takeover really serious?
Yes. The attacker serves content on a hostname you own, so it inherits your brand's trust. Depending on how your cookies and policies are scoped, it can also be used to steal session cookies or bypass allowlists that trust *.yourdomain.com.
Do cloud providers prevent takeovers now?
Some services now require you to verify domain ownership before anyone can attach a custom domain, which blocks the classic attack. Many don't, and the rules differ per service, so don't rely on the provider. Clean up your DNS.
How often should I check for dangling records?
Whenever you shut something down, and as a routine at least monthly. Continuous monitoring is better for teams that create and delete cloud resources often.