Menu

Your 2FA isn't safe: how session hijacking (pass-the-cookie) works and how to stop it
📰

Your 2FA isn't safe: how session hijacking (pass-the-cookie) works and how to stop it

DEV Community: azure·CD Security Lab·about 10 hours ago
#tWVTZUrC
#devtoazure#devto#dev#cookie#microsoft
Reading 0:00
15s threshold

Your account has a strong password. It has 2FA turned on. And an attacker can still walk straight in without either of them.

The trick is called session hijacking , also known as pass-the-cookie or token theft . In the one-minute video above I show it on two of my own test accounts, in two browsers, with nothing more than the browser's own developer tools. This post explains what is happening and, more importantly, how to defend against it.

For learning only. Never use this against accounts that are not yours.

Why the password and the 2FA code don't matter here

When you sign in, the site checks your password and your 2FA code once . Then it hands your browser a session cookie : a long random value that says "this browser already proved who it is". Every page you open after that sends the cookie, and the site lets you in without asking again.

Think of a wristband at a theme park.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.