Course contentsShow
← Security
Lesson 716 of 3,05215. Web Security - Authentication and SessionsFree lesson

Session Sidejacking and Network Sniffing

Capturing session tokens over unencrypted connections using packet sniffing and network interception techniques.

Session Sidejacking and Network Sniffing

What you'll learn: How attackers capture session tokens by eavesdropping on unencrypted network traffic.


The Eavesdropping Problem

Session sidejacking (also called "cookie hijacking") occurs when an attacker intercepts session tokens traveling across a network. Unlike session fixation or prediction attacks, sidejacking doesn't require tricking the victim or guessing tokens—the attacker simply listens to network traffic and copies legitimate session identifiers as they pass by.

How Network Sniffing Enables Sidejacking

Think of unencrypted network traffic like postcards in the mail: anyone who handles them can read the message. When you connect to a website over plain HTTP (not HTTPS), your session cookies travel in plaintext across the network.

An attacker on the same network—like a coffee shop Wi-Fi, compromised router, or even your ISP—can use packet sniffing tools to capture this traffic. These tools record all data packets flowing through the network, including HTTP headers containing session cookies.

Once captured, the attacker extracts the session identifier from the intercepted traffic and places it in their own browser. The server now treats the attacker as the authenticated user because the stolen token is valid.

The Unencrypted Connection Vulnerability

This attack only works when traffic travels unencrypted. Key scenarios include:

  • Websites using HTTP instead of HTTPS
  • Mixed content (HTTPS pages loading HTTP resources)
  • Session cookies transmitted before HTTPS redirect
  • Public Wi-Fi networks where traffic monitoring is trivial

Real-World Attack Surface

Sidejacking became infamous through tools like Firesheep (2010), which allowed non-technical users to hijack sessions on public Wi-Fi with a single click, demonstrating how vulnerable unencrypted connections truly are.

Key Takeaway: Session sidejacking exploits unencrypted network connections to passively capture valid session tokens in transit—always use HTTPS with secure cookies to prevent eavesdropping attacks.