Explore our new Cybersecurity Terms Glossary, explained by our experts.
Cybersecurity Terms Glossary
SYN, SYN-ACK, ACK: three packets that establish a TCP connection and synchronise sequence numbers. Understanding them explains port scanning, SYN floods, and half-open states.

What Is the TCP Three-Way Handshake?
Before any data moves over TCP, the two ends agree that they are both present and willing, and they synchronise the sequence numbers they will use to order and acknowledge what follows. That agreement takes three packets, which is why it is called the three-way handshake. It is described in RFC 793, published in 1981 and updated by RFC 9293 in 2022, and almost every network behaviour a security engineer cares about follows from it.
SYN. The client sends a segment with the SYN flag set and an initial sequence number. That number must be unpredictable — a point returned to below — and the segment carries options including the maximum segment size, window scaling, and selective acknowledgement support.
SYN-ACK. The server replies with both SYN and ACK set, its own initial sequence number, and an acknowledgement of the client’s number plus one. At this point the server allocates state for a connection that is not yet established.
ACK. The client acknowledges the server’s sequence number. Both sides move to ESTABLISHED and data can flow.
Teardown is separate and takes four packets in the ordinary case, each side sending FIN and receiving ACK, because TCP connections are closed independently in each direction. A RST aborts immediately without that courtesy.
Port scanning is entirely a study of handshake responses.
A connect scan completes the handshake and then closes, which is reliable and gets logged by the application. A SYN scan, the default for Nmap when run with privileges, sends SYN, reads the response, and sends RST instead of the final ACK, so no connection is ever established and older logging never sees it. Variants such as FIN, NULL, and Xmas scans send flag combinations the specification does not define a response for, and infer state from what comes back — useful against some stacks, meaningless against Windows, which replies with RST regardless.
The asymmetry in the handshake is a denial of service opportunity. A server that receives SYN must allocate a structure to remember the half-open connection and wait, typically for tens of seconds, for an ACK that may never arrive. An attacker sends a flood of SYN packets with spoofed source addresses and never completes any of them. The backlog queue fills, and legitimate connection attempts are refused.
The elegant defence is SYN cookies, devised by Daniel Bernstein in 1996. Instead of storing state, the server encodes the connection parameters into the initial sequence number it returns, using a cryptographic function of the addresses, ports, and a secret. If a valid ACK arrives, the acknowledgement number contains the cookie and the server reconstructs the connection from it. No state is held, so there is nothing to exhaust. The cost is that some TCP options cannot be preserved, so cookies are usually enabled only when the backlog is under pressure, which is the default on Linux through net.ipv4.tcp_syncookies.
Modern SYN floods are often volumetric as well as state-exhausting, saturating the upstream link rather than the backlog, which needs upstream scrubbing rather than host tuning. The SYN flood remains one of the most common DDoS techniques precisely because it is cheap to generate.
If initial sequence numbers are predictable, an attacker who cannot see the traffic can still inject data into a connection or complete a spoofed handshake. Robert Morris described the attack in 1985, and Kevin Mitnick used it in 1994. RFC 6528 specifies generating initial sequence numbers from a hash of the connection tuple and a secret, which every current stack implements. The residual risk appears in long-lived connections, notably BGP sessions, where a blind RST injection can disrupt routing — which is why BGP sessions use TCP-AO or MD5 authentication and why the generalised TTL security mechanism exists.
Reading a packet capture is largely reading handshakes. A SYN with no reply points at a firewall or a dead host; a SYN followed immediately by RST points at a closed port or a service that has stopped; a completed handshake followed by a TLS alert points at a certificate or cipher mismatch rather than a network fault. Half-open connections in large numbers in netstat output indicate either an attack or a badly behaved client.
It also explains what QUIC changed: by merging the transport and cryptographic handshakes into one exchange over UDP, it removes a round trip and takes the sequence numbers out of plain view. Our Network Security Services start from exactly this layer when mapping what a perimeter really answers.
Each side must send its own initial sequence number and have it acknowledged, which requires two exchanges. The server combines its SYN with the acknowledgement of the client’s SYN into one packet, reducing four messages to three. The result is that both ends confirm the other is present and reachable before any data is sent.
A connection where the server has received a SYN and replied with SYN-ACK but has not received the final ACK. The server holds state waiting for it, usually for tens of seconds. Large numbers of half-open connections indicate either a SYN flood attack or clients that are disappearing mid-handshake, often because of a network problem.
Instead of allocating memory for a half-open connection, the server encodes the connection parameters into the initial sequence number it returns, using a cryptographic function of the addresses, ports, and a secret. If a valid ACK arrives, the server reconstructs the connection from the acknowledgement number. With no state held, there is nothing for a flood to exhaust.
Because the handshake is never completed. The scanner sends SYN, reads the SYN-ACK to learn the port is open, then sends RST rather than the final ACK. No connection reaches the application, so application logs record nothing. Firewalls and network monitoring see the attempt, which is why perimeter logging matters more than host logging for detecting scans.
You May Be Interested In These
We use a few cookies that are needed to make this website work, and they are always on. We would also like to set analytics cookies, to see which pages are useful; functional cookies, so that our live chat works; and advertising cookies, to measure our campaigns. We will not set any of those until you say yes, and you can change your mind at any time from the Cookie Settings link in the footer.
Choose the cookies you are happy for us to use. Strictly necessary cookies are always on; everything else is off until you turn it on.
These cookies keep the website working: they hold your security checks, your form submissions and the choice you make here. The site cannot run without them, so they are always on.
These let our live chat open and remember your conversation, and let the newsletter sign-up work. Switch them off and the chat window will not appear.
These tell us which pages are read and how people find us, so that we can improve the site. The reports are about groups of visitors, never about you personally.
These let us measure our advertising and show you our adverts on other websites, such as LinkedIn, Google and Meta. Switch them off and you will still see adverts, but they will be less relevant.