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

Session Hijacking via MITM

Stealing session tokens and cookies from intercepted traffic to impersonate authenticated users.

Session Hijacking via MITM

What you'll learn: How attackers use man-in-the-middle positioning to steal session tokens and impersonate authenticated users.

The Core Idea

Once you've achieved a man-in-the-middle position (using techniques like ARP spoofing or SSL stripping), you're positioned to intercept all traffic flowing between a victim and a web server. The real prize? Session tokens and cookies that prove a user is already authenticated.

When you log into a website, the server gives your browser a session cookie (like a temporary digital ID badge). Your browser sends this cookie with every subsequent request to prove "I'm still the logged-in user." If an attacker intercepts this cookie, they can copy it into their own browser and suddenly they become you—no password needed.

How It Works

  1. Position yourself as MITM using previously learned techniques (ARP poisoning, rogue gateway, etc.)
  2. Capture traffic with tools like Wireshark as it passes through your system
  3. Extract session identifiers from HTTP headers, cookies (Set-Cookie: and Cookie: headers), or authentication tokens
  4. Replay the session by injecting those cookies into your own browser or crafting requests with the stolen tokens

This is particularly effective against unencrypted HTTP traffic or connections you've stripped of SSL protection. Even with TLS, if you've successfully positioned a certificate substitution MITM, you can decrypt and extract these tokens in real-time.

The Danger

The victim remains logged in and unaware. You gain full access to their account without triggering password alerts or 2FA challenges—because from the server's perspective, you are the legitimate session.

Key Takeaway: Session hijacking via MITM transforms passive traffic interception into active account takeover by stealing the authentication tokens that servers use to recognize logged-in users.