Subdomain Takeover: The Forgotten DNS Record Risk
Delete a service but leave its DNS record behind and a stranger may be able to claim the name and serve their own content on your domain. Here is how it works and how to find and fix it.
๐ก The short version: if a subdomain's DNS record still points at a service you've deleted, anyone who can claim that name on the service can serve their own content from your subdomain. The fix is housekeeping: when you remove a service, remove its DNS record too.
It starts innocently. Last year you spun up demo.yourcompany.com on some hosting service. Then the demo ended, you deleted the project and moved on. ๐งน The DNS record, the signpost that said "demo lives over there", stayed behind.
๐ How a takeover works
- Your DNS has
demo.yourcompany.comas a CNAME pointing to something likeyourproject.some-host.example. - You deleted
yourprojecton that host, so the name is free again. - A stranger registers
yourprojecton the same host. Your signpost now leads to their content. - They are now serving a page, perhaps a phishing page, at an address that really belongs to your company.
Because the address is genuinely yours, browsers and customers trust it more. It can also help someone read cookies set for your wider domain, depending on your setup.
โ ๏ธ Where it tends to happen
- Static page hosts and developer platforms (GitHub Pages and Heroku style services).
- Cloud storage website endpoints, such as Amazon S3 website buckets.
- Any cloud resource with a name you picked, like an Azure app, once it is deleted.
- Names that point at a domain nobody has registered any more.
๐ต๏ธ Find your own dangling records
- List your subdomains. Your DNS dashboard has them. So do public certificate logs, which record the publicly trusted certificates issued for your domain.
- Look at each CNAME. Where does it point? Do you still use that service?
- Visit each address. A host's "nothing here" or "no such app" page is the telltale sign that the record is dangling.
- Check the target resolves. A CNAME to a name that no longer exists at all is a smaller problem, but still worth cleaning up.
dig +short CNAME demo.yourcompany.com
๐งน Fixing and preventing it
- Delete DNS records first when you retire a service. Make it a step in your offboarding checklist.
- Remove the record, don't just stop using it. An unused record is a standing invitation.
- Review DNS twice a year. Twenty minutes catches most of it.
- Claim before you point. Create the resource on the host before you add the record, never the other way round.
๐ค What a scan does
Dr. Security looks at your main address on every scan, using public DNS only. Once you've verified you own the site, it also checks your subdomains, taken from public certificate logs, up to 40 of them. A name that points at a host showing its "unclaimed" page, or at a domain nobody has registered, is high severity. A record that points at a name that no longer exists is medium, with the advice to remove the record. Our messages name your subdomains and the provider, never the page content. If a lookup fails, the name is skipped and never reported as clean.
Think of this as one item on the list of things a stranger can find about you from the outside. The rest is here.
๐ Find out what points where. Run a free scan on your main domain.