Session cookies and session theft
A session cookie keeps a person signed in. Stealing it lets someone into their account without a password. How it works and what to do.
On this page
In 30 seconds
What it is
A session cookie is the small file a website hands to your browser once you have signed in. The browser sends it back with every request. According to OWASP[1], the session identifier is sent with every HTTP request, and cookies are one of the most widely used mechanisms for exchanging it. Websites and services often use it as an authentication token once the user has been identified[2].
Stealing this cookie amounts to stealing the session. According to MITRE ATT&CK[2], an attacker who gets hold of it can access a web application or a service as an authenticated user, without needing credentials.
Straight answers
What is a session cookie?
HTTP treats each request independently of the others. To recognize the user from one page to the next, the application gives them a session identifier, a name=value pair exchanged with every request[1]. According to Microsoft[4], every modern web service opens a session after authentication so that the user does not have to authenticate again on each new page. That session goes through a cookie, which proves to the server that the user is authenticated[4].
Why does a stolen cookie let someone in without a password?
Because the cookie stands in for authentication. According to MITRE ATT&CK[3], the attacker imports the cookie into a browser they control and can then use the site as the user, as long as the session cookie is active. They can then reach sensitive information, read emails or perform the actions the victim's account is allowed to perform[3].
Doesn't two-step sign-in protect against this?
Standard multifactor authentication is not enough against this theft: session cookies can be used to bypass some multifactor authentication protocols[2], since the session is already authenticated[3]. Microsoft[4] writes that this is not a vulnerability of multifactor authentication: because relay phishing steals the session cookie, the attacker is authenticated in place of the user, whatever the sign-in method. It adds that multifactor authentication remains very effective against a wide range of threats[4]. A phishing-resistant method, FIDO v2.0 for example[4], changes the picture: according to MITRE ATT&CK[2], a hardware token that builds the sign-in domain into its protocol prevents cookie theft through proxy methods.
Where are cookies stolen?
Cookies can be found on disk, in browser memory and in network traffic[2]. MITRE ATT&CK[2] lists malware that targets browser cookies, the injection of malicious JavaScript into websites, and victims who are led to run JavaScript in their own browser.
How long does a stolen cookie stay usable?
MITRE ATT&CK[2] states that cookies often remain valid for a long time, even when the application is not in use. OWASP[1] considers it mandatory to set an expiration time for every session. An absolute timeout limits the time during which the attacker can impersonate the victim[1]. For an application used throughout an office day, OWASP gives a range of 4 to 8 hours[1].
How it works
Theft happens in several ways. In relay phishing (AiTM, for adversary-in-the-middle), the attacker places a server between the user and the site they want to imitate. The server passes HTTP packets in both directions, so the fake site looks identical to the real one, and the address is the only visible difference[4]. This step can be automated with open-source kits, including Evilginx2, Modlishka and Muraena[4]. MITRE ATT&CK also lists Evilginx2 and Muraena as tools that collect session cookies through a malicious proxy[2].
A site can protect its cookie with attributes. OWASP[1] describes three of them, among others, for sessions.
- Secure: the browser sends the cookie only over an encrypted HTTPS connection, which prevents the identifier from being captured in traffic during a man-in-the-middle attack[1]. Forcing a site to use only HTTPS is not enough if this attribute is not set: the browser can be tricked into sending the identifier in clear text[1].
- HttpOnly: scripts cannot read the cookie through the document.cookie object, which prevents theft through an XSS flaw[1]. The attribute protects only the confidentiality of the cookie. If an XSS attack is combined with a CSRF attack, the requests sent to the application still include the session cookie[1].
- SameSite: it controls whether the browser sends the cookie with requests coming from another site. With Strict, those requests are excluded. With Lax, top-level navigations that use safe HTTP methods are allowed[1]. OWASP presents it as defense in depth against CSRF, not as a replacement for the CSRF token[1].
These settings depend on the site, not on the employee. OWASP[1] also states that deleting a cookie does not invalidate a stolen copy: the server must close the session at expiration or at sign-out.
On the organization side, Microsoft describes Token Protection, a Conditional Access session control that aims to reduce token replay attacks by accepting only session tokens bound to the device[5]. The primary token issued to a registered device is cryptographically bound to it: if stolen, it cannot be used from another device[5]. For applications in the browser, support is in preview and limited to certain web applications that access Azure Resource Manager[5]. Microsoft[4] adds that Conditional Access policies are evaluated each time an attacker tries to use a stolen cookie.
What you do
- Close your session with the sign-out button when you are done. OWASP[1] states that a site must offer this button, visible and reachable from every page, so that the user can close their session at any time.
- Do not rely on closing the browser. According to OWASP[1], browsers that restore sessions may keep session cookies after they are closed.
- Look at the address before entering your credentials. MITRE ATT&CK[2] recommends training users to spot phishing attempts that ask for credentials on a site whose domain does not match the targeted application.
- Do not paste code into your browser and do not drag an unknown bookmark into the toolbar. MITRE ATT&CK[2] advises against running untrusted JavaScript, for example by copy and paste or by dragging and dropping bookmarks.
- If your organization gives you a hardware key (YubiKey or FIDO key), use it. According to MITRE ATT&CK[2], a hardware token that builds the sign-in domain into its protocol prevents cookie theft through proxy methods. Microsoft[4] refers to phishing-resistant multifactor authentication with FIDO v2.0 and certificate-based authentication.
- If a sign-in approval request that you did not start appears, deny it and report it as suspicious activity, if that feature is enabled where you work. Microsoft[6] notes that such a request can indicate that credentials are compromised, and that the "User reported suspicious activity" detection works only if the reporting feature is enabled.
Pitfalls
- A normal page after sign-in proves nothing. In the 2022 campaign described below, the user was redirected to the real office.com page after entering their credentials, while the attacker intercepted them[4].
- The fake site looks like the real one. If the organization had configured its branding in Azure Active Directory, the phishing page reused the same elements[4].
- The cookie can stay valid without you using it[2].
- Clearing your own cookies does not invalidate a stolen copy[1].
- Controls tied to the IP address or the browser are not foolproof. OWASP[1] notes that a skilled attacker can bypass them, for example by sharing the victim's network or by changing their User-Agent.
Real cases
July 2022: a relay phishing campaign against Office 365
On 12 July 2022, Microsoft Threat Intelligence described a large-scale phishing campaign that used AiTM sites[4]. According to its data, it attempted to target more than 10,000 organizations since September 2021[4]. The iterations targeted Office 365 users by imitating the Office online sign-in page and relied on the Evilginx2 kit[4].
In one of the observed waves, the email carried an HTML attachment and announced a voice message[4]. The download bar displayed was hard-coded: no MP3 file was downloaded[4]. The page redirected to an intermediate site that checked where the visit came from, then the phishing page prefilled the victim's email address[4]. That site relayed the organization's Azure Active Directory sign-in page[4].
Once the user was authenticated, the attacker used the stolen cookie to sign in to Outlook online[4]. Microsoft observed that as little as five minutes could pass between the theft of the credentials and the session and the start of the payment fraud[4]. In several cases, the cookies carried a multifactor authentication claim: the attacker accessed the account even though the organization had a policy requiring it[4].
Over the following days, the attacker read financial emails and attachments, looked for conversations in which payment fraud was possible, and deleted the initial phishing email from the inbox to erase their tracks[4]. They also created an inbox rule that moved emails from the fraud target's domain to the Archive folder, marking them as read[4]. They then replied to conversations about payments and invoices, and deleted their replies from the sent and deleted items[4]. According to Microsoft, the attacker sometimes exchanged messages with the target for a few days, and once ran several attempts in parallel from the same mailbox[4].
Microsoft states that the attackers used several proxies or VPNs located in different countries, which could trigger impossible-travel alerts[4]. To harden multifactor authentication, Microsoft cites FIDO v2.0 compatible solutions and certificate-based authentication[4].
Sources
- OWASP, “Session Management Cheat Sheet”. https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html (accessed 14 November 2026)
- MITRE ATT&CK, “Steal Web Session Cookie”. https://attack.mitre.org/techniques/T1539/ (accessed 14 November 2026)
- MITRE ATT&CK, “Use Alternate Authentication Material: Web Session Cookie”. https://attack.mitre.org/techniques/T1550/004/ (accessed 14 November 2026)
- Microsoft, “From cookie theft to BEC: Attackers use AiTM phishing sites as entry point to further financial fraud”, 12 July 2022. https://www.microsoft.com/en-us/security/blog/2022/07/12/from-cookie-theft-to-bec-attackers-use-aitm-phishing-sites-as-entry-point-to-further-financial-fraud/ (accessed 14 November 2026)
- Microsoft, “Token Protection in Microsoft Entra Conditional Access”. https://learn.microsoft.com/en-us/entra/identity/conditional-access/concept-token-protection (accessed 14 November 2026)
- Microsoft, “What are risk detections?”. https://learn.microsoft.com/en-us/entra/id-protection/concept-identity-protection-risks (accessed 14 November 2026)
Cite this article
Brain, “Session cookies and session theft”, Cyberpedia, 2026. https:/
BibTeX
@misc{brain_cp196_en_2026,
author = {Brain},
title = {Session cookies and session theft},
year = {2026},
howpublished = {Cyberpedia},
url = {https://startbrain.io/cyberpedia/en/articles/session-cookies-session-theft/},
note = {CC BY 4.0}
}