Session hijacking is an attack in which someone steals the proof that you are already signed in, usually a session cookie or an access token, and uses it to act as you. Because the attacker presents a session that has already passed authentication, they often do not need your password and may not face a multi-factor authentication (MFA) prompt at all.
This is why a stolen browser or a piece of information-stealing malware can be more dangerous than a stolen password. The password is the key to the front door. The session token is the wristband you are given after you have been checked in. Anyone who steals the wristband walks around the building as you.
This page explains what a session is, how tokens get stolen, why MFA does not always stop the attack, how to detect it, and the controls that reduce both the chance and the damage. It connects to our wider coverage of credential theft.
What a session is
When you sign in to a website or cloud console, the service checks your credentials and your second factor. It then gives your browser or application a small piece of data to carry on every later request. That data lets the service recognize you without asking you to sign in for every click.
- Session cookie. A small value stored by your browser and sent automatically to the website. Web applications usually use these.
- Access token. A credential, often a signed string, that an application presents to an API. Cloud and SaaS platforms use these through standards such as OAuth. A related refresh token can request new access tokens, so it lives longer.
- Cloud session credentials. In cloud platforms, signing in often produces temporary credentials, such as an access key, secret and session token, that are valid for a period of hours.
Sessions exist for good reasons. Without them, you would have to type a password and approve a prompt on every action. The trade-off is that whoever holds the session is treated as you until it expires or is revoked.
How session tokens get stolen
| Method | How it works |
|---|---|
| Infostealer malware | A program on the victim’s computer copies cookies, saved passwords and tokens from browsers and local files, then sends them to the attacker. This is the most common route today. See the Aokigahara infostealer. |
| Adversary-in-the-middle phishing | A fake login page sits between the victim and the real site. The victim types a password and approves the MFA prompt. The attacker’s server relays both to the real site and captures the resulting session cookie. |
| Cross-site scripting (XSS) | A flaw in a web application lets an attacker run script in the victim’s browser, which can read cookies that are not protected. |
| Network interception | If traffic is not encrypted, or a device trusts a hostile network, the token can be read in transit. TLS makes this much harder. |
| Local file and memory theft | Tokens stored in plain files, such as cloud command-line credentials or the contents of a developer’s home directory, are copied by anyone with access to the machine. |
| Leaked in code or logs | Tokens pasted into tickets, committed to repositories or written to logs can be found later. See secrets sprawl and secret redaction in logs. |
| Session fixation and prediction | Weak applications let an attacker set or guess the session identifier. This is rarer in modern frameworks. |
MITRE ATT&CK catalogs the behavior: Steal Web Session Cookie (T1539) for the theft, and Use Alternate Authentication Material (T1550) for the reuse, including the sub-technique for web session cookies.
Why MFA does not always stop it
MFA protects the sign-in step. Session hijacking happens after sign-in. By the time the attacker presents the cookie, the second factor has already been satisfied, by the real user, earlier.
Two cases are worth separating:
- Infostealer theft. The user signed in normally on their own machine. The malware copied the cookie afterward. No MFA prompt is involved on the attacker’s side, because the service sees a valid existing session.
- Adversary-in-the-middle phishing. The user is tricked into completing MFA on a fake page. Codes, push approvals and many one-time passwords can be relayed this way. This is the reason for phishing-resistant MFA, which ties the authentication to the real site so that a fake one cannot use it.
This does not mean MFA is pointless. It stops a large share of attacks, especially those that start with a leaked password. It means MFA reduces the chance of a stolen login, and does not on its own limit what a stolen session can do.
What an attacker can do with a hijacked session
Whatever the victim could do, for as long as the session lasts:
- Read mail and files in a productivity suite, and set forwarding rules to keep access
- Sign in to a cloud console, create access keys or new users, and change policies
- Reach source repositories, ticketing systems and chat
- Approve requests or reset other accounts, for example by using the victim’s mailbox
- Move on to more systems. See lateral movement in the cloud.
The damage depends mostly on how much standing access the hijacked identity holds. A session for an account with permanent administrator rights is a very different problem from a session for an account with read-only access. See blast radius.
How to detect session hijacking
Signs include:
- New device or browser fingerprint for an existing session
- Impossible travel: the same account active in two distant places within a short time. See the impossible travel detection use case.
- Session used from an unusual network, such as a hosting provider address or an anonymizing service
- Sensitive actions soon after sign-in that the user does not normally perform, such as creating keys, adding inbox rules or changing MFA settings
- A burst of API calls inconsistent with human behavior
- A sign-in that skips MFA when the user normally has to complete it
Behavioral detection helps here because the credentials are valid. See cloud UEBA and anomaly detection.
Example query for AWS CloudTrail logs in CloudWatch Logs, to find console sign-ins from many addresses for one user:
fields @timestamp, userIdentity.arn, sourceIPAddress
| filter eventName = "ConsoleLogin"
| stats count_distinct(sourceIPAddress) as ips, count() as logins by userIdentity.arn, bin(1d)
| sort ips desc
How to defend against session hijacking
Think in three groups: stop the theft, shorten the window, and limit the damage.
Stop the theft
- Protect endpoints. Use endpoint detection and response (EDR), keep operating systems and browsers patched, and restrict who can install software. Infostealers are the main source of stolen sessions.
- Use phishing-resistant MFA for administrators and for access to sensitive systems. See phishing-resistant MFA.
- Do not store credentials where malware can read them. Avoid saving work passwords in the browser. Keep cloud credentials out of plain files in the home directory, and prefer short-lived credentials.
- Secure web applications you build. Set the
Secure,HttpOnlyandSameSiteflags on session cookies, use TLS everywhere, regenerate session identifiers after login, and follow the OWASP Session Management Cheat Sheet.
Shorten the window
- Set shorter session lifetimes for sensitive applications, and require re-authentication before high-risk actions.
- Bind sessions to the device where the platform supports it, for example through device-bound session credentials or conditional access that requires a managed, compliant device.
- Use short-lived cloud credentials. A temporary credential valid for an hour is worth less than a key that never expires.
Limit the damage
- Remove standing privileges. If privileged access exists only when an approved request is active, a hijacked session of an idle administrator opens very little. See just-in-time access and zero standing privilege.
- Apply least privilege so the default access of every identity is small.
- Monitor and respond. Alert on the signs above, and have a procedure to revoke sessions fast.
How to revoke sessions
Changing a password does not always end an existing session. Revoke the session itself.
For Microsoft Entra ID, with Microsoft Graph PowerShell:
Connect-MgGraph -Scopes "User.ReadWrite.All"
Revoke-MgUserSignInSession -UserId user@yourcompany.com
For an AWS identity, attach a deny policy for credentials issued before a chosen time. This is what the console’s “Revoke active sessions” action does:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"Action": "*",
"Resource": "*",
"Condition": { "DateLessThan": { "aws:TokenIssueTime": "2026-11-17T09:00:00Z" } }
}]
}
Then rotate the underlying credentials and review what the account did during the exposure window.
How Cloudanix helps
Cloudanix does not detect infostealers on endpoints, and it does not replace EDR or phishing-resistant MFA. It reduces what a hijacked session can do, and helps you notice misuse.
- Less to steal. Cloud JIT removes standing administrator access to AWS, Azure and GCP. People request access for a reason and a duration, and the grant revokes itself. A hijacked session belonging to someone with no active grant opens little. Database JIT, VM JIT and Kubernetes JIT apply the same model to databases, servers and clusters, with identity-stamped audit logs written to storage you own.
- Fewer long-lived credentials. Agentic JIT and Coding Agent JIT give pipelines and AI agents credentials that last for a task, not months.
- Noticing misuse. Cloud UEBA and cloud detection and response look for identities behaving unlike themselves.
- Knowing the exposure. CIEM shows which identities hold powerful permissions, so you know which sessions would be most damaging if stolen.
See how this plays out in Operation Endgame and 6.4 million stolen logins.
Further reading
- MITRE ATT&CK: Steal Web Session Cookie (T1539)
- MITRE ATT&CK: Use Alternate Authentication Material (T1550)
- OWASP Session Management Cheat Sheet
- NIST SP 800-63B: Digital Identity Guidelines, Authentication and Lifecycle Management
Frequently asked questions
What is session hijacking?
It is an attack in which someone steals and reuses a valid session cookie or token to act as an authenticated user, often without needing the password or passing a new MFA check.
Can session hijacking bypass MFA?
It can bypass the MFA step, because the stolen session has already passed it. MFA still blocks many other attacks. Phishing-resistant MFA and shorter, device-bound sessions reduce this risk.
What is the difference between session hijacking and credential stuffing?
Credential stuffing tries stolen username and password pairs against many sites. Session hijacking reuses a live session after sign-in, so passwords are not involved.
How do infostealers relate to session hijacking?
Infostealers are malware that copy cookies, tokens and saved passwords from a device. They are the most common supply of stolen sessions.
What should I do if I suspect a hijacked session?
Revoke all active sessions for the account, reset credentials, rotate any keys it could reach, review the account’s activity back to the earliest plausible date, and check the user’s device for malware.