Course contentsShow
← Security
Lesson 377 of 3,0529. Network Security - Traffic AnalysisFree lesson

TCP Stream Analysis and Session Reconstruction

Follow TCP streams, reconstruct sessions, analyze handshakes, and understand connection establishment and teardown.

TCP Stream Analysis and Session Reconstruction

You'll learn how to follow entire conversations between two computers by reconstructing TCP streams from captured packets.

When you capture network traffic with Wireshark, you see individual packets flying by—like catching glimpses of single letters in a conversation. But TCP connections aren't just isolated packets; they're complete exchanges between a client and server. Stream analysis lets you reassemble these fragments into readable, chronological sessions.

What Is a TCP Stream?

A TCP stream is the full bidirectional communication between two endpoints (identified by IP addresses and ports). Think of it like a phone call: individual sound waves are packets, but the entire conversation from "Hello" to "Goodbye" is the stream.

How Stream Reconstruction Works

TCP uses sequence numbers to order packets correctly, even if they arrive out of order. Wireshark uses these numbers to:

  1. Group related packets (same source/destination IPs and ports)
  2. Sort them chronologically using sequence numbers
  3. Reassemble the payload into readable data

Analyzing the Three-Way Handshake

Every TCP connection begins with a handshake:

  • SYN: Client requests connection
  • SYN-ACK: Server acknowledges and agrees
  • ACK: Client confirms

This establishes sequence numbers and prepares both sides for data exchange.

Session Teardown

Connections close gracefully with:

  • FIN: One side signals "I'm done sending"
  • ACK: Other side acknowledges
  • Repeat from the other direction

Or abruptly with a RST (reset) packet when something goes wrong.

In Wireshark

Right-click any packet → "Follow" → "TCP Stream" reconstructs the entire conversation in a readable window, showing what both sides sent in order—perfect for analyzing HTTP requests, protocols, or detecting data exfiltration.

Key Takeaway: TCP stream analysis transforms fragmented packets into complete sessions, revealing the full conversation between client and server by following handshakes, data exchange, and teardowns.