Subdomain Takeover: How Dangling DNS Gets Hijacked
Part of our guide to onchain monitoring

Quick answer. A subdomain takeover happens when a CNAME still points at a deleted cloud resource and someone else claims it. They then serve a drainer or phishing page on your real subdomain, which users, cookies and allowlists trust.
Video transcript
A subdomain takeover needs no registrar breach, just a DNS record someone forgot to delete. AWS says attackers are actively scanning for them.
You point a CNAME at a cloud resource. The resource is deleted, but the record stays. An attacker claims the same name, and your subdomain serves their page.
Exposure depends on the provider. A community tracker lists Amazon S3, Elastic Beanstalk and Azure as vulnerable, with GitHub Pages as an edge case.
A taken-over subdomain is really yours. Users see your name with a valid certificate, domain cookies flow to it, wildcard content policies allow it, and wallet checks can still match.
Bug bounties reflect this. Immunefi rates a takeover Critical when it involves a connected wallet, and High without one.
Detection takes four checks. Inventory every hostname, including Certificate Transparency logs. Confirm each target exists, and that you own it. Then alert on CNAME changes as they happen.
On teardown, delete the record, wait for its TTL, then delete the resource. On setup, claim the host first. Verify domain ownership, and avoid wildcard records.
Guardian Managed Security re-runs full reconnaissance of your domains and subdomains weekly by default. Between runs, a re-pointed CNAME alerts within 5 minutes.
Read the full article for the cleanup and prevention steps, or talk to Guardian about finding the records you forgot.
Most domain hijacks need a registrar or a registry to fail. A subdomain takeover needs only a DNS record someone forgot to delete.
Attackers look for those records. In June 2026, AWS's incident response team said it had seen threat actors actively scanning for CNAMEs that point to resources that no longer exist.
In May 2025, Infoblox described a threat actor it calls Hazy Hawk. Since at least December 2023, it had taken over abandoned cloud resources under cdc.gov, deloitte.com and berkeley.edu, among others, to push scams.
The registrar route to a whole domain is covered in our DeFi DNS hijack prevention checklist. This page is about the records you control.
How a Subdomain Takeover Happens
Microsoft's guidance walks through the usual sequence:
- You create a cloud resource, such as an app at app-name.azurewebsites.net.
- You add a CNAME so app.example.com points to it.
- Later, you delete the resource but leave the CNAME in place.
- An attacker creates a resource with the same name in their own account.
- Traffic for app.example.com now reaches content the attacker controls.
The leftover record is a dangling DNS entry. CNAMEs are especially exposed, Microsoft says.
The provider is not breached. AWS stresses that the tactic exploits a dangling record, not a flaw in its services.
Setup has the same gap. If you create the DNS record before claiming the host, someone quicker can claim it first, MDN notes.
Other record types can dangle too. OWASP's testing guide says a dangling NS record has the highest impact, since it can hand over the whole DNS zone, though it is less likely.
Dangling DNS: Which Services Are Exposed
A takeover needs two things: a resource name any customer can register, and a provider that does not check who owns your domain.
The community list can-i-take-over-xyz tracks which services meet both. Its table, last refreshed on February 8, 2025, includes these:
| Service | Listed status | Note |
|---|---|---|
| Amazon S3 | Vulnerable | A deleted bucket's name can be re-created by another account (AWS) |
| AWS Elastic Beanstalk | Vulnerable | A terminated environment's name can be claimed by any account (AWS) |
| Microsoft Azure | Vulnerable | Hazy Hawk took a CDC subdomain via an abandoned Azure site (Infoblox) |
| Read the Docs, ReadMe | Vulnerable | Hosted documentation |
| Discourse | Vulnerable | Hosted forums |
| GitHub Pages | Edge case | Takeovers can follow a deleted repo or downgraded plan on unverified domains (GitHub) |
| Amazon CloudFront | Not vulnerable | AWS assigns names, but says a reissued one could serve another customer |
Heroku, Netlify and Vercel are listed as edge cases. Vendor-hosted docs, forums and help pages carry your name just as your main app does.
S3 has a newer fix. Since March 2026, buckets created in an account regional namespace can never be re-created by another account, AWS says.
It is opt-in: the global namespace is still the default for new buckets, and existing buckets cannot move.
Your Domain's Trust Makes It Worse
A lookalike domain has to fool the user. A taken-over subdomain does not: it is your domain, and whatever trusts your domain trusts it.
- Users. The address bar shows your name, and the attacker can get a valid TLS certificate for it, Microsoft notes.
- Cookies. A cookie set with a Domain attribute goes to every subdomain, MDN says. Microsoft warns attackers can harvest them, even secure cookies.
- Content Security Policy. A source like https://*.example.com permits every subdomain, the claimed one included.
- Your own code. If your app loads scripts from that hostname, it now loads the attacker's. Microsoft tells teams to check code for such references.
- Wallet checks. Reown's Verify API trusts only the domain in an app's metadata. A takeover of that exact hostname still matches.
The certificate is easy to get. Let's Encrypt's HTTP-01 check asks for a file at a set path on the site, and the attacker now serves the site.
Bug bounty severity reflects this. Immunefi's severity classification rates a subdomain takeover Critical when it involves an already-connected wallet, and High without one.
Subdomain Takeover Detection
Detection is attack surface management applied to DNS. It comes down to four checks:
- Inventory every hostname. Export every DNS zone you run, past and present. Public Certificate Transparency logs add names that have had certificates.
- Check targets exist. OWASP says NXDOMAIN, SERVFAIL and REFUSED answers warrant a look. So do provider errors, like S3's "The specified bucket does not exist."
- Check you own it. A target that resolves may already be the attacker's. AWS's reference rule checks each target against your own account's inventory instead.
- Alert on change. Watch CNAME edits as they happen, and treat a new target that doesn't exist as urgent.
Our domain monitoring alert table sets the timing for this and the other DNS changes worth watching.
Resources come and go, so run the first three checks on a schedule. AWS's reference implementation runs every 24 hours by default.
Fixing and Preventing Dangling Records
If you find one
- Remove the record, or point it back at a resource you own, Microsoft advises.
- Check whether the name was claimed, and what it served while it was.
- If secrets such as OAuth credentials were sent to it, treat them as exposed, Microsoft warns.
- Find out why the record outlived its resource, and fix that process.
Preventing the next one
- DNS first. Delete the record, wait for its TTL to expire, then delete the resource, AWS says.
- DNS last on setup. Claim the host before creating the record, MDN advises.
- Claim and hold. AWS recommends emptying an unused S3 bucket and keeping it, rather than deleting it.
- Verify ownership. GitHub Pages domain verification and Azure's asuid TXT record stop other accounts claiming your name.
- No wildcard records. GitHub warns they risk takeovers even on a verified domain.
- Make it a checklist item. Microsoft puts "Remove DNS entry" on the required checks for decommissioning a service.
Guardian's Recon and CNAME Alerts
Guardian Managed Security starts with full reconnaissance of your domains, subdomains, IPs and network services, to see what an attacker has at their disposal.
Recon re-runs weekly by default and flags anything new that looks unexpected. Between runs, a re-pointed CNAME alerts within 5 minutes, at High if the new target doesn't exist.
Shield, Guardian's attack surface management system, runs that reconnaissance and pentests what it finds, and a Guardian researcher verifies each finding. See what else Guardian Managed Security covers.
Find the records you forgot
Guardian Managed Security maps every domain and subdomain you expose, and alerts within 5 minutes when a CNAME is re-pointed.
Frequently Asked Questions
Will a bug bounty accept a dangling record without a takeover?
It depends on the program. The can-i-take-over-xyz maintainers note some may accept dangling DNS reports without proof of compromise. For proof, they suggest claiming the name quietly and serving a harmless file on a hidden path, not the index page.
Can MX records dangle too?
Yes. Microsoft warns that dangling MX records could let attackers receive email sent to your legitimate subdomains. Inventory mail records with the same care as CNAMEs.
Should dangling records be deleted automatically?
Not at first. AWS suggests starting with detection and alerts, with a person approving each deletion, because auto-deleting on a false positive could take down a legitimate service.
Sources
- AWS Security Blog: Threat tactic spotlight: Subdomain takeover (June 16, 2026)
- Amazon S3 User Guide: General purpose bucket naming rules
- Microsoft Learn: Prevent dangling DNS entries and avoid subdomain takeover (updated July 24, 2026)
- GitHub Docs: Verifying your custom domain for GitHub Pages
- EdOverflow: can-i-take-over-xyz (GitHub, table refreshed February 8, 2025)
- OWASP: Web Security Testing Guide v4.2, WSTG-CONF-10, Test for Subdomain Takeover
- MDN: Subdomain takeover (September 10, 2025)
- MDN: Set-Cookie header
- MDN: Content-Security-Policy header
- Let's Encrypt: Challenge Types (February 12, 2026)
- Reown Docs: Domain Verification
- Infoblox: Cloudy with a Chance of Hijacking: Forgotten DNS Records Enable Scam Actor (May 20, 2025)
- Immunefi: Immunefi Vulnerability Severity Classification System, v2.3
- IETF: RFC 9162, Certificate Transparency Version 2.0 (December 2021)