UnixDroid

Lesson 4 of 6 · 8 min

Step 4: the TCP handshake (the one everyone skips)

SYN, SYN-ACK, ACK: understand the handshake and you understand what Nmap's default scan is really doing.

This is the step beginners skip, and it's why their scan results make no sense.

A normal TCP connection

Before any data moves, two machines do a three-way handshake:

  1. SYN: you say "I want to connect."
  2. SYN-ACK: the target says "OK, I'm listening."
  3. ACK: you say "Great, connected."

What Nmap's default scan does

When you run Nmap with root privileges, the default is a SYN scan (-sS), also called a half-open scan:

  1. Nmap sends SYN.
  2. If the target replies SYN-ACK, the port is open.
  3. Nmap never sends the final ACK. It sends a reset (RST) instead, so no full connection is made.

If the target replies RST, the port is closed. If nothing comes back, the port is probably filtered by a firewall.

sudo nmap -sS 10.0.2.5    # SYN scan (needs root)
nmap -sT 10.0.2.5         # full connect scan (no root needed)

Without root, Nmap can't craft raw packets, so it falls back to a connect scan (-sT), which completes the full handshake.

Watch it happen

Run Wireshark in your lab while you scan, and filter with tcp.flags.syn == 1. Seeing the packets once makes this click forever. Start with Capture your first packets with Wireshark.

Try it yourself
  1. Start a Wireshark capture in your lab.
  2. Run sudo nmap -sS against your target.
  3. Find one open port and spot the SYN → SYN-ACK → RST sequence.
No Linux machine? Practise in the free online terminal

Quick check

Nmap's default scan as root is called a ___ scan (three letters)

Need a hint?

The first packet of the handshake.

Finished this lesson?

Done lessons keep your daily streak going 🔥

0 day streak

0 lessons done

best 0 days

Log in to keep your streak on every device →