Nmap
Nmap
Org
Scan Goals
Scan Challenges:
Determining the IP addresses to Scan
• Dozens of large but targeted scans rather
than one giant scan.
• Many options: BGP routing tables, DNS
zone files, registry allocation, etc.
• Nmap's own random IP generation:
– nmap iR 25200000 sL n | grep "not scanned"
| awk '{print $2}' | sort n | uniq >! tp; head
25000000 tp >! 25MIPs; rm tp
Insecure.Org
Scan Challenges:
Scan Source
• P2P scanning?
• Legal issues
• ISP response
• US Department of Defense response
– DoD JTFGNO: Joint Task Force for Global
Network Operations
Insecure.Org
Scan Challenges:
Firewalls
• Network conditions often differ significantly
behind firewalls vs. Internet scanning
• Contributed data
Insecure.Org
Scan Challenges:
Performance and Accuracy
• Internet scanning is long, hard work. Can
be disheartening:
– Stats: 93:57:40 elapsed; 254868 hosts
completed (2048 up), 2048 undergoing UDP
Scan
UDP Scan Timing: About 11.34% done; ETC:
03:21 (688:41:48 remaining)
• Finding and resolving performance and accuracy
problems is a key goal.
Insecure.Org
• Goals
• Big challenge: Deciding on discovery
methods
• Echo requests and even Nmap default
discovery (TCP ACK to port 80 & echo
request) are often insufficient for Internet
scanning.
Insecure.Org
• 80/http
• 25/smtp
• 22/ssh
• 443/https
• 21/ftp
• 113/auth
• 23/telnet
• 53/domain
• 554/rtsp
• 3389/mstermserver
Insecure.Org
• Enhanced discovery:
– took 71 minutes vs. 27 (up 167%)
– Found 1,125 more live hosts (up 34%)
Insecure.Org
• 80 (http)
• 23 (telnet)
• 22 (ssh)
• 443 (https)
• 3389 (mstermserv)
• 445 (microsoftds)
• 139 (netbiosssn)
• 21 (ftp)
• 135 (msrpc)
• 25 (smtp)
Insecure.Org
Nmap News!
Insecure.Org
NSE Demo
# ./nmap -PN -v -sU -p53 -T4 --script=dns-test-open-
recursion,dns-safe-recursion-port.nse,dns-safe-recursion-
txid.nse dns-1.blackhat.com archimedes.shmoo.com
Zenmap GUI
Insecure.Org
nd
2 Generation OS Detection
# nmap -A -T4 scanme.nmap.org
[...]
Device type: general purpose
Running: Linux 2.6.X
OS details: Linux 2.6.20-1 (Fedora Core 5)
More info:
http://nmap.org/book/osdetect.html
Insecure.Org
Version Detection
# nmap -A -T4 scanme.nmap.org
Starting Nmap ( http://nmap.org )
Interesting ports on scanme.nmap.org (64.13.134.52):
Not shown: 1709 filtered ports
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 4.3 (protocol 2.0)
25/tcp closed smtp
53/tcp open domain ISC BIND 9.3.4
70/tcp closed gopher
80/tcp open http Apache httpd 2.2.2 ((Fedora))
|_ HTML title: Site doesn't have a title.
113/tcp closed auth
Device type: general purpose
Now has 4,803 signatures
Running: Linux 2.6.X
OS details: Linux 2.6.20-1 (Fedora Core 5)
Uptime: 40.425 days (since Tue May 13 12:46:59 2008)
More info: http://nmap.org/book/vscan.html
Nmap done: 1 IP address scanned in 30.567 seconds
Raw packets sent: 3464 (154KB) | Rcvd: 60 (3KB)
Insecure.Org
reason
# nmap --reason -T4 scanme.nmap.org
[...]
Interesting ports on scanme.nmap.org
(205.217.153.62):
Not shown: 1709 filtered ports
Reason: 1709 no-responses
PORT STATE SERVICE REASON
22/tcp open ssh syn-ack
25/tcp closed smtp reset
53/tcp open domain syn-ack
70/tcp closed gopher reset
80/tcp open http syn-ack
113/tcp closed auth reset
Insecure.Org
packettrace
# nmap --packet-trace -p 25,113
scanme.nmap.org
Advanced Traceroute
# nmap –traceroute scanme.nmap.org
[...]
TRACEROUTE (using port 22/tcp)
HOP RTT ADDRESS
1 0.60 wap.nmap-int.org (192.168.0.6)
[...]
6 9.74 151.164.251.42
7 10.89 so-1-0-0.mpr1.sjc2.us.above.net
(64.125.30.174)
8 10.52 so-4-2-0.mpr3.pao1.us.above.net
(64.125.28.142)
9 14.25 metro0.sv.svcolo.com
(208.185.168.173)
10 12.80 scanme.nmap.org (64.13.134.52)
Insecure.Org
Ncat
• A modern interpretation of Hobbit's venerable
Netcat
• Supports virtually all of the Netcat 1.10 features,
except the basic portscanner.
• Also supports SSL, IPv6, multiple platforms,
connection brokering, port redirection, proxies
(client, server, chaining), shell execution, access
control, and more.
• In development since 2005, nearly ready for
release. Current dev lead is Kris Katterjohn.
• Available from svn://svn.insecure.org/ncat (login:
guest/guest)
Insecure.Org
Ndiff