CPSA ยท Network protocols and filtering
TCP and UDP: how ports answer probes
Three-way handshake, flags, resets, UDP statelessness, and how open, closed and filtered ports respond.
Key points
- TCP opens with SYN, SYN/ACK, ACK.
- To a SYN, an open port replies SYN/ACK, a closed port replies RST, and a filtered port stays silent or returns an ICMP unreachable.
- UDP has no handshake: an open service may reply with data, a closed port usually triggers ICMP port unreachable, and silence means open or filtered.
Source: https://nmap.org/book/man-port-scanning-techniques.html
Practice questions
Which segment does the client send first in a TCP three-way handshake?
- ACK
- SYN
- SYN/ACK
- FIN
Show answer
Answer: B. SYN
The client starts with SYN, the server answers SYN/ACK, and the client finishes with ACK. A bare ACK or FIN as an opener would be treated as stray traffic.
Which statements about UDP port scanning are correct?
- A data reply from the service shows the port is open
- ICMP port unreachable (type 3 code 3) indicates closed
- No response leaves the port open or filtered
- A TCP RST is the standard reply from a closed UDP port
- A SYN/ACK confirms the UDP port is open
Show answer
Answer: A. A data reply from the service shows the port is open, B. ICMP port unreachable (type 3 code 3) indicates closed, C. No response leaves the port open or filtered
UDP has no handshake, so an open service may reply with data, a closed port normally yields ICMP port unreachable (type 3 code 3), and total silence is ambiguous (open or filtered). A RST is a TCP reaction and does not signal a closed UDP port.
True or false: if a UDP probe gets no response at all, the port is certainly open.
Show answer
Answer: False
False. Silence is ambiguous: an open service may simply not answer an empty probe, and a firewall may be dropping the packet, so the state is open or filtered.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
