| name | dns-pentesting |
| description | Perform DNS security assessments and enumeration. Use this skill whenever the user needs to enumerate DNS servers, check for zone transfers, discover subdomains, validate DNSSEC configuration, or assess DNS security posture. Trigger on requests involving DNS reconnaissance, domain enumeration, DNS vulnerability scanning, or any DNS-related security testing. |
DNS Pentesting Skill
A comprehensive skill for performing DNS security assessments, enumeration, and vulnerability testing.
When to Use This Skill
Use this skill when:
- Enumerating DNS servers and discovering domain information
- Testing for zone transfer vulnerabilities
- Discovering subdomains through brute force or enumeration
- Checking DNSSEC configuration and validation
- Assessing DNS server security posture
- Performing Active Directory DNS enumeration
- Validating DNS record types and configurations
Quick Start
For rapid DNS enumeration, use the bundled scripts:
./scripts/dns-enumerate.sh <target-ip> <domain>
./scripts/dns-zone-transfer.sh <target-ip> <domain>
./scripts/dns-subdomain-brute.sh <domain> <target-ip>
./scripts/dns-sec-check.sh <domain>
DNS Enumeration Workflow
1. Initial Reconnaissance
Start with basic DNS information gathering:
dig version.bind CHAOS TXT @<DNS_IP>
dig any <domain> @<DNS_IP>
dig A <domain> @<DNS_IP>
dig AAAA <domain> @<DNS_IP>
dig MX <domain> @<DNS_IP>
dig NS <domain> @<DNS_IP>
dig TXT <domain> @<DNS_IP>
dig SOA <domain> @<DNS_IP>
2. Zone Transfer Testing
Zone transfers (AXFR) can expose all DNS records for a domain:
dig axfr @<DNS_IP>
dig axfr <domain> @<DNS_IP>
fierce --domain <domain> --dns-servers <DNS_IP>
Security Note: Zone transfers should only be allowed between authoritative name servers. If successful, this is a misconfiguration.
3. Subdomain Discovery
Discover subdomains through various methods:
dnsenum --dnsserver <DNS_IP> --enum -p 0 -s 0 -o subdomains.txt -f <wordlist> <domain>
dnsrecon -D <wordlist> -d <domain> -n <DNS_IP>
for sub in $(cat <wordlist>); do
dig $sub.<domain> @<DNS_IP> | grep -v 'SOA' | grep $sub
done
4. Reverse DNS Enumeration
Map IP addresses back to hostnames:
dig -x <IP_ADDRESS> @<DNS_IP>
dnsrecon -r <IP_RANGE>/24 -n <DNS_IP>
dnsrecon -r 192.168.1.0/24 -n <DNS_IP>
5. Active Directory DNS Enumeration
Discover AD infrastructure through DNS:
dig -t _gc._tcp.<domain>
dig -t _ldap._tcp.<domain>
dig -t _kerberos._tcp.<domain>
dig -t _kpasswd._tcp.<domain>
nslookup -type=srv _kerberos._tcp.<domain>
nmap --script dns-srv-enum --script-args "dns-srv-enum.domain='<domain>'" <IP>
6. DNSSEC Validation
Check DNSSEC configuration and validation:
dig <domain> DNSKEY +dnssec
dig <domain> DS +short
dig <domain> CDS +short
dig <domain> CDNSKEY +short
dig @8.8.8.8 <domain> A +dnssec
nmap -sSU -p53 --script dns-nsec-enum --script-args "dns-nsec-enum.domains=<domain>" <DNS_IP>
7. DNS Server Security Checks
Assess DNS server security posture:
dig google.com A @<DNS_IP>
nmap -n --script "(default and *dns*) or fcrdns or dns-srv-enum or dns-random-txid or dns-random-srcport" <IP>
dig <domain> DNSKEY +dnssec +bufsize=1232
dig <domain> DNSKEY +dnssec +tcp
8. Advanced DNS Checks
NS Delegation Integrity
dig <domain> NS +short
for ns in $(dig +short <domain> NS); do
dig @${ns%?} <domain> SOA +short
done
Modern DNS Records (HTTPS/SVCB)
dig <domain> HTTPS +short
dig <domain> SVCB +short
dig www.<domain> HTTPS +short
dig www.<domain> SVCB +short
TTL Analysis
dig <domain> A +ttlid
dig <domain> AAAA +ttlid
dig <domain> MX +ttlid
dig <domain> NS +ttlid
CAA Records (Certificate Authority Authorization)
dig <domain> CAA +short
curl -s "https://crt.sh/?q=%25.<domain>&output=json" | head
Post-Exploitation DNS Checks
If you have access to a compromised system, check DNS configuration files:
/etc/resolv.conf
/etc/host.conf
/etc/bind/named.conf
/etc/bind/named.conf.local
/etc/bind/named.conf.options
/etc/bind/named.conf.log
Key BIND parameters to check:
allow-transfer - Who can perform zone transfers
allow-recursion - Who can send recursive requests
allow-query - Who can query the server
Tools Reference
| Tool | Purpose |
|---|
dig | DNS query tool (most versatile) |
nslookup | Legacy DNS query tool |
dnsrecon | DNS enumeration and brute force |
dnsenum | DNS enumeration suite |
fierce | DNS reconnaissance and zone transfer |
nmap | DNS vulnerability scanning |
fpdns | DNS server fingerprinting |
Nmap DNS Scripts
nmap -n --script "(default and *dns*) or fcrdns or dns-srv-enum or dns-random-txid or dns-random-srcport" <IP>
nmap --script dns-srv-enum --script-args "dns-srv-enum.domain='<domain>'" <IP>
nmap -sSU -p53 --script dns-nsec-enum --script-args "dns-nsec-enum.domains=<domain>" <DNS_IP>
Metasploit DNS Modules
use auxiliary/gather/enum_dns
use auxiliary/scanner/dns/dns_amp
Common DNS Record Types
| Type | Description |
|---|
| A | IPv4 address |
| AAAA | IPv6 address |
| MX | Mail exchange |
| NS | Name server |
| SOA | Start of Authority |
| TXT | Text records (SPF, DKIM, etc.) |
| CNAME | Canonical name (alias) |
| PTR | Pointer (reverse DNS) |
| SRV | Service location |
| DNSKEY | DNSSEC key |
| DS | Delegation signer |
| CAA | Certificate Authority Authorization |
| HTTPS | HTTPS service binding |
| SVCB | Service binding |
Best Practices
- Always test zone transfers - This is a common misconfiguration
- Check for recursion - Can be abused for DDoS amplification
- Enumerate subdomains - Often reveals internal infrastructure
- Validate DNSSEC - Check for proper configuration
- Review NS delegation - Look for lame delegations
- Check TTL values - Low TTLs can accelerate malicious changes
- Examine CAA records - Overly permissive CAA increases cert abuse risk
Output Interpretation
Recursion Available (ra flag)
- Present: Server allows recursive queries (potential DDoS risk)
- Absent: Server only answers authoritative queries (more secure)
Zone Transfer Success
- Success: Misconfiguration - all DNS records exposed
- Refused: Properly configured
Low TTL Values
- < 300 seconds: Very low - changes propagate quickly
- 300-3600 seconds: Normal range
- > 3600 seconds: High - slower propagation
References
Script Usage
See the bundled scripts in scripts/ for automated workflows:
dns-enumerate.sh - Complete DNS enumeration suite
dns-zone-transfer.sh - Zone transfer testing
dns-subdomain-brute.sh - Subdomain discovery
dns-sec-check.sh - DNSSEC validation checks