Subdomain Takeover: Eliminating Dangling DNS CNAME Records
Subdomain takeover occurs when a DNS CNAME record points to an external cloud service (GitHub Pages, AWS S3, Vercel, Heroku) that has been deleted or unclaimed.
An attacker can register an account with that third-party provider and claim the dangling resource, gaining control to serve arbitrary content on your verified domain name.
Vulnerability Risk & Threat Impact
Enables convincing phishing campaigns on official corporate subdomains, session cookie interception, and brand reputation damage.
How Our Scanner Inspects for This Flaw
Site Check inspects DNS records for subdomains to identify unresolved CNAME pointers toward third-party cloud hosts (dangling CNAMEs).
Diagnostics of transport security and HTTP response policies parse security headers returned by the origin server. The scanner checks for Content-Security-Policy, Strict-Transport-Security, X-Frame-Options, and robust cookie protection attributes (HttpOnly, Secure, SameSite).
Remediation Guide (Step-by-Step Fix)
To resolve this vulnerability, apply the following configuration or code snippet to your web server:
; Review your DNS zone and remove orphaned CNAME records:
; blog.yourdomain.com. CNAME old-project.github.io. <- DELETE THIS RECORD
- Conduct regular audits of all corporate DNS zones and subdomains.
- Remove orphaned CNAME records immediately whenever decommissioning third-party SaaS services.
Attack Anatomy & Real-World Business Impact
Dangling CNAME DNS records pointing to decommissioned third-party cloud assets (GitHub Pages, S3, Vercel) allow threat actors to claim the hosting asset and commandeer the subdomain.
Compliance Framework Impact: Violation of fundamental security controls specified in OWASP Top 10 (A05:2021 Security Misconfiguration), SOC 2 Type II trust criteria, and ISO 27001 Annex A.
Defense-in-Depth Engineering Matrix
| Defense Layer | Technical Action | Tool / Enforcement |
|---|---|---|
| Edge Perimeter & Ingress Gateway | Enforce granular path restrictions and deny rules for routes matching subdomain-takeover | Nginx Ingress Directives |
| Application Runtime Hardening | Disable verbose runtime telemetry and enforce least privilege controls for subdomain-takeover | Runtime Configuration Hardening |
| CI/CD DevSecOps Automation | Incorporate automated verification gates for subdomain-takeover within continuous deployment pipelines | Site Check Security Scanner |
CLI Remediation Verification: Terminal Commands
After applying configuration changes or patching source code, verify that the exposure is neutralized using command-line diagnostic tools:
dig CNAME sub.your-domain.com +short
# Verify that target hosting services are active and claimed
DevSecOps Best Practices & CI/CD Hardening
Audit DNS zones regularly and decommission orphaned CNAME records concurrently with third-party service removals.
Frequently Asked Remediation Questions
Properly configured security headers establish browser-enforced defense-in-depth for all visitors. The absence of modern CSP and HSTS leaves client sessions susceptible to Clickjacking, protocol downgrade eavesdropping, and MIME-type confusion attacks.
To permanently close the «Subdomain Takeover: Eliminating Dangling DNS CNAME Records» threat vector, integrate verification gates into your CI/CD pipeline and maintain automated perimeter checks with Site Check.