
A subdomain takeover is an attack where an external party gains control of one of your subdomains by exploiting a DNS record that points to a service you no longer use. The subdomain still resolves — it appears to be yours — but an attacker controls the content it serves.
It's distinct from domain hijacking, which involves seizing control of your domain registration. Subdomain takeovers don't require access to your registrar at all.
The attack relies on what's called a dangling DNS record — a CNAME or A record that points to an external resource that no longer exists or is no longer claimed by you.
The typical sequence:
api.yourcompany.com as a CNAME pointing to a Heroku app: your-app.herokuapp.comapi.yourcompany.com still resolves — it points to your-app.herokuapp.com — but that Heroku app name is now unclaimedyour-app.herokuapp.com on their own Heroku accountapi.yourcompany.com servesFrom a DNS perspective, api.yourcompany.com appears to be your subdomain. From a browser perspective, it loads content from the attacker's server.
An attacker who controls one of your subdomains can:
Because the subdomain is genuinely under your DNS namespace, browser security signals (HTTPS, domain name) don't protect users. The subdomain looks legitimate.
Any cloud service that provides a unique hostname you can CNAME to is a potential attack vector when that service is deprovisioned:
herokuapp.comThe key to catching subdomain takeover risk is monitoring your DNS records for changes and auditing for dangling CNAMEs.
What to watch for:
NXDOMAIN (the target doesn't exist)DNS record change monitoring alerts you when any DNS record in your zone changes — including if someone takes over a target and the IP behind a CNAME shifts. See DNS security monitoring for how to interpret DNS change alerts in a security context.
1. Audit your DNS records regularly
Review all CNAME records. For each one, verify the target still exists and is still claimed by you. See how to audit your DNS records for security issues.
2. Remove records when you decommission services
When you delete a Heroku app, Netlify site, or AWS resource, remove the corresponding DNS record immediately. Treat DNS cleanup as part of your offboarding checklist for any cloud service.
3. Use DNSSEC where possible
DNSSEC doesn't prevent subdomain takeover directly, but it prevents DNS response spoofing and adds a layer of integrity verification.
4. Monitor for NXDOMAIN CNAMEs
Automated scanning tools can flag CNAMEs that point to non-existent targets. Combine automated scanning with monitoring that alerts on any unexpected DNS changes.
A subdomain takeover lets an attacker claim your subdomain by exploiting dangling DNS records. Learn how it happens, real-world examples, and how DNS monitoring detects it.
Read moreMean time to detect (MTTD) measures how long it takes to discover an incident after it starts. Reducing MTTD is one of the highest-leverage improvements in reliability engineering.
Read moreBlack box monitoring tests your systems from the outside, the way users experience them — without access to internal code or infrastructure. Learn how it works and when to use it.
Read moreLooking to monitor your website and domains? Join our platform and start today.