Resources

Cheat sheet

Commands

  • Enumeration
    • Records
      • SOA
        dig soa www.inlanefreight.com
        whois facebook.com
      • NS
        dig ns inlanefreight.htb @10.129.14.128
        nslookup -type=ns facebook.com
      • ANY
        dig any inlanefreight.htb @10.129.14.128
        dig any @81.4.108.41 zonetransfer.me
      • A , AAAA , TXT , MX
        dig A @81.4.108.41 zonetransfer.me
        dig AAAA @81.4.108.41 zonetransfer.me
        dig TXT @81.4.108.41 zonetransfer.me
        dig MX @81.4.108.41 zonetransfer.me
      • AXFR
        dig axfr inlanefreight.htb @10.129.14.128
        dig axfr internal.inlanefreight.htb @10.129.14.128
        dig axfr @81.4.108.41 zonetransfer.me
        • MSF
          msf > use auxiliary/gather/enum_dns
        • nmap
          nmap -Pn -sU -n --script "(default and *dns*) or fcrdns or dns-srv-enum or dns-random-txid or dns-random-srcport" 81.4.108.41
  • Version
    dig CH TXT version.bind 10.129.120.85
    dig version.bind CHAOS TXT @nsztm1.digi.ninja
  • Zone Transfer
    • An alternative method using Nmap’s scripting engine.
      nmap -Pn -sU --script=dns-check-zone -p 53 facebook.com
  • Subdomains
    • dig
      for sub in $(cat /opt/useful/seclists/Discovery/DNS/subdomains-top1million-110000.txt);do dig $sub.inlanefreight.htb @10.129.14.128 | grep -v ';\|SOA' | sed -r '/^\s*$/d' | grep $sub | tee -a subdomains.txt;done
    • dnsenum
      dnsenum --dnsserver 10.129.14.128 --enum -p 0 -s 0 -o subdomains.txt -f /opt/useful/seclists/Discovery/DNS/subdomains-top1million-110000.txt inlanefreight.htb
    • dnsrecon
      dnsrecon -d zonetransfer.me -a -n 81.4.108.41
    • dnscan
      python3 dnscan.py -d facebook.com -w subdomains-10000.txt -r
    • fierce
      fierce --domain facebook.com --subdomains admin call voip
  • Reverse DNS Lookup (PTR Scan)
    • dnsrecon
      dnsrecon -r 176.124.112.0/24 -n 176.124.112.77
  • IPv6 DNS
    • dnsdict6
      dnsdict6 zonetransfer.me
    • dnsrevenum6
      dnsrevenum6 pri.authdns.ripe.net 1301:37d:2e8::/48
  • Attacks
    • DNS Amplification
      dig A @81.4.108.41 zonetransfer.me
      nmap -Pn -sU -p 53 --script=dns-recursion 81.4.108.41

Tools

Notes

Danger

For security reasons, nearly all DNS servers are configured to deny zone transfer requests from the general public. Giving away a complete list of all your servers and subdomains is a huge security risk, as it provides a perfect map for an attacker.