Enumerate DNS servers to discover subdomains, perform zone transfers, and identify misconfigurations. DNS reconnaissance is critical for mapping an organization’s external and internal infrastructure before deeper attacks.
Quick Reference
# Zone transfer attempt dig axfr domain.com @10.10.10.10
# Step 6: Attempt zone transfer on discovered subdomains dig axfr subdomain.domain.com @10.10.10.10
Notes
DNS Zone Transfer Vulnerability:
A DNS zone transfer (AXFR) allows a secondary DNS server to copy the entire zone file from the primary server. If misconfigured to allow transfers from any IP (allow-transfer { any; };), attackers can dump the entire DNS namespace, revealing:
All subdomains
Internal hostnames
IP addresses
Network structure
Critical DNS Misconfigurations:
Option
Description
Risk
allow-query
Defines who can send requests
If set to any, anyone can query
allow-recursion
Defines who can send recursive requests
Enables DNS amplification attacks
allow-transfer
Defines who can perform zone transfers
Exposes entire DNS namespace
zone-statistics
Collects statistical data
Information disclosure
DNS Record Types:
A: IPv4 address
AAAA: IPv6 address
CNAME: Canonical name (alias)
MX: Mail exchange server
NS: Name server
PTR: Pointer (reverse DNS)
SOA: Start of authority
TXT: Text records (often contain SPF, DKIM, verification tokens)
SOA Record Components:
Primary nameserver: Authoritative nameserver for the zone
Responsible person: Email address of domain administrator (@ replaced by .)
Serial number: Version number of zone file
Refresh: How often secondary servers check for updates
Retry: How long to wait before retrying failed refresh
Expire: When secondary servers stop answering queries
Minimum TTL: Default TTL for records
Subdomain Takeover:
Occurs when a subdomain CNAME points to an external service that no longer exists:
sub.target.com. 60 IN CNAME anotherdomain.com
If anotherdomain.com expires and someone else registers it, they control sub.target.com. Common vulnerable services:
AWS S3 buckets
GitHub Pages
Heroku apps
Azure websites
Shopify stores
DNS Spoofing Attack Flow:
Attacker performs ARP poisoning to become MITM
Victim sends DNS query
Attacker responds faster than legitimate DNS server
Victim receives fake DNS response pointing to attacker’s IP
Victim connects to attacker-controlled server
Best Practices for Testing:
Always test zone transfers first (quick and high-value)
Use multiple subdomain wordlists (small, medium, large)
Combine active and passive enumeration
Check for wildcard DNS records
Test for DNS cache poisoning vulnerabilities
Verify discovered subdomains are actually reachable