Skip to content
Account takeover Disclosed report Intermediate

Session Not Expire / 2FA Bypass

The report claims that session cookies do not expire after a victim logs out or clears browser history, allowing an attacker who has stolen the cookies to continue accessing the victim's account. The attacker could also bypass two-factor authentication by reusing the old session.

blackflyhunter Follow

Originally disclosed on HackerOne

Medium 5.2 View original
  • Disclosed after 3 months

Hello Security Team, I hope you are having a good day!

The attacker can use the victim cookie to log in victim's account and if a victim clears her browser history victim can be logged out of her account but the attacker use the victim's previous session cookies and log in multiple times an attacker can still log in the account again and again

Steps To Reproduce:

  1. attacker stole the cookies of victims through any means - https://hackerone.com/ {{attacker perspective}}
  2. Victim clears their browser history {{Victim perspective}}
  3. attacker add victim cookies using http://www.editthiscookie.com addon to own browser {{attacker perspective}}
  4. Victim login their browser again using email password (Victim created a new session but the old session has not expired)
  5. The attacker could still log in victim's hackerone account again. {{attacker perspective}}

POC: (Recommended)

███████

Impact

  1. The session does not expire
  2. 2FA Bypass

The original report as published on HackerOne, by blackflyhunter. 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. 4 min read.

Context

This report concerns the HackerOne platform itself, at hackerone.com, and a weakness classified as Insufficient Session Expiration, rated medium severity with a CVSS score of 5.2. The feature under scrutiny is the login session: the cookie that keeps a user signed in after they authenticate with their email and password. Normally, when a user signs out or starts a fresh login, the previous session should stop being usable. The researcher argues that on HackerOne it did not.

The report was disclosed on 11 July 2024 and was submitted by the researcher blackflyhunter. No bounty figure is recorded.

Setup

The scenario needs two parties: a victim with a HackerOne account, and an attacker who has obtained the victim's session cookies. The only tool named in the report is the browser add-on at http://www.editthiscookie.com, which the attacker uses to insert the stolen cookies into their own browser. The report does not describe how the cookies were stolen; step 1 says only that this happens "through any means".

Finding it

The researcher's observation is that a session cookie remains valid after the victim takes actions that a user would reasonably expect to end it. The victim clearing their browser history logs them out locally, and the victim logging in again with their email and password creates a new session, but the report states the old session has not expired. Because the old cookie keeps working, the attacker who holds a copy can keep returning to the account.

Exploitation

Step 1: Steal the victim's cookies

The attacker obtains the victim's cookies for https://hackerone.com/ by any means. The report gives no further detail on the acquisition method.

Step 2: Victim clears browser history

From the victim's perspective, clearing browser history removes their local session and logs them out of their account. The report treats this as the victim's attempt to terminate the session.

Step 3: Attacker loads the cookies into their own browser

The attacker imports the victim's cookies into their own browser using the editthiscookie add-on:

Text
http://www.editthiscookie.com

Step 4: Victim logs in again

The victim signs back in with their email and password. This creates a new session for the victim, but the report states that the old session has not expired. The report states that the old session has not expired.

Step 5: Attacker logs in again

The attacker, still holding the previous session cookie, can log in to the victim's HackerOne account again. The report's summary at the top makes the same point: the attacker can use the victim's cookie to log in to the victim's account, and even after the victim clears their browser history and is logged out, the attacker can use the previous session cookies and log in multiple times, again and again.

The proof of concept itself is redacted in the published report, so the exact requests and responses are not available here.

Root cause

The report attributes the behaviour to two things: the session does not expire, and this amounts to a 2FA bypass. In other words, the old session token remains valid after the victim starts a new session. The researcher characterises this as a 2FA bypass, though the report gives no further detail on the second factor. The report does not describe the server-side implementation, so the precise reason the old session survives is not stated; The report does not describe the server-side implementation, so the precise reason the old session survives is not stated.

Impact

Under the condition that an attacker has already obtained a victim's session cookie, the attacker can keep accessing the victim's HackerOne account after the victim believes they have logged out, and can do so repeatedly, including after the victim signs in again. The researcher characterises this as a session that does not expire and as a 2FA bypass.

Fix

What the behaviour calls for is server-side invalidation of a session when the user logs out and when a new session is created, so that a previously issued cookie stops being accepted, and a check that a session used to reach sensitive actions corresponds to a recent authentication rather than an old token.

Variants to test

  1. Log out in one browser, then replay the old cookie from a second browser. A positive result is that the replayed cookie still returns authenticated content.
  2. Log in on a second device and check whether the first device's session is invalidated. A positive result is that both sessions remain valid indefinitely.
  3. Change the password and replay an old session cookie. A positive result is that the old cookie still works after the credential change.
  4. Complete a 2FA challenge, then replay a pre-2FA session cookie. A positive result is that the pre-challenge cookie reaches authenticated pages, which is the bypass the researcher describes.
  5. Wait past any stated session lifetime and replay the cookie. A positive result is that the session outlives its advertised expiry.

Hunting notes

This kind of bug hides in the session management layer rather than in a single endpoint: logout handlers, password change flows, 2FA enrolment and verification, and the code that issues a new session on login. During recon, the signals are a session cookie whose value does not change after logout and re-login, a logout that only clears the cookie client-side, and the absence of any server-side session list or "log out all devices" control. The researcher described the sequence from the victim's side and the attacker's side, though the proof of concept is redacted. That end-to-end demonstration, rather than a single replayed request, is what makes the missing expiry and the 2FA bypass legible to a triager.

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. 8 min read.

What happened, in plain words

When you log in to a website, the site gives your browser a small piece of data called a session cookie. Your browser sends that cookie back with every request, and the site uses it to recognise you without asking for your password again on every page. Think of it like a wristband at a festival: you show your ticket once at the gate, get the wristband, and after that the staff just look at your wrist.

This report is about the HackerOne platform itself, at hackerone.com. The researcher, blackflyhunter, found that the wristband never really gets taken away. If someone else copies your wristband, they can keep getting into the festival even after you have left, thrown your wristband in the bin, and bought a new ticket. The weakness is classified as Insufficient Session Expiration, rated medium severity with a CVSS score of 5.2. The report was disclosed on 11 July 2024, and no bounty figure is recorded.

Two ideas need explaining before the steps make sense.

  • A session is the period during which a site remembers that you are logged in. It is represented by the session cookie. When you log out or log in again, the site should throw away the old session so the old cookie stops working.
  • 2FA, or two-factor authentication, means logging in with two things: your password plus a second proof, such as a code from your phone. The point of the second factor is that a stolen password alone is not enough. If an old session cookie keeps working, an attacker who has that cookie never has to face the second factor at all, which is why the researcher calls this a 2FA bypass.

The researcher's argument is simple: on HackerOne, the old session did not stop working. The victim clearing their browser history logs them out locally, and the victim logging in again with their email and password creates a new session, but the report states the old session has not expired. Because the old cookie keeps working, an attacker who holds a copy can keep coming back to the account.

Setup

The scenario needs two parties: a victim with a HackerOne account, and an attacker who has obtained the victim's session cookies. The only tool named in the report is the browser add-on at http://www.editthiscookie.com, which the attacker uses to insert the stolen cookies into their own browser. The report does not describe how the cookies were stolen; step 1 says only that this happens "through any means".

Finding it

The researcher's observation is that a session cookie remains valid after the victim takes actions that a user would reasonably expect to end it. The victim clearing their browser history logs them out locally, and the victim logging in again with their email and password creates a new session, but in both cases the old session is still accepted. Because the old cookie keeps working, the attacker who holds a copy can keep returning to the account.

Exploitation

Step 1: Steal the victim's cookies

The attacker obtains the victim's cookies for https://hackerone.com/ by any means. The report gives no further detail on the acquisition method. This step exists because everything that follows depends on the attacker having a copy of the cookie: without it there is nothing to replay.

Step 2: Victim clears browser history

From the victim's perspective, clearing browser history removes their local session and logs them out of their account. The report treats this as the victim's attempt to terminate the session. The victim does this because it is the normal, sensible thing to do when you want to make sure nobody else can use your account on that computer.

Step 3: Attacker loads the cookies into their own browser

The attacker imports the victim's cookies into their own browser using the editthiscookie add-on:

Text
http://www.editthiscookie.com

This is the address of the add-on the attacker installs. A browser add-on is a small extension that adds features to the browser. This particular one lets a user view and edit the cookies stored in the browser, which is how the attacker puts the victim's cookie into their own browser instead of their own cookie.

Step 4: Victim logs in again

The victim signs back in with their email and password. This creates a new session for the victim, but the report states that the old session has not expired. The report states that the old session has not expired. This is the heart of the bug: a fresh login should normally replace or revoke the previous session, so that anyone holding the old cookie is locked out.

Step 5: Attacker logs in again

The attacker, still holding the previous session cookie, can log in to the victim's HackerOne account again. The report's summary at the top makes the same point: the attacker can use the victim's cookie to log in to the victim's account, and even after the victim clears their browser history and is logged out, the attacker can use the previous session cookies and log in multiple times, again and again.

The proof of concept itself is redacted in the published report, so the exact requests and responses are not available here.

Root cause

The report attributes the behaviour to two things: the session does not expire, and this amounts to a 2FA bypass. In other words, the old session token remains valid after the victim starts a new session. The researcher characterises this as a 2FA bypass, though the report gives no further detail on the second factor. The report does not describe the server-side implementation, so the precise reason the old session survives is not stated; The report does not describe the server-side implementation, so the precise reason the old session survives is not stated.

Impact

Under the condition that an attacker has already obtained a victim's session cookie, the attacker can keep accessing the victim's HackerOne account after the victim believes they have logged out, and can do so repeatedly, including after the victim signs in again. The researcher characterises this as a session that does not expire and as a 2FA bypass.

Fix

What the behaviour calls for is server-side invalidation of a session when the user logs out and when a new session is created, so that a previously issued cookie stops being accepted, and a check that a session used to reach sensitive actions corresponds to a recent authentication rather than an old token.

Variants to test

These are other ways to probe the same weakness, each with a clear sign that the bug is present.

  1. Log out in one browser, then replay the old cookie from a second browser. A positive result is that the replayed cookie still returns authenticated content.
  2. Log in on a second device and check whether the first device's session is invalidated. A positive result is that both sessions remain valid indefinitely.
  3. Change the password and replay an old session cookie. A positive result is that the old cookie still works after the credential change.
  4. Complete a 2FA challenge, then replay a pre-2FA session cookie. A positive result is that the pre-challenge cookie reaches authenticated pages, which is the bypass the researcher describes.
  5. Wait past any stated session lifetime and replay the cookie. A positive result is that the session outlives its advertised expiry.

Hunting notes

This kind of bug hides in the session management layer rather than in a single endpoint: logout handlers, password change flows, 2FA enrolment and verification, and the code that issues a new session on login. During recon, the signals are a session cookie whose value does not change after logout and re-login, a logout that only clears the cookie client-side, and the absence of any server-side session list or "log out all devices" control. The researcher described the sequence from the victim's side and the attacker's side, though the proof of concept is redacted. That end-to-end demonstration, rather than a single replayed request, is what makes the missing expiry and the 2FA bypass legible to a triager.

Glossary

  • Session: the period during which a website remembers that you are logged in, represented by a session cookie.
  • Session cookie: a small piece of data the site stores in your browser and your browser sends back with each request, so the site can recognise you without asking for your password again.
  • Insufficient Session Expiration: a weakness where a session stays valid longer than it should, for example after logout or after a new login.
  • CVSS: a standard scoring system for rating the severity of a security weakness; 5.2 is a medium score.
  • 2FA (two-factor authentication): logging in with two separate proofs, such as a password plus a code from your phone.
  • 2FA bypass: getting into an account without completing the second factor, for example by reusing a session that was created before the challenge.
  • Cookie: a small piece of data a website stores in your browser; cookies carry things like your session.
  • Browser add-on: a small extension that adds features to a browser.
  • editthiscookie: the browser add-on named in the report, used to view and edit cookies in the browser.
  • Endpoint: a specific address on a server that a request is sent to.
  • Server-side: happening on the website's server rather than in your browser.
  • Client-side: happening in your browser rather than on the website's server.
  • Invalidation: marking a session as no longer valid so that its cookie stops being accepted.
  • Replay: sending an old, captured piece of data (such as a cookie) again to see whether the server still accepts it.
  • Triager: the person who reviews a bug report and decides whether it is valid and how serious it is.
  • Recon: the exploratory phase of looking at a target to find things worth testing.

More by blackflyhunter

View all

1 more disclosed report, best first.

More from HackerOne

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.