Subdomain Takeover: How to Check and Fix It
Subdomain takeover happens when a DNS record on your domain still points to an online service you deleted, so someone else can sign up for that service, claim the name, and publish content on your subdomain. You can check for it in about 20 minutes by listing your subdomains, finding the ones that point to outside services, and confirming whether each service still exists.
This guide is for owners of small sites, online stores and SaaS products who have heard the term and want to know if they are exposed. You will get a plain-English explanation, a step-by-step check with copy-pasteable commands, and a fix-or-remove table for common providers.
What is subdomain takeover?
A subdomain is a prefix on your main domain, like blog.example.com or shop.example.com. Most small businesses have several. Each one is controlled by a DNS record, which is an entry in your domain's settings that says where that name should go. DNS is the internet's phone book.
A CNAME record is a common type of DNS record. It says: "this name is an alias for that other name." For example, help.example.com might be an alias for yourcompany.zendesk.com, so your help center loads at your own address.
The problem starts when you cancel the help center but forget to delete the CNAME. The record is now dangling: it points at something that no longer exists. Where the provider allows it, a stranger can create an account, claim yourcompany, and your subdomain now shows their content. Many providers now require proof of domain ownership, so this is not possible everywhere, but a dangling record is still worth removing. The OWASP Web Security Testing Guide lists this as a standard configuration test, and MDN's overview explains the same mechanism.
How subdomain takeover works
The usual sequence looks like this:
- You point
promo.example.comat a hosted service (a static site host, a store platform, a help desk). - Later you delete the project or cancel the plan, but leave the DNS record in place.
- The provider frees up the name. It shows a "not found" page for it.
- Someone else registers that name on the same provider.
- Visitors who go to
promo.example.comnow see the other person's page, served under your domain.
No password is guessed and nothing on your server is broken. The attacker only used a gap in your cleanup.
Why it matters for a small business
Visitors and browsers trust your domain. A page on your subdomain can look like yours, which makes it useful for phishing. Depending on your setup, it can also cause these problems:
- Fake login pages on an address your customers already trust.
- Cookie exposure. If your site sets cookies for the whole domain (
.example.com), a page on any subdomain may be able to read or overwrite them. - Bypassed allow-lists. Some security settings, like CORS or a Content Security Policy, trust every subdomain by name.
- Reputation damage. Spam or scam content under your name can get your domain flagged.
This is a real but fixable risk. It does not mean you will be attacked. It means a loose end is worth tying off. If you want the bigger picture, see our guide on whether your website is hackable.
How to check for subdomain takeover, step by step
Only test domains you own or have written permission to test. These steps use read-only lookups.
Step 1: List your subdomains
No single source is complete, so combine a few:
- Your DNS provider's zone list. Log in to Cloudflare, GoDaddy, Namecheap, Route 53 or wherever DNS lives, and export or copy every record. This is the most reliable source for what you actually have.
- Certificate transparency logs. Public logs of HTTPS certificates reveal many subdomains. Visit
https://crt.sh/?q=%25.example.com(replaceexample.comwith your domain). - Your own memory and team. Ask marketing, support and past agencies what they set up. Old campaigns are a classic source.
- Optional tools.
subfinder -d example.com(from ProjectDiscovery) finds names from public sources.
Put the names in a text file called subdomains.txt, one per line.
Step 2: Find records that point to outside services
In your DNS list, look at every CNAME. Flag any that point to a third-party address, such as github.io, herokuapp.com, azurewebsites.net, s3.amazonaws.com, myshopify.com, netlify.app or zendesk.com.
To check from a terminal (Mac, Linux or Windows with WSL):
while read -r h; do echo "$h -> $(dig +short CNAME "$h")"; done < subdomains.txt
A line like promo.example.com -> yourcompany.github.io. is an outside service. Write down each one and ask: do we still use this?
Step 3: Confirm the "not found" signs
For each flagged name, load it in a browser or run:
curl -sI -m 10 http://promo.example.com | head -n 5
curl -s -m 10 http://promo.example.com | head -n 20
These use http:// on purpose. Dangling hosts often have no certificate for your domain, or serve one that does not match, so an https:// request can fail and show nothing. If https shows a certificate error in your browser, that is also a clue. Empty output, a timeout or a connection error is a signal too, not a sign that the command is broken.
You are looking for a provider error page, or a name that no longer resolves. Common examples:
- GitHub Pages: "There isn't a GitHub Pages site here."
- Heroku: "No such app."
- Amazon S3: "NoSuchBucket" (bucket does not exist).
- Shopify: "Sorry, this shop is currently unavailable."
- Azure App Service: the target name
yourapp.azurewebsites.netdoes not resolve at all.
A generic "404" alone is not proof, since live sites also return them. The community-maintained can-i-take-over-xyz list tracks which providers are actually claimable and what their error messages look like. Provider behavior changes over time, so treat any list as a guide and not a guarantee.
Step 4: Check the target itself
First find the target of the CNAME with dig +short CNAME promo.example.com. Then test the target. For an Azure example, run dig yourapp.azurewebsites.net | grep status. If you see status: NXDOMAIN, the name does not exist, so the record points to nothing. That is dangling even if you see no error page, and you should clean it up.
You can also run dig +short yourcompany.github.io (a target from Step 2). Empty output can mean the name does not exist, but dig +short never prints the word NXDOMAIN, so confirm with dig yourcompany.github.io | grep status. Empty output can also mean the name exists but has no address record, or that the lookup failed. Not every provider returns NXDOMAIN for a missing name. Many still resolve and show a "not found" page instead, which is why Step 3 matters.
Fix or remove: a table for common providers
The safest fix is almost always the same: delete the DNS record. If you still need the subdomain, re-create or re-claim the service first, then verify the domain with the provider.
| Provider | Typical sign it is dangling | Best fix |
|---|---|---|
| GitHub Pages | "There isn't a GitHub Pages site here." | Delete the CNAME. If you still need it, restore the repo's Pages site and verify the domain in your GitHub account's Pages settings. |
| Heroku | "No such app" | Delete (or repoint) the DNS record first, or do both steps in the same sitting, then remove the domain from the app. |
| Amazon S3 website | "NoSuchBucket" | Delete the CNAME. If needed, re-create the bucket in your own account with the exact name. |
| Azure App Service | Target *.azurewebsites.net does not resolve | Delete the CNAME. When using a custom domain, also add the asuid TXT verification record Azure provides. |
| Shopify | "Sorry, this shop is currently unavailable." | Delete (or repoint) the DNS record first, or do both steps in the same sitting, then remove the domain in Shopify (Settings, Domains). |
| Netlify / Vercel (check the provider's current behavior) | Provider "not found" or "deployment not found" page | Often needs ownership verification, so takeover is less likely, but a dangling record is still clutter and a risk if provider rules change. Delete the record, or re-add the domain to a live project you control. |
| Zendesk / help desks (check the provider's current behavior) | "Help Center Closed" or similar | Often needs domain verification, so takeover is less likely, but a dangling record is still clutter and a risk if provider rules change. Delete the CNAME once the help center is gone. |
After changing DNS, caches can hold the old answer until the record's TTL (time to live, the number of seconds before it refreshes) runs out. Re-run your check later to confirm the change took effect.
Other dangling records to look for
CNAMEs are the usual culprit, but not the only one:
- A records pointing to an IP address you released from a cloud provider. Someone else may get that IP later. Remove the record when you release the IP.
- NS records delegating a subdomain to another DNS provider where the zone no longer exists. These are more serious, so fix them first.
- Wildcard records like
*.example.com. They make every made-up name resolve, which widens the surface. Use them only if you need them.
How to prevent it from coming back
- Remove DNS first when you shut something down. Put "delete the DNS record" at the top of your decommission checklist, not the bottom.
- Keep a simple inventory. A spreadsheet with subdomain, service, owner and purpose is enough.
- Scope cookies tightly. Avoid setting cookies on the parent domain unless needed.
- Review quarterly. Set a reminder to run Steps 1 to 3 again.
- Get outside eyes. A free passive security check is a quick start. Weekly outside checks that email you when something changes can add another view, but they do not replace your own DNS cleanup.
Can a scanner do this for you?
Some automated tools flag dangling records, and they are useful. But they can miss providers they do not know, and they can raise false alarms. A human can judge context: is this record really abandoned, can it actually be claimed, and what else trusts this subdomain? Our post on manual vs automated penetration testing covers the tradeoffs. If you think something has already been abused, see our website hacked guide.
Key takeaways
- Subdomain takeover is a cleanup problem: a DNS record still points to a service you deleted, and someone else may be able to claim it.
- Check by listing subdomains, finding CNAMEs to outside services, then looking for provider "not found" pages or targets that do not resolve.
- The safest fix is to delete the unused DNS record. Do this first whenever you retire a service.
- Also review A records, NS records and wildcards, and keep a simple subdomain inventory with a quarterly reminder.
- A "not found" page is a clue, not proof, so confirm before you change anything important.
Next step
If you would rather not do this alone, our Circuit audit ($49, one time) means a real person reviews your site and reports the issues found, with severity, evidence and exact fixes. Tell us about any subdomains you want included. It is a focused small-site audit, not an enterprise pentest or a compliance certification. See pricing for details, or start with the free check.
A real human security engineer audits your whole site by hand and sends a full report: every issue, its severity, and the exact fix. From $49, with a 14-day money-back guarantee.
See pricing