23 Nmap
23 Nmap
Computer Networking
COMP 177 | Fall 2020 | University of the Pacific | Jeff Shafer
Nmap
Network Scanning
2
ì Sweeps/Traces
ì Send out a small number of probes to each IP
address and listen for reply
ì Make note of active systems
ì Attempt to deduce network topology
ì Port scans
ì Send out a larger number of probes to each active IP
address and listen for reply
ì Make note of TCP and UDP ports that are listening
ì Vulnerability Scanning
ì Armed with lists of active hosts, their OS, and
network services, check for known vulnerabilities or
common misconfigurations
Scan Challenges
Scan Challenges
ì SMTP – 25
ì HTTP – 80
ì
Scanning Mechanics
Computer Networking Fall 2020
11
Nmap
Nmap
Target Specification
ì Hostnames: scanme.nmap.org
ì Challenge that one hostname might map to multiple
systems (i.e. web servers behind a proxy)
ì Not preferred for serious analysis
Scanning Mechanics
ì Host Detection
ì How do we detect if a host is active?
ì Even if it is nominally configured to hide its presence
ì Port Detection
ì How do we detect if a port is open/listening?
Host Detection
Host Detection
ì Different subnet?
ì ICMP Echo Request
ì ICMP Timestamp Can customize –
ì TCP SYN to port 443 (HTTPS) Burst in parallel these defaults will
ì TCP ACK to port 80 (HTTP) not detect all hosts
ì DNS Reverse Lookup
Computer Networking
https://nmap.org/book/synscan.html Fall 2020
20
Open:
Closed:
Filtered:
Computer Networking
https://nmap.org/book/synscan.html Fall 2020
22
🤔
445/tcp filtered microsoft-ds ì AT&T blocking?
9929/tcp open nping-echo
31337/tcp open Elite
😎
80/tcp open http
9929/tcp open nping-echo
31337/tcp open Elite
Usefulseconds
Nmap done: 1 IP address (1 host up) scanned in 0.73 lesson about where
Computer Networking
you are scanning from?
Fall 2020
24
Port Detection
Table 6.1. Required --top-ports values for reaching various effectiveness levels
TCP ports UDP ports
Effectiveness
ì Nmap does not scan all required required
Port Detection
OS Detection
OS Detection
ì Purposes of OS detection?
ì Check if hosts are vulnerable to known exploits
ì Inventory of systems on network
ì Detect unauthorized devices on the network (e.g.
wireless access point)
OS Detection
Doing it ALL
(Host + Port + OS + Version + scripts)
nmap –A [options] {target specification}
Big drawback for always using -A: 12.26 seconds vs 0.38 seconds for –sT for ONE HOST
Computer Networking Fall 2020
35
ì “Timing Templates”
ì -T0: Paranoid: 300s between probes Sufficiently slow
that IDS won’t
ì -T1: Sneaky: 15s between probes detect scan?
ì -T2: Polite: 0.4s between probes
ì -T3: Normal (default)
ì -T4: Aggressive: More parallelism, shorter timeouts
Consider -T4 for LAN
ì -T5: Insane: MOAR!!
ì Output Formats
ì No option – Default human-readable option
ì -oN [filename] – Similar output saved to file
ì -oX [filename] – XML output, easily imported
ì -oG [filename] – “Grepable” single-line-per-host
ì -oA [dirname] – Normal + XML + Grepable in a directory
ì -oS [filename] – sCRiPt KiDDi3 0utPU+
ì This format is provided for the l33t haXXorZ! J
Closing Thoughts
Presentation
Due Nov 23rd