Cloudanix Achieves AWS Security Competency Status for Its CNAPP+ Platform and Just-in-Time Access Engine

What Is Session Hijacking? Token and Cookie Theft Explained

Session hijacking lets an attacker reuse a stolen cookie or token to act as you, often without a password or MFA prompt. Learn how it works and how to defend.

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

MethodHow it works
Infostealer malwareA 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 phishingA 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 interceptionIf 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 theftTokens 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 logsTokens 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 predictionWeak 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, HttpOnly and SameSite flags 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

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.

People Also Read

What Our Users Are Saying

Customer Reviews

Cloudanix is trusted by security leaders worldwide to deliver proactive, reliable, and cutting-edge cloud security.

One day, I changed the password of a root account, and my CTO called me within less than a minute to confirm if I did so. I was not expecting a reaction this quick. He told me Cloudanix alerted him of this password change and that he wanted to confirm as it was a critical security notification. I couldn't believe it!

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Compliance is one way of staying secure, but what I want is the ability to go deeper and attain 'true security.' Cloudanix provides us the capability to do so.

Vishal Madan
Vishal Madan
Head of Engineering, iMocha

Cloudanix is building for the future of the cloud, which makes the product all the more desirable.

Ritesh Agarwal
Ritesh Agarwal
CEO, Airgap Networks

Cloudanix gave us the visibility we were missing. Being able to move from permanent access to a robust Just-In-Time (JIT) workflow has fundamentally changed our security posture without slowing down our engineering velocity.

Pavan Kumar Lekkala
Pavan Kumar Lekkala
SRE Lead, HugoHub

We are excited to leverage Cloudanix's comprehensive multi-cloud DevSecOps solution to secure our production workloads on AWS. Cloudanix has demonstrated that it can solve many challenges that DevSecOps teams face while continually adding new features such as SOC2 compliance and drift detection.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Managing third-party partner access was once a major concern for our security posture. With Cloudanix JIT Cloud, we've effectively achieved zero third-party risk. We can now grant access confidently, knowing that it is temporary, audited, and automatically revoked, resulting in a 100% reduction in our privileged access exposure.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

The snooze feature and responsible alerts have helped us save time and prioritize what to tackle first.

Satish Mohan
Satish Mohan
Co-founder & CTO, Airgap Networks

Implementing Cloudanix JIT internally allowed us to practice what we preach. By eliminating permanent access to our own clouds and databases, we've neutralized the risk of standing privileges, ensuring our own 'keys to the kingdom' are never left exposed.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

The problem with permissions is a lot of times, the gaps are left open due to oversights from inside the organization itself. With Cloudanix's CIEM, we get a complete view of user permissions and access. This enables us to update the permissions, reducing the attack surface.

Nilesh Pethani
Nilesh Pethani
Application Architect, iMocha

In the world of Fintech, trust is our currency. Cloudanix provided the frictionless visibility we needed to secure our EKS workloads across AWS, ensuring we stay audit-ready for SOC2 and GDPR without slowing down our engineering velocity.

Amol Naik
Amol Naik
Head of Security & Infrastructure, HugoHub

Cloudanix delivered value within 5 minutes of onboarding. Continuous monitoring, timely detection, and excellent documentation helped us attain a great cloud security posture.

Divyanshu Shukla
Senior DevSecOps, Meesho

Technology strategies and business strategies are in a state of constant change which includes centralization and decentralization of responsibilities. Regardless of strategic shift, we still have intellectual property to protect. Cloudanix are critical partners for us in our public cloud security posture across our three cloud providers.

Jerry Locke
Jerry Locke
Senior Director Global Solutions Engineering, Eversana

Cloudanix has been amazing. They opened up a common Slack channel with us — and it feels like we are talking to our own team and getting things done with Cloud security. The support team is always available, friendly, helpful, and ready to go out of their way.

Satish Mohan
Satish Mohan
CTO, Airgap Networks

Beyond just access management, Cloudanix CSPM has given us a unified view of our AWS environment. The real-time alerting and anomaly detection allow us to prevent any untoward activity before it happens, which is critical for a marketplace connecting 50+ financial institutions.

Okesh Badhiye
Okesh Badhiye
Head of Technical Engineering, Finfinity

For a Fintech company, data is our most valuable — and most sensitive — asset. Cloudanix DAM hasn't just improved our visibility; it has given us control. The ability to mask data and prevent unauthorized queries in real-time is a game-changer for our compliance and customer trust.

Jiten Gala
Jiten Gala
President Engineering and Product, Kapittx

Our clients, especially in the Middle East financial sector, demand absolute accountability. Cloudanix JIT Cloud has been a competitive differentiator for us, allowing us to provide secure, governed access to customer accounts that meet their strictest audit and compliance requirements.

Girish Manghnani
Girish Manghnani
Managing Partner, Tech Inspira

Cloudanix is always on my team's lips because of its exceptional support. Be it a small or big query, Cloudanix has gone above and beyond to resolve them. This one's a keeper for us.

Sujit Karpe
Sujit Karpe
CTO, iMocha

For a long-lasting partnership, great support goes a long way. Cloudanix has delivered exceptional support whenever required. Their edge is their team is always ready to go beyond to solve any issues that we have. This speaks volumes about the culture at Cloudanix.

Akash Maheshwari
Akash Maheshwari
Co-founder, MoveInSync

Beyond the technology, Cloudanix feels like an extension of our own team. Their willingness to stand up a dedicated Middle East tenant for us and provide exceptional support at a sensible price makes them a long-term partner for Hugosave.

Surya Tamada
Surya Tamada
CTO, HugoHub

The real-time notifications that Cloudanix provides are a real lifesaver. Their adaptive notifications ensure that my team stays productive and doesn't get interrupted all the time.

Digvijay Singh
Staff Security Engineer, Meesho

The whole point in technological evolution is to help improve the world we live in. We must protect that and to do so requires an effective and efficient security strategy. The Cloudanix team helped make our public cloud security posture management strategy a reality. The symbiotic relationship we have allows for a continuous feedback loop which is how business should operate.

Larry Wheat
Larry Wheat
Staff Solutions Engineer, Eversana

Ready to see your graph?

Connect a cloud account in under 30 minutes. See every finding rooted in identity, asset, and blast radius — with a fix path attached.

Book a Demo