Lesson 03 of 5
Nmap Scan Types, Version and OS Detection (-sS, -sT, -sU, -sV, -O, -A)
4 min read
SYN vs connect vs UDP scans, exact software versions, OS guessing and timing templates.
So far Nmap has told us which ports are open. Now we go deeper: how Nmap scans, and how to find out exactly which software is running. This is where Nmap goes from a simple port checker to a real recon tool.
TCP SYN scan (-sS) vs TCP connect scan (-sT)
A normal TCP connection starts with a three-way handshake: SYN → SYN/ACK → ACK.
The SYN scan (-sS) sends a SYN. If the port answers with SYN/ACK it's open, and Nmap immediately sends RST to cancel. Because the handshake never finishes, it's called a "half-open" or "stealth" scan. It's fast, and it's Nmap's default when you run as root.
sudo nmap -sS 192.168.56.101
The TCP connect scan (-sT) asks the operating system to open a full connection, just like a browser would. It's the default when you don't use sudo. It's slower and more likely to show up in the target's application logs.
nmap -sT 192.168.56.101
"Stealth" is a bit of an old name. Any modern firewall or IDS still detects a SYN scan; it's just quieter in application logs.
UDP scan (-sU)
DNS (53), DHCP (67), NTP (123) and SNMP (161) all run on UDP, and beginners often forget to check them. UDP scanning is slow because open UDP ports often don't reply, so start with the top ports only:
sudo nmap -sU --top-ports 20 192.168.56.101
You can scan TCP and UDP in one run:
sudo nmap -sS -sU -p T:22,80,U:53,161 192.168.56.101
Service and version detection (-sV)
In Lesson 1 the SERVICE column was only a guess based on the port number. -sV actually talks to each open port and identifies the software and its version:
nmap -sV -p 22,80 scanme.nmap.org
Instead of just "ssh" and "http", we now know the server runs OpenSSH 6.6.1p1 and Apache httpd 2.4.7 on Ubuntu. Version numbers are gold for a pentester: you can search them for known vulnerabilities (CVEs) on exploit-db.com or nvd.nist.gov.
Control how hard Nmap tries with --version-intensity (0 is light and fast, 9 tries every probe):
nmap -sV --version-intensity 9 192.168.56.101
OS detection (-O)
Nmap can guess the operating system from tiny differences in how each OS builds its TCP/IP packets. It needs root, and it works best when the target has at least one open and one closed port.
sudo nmap -O 192.168.56.101
If Nmap isn't sure, add --osscan-guess to see its best guesses with a confidence percentage.
Aggressive scan (-A)
-A turns on OS detection, version detection, default scripts and traceroute in one go:
sudo nmap -A 192.168.56.101
It's handy in labs and CTFs, but it's loud. On a real engagement, run it only against ports you've already found.
Timing templates (-T0 to -T5)
- -T0 paranoid and -T1 sneaky – extremely slow, meant to stay under IDS thresholds
- -T2 polite – slows down to use less bandwidth
- -T3 normal – the default
- -T4 aggressive – faster; the usual choice on a decent network and in labs
- -T5 insane – very fast, but it can miss ports on slow networks
nmap -T4 -sV 192.168.56.101
Simple words mein (Hinglish)
-sS (SYN scan) handshake poora nahi karta, isliye fast hai, lekin sudo chahiye. -sT poora connection banata hai aur bina sudo ke chal jata hai. UDP ports ke liye -sU use karo. -sV se exact software version pata chalta hai, -O se operating system ka guess milta hai, aur -A sab kuch ek saath karta hai. Speed ke liye -T4 sabse common choice hai.
FAQ
What is the difference between -sS and -sT in Nmap? -sS sends a SYN and never completes the handshake (it needs root). -sT makes a full TCP connection (no root needed) and is more likely to be logged.
Why is an Nmap UDP scan so slow? Open UDP ports often send no reply, and closed ports answer slowly because most systems rate-limit ICMP errors, so Nmap has to wait and retry.
What does nmap -A do? It enables OS detection, version detection, default NSE scripts and traceroute.
Is a SYN scan really stealthy? Not against modern defences. Firewalls and IDS such as Snort and Suricata detect it easily.
Practice task
- Run nmap -sV on scanme.nmap.org and write down every version
- In your lab, compare sudo nmap -sS and nmap -sT on the same target with -v
- Run sudo nmap -O on a machine you own and check whether Nmap guessed the OS correctly
Next lesson: the Nmap Scripting Engine – 600+ scripts that turn Nmap into a vulnerability scanner.