Last Updated: 2015-11-08 19:55:12 UTC
by Rick Wanner (Version: 1)
In a penetration test (PenTest) a thorough reconnaissance is critical to the overall success of the project.
DNS information for the target network is often very useful reconnaissance information. DNS information is publicly available information and enumerating it from DNS servers does not require any contact with the target and will not tip off the target company to any activities.
A tool that can be used to assist with DNS information gathering is nmap. Nmap has a parallel reverse DNS resolution engine that is normally employed as part of an nmap scan, but can also be used independently of the scan function to do DNS enumeration.
Let’s pretend we were hired to do a pentest against SANS. www.sans.org is 22.214.171.124. According to ARIN whois 126.96.36.199 is part of a /24 range allocated to the SANS (188.8.131.52/24). ARIN also shows another /24 network range allocated to SANS (184.108.40.206/24).
The nmap command to be used in this case is:
# nmap --dns-servers 220.127.116.11,18.104.22.168 -sL 22.214.171.124/24 126.96.36.199/24
By default nmap will use your system’s configured DNS. If you are enumerating a large address space nmap can generate a high volume of queries. While this shouldn’t cause an issue for your DNS servers, being paranoid, I use publicly available servers that I know can handle the volume. In this case Google’s public DNS at 188.8.131.52 and 184.108.40.206 or OpenDNS. These servers are specified using the –dns-servers parameter.
-sL specifies a list scan, which means nmap will only do a DNS resolution, not actually scan the target.
220.127.116.11/24 18.104.22.168/24 is the target networks we want to enumerate. In nmap if multiple address ranges are to be part of the target they are space separated.
The output is one line per IP in the range (heavily edited for space). Notice that every IP with a reverse DNS entry has that entry listed. IPs without reverse DNS entries just show the IP.
Starting Nmap 5.51 ( http://nmap.org ) at 2015-11-08 13:39 EST
Nmap scan report for 204-51-93-0.clp.sans.org (22.214.171.124)
Nmap scan report for router31-int.clp.sans.org (126.96.36.199)
Nmap scan report for fw31.clp.sans.org (188.8.131.52)
Nmap scan report for 184.108.40.206
Nmap scan report for 220.127.116.11
Nmap scan report for portal.sans.org (18.104.22.168)
Nmap scan report for mail.sans.org (22.214.171.124)
Nmap scan report for exams.giac.org (126.96.36.199)
Nmap scan report for www.giac.org (188.8.131.52)
Nmap scan report for www.sans.org (184.108.40.206)
Nmap scan report for exams.giac.org (220.127.116.11)
Nmap scan report for www.giac.org (18.104.22.168)
Nmap scan report for dshield.org (22.214.171.124)
Nmap scan report for isc.sans.org (126.96.36.199)
Nmap scan report for isc.sans.org (188.8.131.52)
Nmap scan report for isc.sans.org (184.108.40.206)
Nmap done: 512 IP addresses (0 hosts up) scanned in 58.98 seconds
DNS information is publicly available information, so enumerating it is not a crime in any jurisdiction that I am aware of. If you really feel the need to go further than this, please remember that the difference between an attack and a pentest is permission.
-- Rick Wanner MSISE - rwanner at isc dot sans dot edu - http://namedeplume.blogspot.com/ - Twitter:namedeplume (Protected)