Analysing Networks With NMAP: OWASP Ruhrpott Meetup March 2019
Analysing Networks With NMAP: OWASP Ruhrpott Meetup March 2019
Analysing Networks With NMAP: OWASP Ruhrpott Meetup March 2019
● Minimalistic
● Stateless
● Unreliable
● Unordered
● Fast?
● Much overhead
● Stateful
● Reliable
● Ordered
● Supporting protocol
● Not usually used to send data*
● Does things like:
○ ping
○ traceroute*
NMAP Basics
NMAP Basics
NMAP Basics - Default Privileges
Default NMAP behaviour depends on privileges:
● Privileged (root/Administrator*)
○ TCP SYN scan
● Unprivileged
○ TCP connect scan
NMAP Basics - Host Discovery
Several ways - different outcomes
● TCP-SYN-Scan (-sS)
○ Fast
○ Stealthy (?)
○ Requires privileges
● TCP-Connect-Scan (-sT)
○ Relies on OS
○ Slower than TCP-SYN-Scan
● UDP-Scan (-sU)
○ Slow
○ Unreliable
NMAP Basics - Scan Types II
More Scan Types:
● TCP-NULL-Scan (-sN)
○ None
● TCP-FIN-Scan (-sF)
○ FIN
● TCP-Xmas-Scan (-sX)
○ URG, PSH, FIN
NMAP Basics - Scan Types III
Even More Scan Types:
● open
○ “Proper” response received
● closed
○ RST received
● filtered
○ Something else happened
● open|filtered
○ Couldn’t determine port state
■ often UDP related
NMAP Basics - Scan Speeds
Different Speed Settings (-T):
● paranoid (0)
● sneaky (1)
● polite (2)
● normal (3) [default]
● aggressive (4)
● insane (5)
NMAP Basics - Target Syntax
Everything that isn’t an option is considered a host :-)
Everything above can be combined and loaded from a file as well (-iL)
NMAP Basics - Port Syntax
Ports are scanned in a (mostly) random order
● Script-Scan (-sC)
○ Equivalent to --script=default
● --script accepts:
○ Filename
○ Directory
○ Category
○ Expressions
NMAP Basics - Script Scan II
Script Categories:
● auth ● intrusive
● broadcast ● malware
● brute ● safe
● discovery ● version
● dos ● vuln
● exploit
● external
● fuzzer
● Service scripts
○ Executed once per port
● Host scripts
○ Executed once per host
● Pre-rule script
○ Executed prior any scan
● Post-rule script
○ Executed after all scans
NSE Scripting - Example http-title
https://svn.nmap.org/nmap/scripts/http-title.nse
NMAP Tool Suite
NMAP Tool Suite - ncat
● Netcat (nc) alternative
○ Supports SSL
○ Supports IPv6
○ Proxying
Further reading:
● https://nmap.org/ncat/guide/ncat-tricks.html
● http://alexcreek.com/ncat-cheatsheet.html
NMAP Tool Suite - ndiff
● Compares scans
● Takes in two XML files
NMAP Tool Suite - nping
● Network packet generator
● Response analysis
● Response time measurement.
● Also does ping :-)
NMAP Tool Suite - zenmap
● GUI for NMAP
● Quick profile selection
● Graphical organisation
● Topology
Training with NMAP
Training with NMAP
Don’t go wandering off, scanning networks without consent!
This could get you into trouble. Things could break, people could sue you.
Questions?