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

Man-in-the-Browser and Session Riding

Advanced attacks using malware to intercept sessions within the browser and ride active authenticated sessions.

Man-in-the-Browser and Session Riding

What you'll learn: How malware can silently hijack your authenticated browser sessions without stealing credentials.

The Core Idea

While session hijacking typically involves stealing session tokens (as covered in lesson 713), Man-in-the-Browser (MitB) attacks and Session Riding take exploitation to another level by operating inside your browser itself.

Man-in-the-Browser attacks use malware (trojans, browser extensions, or compromised plugins) installed directly on the victim's machine. This malware sits between the user and the browser, intercepting and modifying data in real-time after HTTPS decryption occurs. Unlike network sniffing, MitB sees everything in plain text because it operates after SSL/TLS has decoded the traffic.

Session Riding leverages an already-authenticated session. If you're logged into your bank in one tab, malware can make requests in the background using your active session—without needing your session token at all. The browser automatically includes your cookies with every request to that domain.

The Attack Flow

Think of it like a puppet master controlling your hands while you're already holding the keys to your house. You've authenticated legitimately—the malware just piggybacks on your active, trusted session.

The malware can:

  • Read form data before submission and exfiltrate it
  • Modify transaction amounts invisibly
  • Add unauthorized recipients to transfers
  • Execute actions as soon as you authenticate
  • Operate completely silently without triggering CSRF protections (since requests originate from the legitimate browser)

Unlike CSRF (lesson 642), which tricks you into making requests from an external site, Session Riding happens within your legitimate browsing context, making it nearly invisible to standard defenses.

Key Takeaway: Man-in-the-Browser malware and Session Riding bypass traditional session security by operating inside the trusted browser environment itself, exploiting active authenticated sessions without needing to steal tokens.