Short Answer Session hijacking is a cyber security attack in which someone steals or guesses your session token and uses it to act as you online. They do not need your password or OTP. A session is the time you stay signed in after you log in. The session token is a secret code that the website gives your browser so it remembers you. The browser often keeps it in a small file called a cookie. Think of it like someone picking up your visitor badge after you have already passed the front desk.
What is Session Hijacking?
Every time you sign in to email, a bank site or a company app, the website checks your password and often an OTP. After that, it does not ask again on every click. Instead, it hands your browser a session token. Your browser then shows this token every time you click or open a new page, and the website says, “Yes, this is you.”
Session hijacking is the theft of that token. If an attacker copies it and puts it into their own browser, the website sees a valid token and lets them in. So the attacker never needs your password. In fact, they often skip the OTP too, because you already passed that check when you signed in.
People also call it cookie hijacking, token theft or session stealing. In networking courses, you may also see the older name “TCP session hijacking”. TCP is one of the basic rules computers use to talk over a network, and this older attack took over that connection. However, most attacks today target the web session token, so this page focuses on that.
Key Words to Know
- Session: the period during which a website remembers that you signed in.
- Session token: a long, random code that proves you already signed in. Whoever holds it looks like you.
- Cookie: a small piece of data that a website stores in your browser. Websites often keep the session token in a cookie.
- Token replay: using a stolen token again from another device, a term Microsoft uses.
- Sign-out: ending the session, so the website stops accepting the old token.
How Does Session Hijacking Work?
Most session hijacking follows the same pattern. The goal is to get the token and reuse it before it expires.
- You sign in: you enter your password and OTP. The website then gives your browser a session token.
- The attacker gets the token: for example, harmful software on your PC copies your browser cookies. Other routes include a fake login page that looks real, quietly forwards your password and OTP to the real site, and keeps the token. A bad script, which is a small hidden program on a weak website, can also leak it, and so can an unsafe public Wi-Fi network.
- Reuse from elsewhere: the attacker loads your token into their own browser, often from another city or country.
- The website trusts it: because the token is valid, the website treats the attacker as you. They can then read mail, change settings or send payments.
Very often, the token thief is a kind of malware, or harmful software, called an info-stealer. It quietly collects saved passwords and browser cookies, then sends them to the attacker. As a result, one infected laptop can expose every site where the user is still signed in.

A Session Hijacking Example From a Delhi CA Firm
For example, a partner at a chartered accountant (CA) firm in Delhi signs in to the firm’s cloud email on her laptop. A week earlier, she installed a “PDF converter” from an unknown website. That program was an info-stealer. So it copies her browser cookie and sends it to the attacker. Two hours later, someone opens her mailbox from another city and starts reading client tax files. Then the firm’s sign-in system raises an alert about an unusual location. Next, the IT team ends all her active sessions, resets her password, sets up her OTP app again and wipes the laptop. Finally, they check her mailbox for rules that quietly send copies of her mail to an outside address.
When a stolen session leads to full control of a person’s account, security teams call it an account takeover. Session hijacking is one of the quickest routes to it.
Types of Session Hijacking
The table below lists the common types of session hijacking.
| Type | What Happens |
|---|---|
| Cookie or token theft | Harmful software on the device copies the session cookie from the browser. |
| Session sniffing | Someone on an unsafe network reads traffic that is not encrypted and spots the token. |
| Sidejacking | A type of sniffing where the site locks only the login page. Later pages are not locked, so the token leaks after you sign in. |
| Cross-site scripting | A bad script hidden on a weak website runs in your browser and reads your token. |
| Session fixation | The attacker sends you a link that carries a token they chose. You sign in through it, and the site keeps that same token, so the attacker can use it too. |
| Man-in-the-browser | Harmful software inside the browser changes what you see and do while you stay signed in. |
Cross-site scripting depends on a coding flaw in the website, not on your device.
Active vs Passive Session Hijacking
In passive session hijacking, the attacker only watches. For instance, they quietly read your mail or files and change nothing, so you do not notice. Your data is still exposed. In active session hijacking, the attacker takes over and acts as you, for example by changing a bank account number on an invoice. Both start with the same stolen token.
Session Hijacking vs Man in the Middle Attack
A man-in-the-middle attack (MITM) puts the attacker between you and the website while you talk, so they can read or change the traffic. Session hijacking, in contrast, takes over a session that already exists. The attacker does not need to stay in the middle.
Some attacks do both. For example, a fake login page can sit between you and the real site. It passes your password and OTP through, then keeps the session token it gets back. Microsoft calls this adversary-in-the-middle phishing, because the fake page sits in the middle. It is a common way to steal sessions from people who use a second sign-in step.
| Question | Man-in-the-Middle Attack | Session Hijacking |
|---|---|---|
| Main goal | Read or change traffic between two sides | Take over a signed-in session |
| Timing | While the conversation is happening | Any time before the token expires |
| Where it happens | On the network path | On the device, the website or the network |
| Password needed? | Sometimes captured on the way | No, the token is enough |
Why a Second Sign-In Step is Not Enough
Multi-factor authentication (MFA) asks for a second proof, such as an OTP or a phone prompt, when you sign in. It stops many password attacks. However, MFA protects the moment of sign-in, and the session token comes after that moment. So once an attacker holds a valid token, the website usually does not ask for MFA again.
Here is an everyday office case. At the same Delhi CA firm, a junior accountant signs in to the firm’s client portal on the shared reception PC and walks away without signing out. Anyone who sits down next can use the open session. They need no password, OTP or hacking skill. To prevent this, sign out, lock the screen and keep session times short on shared PCs.
For this reason, security teams now ask for phishing-resistant MFA. Examples are passkeys, which let you sign in with your phone’s fingerprint or face check, and security keys, which are small USB devices. These methods only work on the real website, so a fake login page cannot catch the sign-in. Even so, they cannot protect a token that malware copies later. The next section covers that gap.
Talk to an ExpertCould a stolen browser cookie open your company mail? Talk to our team about session hijacking.Ways to Prevent Session Hijacking
No single control stops every stolen session. Instead, good protection uses layers. Staff make tokens harder to steal, and the company makes stolen tokens hard to use.
What Staff Can Do
- Sign out on shared PCs: always sign out and lock the screen when you leave a shared or public computer.
- Avoid unknown Wi-Fi: on cafe, hotel or airport Wi-Fi, use the company VPN (a secure tunnel to the office network) or your phone’s own data.
- Install only approved software: unknown converters and cracked programs often carry info-stealers.
- Keep the browser updated: updates close the flaws that harmful scripts use.
- Act on sign-in alerts: if you get an alert about a place or device you do not know, tell IT at once.
What Companies Can Do
- HTTPS everywhere: encrypt every page, not just the login page, so no one can read tokens on the network.
- Safe cookie settings: mark session cookies as Secure (sent only over HTTPS) and HttpOnly (hidden from page scripts).
- Short sessions: end idle sessions quickly and ask users to sign in again for risky actions, such as payments.
- A new token after sign-in: give a fresh token every time someone signs in, which blocks session fixation.
- Tokens tied to the device: bind the session to the device that signed in, so a copied token fails elsewhere.
- A web filter for your apps: a web application firewall can block many harmful scripts and odd requests. Examples are AWS WAF and Azure Web Application Firewall.
- Checks on every request: a zero trust approach checks the user, device and location again and again, not just once at sign-in.

Session Protection in Microsoft Entra ID
Microsoft Entra ID, Microsoft’s sign-in service for work accounts, offers two features that help here. First, Conditional Access works like a set of if-then rules. For example, if a sign-in looks risky or comes from a personal laptop the company does not manage, the user must prove who they are again or is blocked. Second, token protection is one of these rules that applies after sign-in. It makes Entra ID accept only sign-in tokens bound to the device they came from. So a copied token does not work on the attacker’s machine. Today it covers selected apps, such as Exchange Online, SharePoint Online and Microsoft Teams, on supported devices, so companies still need the other layers above.
What to Do If a Session is Hijacked
Common signs include a sign-in alert from a place you do not know, mailbox rules you did not create and sent mail you did not write. If you see one, move fast, because the attacker can act as long as the token works. These steps help limit the harm:
- End all active sessions: sign the user out everywhere, so every old token stops working.
- Reset the password and MFA: change the password and register the second sign-in step again.
- Check mailbox rules: look for new forwarding or delete rules that the attacker may have added.
- Clean the device: scan or wipe the PC, because the info-stealer may still be there.
- Tell IT and report it: in India, people can report cyber crime on cybercrime.gov.in. If money was lost, call the helpline 1930 at once. Companies must also report certain cyber incidents, such as unauthorized access to IT systems or data, to CERT-In, the national agency, within 6 hours of noticing them.
Frequently Asked Questions About Session Hijacking
What is session hijacking in networking?
What is session cookie hijacking?
What is session stealing malware?
What is HTTP session hijacking?
Is session hijacking a vulnerability?
What is session hijacking remediation?
What is session token hijacking?
References
- Token protection in Conditional Access: Microsoft Learn, How Token Protection Enhances Conditional Access Policies
- Token theft and replay defenses: Microsoft Learn, Protecting Tokens in Microsoft Entra ID
- Reporting cyber crime in India: Indian Cybercrime Coordination Centre (I4C), Ministry of Home Affairs, National Cybercrime Reporting Portal
Get the Latest Terms & Insights.
New encyclopedia terms, threat intelligence, and architecture decisions, by email.
