Subdomain enumeration expands your attack surface. Dev servers, staging environments, forgotten admin panels, and legacy applications all live on subdomains.
Passive Enumeration subfinder go install -v github.com/projectdiscovery/subfinder/v2/cmd/subfinder@latest subfinder -d target.com subfinder -d target.com -all subfinder -dL domains.txt subfinder -d target.com -o subdomains.txt -oJ subfinder -d target.com -v
amass go install -v github.com/owasp-amass/amass/v4/...@master amass enum -passive -d target.com amass enum -active -d target.com -brute amass enum -d target.com -brute -w /usr/share/wordlists/dnsmap.txt amass enum -passive -df domains.txt amass db -list amass db -show -d target.com amass viz -d3 -d target.com -o viz.html
Certificate Transparency curl -s "https://crt.sh/?q=%.target.com&output=json" | \ jq -r '.[].name_value' | \ sed 's/\*\.//g' | \ sort -u chaos -d target.com -o chaos.txt curl -H "APIKEY: YOUR_KEY" \ "https://api.securitytrails.com/v1/domain/target.com/subdomains" | \ jq '.subdomains[]' | sed 's/"//g' | sed 's/$/.target.com/' curl "https://www.virustotal.com/vtapi/v2/domain/report?apikey=KEY&domain=target.com" | \ jq '.subdomains[]' curl "https://otx.alienvault.com/api/v1/indicators/domain/target.com/passive_dns" | \ jq '.passive_dns[].hostname'
Active Enumeration (DNS Brute Force) puredns go install github.com/d3mondev/puredns/v2@latest puredns bruteforce wordlist.txt target.com puredns bruteforce wordlist.txt target.com -r resolvers.txt puredns resolve subdomains.txt -r resolvers.txt curl -s https://raw.githubusercontent.com/trickest/resolvers/main/resolvers.txt -o resolvers.txt
massdns + shuffledns go install -v github.com/projectdiscovery/shuffledns/cmd/shuffledns@latest shuffledns -d target.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt \ -r resolvers.txt shuffledns -d target.com -list subdomains.txt -r resolvers.txt massdns -r resolvers.txt -t A -o S subdomains_with_domain.txt
dnsx go install -v github.com/projectdiscovery/dnsx/cmd/dnsx@latestcat subdomains.txt | dnsx -respcat subdomains.txt | dnsx -a -respcat subdomains.txt | dnsx -cname -respcat subdomains.txt | dnsx -a -aaaa -cname -ns -txt -mx -resp dnsx -d target.com -w wordlist.txt -resp
Virtual Host Discovery When multiple sites share one IP, vhosts reveal hidden apps:
ffuf -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt \ -u https://TARGET_IP/ \ -H "Host: FUZZ.target.com" \ -mc 200,301,302,403 \ -fs FILTER_SIZE gobuster vhost -u http://TARGET_IP -w wordlist.txt --append-domain gobuster vhost -u https://TARGET_IP -w wordlist.txt --append-domain -k wfuzz -c -w wordlist.txt -u https://TARGET_IP/ -H "Host: FUZZ.target.com" \ --hc 404 --hw WORDS
Filtering Live Hosts go install -v github.com/projectdiscovery/httpx/cmd/httpx@latestcat subdomains.txt | httpx -silentcat subdomains.txt | httpx -status-code -title -tech-detectcat subdomains.txt | httpx -status-code -content-length -silentcat subdomains.txt | httpx -o live.txtcat subdomains.txt | aquatone -out screenshots/cat subdomains.txt | httpx -silent | gowitness file --file - gowitness file -f live.txt --screenshot-path ./screenshots
Wordlists /usr/share/seclists/Discovery/DNS/subdomains-top1million-110000.txt /usr/share/seclists/Discovery/DNS/subdomains-top1million-5000.txt /usr/share/seclists/Discovery/DNS/dns-Jhaddix.txt wget https://wordlists-cdn.assetnote.io/data/manual/best-dns-wordlist.txt wget https://wordlists-cdn.assetnote.io/data/automated/httparchive_subdomains_2024_11_01.txt sudo apt install seclists git clone https://github.com/danielmiessler/SecLists.git /usr/share/seclists/
Full Recon Pipeline #!/bin/bash DOMAIN=$1 OUTPUT="recon_$DOMAIN " mkdir -p $OUTPUT echo "[*] Passive recon..." subfinder -d $DOMAIN -all -o $OUTPUT /subfinder.txt amass enum -passive -d $DOMAIN -o $OUTPUT /amass.txt curl -s "https://crt.sh/?q=%.${DOMAIN} &output=json" | jq -r '.[].name_value' | \ sort -u > $OUTPUT /crtsh.txtecho "[*] Merging..." cat $OUTPUT /subfinder.txt $OUTPUT /amass.txt $OUTPUT /crtsh.txt | \ sed 's/\*\.//g' | sort -u > $OUTPUT /all_subs.txtecho "[+] Total: $(wc -l < $OUTPUT/all_subs.txt) subdomains" echo "[*] DNS resolution..." puredns resolve $OUTPUT /all_subs.txt -r resolvers.txt -w $OUTPUT /resolved.txtecho "[*] HTTP probing..." cat $OUTPUT /resolved.txt | httpx -silent -status-code -title -o $OUTPUT /live.txtecho "[*] Screenshots..." gowitness file -f $OUTPUT /live.txt --screenshot-path $OUTPUT /screenshots/echo "[+] Done! Results in $OUTPUT /"
Wildcard Detection Some domains return results for any subdomain (wildcard DNS):
dig randomstring12345.target.comcat subdomains.txt | dnsx -resp -wc -wd target.com
Subdomain Takeover Scanning nuclei -l subdomains.txt -t takeovers/ subjack -w subdomains.txt -t 100 -timeout 30 -o takeovers.txt -ssl subzy run --targets subdomains.txtcat subdomains.txt | dnsx -cname -resp | grep CNAME
No comments yet. Be the first.