Subdomain Enumeration: Finding Hidden Attack Surface
Master subdomain enumeration techniques using passive and active methods to discover hidden subdomains and expand attack surface mapping.
Attack Surface Discovery
Subdomain enumeration is a methodology for discovering hidden attack surfaces within a target's domain infrastructure. Organizations host different services on separate subdomains — development servers, staging environments, API endpoints, admin panels — many of which are less monitored and secured than the primary site. Identifying these subdomains maps the full extent of a target's online presence and reveals potential entry points overlooked by defenders.
Main domain: company.com (well-secured, behind WAF)
Hidden: dev-api.company.com (no WAF, default credentials)
Hidden: test.company.com (staging, outdated software)
Hidden: admin.company.com (internal panel, weak auth)
Prerequisites
Before studying subdomain enumeration, you should understand:
Passive Subdomain Enumeration
Certificate Transparency Logs
# Using crt.sh
curl -s "https://crt.sh/?q=%25.target.com&output=json" | jq -r '.[].name_value' | sort -u
# Using certspotter
curl -s "https://certspotter.com/api/v0/certs?domain=target.com" | jq -r '.[].dns_names[]' | sort -u
Search Engines
# Google dork
site:target.com -www -mail
DNS Datasets
# SecurityTrails
curl -s "https://api.securitytrails.com/v1/domain/target.com/subdomains" -H "APIKEY: YOUR_KEY" | jq -r '.subdomains[]' | awk '{print $0".target.com"}'
# AlienVault OTX
curl -s "https://otx.alienvault.com/api/v1/indicators/domain/target.com/passive_dns" | jq -r '.passive_dns[].hostname' | sort -u
Active Subdomain Enumeration
DNS Brute Forcing
# Using dnsrecon
dnsrecon -d target.com -D /usr/share/wordlists/dns/subdomains-top1million-20000.txt -t brt
# Using gobuster
gobuster dns -d target.com -w /usr/share/wordlists/dns/subdomains-top1million-110000.txt
# Using ffuf for virtual host discovery
ffuf -w subdomains.txt:HOST -u https://target.com -H "Host: HOST.target.com" -fc 400,403,404,301
# Using massdns (fastest)
massdns -r /usr/share/seclists/Discovery/DNS/resolvers.txt -t A -o S -w results.txt subdomains.txt
DNS Zone Transfer
for ns in $(dig target.com NS +short); do
echo "Trying $ns..."
dig @$ns target.com AXFR +short 2>/dev/null
done
Web Scraping
# Extract links from main site
curl -s https://target.com | grep -oP 'https?://[a-zA-Z0-9.-]*.target.com' | sort -u
# Check robots.txt and sitemap.xml
curl -s https://target.com/robots.txt
curl -s https://target.com/sitemap.xml | grep -oP 'https?://[^/]+'
Subdomain Takeover Detection
When a subdomain's DNS points to a third-party service that has been deprovisioned, anyone can claim it:
# Check for dangling CNAME records
dig subdomain.target.com CNAME +short
# Automated detection
subjack -w subdomains.txt -t 100 -timeout 30 -o results.txt
# Using Nuclei
nuclei -t nuclei-templates/subdomain-takeover/ -l subdomains.txt
Vulnerable Services
| CNAME Target | Service | Check |
|---|---|---|
| cloudfront.net | AWS CloudFront | NXDOMAIN |
| s3.amazonaws.com | AWS S3 | NoSuchBucket |
| github.io | GitHub Pages | 404 |
| herokuapp.com | Heroku | No such app |
| azurewebsites.net | Azure | 404 |
| firebaseio.com | Firebase | Not found |
Real-World Examples
Uber Subdomain Takeover (2016): A researcher found multiple Uber subdomains vulnerable to takeover through CloudFront, earning critical bounties.
Samsung (2020): Several Samsung subdomains were taken over by pointing CNAME records to unclaimed AWS S3 buckets.
Common Mistakes
Only using one source: Combining passive and active sources yields the best results.
Not checking for wildcard records: *.target.com causes false positives in brute forcing.
Ignoring subdomain takeovers: Dangling CNAME records are high-severity findings.
Best Practices
Related Tools
Related Articles
Summary
Subdomain enumeration combines passive sources (certificate logs, search engines, DNS datasets) with active techniques (brute forcing, zone transfers, web scraping). Discovering hidden subdomains reveals additional attack surface and potential takeover opportunities.
Knowledge Check
Frequently Asked Questions
Continue Learning
Attack Surface Mapping: Complete External Reconnaissance Guide
Learn to map external attack surfaces using OSINT tools. Master subdomain discovery, service enumeration, and asset inventory for penetration testing and bug bounty hunting.
OSINT · AdvancedOSINT for Bug Bounty Hunters: Reconnaissance Mastery Guide
Complete OSINT guide for bug bounty hunters. Master reconnaissance workflows, subdomain discovery, email enumeration, and attack surface mapping for successful bug bounty submissions.
OSINT · IntermediateAmass Guide: Open Source Attack Surface Mapping
Learn to use Amass for comprehensive attack surface mapping including DNS enumeration, subdomain discovery, integration with APIs, and visualizations.
OSINT · IntermediateEmail Enumeration Techniques: Corporate Email Discovery for OSINT
Master email enumeration techniques using theHarvester, search engines, and certificate transparency logs. Learn corporate email pattern discovery, employee identification, and attack surface mapping.
Related Security Tools
Amass
OWASP Amass is the industry-standard in-depth network mapping and attack surface discovery tool. It uses active and passive techniques, scraping 20+ public data feeds, DNS enumeration, and certificate transparency logs to discover subdomains, IP addresses, and ASN data — making it essential for penetration testing, bug bounty hunting, and enterprise security assessments.
Information GatheringSubfinder
Learn how to use Subfinder in this beginner tutorial, from installing ProjectDiscovery's passive subdomain tool to running and reading your first authorised scan. Add API keys for wider coverage, save clean results, and chain Subfinder into httpx to validate live web hosts before further testing.
Web ApplicationGobuster
Learn how to use Gobuster, the fast Go-based directory and subdomain brute-forcer, with install steps, your first dir scan, wordlist picks, and result filtering — a beginner tutorial for Kali Linux.
Information GatheringtheHarvester
Learn how to use theHarvester in Kali Linux: gather emails, subdomains, employee names, open ports, and banners from public sources with a step-by-step first scan, API keys, and worked examples for authorized OSINT recon.