Skip to content
CSRF Disclosed report Beginner

The csrf token remains same after user logs in

The CSRF token issued to a user does not change when that user logs in, so a token captured on a shared workstation can be reused against a later user of the same machine. An attacker who has copied the token could craft a link or form and trick the victim into performing actions without their knowledge.

tmfelwu Follow

Originally disclosed on HackerOne

Bounty$50 View original
  • Triaged in 13 hours
  • Fixed in 8 days
  • Paid in 8 days
  • Disclosed after 9 months

As the CSRF token doesn't change after login. Any other user that uses the same workstation is vulnerable. A safer way would be to use dynamic CSRF token or just change the token after login, so attacker doesnt get hold of this.

Details of the attacks scenario in a shared workstation environment

  1. The attacker simply copies the authenticity token. This token is the only protection against the CSRF attack.

  2. Any other user that uses the workstation after that is vulnerable to CSRF. The attacker simply needs to craft a link with the required GET or POST method as he already have the CSRF token and send it to the victim via email, chat etc.

  3. The attacker can trick the victim in doing anything he wants without the user being aware of it.

In the most basic sense the attacker has an authenticity token of another user which he shouldn't have had in the first place.

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

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 3 min read.

What the report shows

The report concerns a CSRF authenticity token that does not change when a user logs in. The researcher's finding is that the CSRF token remains the same after the user logs in.

The attack scenario the report describes is a shared workstation environment:

  1. The attacker copies the authenticity token. The report calls this token the only protection against a CSRF attack.
  2. Any other user who uses the workstation afterwards is vulnerable to CSRF. The attacker crafts a link using the required GET or POST method, since the CSRF token is already known, and sends it to the victim by email, chat or similar.
  3. The attacker can then make the victim perform actions without the victim being aware of it.

The report summarises the problem as the attacker holding an authenticity token belonging to another user, which they should never have had.

The report proposes two fixes: use a dynamic CSRF token, or change the token after login so that an attacker cannot get hold of it. The platform records the weakness as a violation of secure design principles, a bounty of 50.00 USD, and disclosure on 2015-11-26. No severity or CVSS score is given, and the report contains no requests, parameters or responses.

Root cause

The token does not change at login, so a value seen before login remains valid afterwards. If the token survives login unchanged, a token observed before login remains valid afterwards, and the protection no longer distinguishes one user's session from another's on the same machine.

Impact

On a shared workstation, an attacker who can read the token before or during another user's session can reuse it against that user. The report's scenario has the attacker send a crafted link by email or chat and have the victim perform actions unknowingly. The report describes the impact in a shared workstation environment, where the attacker copies the token from the machine.

How this kind of bug works

CSRF defences rely on a secret value that the attacker's cross-site request cannot know. The server issues the token to the browser, the browser sends it back with state-changing requests, and the server compares the two. This works only if the token is unpredictable, tied to the user's session, and invalidated when the session changes.

A token that persists across login breaks the binding between token and session. On a shared workstation the token can be copied by another user of the same machine. If the same value is accepted after authentication, it becomes a valid credential for the victim's authenticated session.

The report proposes using a dynamic CSRF token or changing the token after login.

How to test for it

  1. Open the target in a clean browser profile and note any CSRF token present on the login page or in pre-authentication forms.
  2. Log in as a normal user and inspect the token in an authenticated state-changing form.
  3. Compare the two values. A positive result is an identical token before and after login, or a token that the server still accepts after the session has changed.
  4. Confirm acceptance by replaying a state-changing request with the old token in a fresh authenticated session, and check whether the server processes it.
  5. Repeat across logout and login, and across privilege changes, to see whether rotation happens at any of those points.

Common false positives are tokens that look identical but are actually reissued with the same value by coincidence, tokens that are validated against a server-side session and rejected on mismatch, and endpoints that are not state-changing. Always verify server-side acceptance rather than relying on the visible value alone.

How it is fixed

Use a dynamic CSRF token, or change the token after login so an attacker cannot get hold of it. Treat the token as a secret and avoid exposing it in places where it can be read by other users of the same machine.

Hunting notes

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 5 min read.

What happened, in plain words

This report is about a security token that a website gives to a browser to protect forms from being submitted by someone else. The token is called a CSRF authenticity token. The researcher found that the token does not change when a user logs in.

To understand why that matters, a little background. Many websites protect actions such as changing an email address or posting a comment with a hidden secret value, the CSRF token. When the browser submits the form, it sends the token back, and the server checks that the value matches the one it issued. The idea is that another website cannot guess this secret, so it cannot forge a request that the server will accept. A request is simply the message a browser sends to a server, for example "please save this new email address".

The problem in this report is that the token stays the same after login. A session is the period during which a site remembers who you are, usually by storing a cookie in your browser. A cookie is a small piece of data the site asks the browser to keep and send back on every request. If the token stays the same across login, another user of the same workstation can copy it and use it.

The attack scenario the report describes is a shared workstation, for example a computer in an office or a library that several people use one after another:

  1. The attacker copies the authenticity token. The report calls this token the only protection against a CSRF attack.
  2. Any other user who uses the workstation afterwards is vulnerable to CSRF. The attacker crafts a link using the required GET or POST method, since the CSRF token is already known, and sends it to the victim by email, chat or similar.
  3. The attacker can then make the victim perform actions without the victim being aware of it.

GET and POST are the two common ways a browser asks a server to do something. GET is normally used to fetch a page, POST to submit data such as a form. The report does not include any actual request, parameter or response, so there is nothing to copy here.

The report summarises the problem as the attacker holding an authenticity token belonging to another user, which they should never have had. It proposes two fixes: use a dynamic CSRF token, or change the token after login so that an attacker cannot get hold of it. The platform records the weakness as a violation of secure design principles, a bounty of 50.00 USD, and disclosure on 2015-11-26. No severity or CVSS score is given.

The token does not change at login, so a value seen before login remains valid afterwards. If the token survives login unchanged, a token observed before login remains valid afterwards.

On a shared workstation, an attacker can copy the token and use it against another user of the same machine.

In general, how this kind of bug works

CSRF defences rely on a secret value that an attacker's cross-site request cannot know. The server issues the token to the browser, the browser sends it back with state-changing requests, and the server compares the two. This works only if the token is unpredictable, tied to the user's session, and invalidated when the session changes.

A token that persists across login breaks the binding between token and session. On a shared workstation the token can be copied by another user of the same machine. If the same value is accepted after authentication, it becomes a valid credential for the victim's authenticated session.

The report proposes using a dynamic CSRF token or changing the token after login. SameSite is a setting on a cookie that tells the browser when to send it along with requests coming from other sites.

How to test for it

  1. Open the target in a clean browser profile and note any CSRF token present on the login page or in pre-authentication forms.
  2. Log in as a normal user and inspect the token in an authenticated state-changing form.
  3. Compare the two values. A positive result is an identical token before and after login, or a token that the server still accepts after the session has changed.
  4. Confirm acceptance by replaying a state-changing request with the old token in a fresh authenticated session, and check whether the server processes it.
  5. Repeat across logout and login, and across privilege changes, to see whether rotation happens at any of those points.

Common false positives are tokens that look identical but are actually reissued with the same value by coincidence, tokens that are validated against a server-side session and rejected on mismatch, and endpoints that are not state-changing. Always verify server-side acceptance rather than relying on the visible value alone.

How it is fixed

Use a dynamic CSRF token, or change the token after login so an attacker cannot get hold of it. Treat the token as a secret and avoid exposing it in places where it can be read by other users of the same machine.

Hunting notes

Glossary

  • CSRF (Cross-Site Request Forgery): an attack where another website makes your browser send a request to a site you are logged in to, without your intent.
  • CSRF token / authenticity token: a secret value a site puts in forms and checks on submission, so that requests from other sites cannot be forged.
  • Request: the message a browser sends to a server, for example to load a page or submit a form.
  • GET / POST: two common request methods; GET usually fetches a page, POST usually submits data.
  • Cookie: a small piece of data a site asks the browser to store and send back with later requests.
  • Session: the period during which a site remembers who you are, usually tracked with a cookie.
  • Authentication: the act of proving who you are, typically by logging in.
  • Login boundary: the point where a visitor becomes a logged-in user.
  • Token rotation: replacing a token with a new value at a defined moment, such as login or logout.
  • State-changing request: a request that changes something on the server, such as updating a profile or posting a comment.
  • SameSite: a cookie setting that controls whether the cookie is sent with requests coming from other sites.
  • Shared workstation: a computer used by several people one after another.
  • Root cause: the underlying reason a vulnerability exists.
  • False positive: a finding that looks like a vulnerability but is not one on closer inspection.
  • CVSS: a standard scoring system for the severity of a vulnerability.

More by tmfelwu

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.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.