Subdomain Takeover Explained: The Bug That Hands Attackers Your Domain


Some of the most valuable bug bounties come from the simplest mistake: a DNS record that points somewhere that no longer exists. When that happens, an attacker can claim the destination — and suddenly your subdomain is serving their content. This is subdomain takeover, and it’s embarrassingly common.

How It Happens

Picture this: a company once hosted a blog at blog.example.com on a cloud platform. Later they delete the cloud account but forget the DNS record. The record still says “blog.example.com lives at this cloud service” — but nobody owns that cloud address anymore. An attacker signs up on the same platform, claims the freed name, and now blog.example.com serves whatever they put there. Same story with deleted GitHub Pages sites, S3 buckets, Heroku apps and Azure services.

Why It’s Dangerous

An attacker controlling your subdomain can:

  • Phish your users — a login page on a real subdomain of a trusted domain fools almost everyone.
  • Steal cookies and sessions — if cookies aren’t scoped tightly, a subdomain can sometimes read them.
  • Distribute malware or defacement — your brand, their payload.
  • Bypass security controls — some systems trust all subdomains of a domain equally.

Real payouts for subdomain takeovers regularly reach four and five figures, because the impact is a trusted brand name in attacker hands.

How Hunters Find It (Legally)

On programs that explicitly allow it — always check scope first, since some programs exclude subdomain takeover entirely:

  1. Enumerate subdomains of the target (tools like subfinder, or a Python subdomain enumerator — your own domains and in-scope targets only).
  2. Resolve each one and look for DNS records pointing to cloud providers (CNAMEs to services like GitHub Pages, S3, Heroku, Azure).
  3. Check whether the destination is claimable — a “not found” page from the provider, an NXDOMAIN, or a provider error saying the site doesn’t exist are the classic signals.
  4. Confirm carefully, don’t exploit. Take a screenshot of the provider’s error page as proof. Claiming the subdomain yourself to “prove it” without permission crosses a line on many programs — report the claimable state instead, unless the program explicitly allows claiming.

How to Prevent It

If you own domains, this is a 15-minute audit:

  • Inventory your DNS records. List every CNAME and check that each destination still exists and is still yours.
  • Delete records before deleting services. The golden rule: remove the DNS record first, then delete the cloud resource. Do it in the wrong order and you create a takeover window.
  • Monitor continuously. DNS changes, new cloud accounts and expired services drift over time — re-check quarterly, or automate it with a script that resolves your CNAMEs and alerts on dangling ones.
  • Use a registrar lock and DNS monitoring so stray records get noticed instead of lingering for years.

Subdomain takeover isn’t a clever exploit — it’s housekeeping failure. The hunter’s edge is simply checking what everyone else forgot. And the defender’s fix is even simpler: clean up your DNS before someone else claims it.

Comments

Popular Posts