DNS and Subdomains
Executive Summary
DNS and subdomain enumeration help identify hosts, services, environments, and infrastructure connected to a target domain.
Use this cheatsheet for quick DNS lookups, zone transfer testing, subdomain discovery, and virtual host fuzzing.
Common DNS Record Types
| Record | Purpose |
|---|---|
A |
Maps hostname to IPv4 address |
AAAA |
Maps hostname to IPv6 address |
CNAME |
Alias to another hostname |
MX |
Mail server |
NS |
Authoritative name server |
TXT |
Text records, SPF, DKIM, verification values |
SOA |
Start of authority record |
PTR |
Reverse DNS lookup |
SRV |
Service location record |
Basic DNS Lookups
Query A record:
Query all common records:
Query name servers:
Query mail servers:
Query TXT records:
Reverse lookup:
Use a specific DNS server:
Nslookup
Basic lookup:
Query record type:
Use specific DNS server:
Interactive mode:
Zone Transfer Testing
Attempt zone transfer:
Example:
Nslookup zone transfer:
A successful zone transfer may expose:
- Subdomains
- Internal naming patterns
- Mail servers
- Name servers
- Infrastructure IP addresses
- Forgotten hosts
Subdomain Discovery
Common tools:
| Tool | Use |
|---|---|
amass |
Passive and active subdomain enumeration |
subfinder |
Fast passive subdomain discovery |
assetfinder |
Lightweight passive discovery |
dnsenum |
DNS enumeration and brute forcing |
dnsrecon |
DNS enumeration and zone transfer checks |
ffuf |
Subdomain and VHost fuzzing |
gobuster |
DNS and VHost brute forcing |
Dnsenum
Basic enumeration:
Use wordlist:
Recursive brute forcing:
Dnsrecon
Standard enumeration:
Zone transfer test:
Brute force subdomains:
dnsrecon -d example.com -D /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt -t brt
Amass
Passive enumeration:
Active enumeration:
Save output:
Subfinder
Run subfinder:
Save output:
Certificate Transparency
Search certificate logs:
Filter for specific keyword:
Certificate logs may reveal:
- Old hosts
- Staging systems
- Development environments
- Wildcard certificates
- Forgotten subdomains
Gobuster DNS
DNS brute force:
Show IP addresses:
gobuster dns -d example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt -i
Virtual Host Discovery
VHost fuzzing checks hidden sites hosted on the same IP or web server.
Gobuster VHost:
gobuster vhost -u http://example.com -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt --append-domain
FFUF VHost:
ffuf -u http://TARGET_IP/ -H "Host: FUZZ.example.com" -w /usr/share/seclists/Discovery/DNS/subdomains-top1million-20000.txt
Filter by response size:
Resolving Subdomains
Resolve a list:
Extract IPs:
Practical Workflow
| Step | Command |
|---|---|
| Get NS records | dig example.com NS |
| Test zone transfer | dig axfr @NAMESERVER example.com |
| Passive subdomains | subfinder -d example.com |
| CT logs | crt.sh query |
| Brute force DNS | gobuster dns -d example.com -w WORDLIST |
| Resolve results | dig +short sub.example.com |
| VHost fuzzing | ffuf -H "Host: FUZZ.example.com" |
Notes
- DNS subdomains and VHosts are related but not the same.
- A VHost may exist without a public DNS record.
- Zone transfers are rare but high-value.
- Certificate logs are passive and often reveal forgotten hosts.
- Always validate discovered subdomains before prioritizing them.