subdomain-takeover
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
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.
6 other projects use a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- mahumadad/quarrytheir own version, first seen Nov 8, 2026
- SubhiSec/claude-ai-cyber-security-skillstheir own version, first seen Oct 25, 2026
- conjure-3301/skillstheir own version, first seen Aug 17, 2026
- Kur1sulab/blackboxedited, first seen Aug 12, 2026
- 0xGhostCAT/claude-ai-cyber-security-skillstheir own version, first seen Jun 2, 2026
- yaklang/hack-skillsword for word, first seen Apr 29, 2026
Other versions6 projects use a version of this.
Word for word · 1
- yaklang/hack-skills★ 2.4k100% same
Edited · 1
- Kur1sulab/blackbox★ 398% same
Wrote their own version · 4
- SubhiSec/claude-ai-cyber-security-skills★ 45same name
- 0xGhostCAT/claude-ai-cyber-security-skills★ 41same name
- mahumadad/quarry★ 1same name
- conjure-3301/skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository168 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/CO-STAR-UI-CREATOR/AGENT.mdcCursor rule
- .cursor/rules/CO-STAR-UI-CREATOR/CO-STAR-CREATOR.mdCursor rule
- .cursor/rules/CO-STAR-UI-CREATOR/CO-STAR-PROMPT.mdCursor rule
- .cursor/rules/CO-STAR-UI-CREATOR/README.mdCursor rule
- .cursor/rules/CO-STAR-UI-CREATOR/ui.mdCursor rule
- 401-403-bypass-techniquesSkill
- active-directory-acl-abuseSkill
- active-directory-certificate-servicesSkill
- active-directory-kerberos-attacksSkill
- agent-browserSkill
- ai-ml-securitySkill
- ai-seoSkill
- android-pentesting-tricksSkill
- anti-debugging-techniquesSkill
- api-auth-and-jwt-abuseSkill
- api-authorization-and-bolaSkill
- api-recon-and-docsSkill
- api-secSkill
- arbitrary-write-to-rceSkill
- arize-adminSkill
- arize-ai-provider-integrationSkill
- arize-annotationSkill
- arize-compliance-auditSkill
- arize-datasetSkill
- arize-evaluatorSkill
- arize-experimentSkill
- arize-instrumentationSkill
- arize-linkSkill
- arize-prompt-optimizationSkill
- arize-promptsSkill
- arize-traceSkill
- authbypass-authentication-flawsSkill
- auth-secSkill
- binary-protection-bypassSkill
- browser-exploitation-v8Skill
- building-nango-functions-locallySkill
- building-nango-functions-remotelySkill
- building-nango-functionsSkill
- business-logic-vulnerabilitiesSkill
- business-logic-vulnSkill
- classical-cipher-analysisSkill
- clickjackingSkill
- cmdi-command-injectionSkill
- code-obfuscation-deobfuscationSkill
- compliance-checkSkill
- compliance-trackingSkill
- container-escape-techniquesSkill
- core-engineeringSkill
- cors-cross-origin-misconfigurationSkill
- crlf-injectionSkill
- csp-bypass-advancedSkill
- csrf-cross-site-request-forgerySkill
- csv-formula-injectionSkill
- d3-visualizationSkill
- dangling-markup-injectionSkill
- defi-attack-patternsSkill
- dependency-confusionSkill
- deserialization-insecureSkill
- dns-rebinding-attacksSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
4 rules. 0 are common, 1 is distinctive, and 3 are very specific to this project.
0
Common
Most of the 5 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 159
When MX records point to deprovisioned mail services:
- Very specific: line 165
If attacker can claim mail.deadservice.com or the mail tenant:
- Very specific: line 178
If *.target.com has a wildcard CNAME to a claimable service:
- Very specific: line 247
SPF subdomain takeover: If SPF includes include:sub.target.com and you take over sub.target.com, you can modify its SPF TXT record to …
“Common” is measured: kept by at least 6 in 10 of the 5 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
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 when a subdomain takeover is used to bypass SSRF allowlists trusting
*.target.com - cors-cross-origin-misconfiguration when CORS trusts
*.target.com— takeover → full cross-origin read - xss-cross-site-scripting takeover gives you script execution under target origin (cookie theft, OAuth redirect abuse)
- http-host-header-attacks when Host routing leads to subdomain-scoped cache or auth issues
- web-cache-deception when a taken-over subdomain shares cache with the main domain
1. CORE CONCEPT
Subdomain takeover occurs when:
sub.target.comhas a DNS record (CNAME, NS, A) pointing to an external service- The external resource is no longer provisioned (deleted S3 bucket, removed Heroku app, etc.)
- The attacker can register/claim that exact resource name on the provider
- 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 hosting4.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 page5. 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 records, TXT records — everything)Detection
1. Enumerate NS records: dig NS target.com +short
2. Check each NS domain: whois ns1.example.com → is the domain expired or available?
3. Also check: dig A ns1.example.com → NXDOMAIN/SERVFAIL?
4. Subdelegated zones: check NS for sub.target.com specificallyImpact
- Full domain takeover (serve any content, intercept email, issue TLS certs via DNS-01)
- Issue DV certificates from any CA using DNS challenge
- Modify SPF/DKIM/DMARC → send authenticated email as target
6. MX TAKEOVER — EMAIL INTERCEPTION
When MX records point to deprovisioned mail services:
target.com MX → mail.deadservice.com (service discontinued)If attacker can claim mail.deadservice.com or the mail tenant:
- Receive password reset emails
- Intercept sensitive communications
- Potentially reset accounts that use email-based auth
Common Scenario
Expired Google Workspace / Microsoft 365 tenant → MX still points to Google/Microsoft → attacker creates new tenant and claims the domain.
7. WILDCARD DNS RISKS
If *.target.com has a wildcard CNAME to a claimable service:
- Every undefined subdomain is vulnerable
anything.target.comcan be taken over- Massively increases attack surface
Detection: dig A random1234567.target.com — if it resolves, wildcard exists.
8. DETECTION & EXPLOITATION DECISION TREE
Subdomain discovered (sub.target.com)?
├── Resolve DNS records
│ ├── Has CNAME → external service?
│ │ ├── HTTP response matches known fingerprint? (Section 3)
│ │ │ ├── YES → Attempt claim on provider (Section 4)
│ │ │ │ ├── Claim successful → TAKEOVER CONFIRMED
│ │ │ │ └── Claim blocked (name reserved, region locked) → document, try variations
│ │ │ └── NO → Service active, no takeover
│ │ └── CNAME target NXDOMAIN?
│ │ ├── Target is a registrable domain? → Register it → full control
│ │ └── Target is a subdomain of active provider → check provider claim process
│ │
│ ├── Has NS records → external nameserver?
│ │ ├── NS domain expired/available? → Register → FULL ZONE TAKEOVER
│ │ └── NS domain active → no takeover
│ │
│ ├── Has MX → external mail service?
│ │ ├── Mail service deprovisioned/claimable? → Claim tenant → EMAIL INTERCEPTION
│ │ └── Active mail service → no takeover
│ │
│ └── Has A record → IP address?
│ ├── IP belongs to elastic cloud (AWS EIP, Azure, GCP)?
│ │ ├── IP unassigned? → Claim IP → serve content
│ │ └── IP assigned to another customer → no takeover
│ └── IP belongs to dedicated server → no takeover
│
└── Post-takeover impact assessment
├── Shared cookies with parent domain? → Session hijacking
├── CORS trusts *.target.com? → Cross-origin data theft
├── CSP whitelists *.target.com? → XSS via taken-over subdomain
├── OAuth redirect_uri allows sub.target.com? → Token theft
└── Can issue TLS cert for sub.target.com? → Full MITM9. DEFENSE & REMEDIATION
| Action | Priority |
| Remove DNS records when deprovisioning cloud resources | Critical |
| Monitor CNAME targets for NXDOMAIN responses | High |
| Use DNS monitoring tools (SecurityTrails, DNSHistory) | High |
| Claim/reserve resource names before deleting DNS records | High |
| Audit NS delegations — ensure NS domains are owned and renewed | Critical |
| Avoid wildcard CNAMEs to third-party services | Medium |
| Implement Certificate Transparency monitoring | Medium |
10. TRICK NOTES — WHAT AI MODELS MISS
- CNAME ≠ takeover: A CNAME to S3 that returns 403 (bucket exists, private) is NOT vulnerable. Only
NoSuchBucket(404) is. - Region matters for S3: Bucket names are global, but website endpoints are regional. Try matching the region from the CNAME.
- GitHub Pages verification: GitHub added domain verification — org-verified domains cannot be claimed by others. Check if target uses this.
- Edge cases: Some providers (e.g., Cloudfront) require specific distribution configuration, not just domain claiming.
- Second-order takeover:
sub.target.com CNAME → other.target.com CNAME → dead-service.com— the chain must be followed fully. - SPF subdomain takeover: If SPF includes
include:sub.target.comand you take oversub.target.com, you can modify its SPF TXT record to authorize your mail server → send spoofed email astarget.com.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

