/subdomain-takeover
Subdomain takeover detection and exploitation playbook. Use when targets have dangling CNAME/NS/MX records pointing to deprovisioned cloud resources, expired third-party services, or unclaimed SaaS tenants that an attacker can register to serve content under the victim's domain.
$ npx -y skills add yaklang/hack-skills --skill subdomain-takeover --agent claude-codeHow it fires
How this skill gets triggered: by you, by Claude, or both.
- Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
- You can call itInvoke it directly when you want it.
- Slash command
/subdomain-takeover
Context preview
The summary Claude sees to decide when to auto-load this skill.
Subdomain takeover detection and exploitation playbook. Use when targets have dangling CNAME/NS/MX records pointing to deprovisioned cloud resources, expired third-party services, or unclaimed SaaS tenants that an attacker can register to serve content under the victim's domain.
SKILL.md
subdomain-takeover.SKILL.mdname: subdomain-takeover
description: >-
Subdomain takeover detection and exploitation playbook. Use when targets have
dangling CNAME/NS/MX records pointing to deprovisioned cloud resources, expired
third-party services, or unclaimed SaaS tenants that an attacker can register
to serve content under the victim's domain.
SKILL: Subdomain Takeover — Detection & Exploitation Playbook
> **AI LOAD INSTRUCTION**: Covers CNAME/NS/MX takeover, per-provider fingerprint matching, claim procedures, and defensive monitoring. Base models often confuse "CNAME exists" with "takeover possible" — the key is whether the *resource behind the CNAME is unclaimed and claimable*.
0. RELATED ROUTING
- [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) when a subdomain takeover is used to bypass SSRF allowlists trusting `*.target.com`
- [cors-cross-origin-misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md) when CORS trusts `*.target.com` — takeover → full cross-origin read
- [xss-cross-site-scripting](../xss-cross-site-scripting/SKILL.md) takeover gives you script execution under target origin (cookie theft, OAuth redirect abuse)
- [http-host-header-attacks](../http-host-header-attacks/SKILL.md) when Host routing leads to subdomain-scoped cache or auth issues
- [web-cache-deception](../web-cache-deception/SKILL.md) when a taken-over subdomain shares cache with the main domain
---
1. CORE CONCEPT
Subdomain takeover occurs when:
1. `sub.target.com` has a DNS record (CNAME, NS, A) pointing to an external service 2. The external resource is **no longer provisioned** (deleted S3 bucket, removed Heroku app, etc.) 3. The attacker can **register/claim** that exact resource name on the provider 4. The attacker now controls content served under `sub.target.com`
**Impact**: cookie theft (parent domain cookies), OAuth token interception, phishing under trusted domain, CORS bypass, CSP bypass via whitelisted subdomain.
---
2. DETECTION METHODOLOGY
2.1 CNAME Enumeration
1. Collect subdomains (amass, subfinder, assetfinder, crt.sh, SecurityTrails)
2. Resolve DNS for each:
dig CNAME sub.target.com +short
3. For each CNAME → check if the CNAME target returns NXDOMAIN or a provider error
4. Match error response against fingerprint table (Section 3)
2.2 Key Signals
| Signal | Meaning | |---|---| | CNAME → `xxx.s3.amazonaws.com` + HTTP 404 "NoSuchBucket" | S3 bucket deleted, claimable | | CNAME → `xxx.herokuapp.com` + "No such app" | Heroku app deleted | | CNAME → `xxx.github.io` + 404 "There isn't a GitHub Pages site here" | GitHub Pages unclaimed | | NXDOMAIN on the CNAME target domain itself | Target domain expired or never existed | | CNAME → provider but HTTP 200 with default parking page | May or may not be claimable — verify |
2.3 Automated Tools
| Tool | Purpose | |---|---| | `subjack` | Automated CNAME takeover checking | | `nuclei -t takeovers/` | Nuclei takeover detection templates | | `can-i-take-over-xyz` (GitHub) | Reference for which services are vulnerable | | `dnsreaper` | Multi-provider takeover scanner | | `subzy` | Fast subdomain takeover verification |
---
3. SERVICE PROVIDER FINGERPRINT TABLE
| Provider | CNAME Pattern | Fingerprint (HTTP Response) | Claimable? | |---|---|---|---| | **AWS S3** | `*.s3.amazonaws.com` / `*.s3-website-*.amazonaws.com` | `NoSuchBucket` (404) | Yes — create bucket with matching name | | **GitHub Pages** | `*.github.io` | `There isn't a GitHub Pages site here` (404) | Yes — create repo + enable Pages | | **Heroku** | `*.herokuapp.com` / `*.herokudns.com` | `No such app` | Yes — create app with matching name | | **Azure** | `*.azurewebsites.net` / `*.cloudapp.azure.com` / `*.trafficmanager.net` | Various default pages, NXDOMAIN | Yes — register matching resource | | **Shopify** | `*.myshopify.com` | `Sorry, this shop is currently unavailable` | Yes — create shop, add custom domain | | **Fastly** | CNAME to Fastly edge | `Fastly error: unknown domain` | Yes — add domain to Fastly service | | **Pantheon** | `*.pantheonsite.io` | `404 Site Not Found` with Pantheon branding | Yes | | **Tumblr** | `*.tumblr.com` (custom domain CNAME) | `There's nothing here` / `Whatever you were looking for doesn't exist` | Yes | | **WordPress.com** | CNAME to `*.wordpress.com` | `Do you want to register` | Yes — claim domain in WP.com | | **Zendesk** | `*.zendesk.com` | `Help Center Closed` / Zendesk branding on error | Yes — create matching subdomain | | **Unbounce** | `*.unbouncepages.com` | `The requested URL was not found` | Yes | | **Ghost** | `*.ghost.io` | `404 Not Found` Ghost error | Yes | | **Surge.sh** | `*.surge.sh` | `project not found` | Yes | | **Fly.io** | CNAME to `*.fly.dev` | Fly.io default 404 | Yes |
---
4. TAKEOVER PROCEDURE — COMMON PROVIDERS
4.1 AWS S3
1. Confirm: curl -s http://sub.target.com → "NoSuchBucket"
2. Extract bucket name from CNAME (e.g., sub.target.com.s3.amazonaws.com → bucket = "sub.target.com")
3. aws s3 mb s3://sub.target.com --region <region>
4. Upload index.html proving control
5. Enable static website hosting
4.2 GitHub Pages
1. Confirm: curl -s https://sub.target.com → "There isn't a GitHub Pages site here"
2. Create GitHub repo (any name)
3. Add CNAME file containing "sub.target.com"
4. Enable GitHub Pages in repo settings
5. Wait for DNS propagation (GitHub verifies CNAME match)
4.3 Heroku
1. Confirm: curl -s http://sub.target.com → "No such app"
2. heroku create <app-name-from-cname>
3. heroku domains:add sub.target.com
4. Deploy proof-of-concept page
---
5. NS TAKEOVER — HIGH SEVERITY
NS takeover is **far more dangerous** than CNAME takeover: you control **all DNS resolution** for the zone.
How It Happens
target.com NS → ns1.expireddomain.com
↓
attacker registers expireddomain.com
↓
attacker now controls ALL DNS for target.com
(A records, MX recorRead more
name: subdomain-takeover description: >- Subdomain takeover detection and exploitation playbook. Use when targets have dangling CNAME/NS/MX records pointing to deprovisioned cloud resources, expired third-party services, or unclaimed SaaS tenants that an attacker can register to serve content under the victim's domain.
SKILL: Subdomain Takeover — Detection & Exploitation Playbook
> **AI LOAD INSTRUCTION**: Covers CNAME/NS/MX takeover, per-provider fingerprint matching, claim procedures, and defensive monitoring. Base models often confuse "CNAME exists" with "takeover possible" — the key is whether the *resource behind the CNAME is unclaimed and claimable*.
0. RELATED ROUTING
- [ssrf-server-side-request-forgery](../ssrf-server-side-request-forgery/SKILL.md) when a subdomain takeover is used to bypass SSRF allowlists trusting `*.target.com`
- [cors-cross-origin-misconfiguration](../cors-cross-origin-misconfiguration/SKILL.md) when CORS trusts `*.target.com` — takeover → full cross-origin read
- [xss-cross-site-scripting](../xss-cross-site-scripting/SKILL.md) takeover gives you script execution under target origin (cookie theft, OAuth redirect abuse)
- [http-host-header-attacks](../http-host-header-attacks/SKILL.md) when Host routing leads to subdomain-scoped cache or auth issues
- [web-cache-deception](../web-cache-deception/SKILL.md) when a taken-over subdomain shares cache with the main domain
---
1. CORE CONCEPT
Subdomain takeover occurs when:
1. `sub.target.com` has a DNS record (CNAME, NS, A) pointing to an external service 2. The external resource is **no longer provisioned** (deleted S3 bucket, removed Heroku app, etc.) 3. The attacker can **register/claim** that exact resource name on the provider 4. The attacker now controls content served under `sub.target.com`
**Impact**: cookie theft (parent domain cookies), OAuth token interception, phishing under trusted domain, CORS bypass, CSP bypass via whitelisted subdomain.
---
2. DETECTION METHODOLOGY
2.1 CNAME Enumeration
1. Collect subdomains (amass, subfinder, assetfinder, crt.sh, SecurityTrails) 2. Resolve DNS for each: dig CNAME sub.target.com +short 3. For each CNAME → check if the CNAME target returns NXDOMAIN or a provider error 4. Match error response against fingerprint table (Section 3)
2.2 Key Signals
| Signal | Meaning | |---|---| | CNAME → `xxx.s3.amazonaws.com` + HTTP 404 "NoSuchBucket" | S3 bucket deleted, claimable | | CNAME → `xxx.herokuapp.com` + "No such app" | Heroku app deleted | | CNAME → `xxx.github.io` + 404 "There isn't a GitHub Pages site here" | GitHub Pages unclaimed | | NXDOMAIN on the CNAME target domain itself | Target domain expired or never existed | | CNAME → provider but HTTP 200 with default parking page | May or may not be claimable — verify |
2.3 Automated Tools
| Tool | Purpose | |---|---| | `subjack` | Automated CNAME takeover checking | | `nuclei -t takeovers/` | Nuclei takeover detection templates | | `can-i-take-over-xyz` (GitHub) | Reference for which services are vulnerable | | `dnsreaper` | Multi-provider takeover scanner | | `subzy` | Fast subdomain takeover verification |
---
3. SERVICE PROVIDER FINGERPRINT TABLE
| Provider | CNAME Pattern | Fingerprint (HTTP Response) | Claimable? | |---|---|---|---| | **AWS S3** | `*.s3.amazonaws.com` / `*.s3-website-*.amazonaws.com` | `NoSuchBucket` (404) | Yes — create bucket with matching name | | **GitHub Pages** | `*.github.io` | `There isn't a GitHub Pages site here` (404) | Yes — create repo + enable Pages | | **Heroku** | `*.herokuapp.com` / `*.herokudns.com` | `No such app` | Yes — create app with matching name | | **Azure** | `*.azurewebsites.net` / `*.cloudapp.azure.com` / `*.trafficmanager.net` | Various default pages, NXDOMAIN | Yes — register matching resource | | **Shopify** | `*.myshopify.com` | `Sorry, this shop is currently unavailable` | Yes — create shop, add custom domain | | **Fastly** | CNAME to Fastly edge | `Fastly error: unknown domain` | Yes — add domain to Fastly service | | **Pantheon** | `*.pantheonsite.io` | `404 Site Not Found` with Pantheon branding | Yes | | **Tumblr** | `*.tumblr.com` (custom domain CNAME) | `There's nothing here` / `Whatever you were looking for doesn't exist` | Yes | | **WordPress.com** | CNAME to `*.wordpress.com` | `Do you want to register` | Yes — claim domain in WP.com | | **Zendesk** | `*.zendesk.com` | `Help Center Closed` / Zendesk branding on error | Yes — create matching subdomain | | **Unbounce** | `*.unbouncepages.com` | `The requested URL was not found` | Yes | | **Ghost** | `*.ghost.io` | `404 Not Found` Ghost error | Yes | | **Surge.sh** | `*.surge.sh` | `project not found` | Yes | | **Fly.io** | CNAME to `*.fly.dev` | Fly.io default 404 | Yes |
---
4. TAKEOVER PROCEDURE — COMMON PROVIDERS
4.1 AWS S3
1. Confirm: curl -s http://sub.target.com → "NoSuchBucket" 2. Extract bucket name from CNAME (e.g., sub.target.com.s3.amazonaws.com → bucket = "sub.target.com") 3. aws s3 mb s3://sub.target.com --region <region> 4. Upload index.html proving control 5. Enable static website hosting
4.2 GitHub Pages
1. Confirm: curl -s https://sub.target.com → "There isn't a GitHub Pages site here" 2. Create GitHub repo (any name) 3. Add CNAME file containing "sub.target.com" 4. Enable GitHub Pages in repo settings 5. Wait for DNS propagation (GitHub verifies CNAME match)
4.3 Heroku
1. Confirm: curl -s http://sub.target.com → "No such app" 2. heroku create <app-name-from-cname> 3. heroku domains:add sub.target.com 4. Deploy proof-of-concept page
---
5. NS TAKEOVER — HIGH SEVERITY
NS takeover is **far more dangerous** than CNAME takeover: you control **all DNS resolution** for the zone.
How It Happens
target.com NS → ns1.expireddomain.com
↓
attacker registers expireddomain.com
↓
attacker now controls ALL DNS for target.com
(A records, MX recorMaster Entry → Category Entries → Deep Topic Skills One master entry, six category entries, and 101 deep topic skills across 14 security domains.
Repo: yaklang/hack-skills
Other skills on hack-skills.
- /401-403-bypass-techniques
401/403 bypass playbook. Use when encountering access-denied responses on admin panels, API endpoints, or restricted paths. Covers path manipulation, HTTP method tampering, header injection, protocol downgrade, and automated bypass tools.
Open skill - /active-directory-acl-abuse
Active Directory ACL abuse playbook. Use when exploiting misconfigured AD permissions including GenericAll, WriteDACL, DCSync rights, shadow credentials, LAPS reading, GPO abuse, and BloodHound-guided attack paths.
Open skill - /active-directory-certificate-services
AD Certificate Services attack playbook. Use when targeting misconfigured AD CS for privilege escalation via ESC1-ESC13 template abuse, NTLM relay to enrollment, CA officer abuse, and certificate-based persistence.
Open skill - /active-directory-kerberos-attacks
Kerberos attack playbook for Active Directory. Use when targeting AD authentication via AS-REP roasting, Kerberoasting, golden/silver/diamond tickets, delegation abuse, or pass-the-ticket attacks.
Open skill - /ai-ml-security
AI/ML security playbook. Use when assessing model supply chain attacks (pickle RCE, poisoned weights), adversarial examples, model poisoning, model stealing, data privacy attacks (membership inference, model inversion), and autonomous agent security risks.
Open skill - /android-pentesting-tricks
Android pentesting playbook. Use when testing Android applications for SSL pinning bypass, exported component abuse, WebView vulnerabilities, intent redirection, root detection bypass, tapjacking, and backup extraction during authorized mobile security assessments.
Open skill

