DNS Enumeration: Uncovering Domain Infrastructure
Learn DNS enumeration techniques to discover domain infrastructure including record types, zone transfers, brute forcing, and DNS security extensions.
DNS as an Intelligence Goldmine
DNS enumeration is a methodology for extracting intelligence from the Domain Name System. Every domain publishes a wealth of data through its DNS records — IP addresses, mail servers, name servers, subdomains, and service configurations — that collectively map an organization's entire online infrastructure. Systematically querying these records reveals the hidden architecture behind any domain.
Prerequisites
Before studying DNS enumeration, you should understand:
DNS Record Types
| Record | Purpose | Example |
|--------|---------|---------|
| A | IPv4 address | domain.com -> 192.0.2.1 |
| AAAA | IPv6 address | domain.com -> 2001:db8::1 |
| CNAME | Canonical name (alias) | www -> domain.com |
| MX | Mail exchange | domain.com -> mail.domain.com |
| NS | Name server | domain.com -> ns1.domain.com |
| TXT | Text records (SPF, DKIM) | v=spf1 include:_spf.google.com |
| SOA | Start of Authority | Zone metadata |
| SRV | Service location | _sip._tcp.domain.com |
Basic DNS Queries
Using dig
# Basic A record lookup
dig google.com
# Short answer only
dig google.com +short
# Query specific record type
dig google.com MX +short
dig google.com NS +short
dig google.com TXT +short
dig google.com SOA
# Query specific DNS server
dig @8.8.8.8 google.com
# Trace DNS resolution path
dig google.com +trace
# Reverse DNS lookup
dig -x 8.8.8.8
Using nslookup
# Basic lookup
nslookup google.com
# Query specific record type
nslookup -type=MX google.com
nslookup -type=NS google.com
Advanced DNS Enumeration
Zone Transfer Attempt
Misconfigured servers allow anyone to request a copy of the DNS zone:
# Find name servers
dig target.com NS +short
# Attempt zone transfer from each NS
dig @ns1.target.com target.com AXFR
# Using dnsrecon
dnsrecon -d target.com -t axfr
Subdomain 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-5000.txt
# Using ffuf
ffuf -w /usr/share/wordlists/dns/subdomains.txt:HOST -u http://FUZZ.target.com -fc 400,404,403
Certificate Transparency Logs
# Using crt.sh to find subdomains
curl -s "https://crt.sh/?q=%25.target.com&output=json" | jq -r '.[].name_value' | sort -u
Automated DNS Enumeration Tools
dnsrecon
# Comprehensive DNS reconnaissance
dnsrecon -d target.com
# Zone transfer test
dnsrecon -d target.com -t axfr
# Subdomain brute force
dnsrecon -d target.com -D subdomains.txt -t brt
# SRV record enumeration
dnsrecon -d target.com -t srv
# DNSSEC zone walking
dnsrecon -d target.com -t zonewalk
dnsenum
# Full DNS enumeration
dnsenum target.com
# With custom wordlist
dnsenum -f /usr/share/wordlists/dns/subdomains.txt target.com
Security Assessment via DNS
Email Security Checks
# Check for DMARC policy
dig _dmarc.target.com TXT +short
# Check SPF record
dig target.com TXT +short | grep "v=spf1"
# Check for DKIM
dig google._domainkey.target.com TXT +short
Real-World Applications
Attack Surface Mapping
# Discover cloud-hosted services
dig target.com CNAME +short | grep -E "cloudfront|aws|azure|google|cloudflare"
# Identify third-party services via MX records
dig target.com MX +short | awk '{print $NF}' | sort -u
Common Mistakes
Not checking all record types: MX, TXT, and SRV records reveal infrastructure not visible in A records.
Assuming zone transfers are always blocked: Some servers still allow AXFR.
Ignoring wildcard records: *.target.com can make brute forcing find false positives.
Forgetting IPv6: AAAA records may expose additional attack surface.
Best Practices
Related Tools
Related Articles
Summary
DNS enumeration reveals an organization's online infrastructure. Key techniques include querying all record types, attempting zone transfers, brute forcing subdomains, and leveraging certificate transparency logs. Automated tools like dnsrecon streamline the process.