Master reconnaissance techniques and Nmap scanning methodologies
Network scanning is the systematic process of identifying active hosts, open ports, running services, and operating systems within a target network. It forms the foundation of penetration testing and security assessments.
Purpose: Identify live systems on the network
Techniques:
Ping Sweep - ICMP echo requestsARP Scan - Layer 2 discovery (local network)TCP SYN Ping - SYN to common portsUDP Ping - UDP packets to portsPurpose: Enumerate open ports and services
Port States:
Open - Application accepting connectionsClosed - Port accessible but no serviceFiltered - Firewall blocking accessUnfiltered - Accessible but state unknownPurpose: Identify application versions
Methods:
Banner Grabbing - Read service bannersVersion Detection - Probe responses analysisNSE Scripts - Nmap Scripting EngineSignature Matching - Pattern recognitionPurpose: Determine target operating system
Techniques:
Active - Send probes, analyze responsesPassive - Observe network trafficTTL Analysis - Time-to-live valuesTCP/IP Stack - Implementation detailsApplication is actively accepting TCP/UDP connections
Port accessible but no application listening
Firewall/filter blocking probe packets
Build custom Nmap commands by selecting options below. The command will update in real-time.
Understanding the TCP handshake is crucial for comprehending different scan types.
Initiates connection. Sent by client to begin TCP handshake. Sequence number synchronization.
Acknowledges receipt of packets. Confirms sequence numbers. Present in all packets after initial SYN.
Gracefully terminates connection. Sender has no more data. Used in FIN scans.
Abruptly terminates connection. Error condition or refused connection. Immediate closure.
Pushes buffered data to application. Don't wait for buffer to fill. Used in XMAS scans.
Urgent data present. Process immediately. Rarely used. Part of XMAS scans.
Select a scan type to see its characteristics and flag patterns:
Full 3-way handshake
Logged, detectable
Half-open scan
Stealth, default
Only FIN flag set
Firewall evasion
FIN+PSH+URG flags
"Lit up like tree"
No flags set
Bypass filters
Only ACK flag
Firewall detection
| Scan Type | Flags | Open Response | Closed Response | Stealth Level | Use Case |
|---|---|---|---|---|---|
| Connect (-sT) | SYN → SYN/ACK → ACK | Full connection | RST | Low (logged) | No privileges needed |
| SYN (-sS) | SYN → SYN/ACK → RST | SYN/ACK | RST | High (half-open) | Default, fast |
| FIN (-sF) | FIN | No response | RST | Very High | Firewall bypass |
| XMAS (-sX) | FIN+PSH+URG | No response | RST | Very High | IDS evasion |
| NULL (-sN) | None | No response | RST | Very High | Filter detection |
| ACK (-sA) | ACK | RST (unfiltered) | RST (unfiltered) | Medium | Firewall rules mapping |
Essential ports every penetration tester should know:
--top-ports 1000 to scan the most common 1000 ports quickly, or -p- for a comprehensive scan of all 65535 ports.
Nmap provides timing templates to balance speed versus stealth and network load.
| Template | Name | Speed | Use Case | Detection Risk |
|---|---|---|---|---|
| -T0 | Paranoid | Extremely Slow | IDS evasion, one port at a time, 5min delays | Very Low |
| -T1 | Sneaky | Very Slow | IDS evasion, 15 second delays between probes | Low |
| -T2 | Polite | Slow | Reduce network load, less bandwidth consumption | Medium-Low |
| -T3 | Normal | Normal | Default timing, balanced approach | Medium |
| -T4 | Aggressive | Fast | Fast, reliable networks, assumes fast connection | Medium-High |
| -T5 | Insane | Very Fast | Very fast networks, sacrifices accuracy for speed | High |
-p 80,443,8080 - Specific ports
-p 1-1024 - Port range
--top-ports 100 - Most common ports
-p- - All 65535 ports
--min-hostgroup 256 - Scan hosts in parallel
--min-parallelism 100 - Probe parallelization
--max-parallelism 300 - Maximum probes
--host-timeout 30m - Skip slow hosts
--max-rtt-timeout 100ms - Probe timeout
--min-rtt-timeout 50ms - Minimum wait
--max-rate 1000 - Max packets/sec
--min-rate 100 - Minimum rate
--scan-delay 10ms - Delay between probes
Test your understanding of network scanning concepts and Nmap techniques.