Hacking Notes
  • What is this?
  • Reconnaissance 🗣
    • Information Gathering 🗣
  • Enumeration 🎯
    • Host Discovery 🛎
    • DNS Enumeration
    • OS Discovery 🖥
    • Port Scanning 📟
    • WAF Evasion
  • Web 📱
    • Unrestricted File Upload
    • Templates Injections ✖️
    • File Inclusion
    • Login Panes
    • SQL Injection
    • NoSQL Injection
    • OAuth 2.0 Bypass
  • Privilege Escalation
    • Linux Privesc
    • Windows Privesc
    • Run Commands AS
  • Post Explotation 💀
    • Port Forwarding and Tunneling
    • Transfering Files 📤
    • Reverse Shell 🔙
    • Crypto 101 👁
    • AV Evasion
    • Bypass UAC
    • Get Credentials
  • Services
    • PORT 21/tcp - FTP
    • PORT 25/tcp - SMTP
    • PORT 53/tcp/udp - DNS
    • Port 80,443/tcp - HTTP
    • Port 111/tcp - RPCBind
    • PORT 143,993/tcp - IMAP
    • PORT 139,445/tcp - SMB
    • PORT 161/udp - SNMP
    • PORT 1100/tcp - Java RMI
    • PORT 1433/tcp - Microsoft SQL Server
    • PORT 2049/tcp - NFS
    • PORT 3306/tcp MySQL
    • PORT 3389/tcp RDP
    • PyPI Server
  • Software
    • Tomcat
    • Jenkins
    • Drupal
    • Wordpress
  • Client-Side Attacks
    • Evil PDF
    • Microsoft Office Macros
  • Other
    • Hacking WiFI
      • WPA/WPA2 PSK
      • WPA/WPA2 PEAP (Enterprise)
      • WEP
    • Hacking with Powershell
    • Hacking AWS
  • Exploiting
    • Buffer Overflow
  • Active Directory
    • 🖥️AD Attacks
Powered by GitBook
On this page
  • Interacting with DNS servers
  • DNS Lookup
  • Reverse DNS Lookup
  • Mail Exchange Lookup
  • Zone Transfers

Was this helpful?

  1. Enumeration 🎯

DNS Enumeration

The Domain Name System (DNS) is on of the most critical systems on the Internet and is a distributed database responsible for translating user-friendly domain names into IP addresses.

PreviousHost Discovery 🛎NextOS Discovery 🖥

Last updated 3 years ago

Was this helpful?

Interacting with DNS servers

DNS queries produce listintgs calles Resource Records. This is a representation of Resource Records:

DNS Lookup

A DNS lookup is the simplest query a DNS server can receive. Its asks the DNS to resolve a given hostname.

nslookup [Domain]
dig [Domain]
host [DOMAIN]

Once we retrieved all the IP addresses corresponding to the domains, we need to consider two things:

  • Is this IP address hosting only that given domain?

It is possible that more than one domain is configured on the same IP address, even if a PTR record is not set. This is also typical in corporate networks where multiple subdomains run on the same web server. First thing to try is reverse lookup and the second is search on google or bing:

bing> ip:[IP]
  • Who does this IP address belongs to?

In order to collect the highest number of domains and subdomain related to the target organization, we can use different techniques:

  • DNS Lookup

  • MX Lookup

  • Zone transfers

Reverse DNS Lookup

With Reverse DNS Lookup, we will recieve the IP address associated to a given domain name. This process queries for DNS pointer records (PTR).

nslookup -type=PTR [IP]
dig [Domain] PTR

or use online tools:

Mail Exchange Lookup

With MX(Mail Exchange) lookup, we retrieve a list of servers responsible for delivering emails for that domain:

nslookup -type=MX [Domain]
dig [Domain] MX

or use online tools:

Zone Transfers

Zone transfers are usually a misconfiguration of the remote DNS server. They should be enabled only for trusted IP addresses. Whe zone transfers are enabled, we can enumerate the entire DNS record for that zone. This includes all the sub domains (A records).

nslookup -type=NS [Domain]
dig [Domain] NS
host -t ns [Domain]

There are usually two name servers. Take note of both of them an run the next command to show all A records:

nslookup -query=AXFR [Domain] [Nameserver]
dig axfr [Nameserver] [Domain]
host -l [Domain] [Nameserver]
dnsrecon -d [Domain] -axfr

Another technique to discover A records if Zone transfers are well configured is to bruteforce them with a most common subdomain names:

fierce -dns [Domain] -dnsserver [Nameserver] -f [Wordlist]
dnsmap [Domain]
dnsrecon -d [Domain] -D [Wordlist] -t brt

To search the owner of an IP address we can use or one of the WHOIS tools seen earlier

whois.arin.net
https://network-tools.com/nslookup/
https://www.dnsqueries.com/
https://www.mxtoolbox.com/
Table of DNS Record Types