DNS (Domain Name System) is the phonebook of the internet. When you type "google.com", DNS translates it to an IP address your computer can use. But DNS is also incredibly chatty - it stores all sorts of useful information that attackers love to harvest.
DNS runs on port 53, using both UDP (queries) and TCP (zone transfers, large responses). Every organization with a web presence has DNS records, and misconfigured DNS can expose the entire internal network structure.
DNS is Hierarchical
DNS Record Types
| Record | Purpose | Value for Pentest |
|---|---|---|
| A | IPv4 address | Target IP addresses |
| AAAA | IPv6 address | Often overlooked IPv6 |
| MX | Mail servers | Email infrastructure |
| NS | Name servers | DNS infrastructure |
| TXT | Text data | SPF, DKIM, verification tokens |
| CNAME | Alias | Subdomains, CDN info |
| SOA | Zone authority | Admin email, serial numbers |
| PTR | Reverse lookup | IP to hostname mapping |
| SRV | Service location | AD, LDAP, Kerberos servers |
Basic DNS Queries
Use Multiple DNS Servers
Zone Transfers (AXFR)
Zone transfers are designed to replicate DNS data between servers. If misconfigured, anyone can request a copy of the entire zone - revealing every subdomain, IP, and record.
Zone Transfers Are Rare Now
Subdomain Enumeration
DNS Brute Forcing
Good Wordlists
- SecLists/Discovery/DNS/subdomains-top1million-*.txt
- SecLists/Discovery/DNS/dns-Jhaddix.txt
- SecLists/Discovery/DNS/namelist.txt
- Custom wordlists based on target (company name, products)
Build Custom Wordlists
Reverse DNS Lookups
PTR records map IP addresses back to hostnames. Sweeping IP ranges can reveal internal naming conventions and hidden subdomains.
DNS Cache Snooping
Query a DNS server's cache to see what domains have been recently resolved - reveals what sites users are visiting.
DNS Vulnerabilities
DNS Hijacking
If you can modify DNS responses, you control where users go.
Subdomain Takeover
When CNAME records point to decommissioned services (GitHub Pages, Heroku, S3), attackers can claim those services.
DNSSEC Issues
Tool Summary
DNS Enumeration Methodology
DNS Enumeration Process
Knowledge Check
Challenges
Key Takeaways
- DNS runs on port 53 (UDP for queries, TCP for zone transfers)
- Zone transfers (AXFR) can expose entire DNS zones if misconfigured
- TXT records often contain SPF, DKIM, and service verification tokens
- Subdomain brute forcing reveals hidden infrastructure
- Reverse DNS sweeps expose internal naming conventions
- Dangling CNAMEs enable subdomain takeover attacks
- Use multiple tools - each finds different results