Subdomain Enumeration
Table of Contents
Subdomain Enumeration
Subdomain enumeration is the process of discovering subdomains associated with a target domain.
It's a crucial reconnaissance phase in web hacking, as overlooked or forgotten subdomains can often expose additional attack surfaces, reveal development environments, or provide access to applications that are less secure than the main domain.
Tools and Techniques
Search Engine orking
Leveraging powerful search engines like Google, Bing, or even specialized ones like Shodan and Censys, with specific queries (dorks) to find publicly indexed subdomains.
- Example:
site:example.com -wwwon Google to find subdomains other than the mainwww.
NS Record Queries
Directly querying Domain Name System servers for various record types (A, AAAA, CNAME, NS, MX, PTR, TXT) can reveal subdomains. Zone transfers (AXFR) can be particularly revealing if misconfigured.
- Tools:
dig,nslookup,host. - Example:
dig example.com ANYordig AXFR @ns1.example.com example.com.
Brute-Forcing with Wordlists
Attempting a large list of common subdomain names (e.g., dev, test, admin, api) against the target domain to see which ones resolve. This is often combined with recursive brute-forcing for deeper enumeration.
- Tools:
ffuf,gobuster,dnsenum,sublist3r,amass,subfinder. - Example:
subfinder -d example.comorffuf -w /path/to/wordlist.txt -u http://FUZZ.example.com.
SSL Certificate Analysis
Publicly available SSL/TLS certificates often list multiple subdomains in their Subject Alternative Names (SANs) field.
- Tools:
crt.sh(a public certificate transparency log),Sublist3r(often integrates this). - Example: Visiting
crt.shand searching forexample.comto view associated certificates and subdomains.
OSINT (Open Source Intelligence)
Gathering information from various public sources, including historical DNS records (Wayback Machine), VirusTotal, GitHub repositories, and other archived data.
- Tools:
theHarvester,recon-ng,Maltego. - Example: Searching
example.comon VirusTotal to see known subdomains and related infrastructure.
Virtual Host Enumeration
When multiple subdomains share the same IP address but are differentiated by the Host header, this technique attempts to discover them by cycling through a wordlist of potential subdomain names in the Host header.
- Tools:
gobuster vhost. - Example:
gobuster vhost -w /path/to/vhost_wordlist.txt -u http://target-ip-address.