All Writeups
2026-03-20Security Scanning

Nmap: Service Enumeration and Scan Timing in Lab Environments

Comparative analysis of SYN scan vs connect scan behavior, banner grabbing, and timing templates in a segmented test network.

NmapLinuxNetworking

Objective

Compare scan speed, accuracy, and firewall footprint between different Nmap scan types (-sS SYN scan vs -sT TCP Connect scan) and examine how timing templates affect detection and packet loss.

Methodology & Execution

Scans were performed against a test Debian host running OpenSSH 9.2, Nginx, and a Python test service listening on port 9000.

1. SYN Stealth Scan (-sS)

bash — syn scan
$ sudo nmap -sS -p 22,80,9000 -T4 192.168.10.50
$ Starting Nmap 7.94 ( https://nmap.org )
$ Nmap scan report for 192.168.10.50
$ PORT STATE SERVICE
$ 22/tcp open ssh
$ 80/tcp open http
$ 9000/tcp open cslistener
$ Nmap done: 1 IP address (1 host up) scanned in 0.12 seconds

The SYN scan sends a SYN packet, waits for a SYN/ACK, and immediately replies with RST rather than completing the three-way handshake. This avoids opening full application sockets on target services.

2. Service Version Detection (-sV)

bash — service detection
$ nmap -sV -p 22,80 192.168.10.50
$ PORT STATE SERVICE VERSION
$ 22/tcp open ssh OpenSSH 9.2p1 Debian 2+deb12u2 (protocol 2.0)
$ 80/tcp open http nginx 1.22.1
$ Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel

When version detection is enabled, Nmap connects to open ports and issues protocol probes (such as GET / HTTP/1.0\r\n\r\n for HTTP or reading SSH banner SSH-2.0-...).

Scan Timing Notes (-T2 vs -T4)

In testing against an interface with simulated 20ms jitter:

  • -T4 completed in 0.28 seconds for 100 ports, but occasionally caused retransmissions when inspecting higher port ranges.
  • -T3 (default) took approximately 1.4 seconds with zero packet loss.
  • In low-bandwidth or IDS-monitored environments, slowing down probe frequency prevents buffer exhaustion on embedded targets like ESP32 or Raspberry Pi.

Practical Recommendations

  1. Always use -sS when root privileges are available to prevent unnecessary socket allocation on the target.
  2. Use --open to filter out closed and filtered ports when scanning larger subnets.
  3. Save scan outputs in multiple formats simultaneously (-oA scan_output) for documentation and post-processing with grep or Python.