Subdomain Enumeration
Bug Bounty Β· Stage 2 β Recon Β· Level: L1 β L4 Β· Reading time: ~12 min
Subdomains are where forgotten, less-tested applications live. The goal is to build a complete, resolved, probed list of hosts β then pick the interesting ones.
Passive sources ββ
Cert transparencyβΌβββΊ merge & de-dupe βββΊ resolve (DNS) βββΊ probe (HTTP) βββΊ ports βββΊ screenshots
Brute force ββββββ€ β
Permutations βββββ remove wildcards
1. Passive Enumerationβ
Passive sources collect subdomains without touching the target: search engines, certificate logs, DNS datasets and threat-intelligence APIs.
subfinder -d example.com -all -silent -o subfinder.txt
assetfinder --subs-only example.com > assetfinder.txt
amass enum -passive -d example.com -o amass.txt
Certificate transparency directly:
curl -s "https://crt.sh/?q=%25.example.com&output=json" \
| jq -r '.[].name_value' | sed 's/\*\.//g' | sort -u > crtsh.txt
Add API keys for subfinder's sources (its provider config file). Many sources are free but need a key β with keys configured, passive results often grow dramatically.
Merge everything:
cat subfinder.txt assetfinder.txt amass.txt crtsh.txt | sort -u > passive.txt
2. Active Brute Forceβ
Passive sources miss hosts that never appeared publicly. Brute forcing tries likely names against the target's DNS:
puredns bruteforce best-dns-wordlist.txt example.com -r resolvers.txt -w brute.txt
| Tip | Why |
|---|---|
| Use good wordlists (Assetnote, SecLists DNS lists) | Quality matters more than size |
| Use fresh, validated resolvers | Bad resolvers produce false positives |
Brute force deeper levels too (*.dev.example.com) | Interesting hosts often sit two levels down |
3. Permutationsβ
Generate variations of known names: api β api-dev, api2, dev-api, api-stagingβ¦
cat passive.txt brute.txt | sort -u | alterx -silent | dnsx -silent > permutations.txt
Build target-specific wordlists from what you've already found: environment words (dev, stg, uat), regions (eu, us-east), product names, and team names pulled from JavaScript and documentation. Custom permutations often find hosts no public dataset contains.
4. Resolve and Handle Wildcardsβ
Combine and resolve everything, keeping only hosts with real DNS answers:
cat passive.txt brute.txt permutations.txt | sort -u > all-subs.txt
dnsx -l all-subs.txt -silent -a -resp -o resolved.txt
Wildcard DNS (*.example.com resolving to one IP) makes every random name look valid. puredns filters wildcards automatically; otherwise, test a random string like nonexistent-8f3a1c.example.com β if it resolves, treat that IP's results with suspicion.
5. Probe for Live Web Servicesβ
dnsx -l all-subs.txt -silent | httpx -silent -sc -title -td -ip -cname -o live.txt
The flags show status code, page title, detected technologies, IP and CNAME β enough to triage hundreds of hosts quickly. Look for:
- unusual titles (
Jenkins,Grafana,Swagger UI,Index of /,Kibana), 401/403hosts (protected = something worth protecting),- default pages and error pages,
- CNAMEs to third-party services (takeover candidates β see the infrastructure Hunt Cards).
6. Port Scanningβ
Web apps don't only live on 80 and 443:
naabu -list resolved-hosts.txt -top-ports 1000 -silent -o ports.txt
httpx -l ports.txt -silent -sc -title -o live-ports.txt
Common interesting ports: 8080, 8443, 8000, 8888, 3000, 5000, 9000, 9200 (Elasticsearch), 5601 (Kibana), 6443 (Kubernetes API), 2375 (Docker API).
Some programs restrict or prohibit port scanning, or ask for low rates. Check the rules, and use conservative rates (-rate) on production infrastructure.
7. Screenshotsβ
Visually reviewing hundreds of hosts is faster than reading titles:
gowitness scan file -f live-urls.txt
Scroll through the gallery looking for login portals, admin panels, error pages and anything unusual.
The Whole Pipelineβ
- Beginner version
- Fuller version
#!/usr/bin/env bash
d=$1
subfinder -d "$d" -all -silent | sort -u > subs.txt
httpx -l subs.txt -silent -sc -title -td -o live.txt
echo "[+] $(wc -l < subs.txt) subdomains, $(wc -l < live.txt) live"
#!/usr/bin/env bash
set -euo pipefail
d=$1; mkdir -p "recon/$d" && cd "recon/$d"
subfinder -d "$d" -all -silent > p1.txt
assetfinder --subs-only "$d" > p2.txt
curl -s "https://crt.sh/?q=%25.$d&output=json" | jq -r '.[].name_value' \
| sed 's/\*\.//g' > p3.txt
cat p*.txt | sort -u > passive.txt
puredns bruteforce ~/wordlists/dns.txt "$d" -r ~/resolvers.txt -w brute.txt -q
cat passive.txt brute.txt | sort -u | alterx -silent > perms-raw.txt
puredns resolve perms-raw.txt -r ~/resolvers.txt -w perms.txt -q
cat passive.txt brute.txt perms.txt | sort -u > all.txt
grep -vFf ../../scope/out-of-scope.txt all.txt > in-scope.txt || true
httpx -l in-scope.txt -silent -sc -title -td -ip -cname -o live.txt
echo "[+] $(wc -l < in-scope.txt) in-scope subdomains, $(wc -l < live.txt) live web services"
Key Takeawaysβ
- Combine passive sources, certificate logs, brute force and permutations.
- Resolve with good resolvers, filter wildcards, then probe for live web services.
- Check non-standard ports and take screenshots to triage quickly.
- Always filter results against out-of-scope lists before testing.