DNS Pentesting Notes
Protocol Overview
Basic Information
Port: UDP/TCP 53
Protocol Type: Application layer
Purpose: Domain name resolution to IP addresses
Security: Minimal built-in security, often unencrypted
DNS Server Types
Root Servers
Manages TLDs
13 servers worldwide
Governed by ICANN
Authoritative Servers
Hold authority over specific zones
Provide definitive answers
Non-authoritative/Caching Servers
Store temporary DNS information
Forward queries to other servers
Initial Enumeration
Basic DNS Queries
Banner Grabbing
Record Types and Queries
Common Record Types
A
IPv4 address mapping
AAAA
IPv6 address mapping
MX
Mail server records
NS
Nameserver records
TXT
Miscellaneous information
CNAME
Domain aliases
PTR
Reverse DNS lookups
SOA
Zone authority info
Querying Records
Zone Transfers
Testing Zone Transfers
Automated Zone Transfer Tools
Subdomain Enumeration
Using DNS Tools
Bash One-liners
Common NSE Scripts
Configuration Files
BIND Configuration
Main config:
/etc/bind/named.conf
Local zones:
/etc/bind/named.conf.local
Options:
/etc/bind/named.conf.options
Zone files:
/var/cache/bind/
Logs:
/var/log/named/
Common Misconfigurations
Zone Transfers:
Unrestricted transfers
Missing allow-transfer directive
Recursion:
Open recursion
Missing allow-recursion directive
Version Info:
Version disclosure
Unnecessary information leakage
Advanced Techniques
DNS Cache Snooping
DNS Amplification Testing
Common Vulnerabilities
Misconfiguration Issues:
Open zone transfers
Recursive queries allowed
Information disclosure
Weak access controls
Protocol Weaknesses:
Cache poisoning
DNS tunneling
Zone walking
Amplification attacks
Implementation Issues:
Buffer overflows
DoS vulnerabilities
BIND vulnerabilities
Post Exploitation
Information Gathering
Map network infrastructure
Identify internal domains
Discover host naming patterns
Find related domains
Locate sensitive records
Further Enumeration
Internal DNS servers
Split-horizon DNS
Dynamic DNS zones
DNSSEC configuration
Secondary servers
Common Response Codes
NOERROR
Query successful
NXDOMAIN
Domain not found
SERVFAIL
Server failure
REFUSED
Query refused
FORMERR
Format error
Best Practices for Pentesting
Initial Reconnaissance:
Identify DNS servers
Check version info
Test basic queries
Look for zone transfers
Deep Enumeration:
Brute force subdomains
Check all record types
Test for misconfigurations
Map DNS infrastructure
Documentation:
Record all findings
Note server versions
Document vulnerabilities
Save evidence
Risk Assessment:
Evaluate impact
Consider data sensitivity
Check exploitation potential
Recommend fixes
Common Tools
Enumeration:
dig
nslookup
host
dnsenum
fierce
Subdomain Discovery:
gobuster
Sublist3r
Amass
Subfinder
Analysis:
dnsrecon
dnswalk
dnsmap
massdns
Remember to always have proper authorization before testing and document all findings thoroughly.