Skip to content
Account takeover Disclosed report Beginner

Session Fixation

The login flow did not issue a fresh session identifier after authentication, so a session value chosen before login remained valid afterwards. An attacker who planted their own session cookies on a shared computer could later use them to reach a victim's account once the victim logged in.

eboda Follow

Originally disclosed on HackerOne

Bounty$50 View original
  • Triaged in 2 days
  • Fixed in 16 days
  • Paid in 16 days
  • Disclosed after 51 days

Summary

Your login flow is vulnerable to session fixation. This can allow an attacker to steal a valid user session from a victim.

Steps to reproduce

  1. As the attacker go to https://wallet.sandbox.romit.io (but do not login!) and check the cookies romit.sandbox.session and SANDBOX-XSRF-TOKEN, that are set. For example:

SANDBOX-XSRF-TOKEN=AAG02cId-yyza3k8uhQR7JKuB-4YOmhizkjM; romit.sandbox.session=s%3AEHm0kA9uwWYHayOwdRQXbuZWEIRIliQZ.ndejz36ofa52c9ENnApLuaLkMnTYCot3IiY1qdTvz0w;

2. Now simulate the victim by opening a second browser and setting those two cookies.
3. As the victim, login in the second browser.
4. As the attacker, go to https://wallet.sandbox.romit.io (using the first browser / same cookies as in step 1). You are now logged in to the victims account.

Possible exploitation scenarios
---------------

This can be exploited if there is another bug like HTTP Response Splitting on your website. 

But a far easier way is to exploit this on shared computers. For example in a library, as an attacker open https://wallet.sandbox.romit.io (but do not login!) and keep note of the cookies as above in step 1. Then simply go away and now when a victim will use the same computer and try to login, the attacker will have access to the victims account.

Mitigation
--------------

If you assign a new session when someone logs in, this flaw should be fixed.

The original report as published on HackerOne, by eboda. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 5 min read.

Context

The target is the Romit wallet, a web application reachable at https://wallet.sandbox.romit.io. The feature under examination is the login flow: the sequence of requests that turns an anonymous visitor into an authenticated user. Normally such a flow should bind a fresh session to the user who has just proved their identity, so that the session identifier held by the browser before authentication is worthless afterwards.

In this report the researcher shows that the sandbox wallet does not do that. The session identifier issued to an anonymous visitor survives the login, which makes the flow vulnerable to session fixation: an attacker who can plant a known session identifier in a victim's browser can later use that same identifier to reach the victim's authenticated account.

The report was filed on HackerOne against the Enter program, credited to the researcher eboda, classified as a violation of secure design principles, and disclosed on 2016-06-22 with a bounty of 50.00 USD.

Setup

No special tooling is required. The researcher uses two browsers to represent two parties:

  1. A first browser acting as the attacker.
  2. A second browser acting as the victim.

The only precondition is the ability to read and set cookies for wallet.sandbox.romit.io in both browsers. The report does not describe any account creation, credentials or particular user role; the victim simply logs in to the wallet in the second browser.

Finding it

The observation is that the application sets its session and CSRF cookies on the very first visit, before any authentication has happened. The researcher checked the cookies set on https://wallet.sandbox.romit.io while not logged in and found two of them: romit.sandbox.session and SANDBOX-XSRF-TOKEN. Because those values are fixed at that point and are not replaced at login, whoever knows them in advance knows the session that will be authenticated.

Exploitation

Step 1: obtain a pre-authentication session as the attacker

As the attacker, visit https://wallet.sandbox.romit.io without logging in, and note the cookies that are set. The report gives this example:

Text
SANDBOX-XSRF-[redacted]
romit.sandbox.[redacted]

romit.sandbox.session is the session cookie; its value is URL-encoded (the %3A is a colon) and carries a signature suffix after the dot. SANDBOX-XSRF-TOKEN is the companion CSRF token cookie. Both are issued to an anonymous visitor, which is the precondition for the whole attack.

Step 2: plant the cookies in the victim's browser

Open a second browser to simulate the victim and set those two cookies to the values captured in step 1. The report does not describe the mechanism used to set them; the point is that the victim's browser now holds the attacker's pre-authentication session identifier.

Step 3: the victim logs in

In the second browser, log in as the victim. Because the application does not issue a new session at login, the session identifier in the victim's browser remains the one from step 1, now associated with the victim's authenticated account.

Step 4: the attacker reuses the session

As the attacker, go to https://wallet.sandbox.romit.io using the first browser, which still holds the same cookies as in step 1. The attacker is now logged in to the victim's account.

Root cause

The flaw is that the session identifier is not rotated when authentication succeeds. The application assigns a session to an anonymous visitor and keeps that same identifier after the user logs in, so the value known before login is still valid after login. The report does not analyse how the CSRF token cookie behaves across the login boundary.

The session cookie is not bound to the moment of authentication: nothing in the flow invalidates the pre-login identifier or replaces it with a new one. The report does not discuss cookie attributes such as HttpOnly, Secure or SameSite, nor any server-side session store details.

Impact

An attacker who can make a victim's browser use a session identifier the attacker already knows can take over the victim's authenticated session. The report frames two exploitation scenarios:

  1. Combined with another bug such as HTTP Response Splitting on the website, which could be used to set the cookies in the victim's browser.
  2. On shared computers, which the researcher describes as far easier. In a library, for example, the attacker opens https://wallet.sandbox.romit.io without logging in, notes the cookies as in step 1, and walks away. When a victim later uses the same computer and logs in, the attacker has access to the victim's account.

The impact therefore depends on the attacker being able to plant or preserve a known session identifier in the victim's browser, either through a separate vulnerability or through shared access to the machine.

Fix

The mitigation stated in the report is to assign a new session when someone logs in. Assigning a new session at login means a value captured before login is no longer the one used for the authenticated session.

Variants to test

  1. Capture the session cookie before login, log in, and compare the cookie value afterwards. A positive result is an unchanged session identifier that still grants access to the authenticated account.
  2. Set a known session cookie in a second browser, log in there, then reuse the original value in the first browser. A positive result is access to the victim's account from the first browser.
  3. Check whether the CSRF token cookie is also reused across the login boundary.
  4. A positive result is a session identifier issued anonymously and still accepted after login.

Hunting notes

This class of bug hides in login and authentication flows, especially where the application hands out a session on first page load rather than at the moment of login. During recon, the signal is a session cookie that appears on an unauthenticated visit and does not change after authentication. The researcher demonstrated impact with a concrete two-browser reproduction: capture the cookies anonymously, plant them in a second browser, log in there, and show that the first browser is authenticated as the victim. The researcher describes the shared-computer scenario as far easier than relying on another bug.

Difficulty: beginner. The reproduction needs only two browsers and cookie inspection, and the report's steps are short and direct.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 9 min read.

What happened, in plain words

A wallet website, reachable at https://wallet.sandbox.romit.io, hands every visitor a session cookie the moment they arrive, even before they log in. When that visitor later logs in, the website keeps the same session cookie instead of giving them a new one. That means anyone who knew the cookie value beforehand still knows it after the login, and can use it to get into the account that was just logged in.

This kind of flaw is called session fixation. The word "fixation" is the clue: the session is fixed in place before login, and login does not change it. A useful everyday comparison is a hotel key card. Normally, when you check in and prove who you are, the receptionist programs a fresh card for your room. Here, the card is programmed before you arrive, and checking in does not reprogram it. Anyone who copied that card earlier can walk into your room.

The report was filed on HackerOne against the Enter program, credited to the researcher eboda, classified as a violation of secure design principles, and disclosed on 2016-06-22 with a bounty of 50.00 USD.

The pieces you need to know

Before the steps make sense, a few everyday ideas.

  • Web application: a program you use through your browser. The Romit wallet is one: you open a web address and it shows you pages and forms.
  • Login flow: the sequence of pages and requests that turns a stranger into a logged-in user. You type your details, the site checks them, and from then on it treats you as you.
  • Cookie: a small piece of text that a website asks your browser to store and to send back on every later visit to that site. It is how a website recognises you between page loads, because the web itself has no memory. Think of a cloakroom ticket: the attendant gives you a number, and when you come back with the same number you get the same coat.
  • Session: the website's record of "this browser is this person, for now". The session cookie is the ticket that points to that record. If someone else has your ticket number, the website cannot tell the difference between you and them.
  • Session identifier: the actual value inside the session cookie, the number on the ticket.
  • CSRF token: a second value a site stores in a cookie (and usually also in the page) to prove that a form submission really came from the site's own pages and not from a malicious page elsewhere. CSRF stands for Cross-Site Request Forgery. The token is a kind of anti-forgery stamp.
  • Session fixation: an attack where the attacker arranges for the victim's browser to use a session identifier the attacker already knows, and the site then keeps that identifier after login. The attacker does not need the victim's password; they just reuse the ticket.
  • Sandbox: a test copy of a product, separate from the real one, used for trying things out. The address here contains sandbox, which tells you this is the test wallet.

Setting up the experiment

No special tools are needed. The researcher uses two browsers to stand in for two people:

  1. A first browser acting as the attacker.
  2. A second browser acting as the victim.

Two separate browsers matter because each browser keeps its own cookies. If you used two tabs of the same browser, they would share the same cookie jar and you could not tell the two parties apart. The only thing you need is the ability to look at and change the cookies for wallet.sandbox.romit.io in both browsers. The report does not describe creating an account, any credentials, or a particular kind of user; the victim simply logs in to the wallet in the second browser.

Finding it

The observation is simple: the application sets its session and CSRF cookies on the very first visit, before anyone has logged in. The researcher looked at the cookies set on https://wallet.sandbox.romit.io while not logged in and found two of them, romit.sandbox.session and SANDBOX-XSRF-TOKEN. Because those values exist at that point and are not replaced at login, whoever knows them in advance knows the session that will later be logged in.

Exploitation

Step 1: get a session before logging in, as the attacker

As the attacker, visit https://wallet.sandbox.romit.io without logging in, and note the cookies that get set. The report gives this example:

Text
SANDBOX-XSRF-[redacted]
romit.sandbox.[redacted]

Line by line:

  • `SANDBOX-XSRF-[redacted] is the name of the CSRF cookie, an equals sign, then its value, ending with a semicolon. The semicolon is just the separator browsers use between cookies.
  • romit.sandbox.[redacted] is the session cookie. Its value contains %3A`, which is how a colon is written when a value is URL-encoded, meaning special characters are swapped for safe codes so they survive being sent over the web. After the dot there is a signature suffix, a short code the server can check to make sure the value was not tampered with.

Why this step matters: the attacker is collecting a ticket that the site has already issued but that nobody has used to log in yet. Both cookies are given to an anonymous visitor, and that is the precondition for the whole attack.

Step 2: put those cookies into the victim's browser

Open a second browser to stand in for the victim, and set those two cookies to the values captured in step 1. The report does not describe the mechanism used to set them; the point is that the victim's browser now holds the attacker's pre-login session identifier. In the hotel comparison, the attacker has copied their own blank key card and slipped it to the victim.

Step 3: the victim logs in

In the second browser, log in as the victim. Because the application does not issue a new session at login, the session identifier in the victim's browser stays the one from step 1, and it is now attached to the victim's logged-in account. This is the moment the flaw does its damage: the ticket the attacker already copied has just been upgraded to a ticket for the victim's room.

Step 4: the attacker reuses the session

As the attacker, go to https://wallet.sandbox.romit.io using the first browser, which still holds the same cookies as in step 1. The attacker is now logged in to the victim's account. No password was needed, because the site recognises the ticket, not the person.

Why it works

The flaw is that the session identifier is not rotated when authentication succeeds. "Rotating" means replacing the old value with a brand new one and throwing the old one away. The application gives a session to an anonymous visitor and keeps that same identifier after the user logs in, so a value known before login is still valid after login. The report does not analyse how the CSRF token cookie behaves across the login boundary.

The session cookie is not tied to the moment of authentication: nothing in the flow cancels the pre-login identifier or swaps it for a new one. The report does not discuss cookie settings such as HttpOnly, Secure or SameSite, nor how sessions are stored on the server.

What an attacker could do with it

An attacker who can make a victim's browser use a session identifier the attacker already knows can take over the victim's logged-in session. The report describes two ways this could happen in practice:

  1. Combined with another bug such as HTTP Response Splitting on the website, which could be used to set the cookies in the victim's browser. HTTP Response Splitting is a separate flaw where an attacker can sneak extra content into a server's reply, and here it is only mentioned as a possible delivery route for the cookies.
  2. On shared computers, which the researcher calls far easier. In a library, for example, the attacker opens https://wallet.sandbox.romit.io without logging in, notes the cookies as in step 1, and walks away. When a victim later uses the same computer and logs in, the attacker has access to the victim's account.

So the impact depends on the attacker being able to plant or keep a known session identifier in the victim's browser, either through a separate vulnerability or through shared access to the machine.

The fix

The mitigation stated in the report is to assign a new session when someone logs in. Assigning a new session at login means a value captured before login is no longer the one used for the logged-in session. Back to the hotel: the receptionist programs a fresh card at check-in and cancels the old one.

Things to try on other sites

These are the same checks, phrased as experiments you can repeat:

  1. Note the session cookie before login, log in, and compare the cookie value afterwards. A positive result is an unchanged session identifier that still grants access to the logged-in account.
  2. Set a known session cookie in a second browser, log in there, then reuse the original value in the first browser. A positive result is access to the victim's account from the first browser.
  3. Check whether the CSRF token cookie is also reused across the login boundary.
  4. A positive result is a session identifier handed out anonymously and still accepted after login.

Where this bug tends to hide

This class of bug hides in login and authentication flows, especially where the application hands out a session on the first page load rather than at the moment of login. When you are looking around a site, the signal is a session cookie that appears on an anonymous visit and does not change after you log in. The researcher showed the impact with a concrete two-browser reproduction: capture the cookies anonymously, plant them in a second browser, log in there, and show that the first browser is logged in as the victim. The researcher describes the shared-computer scenario as far easier than relying on another bug.

Difficulty: beginner. The reproduction needs only two browsers and a look at the cookies, and the steps are short and direct.

Glossary

  • Web application: a program you use through a browser by visiting a web address.
  • Login flow: the sequence of pages and requests that turns an anonymous visitor into a logged-in user.
  • Cookie: a small piece of text a website asks your browser to store and send back on later visits, so the site can recognise you.
  • Session: the website's record of which browser belongs to which person for the time being.
  • Session identifier: the value inside the session cookie that points to that record, like the number on a cloakroom ticket.
  • Session fixation: an attack where the victim's browser is made to use a session identifier the attacker already knows, and the site keeps that identifier after login.
  • Session rotation: replacing the session identifier with a new one, and invalidating the old one, typically at login.
  • CSRF token: a value stored in a cookie and usually also in the page, used to prove a form submission came from the site's own pages rather than a malicious page elsewhere.
  • CSRF (Cross-Site Request Forgery): an attack where a malicious page causes your browser to send a request to another site where you are logged in.
  • URL-encoding: writing special characters as safe codes, for example %3A for a colon, so values survive being sent over the web.
  • Signature suffix: a short code attached to a value so the server can check it was not tampered with.
  • HTTP Response Splitting: a separate flaw where an attacker can insert extra content into a server's reply.
  • Bounty: a payment a company makes to a researcher who reports a valid security problem.
  • HackerOne: a platform where security researchers report vulnerabilities to companies.
  • Violation of secure design principles: a classification meaning the problem comes from how the system was designed, not from a coding slip.
  • HttpOnly, Secure, SameSite: cookie settings that control whether scripts can read a cookie, whether it is only sent over encrypted connections, and when it is sent across sites.

More by eboda

View all

6 more disclosed reports, best first.

More from Enter

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.