Master the fundamental concepts of tcp/ip from scratch through this focused micro-challenge.
TCP is connection-oriented. Before data flows to port 443, both sides complete a three-step dance. For example, a client with ISN 1000 connects to a server with ISN 5000:
1000, SYN flag set. State: CLOSED -> SYN_SENT5000, ACK=1001, SYN+ACK flags. State: LISTEN -> SYN_RECEIVED1001, ACK=5001, ACK flag only. Both sides reach ESTABLISHEDClient: CLOSED -> SYN_SENT -> ESTABLISHED
Server: CLOSED -> LISTEN -> SYN_RECEIVED -> ESTABLISHED
Each side picks a random 32-bit ISN. The ACK number always equals the peer's sequence plus one because the SYN itself consumes one sequence number.
The handshake confirms both sides can send and receive. A stale delayed SYN fails because the ACK number will not match any live connection. SYN flood attacks exploit the half-open SYN_RECEIVED state, which is why Linux ships SYN cookies as a defense.
This task asks you to simulate the handshake with printed segments and state transitions. The Linux kernel's tcp_v4_syn_recv() implements exactly this state machine, and nmap's SYN scan reads these same flag bytes without completing the handshake. Kevin Mitnick's 1994 ISN-prediction attack against Tsutomu Shimomura targeted the random sequence number chosen during step one of this exact exchange.
Implement a simulation of the TCP 3-way handshake.
Requirements:
Three hints are available for this task, revealed one at a time inside the code workspace so you can struggle productively before seeing them.
Every task includes starter code, theory, and hidden tests so you can implement and verify locally in the browser.
How it works