What is subdomain takeover?
Subdomain Takeover is a critical vulnerability that occurs when a subdomain (e.g., marketing.example.com) points to a third-party cloud service that has been deprovisioned or deleted, but the DNS record mapping remains active.
Because the DNS record still directs traffic to the external service provider, an attacker can register an account with that same provider, claim the abandoned resource name, and effectively gain full control over the content served on your subdomain.
The attack chain
The lifecycle of a subdomain takeover usually follows a predictable, preventable sequence:
- Provisioning: Your team creates a CNAME record (
blog.company.com->company-blog.github.io). - Deprovisioning: Months later, the marketing team moves the blog to WordPress and deletes the GitHub Pages repository.
- The Dangling CNAME: The IT team forgets to delete the
blog.company.comDNS record. It now points to a non-existent GitHub repo. - Unclaimed Resource: When users visit
blog.company.com, they see a GitHub "404 Not Found" page. - Registration and Hijack: An attacker notices this, creates their own GitHub repo named
company-blog, and configures it to respond toblog.company.com. They now control your subdomain.
Vulnerable platforms and telltale 404s
Different cloud providers respond differently when a CNAME points to an unclaimed resource. Attackers build automated scanners looking for these specific HTTP responses:
- GitHub Pages: "There isn't a GitHub Pages site here."
- Heroku: "No such app."
- Netlify: "Not Found - Request ID: [ID]"
- AWS S3: "NoSuchBucket" or "The specified bucket does not exist."
- Azure: "404 Web Site not found."
- Shopify: "Sorry, this shop is currently unavailable."
- Fastly / Ghost / Tumblr: Similar identifiable missing-resource errors.
If your DNS points to one of these services and returns these specific errors, you are highly vulnerable.
Step-by-step walkthrough of a real takeover
Let's look at how an attacker exploits a dangling S3 bucket:
- Reconnaissance: The attacker runs a tool like
sublist3rorAmassto enumerate your subdomains. - Resolution: They resolve
assets.example.comand see a CNAME pointing toexample-assets.s3.amazonaws.com. - Verification: Browsing to
assets.example.comreturns the AWSNoSuchBucketXML error. - Exploitation: The attacker logs into their own AWS console, creates a bucket exactly named
example-assets, and uploads a malicious script (malware.js). - Execution: Any user visiting
assets.example.com/malware.jsnow executes the attacker's code under the trusted umbrella ofexample.com.
What attackers gain
Taking over a subdomain is devastating because it bypasses perimeter defenses and leverages your brand's inherent trust:
- Phishing Credibility: Sending phishing emails linking to
login.yourcompany.comlooks incredibly convincing to victims. - Cookie Scope: Depending on how your session cookies are scoped (e.g.,
Domain=.yourcompany.com), the attacker can steal authentication cookies meant for the main application. - Cross-Site Scripting (XSS): If your main application trusts the hijacked subdomain for CORS or script loading, the attacker can pivot to compromise the primary application.
- SSL Certs for Your Subdomain: Attackers can easily provision Let's Encrypt certificates for the hijacked subdomain to establish full HTTPS legitimacy.
Important
Attackers can easily get a valid Let's Encrypt certificate for your hijacked subdomain because they control the HTTP response required to pass the ACME HTTP-01 challenge.
High-value subdomain targets
While any takeover is bad, attackers specifically hunt for subdomains that historically handled sensitive functions.
The most prized targets include:
mail.*oremail.*staging.*ordev.*api.*status.*cdn.*
These prefixes imply trust and often have leftover integrations with internal systems.
Detection: automated scanning and monitoring
Finding dangling CNAMEs manually across thousands of records is impossible. You need automated detection:
- Automated Scanning: Use tools that continuously resolve your entire DNS zone and HTTP GET the destinations, matching the responses against known vulnerable platform signatures.
- Passive DNS Monitoring: Watch for changes in resolution patterns that might indicate a formerly dead subdomain suddenly coming back to life on unknown infrastructure.
- CT Log Alerts: Monitor Certificate Transparency logs. If Let's Encrypt suddenly issues a cert for a forgotten staging subdomain, an attacker may have just taken it over.
Prevention: deprecation policy and DNS management
The only permanent fix is operational hygiene.
- DNS Record Lifecycle Management: Never delete a cloud resource without deleting the associated DNS record first.
- Infrastructure as Code (IaC): Manage DNS and cloud resources together using Terraform or Pulumi, so destroying an environment automatically tears down the routing.
- Deprecation Policies: Enforce strict offboarding checklists for vendor migrations.
- Platform Defenses: Some providers (like AWS CloudFront and Azure) have implemented domain verification steps that make immediate takeover much harder, but you cannot rely on this universally.
Remediation steps
If you discover an active takeover:
- Delete the DNS Record: Immediately delete the CNAME record from your DNS zone. This stops traffic routing to the attacker's infrastructure.
- Revoke Certificates: Search CT logs for any certificates issued during the takeover window and request revocation.
- Audit Logs: Check your WAF and application logs to see what traffic the attacker intercepted and whether any session cookies were compromised.
- Reclaim Resource (Optional): If you cannot delete the DNS record immediately (due to change control), register the resource on the third-party platform yourself to lock the attacker out.
How CyberFurl Helps
Automated monitoring. Zero manual work.
CyberFurl continuously scans your DNS zone for dangling CNAME records pointing to deprovisioned cloud services — the exact attack vector that enables subdomain takeover. When a CNAME target returns a platform-specific unclaimed response (GitHub Pages, Heroku, Netlify, Azure, Shopify, S3), CyberFurl raises an immediate high-priority alert with the vulnerable subdomain, target platform, and proof-of-concept response, giving your team the evidence needed to escalate and remediate before attackers act.
