Subdomain takeover happens when a DNS record (most often a `CNAME`, `A`, or `NS` delegation) points to an external cloud resource—such as a GitHub Pages repository, AWS S3 bucket, Azure App Service, or PaaS instance—that has been deleted or expired without removing the DNS entry. Anyone who registers that unclaimed resource name on the external provider can begin serving content on your organization's subdomain.
Why a hijacked subdomain threatens the parent application
Even if the forgotten subdomain (such as `events.example.com` or `old-docs.example.com`) never hosted customer data itself, controlling a hostname inside your registrable domain gives an attacker dangerous leverage over your primary web application:
- Session cookie capture and fixation: any cookies set on the parent domain (`Domain=.example.com`) without the `__Host-` prefix are transmitted by browsers to the hijacked subdomain, and the subdomain can also write cookies onto the parent domain.
- OAuth redirect and CORS trust abuse: identity providers or API servers that allowlist `*.example.com` for OAuth `redirect_uri` callbacks or `Access-Control-Allow-Origin` headers will treat the taken-over subdomain as a trusted origin.
- Authentic TLS certificates and phishing: because the attacker controls HTTP responses for the subdomain, automated Certificate Authorities will issue a valid Let's Encrypt TLS certificate for it, enabling convincing credential phishing under your real brand domain.
Preventing and auditing dangling DNS records
Make DNS cleanup an explicit step in your infrastructure deprovisioning checklist: always delete the DNS `CNAME` or `A` record in your authoritative DNS zone before deleting the underlying cloud bucket, CDN distribution, or PaaS app.
Scope your main application's session cookies to the exact host using the `__Host-` prefix rather than a broad parent domain, avoid wildcard `*.example.com` allowlists in OAuth and CORS configurations, and periodically review your public DNS and subdomain footprint using MyRecon and MyPentest.
Delete DNS CNAME and A records before deprovisioning cloud services, and bind primary session cookies with the __Host- prefix to isolate sibling subdomains.