Security operations

Session Hijacking Techniques: How Attackers Steal Logins in 2026

A stolen session cookie is worth as much as the password and MFA code that created it. Here is how attackers steal sessions — and how to make a stolen cookie useless.

Cysoro Security TeamPublished · 8 min read
SECURITY OPERATIONSSessionhijackingtechniquesHow stolen cookies bypass MFA — and stop itYou log in ✓ MFA passedSession cookie issuedAttacker copies cookieNo password. No MFA prompt.Fix: bind it to the deviceStolen cookie becomes useless
Quick answer

Session hijacking is the theft and reuse of a logged-in session token, usually a cookie, so an attacker can act as the victim without a password or MFA prompt. The main techniques are infostealer malware, adversary-in-the-middle phishing, cross-site scripting, network sniffing, session fixation and predictable session IDs. The strongest defenses are phishing-resistant MFA, HttpOnly and Secure cookies, short sessions, device-bound sessions and replay detection.

Key takeaways

  • A session cookie is temporarily as powerful as the login that created it, including MFA.
  • Infostealer malware and adversary-in-the-middle phishing are now the dominant session-theft routes.
  • Short sessions help, but binding a session to the device that earned it is what makes a stolen cookie useless.

You log in once, with a password and a second factor, and the site remembers you. That memory is a session cookie — and if an attacker copies it, they do not need your password at all. They simply present the cookie and the site treats them as you.

What is session hijacking?

Session hijacking is the takeover of an authenticated session by someone who obtained the token proving the user already logged in. The attacker skips the login page entirely, and with it the password check and the MFA prompt.

HTTP has no memory between requests. After a successful login, the server sends the browser a random identifier in a Set-Cookie header, and the browser returns it with every later request. OWASP puts it plainly: once a session exists, its ID is temporarily equivalent to the strongest authentication method used by the application.

MITRE ATT&CK splits the attack in two. The theft is T1539: Steal Web Session Cookie, and the reuse is T1550.004: Web Session Cookie, which MITRE says bypasses some MFA protocols because the session is already authenticated.

How does a login session work?

A session has four steps: you sign in, the site issues a cookie, your browser sends it back on every request, and the server trusts it. The cookie is the only proof the server checks after login, which is why stealing it is so valuable.

Most sessions are cookies, but the same idea applies to access and refresh tokens in apps and single sign-on. The token may live in a cookie store on disk, in browser memory, or in local storage. Wherever it lives, whoever holds a valid copy is treated as the account owner until the token expires or is revoked.

How a session is created — and replayed1. You log inpassword + MFAchecked once2. Cookie issuedrandom session IDstored in browser3. Copy leavesmalware, proxy,script or leak4. Replayattacker presentsthe same cookieThe server sees a valid session. No password. No MFA prompt.Defense sits at step 3 (stop the copy leaving) and step 4 (make it useless elsewhere).
The four steps of session hijacking. Illustration by Cysoro.

What are the main session hijacking techniques?

OWASP lists five ways a session token leaks: a predictable identifier, sniffing it on the network, client-side attacks such as cross-site scripting, man-in-the-middle interception, and man-in-the-browser malware. In practice, three routes dominate in 2026.

TechniqueWhat is stolenMain preconditionKey defense
Infostealer malwareBrowser cookie storesUser runs malwareDevice-bound sessions, EDR
Adversary-in-the-middleCookie after real MFASign-in via fake proxyPasskeys, FIDO2
Cross-site scriptingCookies readable by scriptInjection flaw in appHttpOnly, CSP
Network sniffingCookie in clear textPlain HTTP trafficHTTPS, Secure flag
Session fixationPre-planted session IDID kept after loginRegenerate ID on login
Predictable IDsGuessed session IDWeak randomness128-bit CSPRNG

How does infostealer malware steal sessions?

Infostealer malware is the largest source of stolen sessions today. A victim runs a disguised file, often a fake software crack, invoice or sponsorship brief, and the malware copies cookie stores and saved passwords from every browser on the machine.

One infection can capture sessions for every site the browser is logged into, including ones protected by two-factor authentication. The stolen cookies are then sold or traded in bulk: one threat-intelligence count found nearly 94 billion stolen cookies advertised in Telegram channels in April 2025, with about one in five still active.

Stolen cookies keep working even after the malware is detected and removed, because the session on the server is still valid. That is why cleaning the device alone is not enough: you must also revoke sessions and change passwords. If you suspect your credentials were exposed, check them with our free pwned password checker.

What is adversary-in-the-middle phishing?

Adversary-in-the-middle phishing, or AiTM, steals the token in transit. Instead of a static fake login page, the attacker runs a reverse proxy that relays traffic between the victim and the real site, so the victim completes a genuine login, including the second factor.

The proxy keeps the session cookie the real site issues. MITRE lists open-source tools such as Evilginx2 and Muraena that do this, and notes that session cookies can bypass some MFA protocols. The victim sees the real site working normally, which makes this attack hard to spot.

Phishing-resistant MFA is the main defense. Passkeys and FIDO2 security keys are bound to the real website, so a fake login page cannot reuse them. One-time codes and push approvals, by contrast, pass straight through the proxy. Our guide to spear phishing explains how these lures reach victims in the first place.

How does cross-site scripting steal sessions?

Cross-site scripting, or XSS, lets an attacker run JavaScript inside a victim's session on a vulnerable site. That script can read document.cookie and send the value to the attacker, all without the victim doing anything unusual.

The HttpOnly cookie flag blocks exactly this read: a cookie marked HttpOnly cannot be accessed by JavaScript. That is why every session cookie should carry it. Output encoding, Content Security Policy and keeping tokens out of localStorage are the other layers, because HttpOnly does not help if the token sits in web storage that scripts can read.

Server-side memory leaks are a related route. The CitrixBleed flaw, CVE-2023-4966, let unauthenticated attackers read session tokens from the memory of Citrix NetScaler gateways, and those tokens were then replayed to hijack sessions. Patching gateways matters as much as patching apps.

What about sniffing, fixation and predictable IDs?

Network sniffing is the oldest route: over plain HTTP, the cookie travels in clear text and anyone on the same network path can read it. HTTPS everywhere plus the Secure flag has largely closed it, which is why it is now rare — but any page still served over HTTP reopens it.

Session fixation works the other way round. The attacker plants a session ID they already know in the victim's browser before login. If the site keeps the same ID after authentication, the attacker's copy becomes a logged-in session. The fix is mandatory: regenerate the session ID on login and on every privilege change.

Predictable IDs are a design failure. OWASP requires session identifiers to have at least 64 bits of entropy from a secure random generator, and recommends 128 bits or more for tokens you generate yourself. Short or patterned IDs can be guessed, and IDs in URLs leak through history, logs and referrer headers.

How do you detect session hijacking?

The theft is often invisible; the replay is where it shows. Watch for one session used from a new IP address, network, user agent or device, especially a session that suddenly appears in another country minutes after a legitimate login.

  • Impossible travel: the same session in two distant locations within minutes.
  • New device signals: an unfamiliar user agent, ASN or device fingerprint on an old session.
  • Account changes: a new recovery email, a changed password, or new mail-forwarding rules.
  • Unfamiliar activity: purchases, messages or admin actions the owner does not recognize.
  • Security alerts: new sign-in notifications for a session nobody started.

For teams, the practical control is continuous evaluation: re-check the session's IP, device and risk signals on sensitive actions, not just at login. If anything looks wrong, step the user up to re-authentication and revoke the session.

The session hijacking defence guide covers the same ground for SSO, SaaS and remote-access gateways, including memory-leak flaws such as CitrixBleed that expose tokens server-side.

How can users protect themselves?

Users cannot fix a website's session handling, but they can shrink the ways a cookie leaves their device. The highest-value habits are keeping the device clean, using phishing-resistant login, and treating session alerts seriously.

  • Use passkeys or a security key where the site offers them, so phishing proxies cannot capture a usable login.
  • Do not run untrusted downloads or paste commands from strangers; infostealers arrive as cracks, invoices and job offers.
  • Keep the browser and OS updated and run reputable endpoint protection, especially on devices used for work.
  • Sign out of shared or public devices and use the site's sign-out-everywhere option after any scare.
  • Check active sessions regularly in Google, Microsoft 365 and other major accounts, and revoke anything unfamiliar.

What should developers and site owners do?

Most of the protection is in how the site issues and handles sessions. The OWASP Session Management Cheat Sheet sets these as baseline requirements, and they are worth treating as a checklist rather than guidance.

Session defenses that actually workHttpOnly + Secure + SameSite on every session cookieNew session ID on login and privilege changeShort lifetimes: 15-minute idle timeout, 30-day maximumBind the session to the device (token binding / DBSC)Detect replay: new IP, device or location triggers re-auth
Layered session controls, from cookie flags to device binding. Illustration by Cysoro.

Set cookies with HttpOnly, Secure and SameSite attributes, and prefer the __Host- prefix so the cookie is bound to your domain and path. Generate IDs with a cryptographically secure random generator, regenerate them on login, and set a short idle timeout with an absolute maximum lifetime.

Then go further: bind sessions to the device where your platform supports it, such as token protection or Device Bound Session Credentials, so a stolen cookie is useless elsewhere. Log session creation and replay signals, and give users a visible list of active sessions with a revoke-all button. Verify your TLS setup with our free SSL checker as part of the same review.

What should you do if a session was hijacked?

Act within minutes. Revoke every session, change the password from a clean device, and check for persistence the attacker may have set up. Speed matters because a live session lets the attacker change recovery options and lock you out.

  1. Revoke all sessions from the account security page, or ask the provider to do it.
  2. Change the password from a trusted device, and check for new recovery emails, phone numbers and MFA devices.
  3. Check mail rules and forwarding, connected apps and API tokens the attacker may have added.
  4. Clean the device with a full malware scan; if it was an infostealer, assume saved passwords were copied too.
  5. Tell your IT or security team and report the incident, especially if work accounts were involved.
Do not just change the passwordChanging the password alone does not always kill an existing session. Revoke sessions first, then change the password, or the attacker can keep using the stolen cookie.

The bottom line

Session hijacking works because the cookie is the credential after login. Infostealers and phishing proxies have made stealing it easier than guessing a password, and ordinary MFA does not stop the replay.

The fix is layered: phishing-resistant login, HttpOnly and Secure cookies, fresh session IDs, short lifetimes, device binding and replay detection. Start by reviewing your own accounts' active sessions today, and check your site's headers with the free security headers checker.

Frequently asked questions

What is session hijacking in simple terms?

Session hijacking is when an attacker copies the token a website gave your browser after you logged in, usually a cookie, and uses that copy to act as you. The site sees a valid session, so it does not ask for a password or a second factor.

Does two-factor authentication stop session hijacking?

No, not on its own. MFA is checked at login, and the session cookie is issued after that check. A stolen cookie bypasses MFA. Phishing-resistant MFA such as passkeys helps because it stops the phishing step, but device-bound sessions are the control that makes a stolen cookie useless.

How do I know if my session was hijacked?

Look for logins from a new location or device, password or recovery-email changes you did not make, new mail-forwarding rules, unfamiliar active sessions, and security alerts about a new sign-in. Revoke all sessions and change your password if you see any of these.

What is pass-the-cookie?

Pass-the-cookie is MITRE technique T1550.004: reusing a stolen web session cookie to authenticate as the victim. It is the reuse step that follows the theft step, T1539, and it works because the cookie is already authenticated.

Can session hijacking happen on public Wi-Fi?

It used to be common on public Wi-Fi when sites sent cookies over plain HTTP. HTTPS everywhere and the Secure cookie flag have largely closed that route, which is why attackers now prefer malware and phishing proxies instead.

How long does a stolen session cookie work?

Until it expires or is revoked. Some sessions last hours, others weeks, and persistent cookies can last far longer. Chrome has capped cookie lifetime at 400 days since version 104, but a stolen cookie is usually used within hours.

Should I clear cookies to stop session hijacking?

Clearing cookies ends your own sessions, which can cut off a stolen copy if the server also invalidates it, but it does not remove malware or fix a compromised account. Change your password, revoke all sessions and clean the device as well.

Sources

  1. OWASP — Session Management Cheat Sheet
  2. MITRE ATT&CK — T1539: Steal Web Session Cookie
  3. MITRE ATT&CK — T1550.004: Web Session Cookie
  4. NHI Mgmt Group — Session Hijacking and Cookie Theft: Defence Guide
  5. Larely Learn — Session Hijacking: How Attackers Steal Logins and How to Stop It
Written & fact-checked byCysoro Security Team

The engineers and analysts who build Cysoro's domain scanner, email-authentication checks and free security tools. We test what we write about every day — SPF, DKIM, DMARC, certificates, look-alike domains and phishing — and check each guide against the relevant standards, government guidance and vendor documentation.

  • Email authentication
  • Phishing & BEC
  • Domain & DNS security
  • Small-business security

Checked against the OWASP Session Management Cheat Sheet and MITRE ATT&CK techniques T1539 and T1550.004.

How we write and fact-check →

See where your domain stands

Free for up to 3 domains. No card, no installs.

Start free