Websites and networks
Subdomain takeover: how to find forgotten subdomains and dangling DNS
A DNS record pointing at a deleted cloud service lets anyone take over your subdomain. How to list your subdomains, spot dangling records and close them.
By Brandon Sooknanan, Founder, Varaxon Technologies · · 5 min read
Someone in marketing set up promo.example.com on a hosted landing-page service for a campaign three years ago. The campaign ended, the account was closed, but the DNS record pointing promo at the service is still there. If an attacker opens an account on the same service and claims that name, your subdomain now shows their page, under your domain name, often with a valid certificate. That's a subdomain takeover.
It's one of the cheapest attacks to prevent, because nothing has to be patched. You just have to know which names you have and where they point.
Why a taken-over subdomain is dangerous
- Convincing phishing. A login page at
login.example.compasses every "check the address" test you've ever taught staff. - Cookie and session theft. Cookies set for the whole domain (
.example.com) are sent to every subdomain, including the hijacked one. - Damage to your reputation and email. Search engines and spam filters judge your domain by what it serves.
Step 1: list every subdomain you have
You can't check names you don't know about, and DNS won't hand you a list. The best public source is Certificate Transparency: every certificate a public authority issues is recorded in open logs, along with every name it covers. Enter your domain in the subdomain finder and it reads those logs, then looks each name up in public DNS. It's passive: nothing is guessed, scanned or brute-forced, and none of your hosts are contacted.
Two limits to know. A name that only ever used a wildcard certificate (*.example.com) isn't listed by name, and a name that never had a public certificate won't appear at all. Your DNS host's zone file is the other half of the picture: export it and compare.
Step 2: read the statuses with takeover in mind
| Status | What it means | Takeover angle |
|---|---|---|
| Live | The name has a public address today | Check where it points (step 3). A live name can still point at a provider page that's been abandoned. |
| Gone | The name doesn't resolve in public DNS | Don't skip these. A CNAME to a deleted cloud resource often stops resolving, so it shows as gone while the record still sits in your zone. Look for the name at your DNS host. |
| Private address | The name points to an internal address | Not a takeover risk, but it tells anyone your internal layout. Move internal names to internal DNS. |
| DNS didn't answer | The lookup failed this time | Try again later. |
The finder also picks out live names that read like remote access, admin panels, file sharing or test sites, and names that still answer in DNS but whose certificates have all expired. Those are often servers nobody looks after any more, which is the same root problem as a dangling record.
Step 3: check where each name points
For each name, ask DNS what it points to: dig CNAME promo.example.com +short on macOS or Linux, or nslookup -type=cname promo.example.com on Windows. You'll get one of three answers:
| Answer | What to do |
|---|---|
| No CNAME, just an address | Lower risk for takeover. Confirm you still own and run the server at that address. |
| A CNAME to another of your own names | Follow it and check that name the same way. |
| A CNAME to a cloud or hosting provider (an app platform, a storage bucket, a hosted page or a status page) | Log in to that provider and confirm the resource exists in your account. If you can't find it, treat the record as dangling. |
Visiting the name in a browser often gives it away. Abandoned resources show the provider's own error rather than your site: GitHub Pages says "There isn't a GitHub Pages site here", and an Amazon S3 website endpoint returns NoSuchBucket. Other providers have their own equivalents. Any provider "not found" page on one of your names deserves a look the same day.
Step 4: close it, and stop it happening again
- Delete the DNS record for any name whose resource you no longer use. This takes effect as soon as caches expire, and it's the whole fix.
- If you still need the name, reclaim the resource in your own account first, then check it serves your content.
- Change the decommission order. When a project ends, remove the DNS record first, then delete the cloud resource. Doing it the other way round leaves a window, sometimes years long, where the name points at nothing.
- Give every subdomain an owner. A name with no owner is the one nobody will clean up.
- Re-run the list monthly and compare. New names in the certificate logs that nobody recognises are worth asking about too.
After the clean-up
Once the list is tidy, check what the live names expose. Select any live name in the subdomain finder to open it in the SSL checker, which catches expired certificates and old TLS on hosts nobody watches. "Your connection is not private" explains the fixes. For a deeper look at what's running on those hosts, an external vulnerability scan of the live names is the next step, and Scan Hub turns the results from any scanner into a report you can hand to the people who own them.
Common questions
What is a dangling DNS record?
A DNS record that points to a resource that no longer exists, such as a deleted cloud app or storage bucket. If someone else can create a resource with the same name, they control what your subdomain shows.
Does the subdomain finder test for subdomain takeover?
No. It lists every name from public certificate logs and shows which are live, gone or pointing to private addresses. It doesn't contact your hosts or test them. Use the list to check each name's CNAME as described above.
How do I check if a subdomain is vulnerable to takeover?
Look up its CNAME. If it points to a cloud or hosting provider, confirm the resource still exists in your account. A provider "not found" page on the subdomain is a strong sign the record is dangling.
How do I remove a subdomain from certificate logs?
You can't. The logs are permanent by design. Delete the DNS record and take the host offline, and the name will show as gone.
Turn your next scan export into a client-ready report.
Run a free pre-flight check