Security
Session hijacking: how stolen cookies bypass two-factor sign-in
Two-factor sign-in keeps most attackers out. But anyone who steals a valid session cookie is already inside: to the service, they look like someone who has just signed in properly.
In short
- After sign-in, a service remembers the session through a cookie or token; whoever holds it counts as signed in.
- Infostealers and fake sign-in pages that relay traffic capture such cookies and bypass the password and second factor.
- Countermeasures are short sessions, re-authentication for sensitive actions, binding to managed devices and ending all sessions immediately when in doubt.
What it is about
Many companies have introduced two-factor sign-in in recent years. That was the right move. Attackers have adapted and increasingly target the moment after sign-in: the session.
In November 2026, an open database with around two billion credentials came to light. According to WIRED, it contained cookies and session tokens as well as passwords. Our special issue on the data leak describes the find.
How it works
After a successful sign-in, the browser receives a session cookie or token. It presents it with every further click so you do not have to sign in again all the time. For the service, whoever has the cookie is signed in.
MITRE ATT&CK lists the theft of such cookies as a technique of its own. Two routes are particularly common:
- Infostealers read cookies directly from the browser of an infected device, see the article on infostealers.
- Fake sign-in pages that relay traffic pass password and code on to the real service and keep the cookie that comes back.
The OWASP cheat sheet on session management describes how applications protect themselves: random, long session identifiers, short lifetimes, a new identifier after sign-in and a proper sign-out that also ends the session on the server.
Where it goes wrong
Sessions without end. Many services keep users signed in for weeks. A stolen cookie then stays valuable for a long time.
SMS codes and app confirmations. They help against simple password attacks, but not against a fake page that relays everything live.
Password changed, session still running. Not every service ends all sessions when the password changes. The attacker stays inside.
Mailbox rules. After a takeover, attackers like to set up forwarding that keeps running after they are thrown out. If you use Microsoft 365, see the article on securing Microsoft 365.
How to proceed
1. Limit sessions. Maximum duration and sign-out after inactivity for email, cloud and admin interfaces. 2. Secure sensitive actions. Require re-authentication for payments, permission changes and new forwarding. 3. Bind devices. Where the service offers it, allow access only from managed devices or bind sessions to the device. 4. Sign in phishing-resistantly. Passkeys or security keys instead of SMS, see passwords, MFA and passkeys. 5. Know the emergency button. Who can end all sessions of an account, and how fast? This belongs in the response plan for leaked credentials.
How Airnite helps
In a penetration test, Airnite checks how your web applications and services handle sessions and advises on session rules, device binding and phishing-resistant sign-in. In our training courses, we show live how a fake sign-in page bypasses the second factor.
Checklist
Sources
Every fact in this article is based on the following publications. Primary sources are marked.
Matching services
Read on
Infostealers: how malware steals passwords and sessions from the browser
Many large data leaks are not caused by an attack on a company but by malware on individual computers. Infostealers quietly collect everything stored in the browser for sign-ins and sell it on.Security3 minPasswords, MFA and passkeys: what actually applies today
A new password with symbols every 90 days? That rule is officially dead. What counts instead is length, a second factor and, ideally, no password at all.Security3 minCredentials leaked: the response plan in the right order
A company account turns up in a data leak. The first reflex is to change the password quickly. That is right, but not enough on its own, and the order matters. This response plan shows the steps that really protect.Security3 minSecuring Microsoft 365: the basic settings attackers hate
For many companies, Microsoft 365 is the office: mail, files, Teams, calendar. Anyone who gets in with a password is sitting at the CEO's desk.Current incidents and warnings are covered in the Zero Day magazine. Go to the magazine