Security
By Fadhil Abdulla

Subdomain Takeover: How Dangling DNS Records Get Hijacked — and How to Find Them

A subdomain takeover happens when a DNS record still points at a service you no longer own. Here's how dangling CNAMEs get hijacked, what an attacker can do with one, and how to detect and close them.

Editorial disclosure: Pyalm publishes and maintains the products and free tools discussed on this site. Regulatory statements are linked to primary sources where applicable. No independent professional review is claimed unless a reviewer is explicitly named.

A subdomain takeover is one of the quietest ways to lose control of part of your domain. Nobody breaks into a server. No password is stolen. A DNS record simply keeps pointing at a service you stopped using — and someone else claims the other end.

What a subdomain takeover actually is

Most subdomains don't resolve to your own servers. They CNAME to a third-party service: a marketing site on a SaaS host, a docs portal, a status page, a storage bucket, a support widget. The record says "for help.example.com, go ask this provider."

The problem starts when you decommission that service but leave the DNS record behind. Now help.example.com points at a hostname the provider no longer has assigned to anyone. That's a dangling CNAME. If the provider lets a new customer claim that hostname, whoever claims it now controls content served at your subdomain.

Why it matters more than it looks

A subdomain you forgot about is still your domain to a browser, a user, and often a cookie. An attacker who takes one over can:

  • Phish with a real domain. A login page on portal.example.com is far more convincing than any lookalike domain.
  • Steal cookies and tokens scoped to *.example.com, depending on how yours are set.
  • Bypass allowlists — CSP frame-ancestors, CORS rules, and OAuth redirect allowlists that trust your own subdomains now trust the attacker.
  • Damage reputation by hosting spam or malware under your brand.

How to find dangling records

Detection is really two questions asked across every subdomain you have:

  1. Do I even know all my subdomains? Enumerate them from certificate-transparency logs, passive DNS, and a brute-force wordlist. You can't check records you don't know exist.
  2. Does each CNAME still resolve to a claimed resource? For every subdomain that CNAMEs to a third party, confirm the target still exists and is still yours. A CNAME that resolves to a provider's "no such site" fingerprint is the red flag.

Doing this by hand across a real domain is tedious, which is exactly why forgotten records survive. Automated attack-surface tooling handles both halves — enumerating subdomains and flagging dangling CNAMEs before someone else finds them. For an assessment on a domain you own, our sister company Defense Net Solutions does this work.

How to prevent them

  • Delete the DNS record the moment you retire a service — make it a step in your decommissioning checklist, not an afterthought.
  • Enumerate on a schedule. Attack surface grows quietly; a quarterly sweep catches records that outlived their service.
  • Prefer records you control for anything sensitive, and avoid wildcard CNAMEs that mask individual dangling entries.
  • Claim before you cancel where a provider allows it, so there's no window between "you stopped paying" and "the hostname is free."

The fix is almost always a one-line DNS deletion. The hard part is knowing which line — and that's a discovery problem, not a security-genius problem.

Assess your attack surface with Defense Net Solutions | Introducing Pyalm Guard | SPF, DKIM & DMARC explained | HTTP security headers guide

Keep reading

More from Pyalm

Jul 7, 2026

Introducing Pyalm Guard: An Authorized Security Posture Assessment Tool

Point Pyalm Guard at a domain you own and it runs a full, non-destructive checkup — DNS, subdomains, email authentication, TLS, headers, ports, threat intelligence, and breach exposure — scored into one clear risk grade.

Jul 7, 2026

SPF, DKIM, and DMARC Explained: How to Stop Email Spoofing on Your Domain

SPF says who can send, DKIM proves nothing was tampered with, and DMARC ties them together and tells receivers what to do. Here's how the three work — and how to check yours are set up right.

Jul 7, 2026

HTTP Security Headers: A Practical Guide to HSTS, CSP, and the Rest

A handful of response headers quietly decide whether your site can be framed, downgraded, or injected into. Here's what HSTS, CSP, X-Frame-Options and friends do, and how to tell if yours are set right.

Oct 16, 2026

Expense Tracking and Input VAT Recovery in the UAE

How to record business expenses, when input VAT can be recovered, the documents you need, common non-recoverable items and a monthly routine.

Oct 16, 2026

Petty Cash Management: Imprest System and Controls

How to run petty cash so it balances: the imprest method, vouchers, replenishment, counting, VAT on small purchases and anti-leakage controls.

Oct 16, 2026

Accounting for Restaurants and Cafes in the UAE

How UAE restaurants and cafes handle daily POS sales, card settlements, 5% VAT, food cost, delivery app commissions, wastage and payroll.

Need This Handled Properly?

Security posture assessment and credential management are now with our sister company, Defense Net Solutions — the same work, under the team that specialises in it.

Visit Defense Net Solutions Free security tools