Skip to content
CSRF Disclosed report Beginner

Log in a user to another account

The login endpoint accepted a cross-site POST without a CSRF token, so a page on another site could submit credentials and log the victim into an attacker-chosen account. The attacker could force a logged-out victim to be signed in as a different user.

dawidczagan Follow

Originally disclosed on HackerOne

Bounty$300 View original
  • Triaged in 4 hours
  • Fixed in 9 hours
  • Paid in 10 hours
  • Disclosed after 30 days

It is possible to log in the user to another account (no CSRF token). POC (for demonstration purposes with Submit button; normally sent automatically):

<html> <body> <form action="http://DOMAIN-WITH-PHABRICATOR/auth/login/password:self/" method="POST"> <input type="hidden" name="&#95;&#95;dialog&#95;&#95;" value="1" /> <input type="hidden" name="username" value="user3" /> <input type="hidden" name="password" value="password3" /> <input type="submit" value="Submit request" /> </form> </body> </html>

The user needs to be logged out, when the aforementioned request is submitted. It is assumed that user3 with password3 exists.

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

What the report shows

The feature in question is the password login endpoint. The researcher found that a login request could be submitted on behalf of a victim without a CSRF token, which makes it possible to log the user in to another account. It was disclosed on 22 February 2014 with a bounty of 300 USD. No severity or CVSS score is given.

The proof of concept is an HTML page containing a form that posts to the password login path. The researcher notes that the Submit button is there for demonstration and that the request would normally be sent automatically.

HTML
<html>
  <body>
    <form action="http://DOMAIN-WITH-PHABRICATOR/auth/login/password:self/" method="POST">
      <input type="hidden" name="&#95;&#95;dialog&#95;&#95;" value="1" />
      <input type="hidden" name="username" value="user3" />
      <input type="hidden" name="password" value="password3" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

The form carries three fields: a hidden __dialog__ field set to 1 (written with HTML entities for the underscores), a username field set to user3, and a password field set to password3. The action points at /auth/login/password:self/ on the domain hosting the installation.

The report states one precondition: the user needs to be logged out when the request is submitted. It also assumes that user3 with password3 exists. The report assumes that user3 with password3 exists, and that the victim is logged out when the request is submitted.

The report stops there. It does not describe the response, the resulting session state, any fix applied by the vendor, or any further exploitation.

Root cause

The login endpoint accepts a POST that changes authentication state without requiring a CSRF token. The report says this directly: the request works with no CSRF token. Because the endpoint does not tie the request to the user's browser session through an unpredictable value, any other site can cause the victim's browser to submit it.

Impact

The consequence described is login CSRF: the victim is logged in to another account, in this case user3. The report itself only claims the account switch, and only under the stated condition that the victim is logged out at the time.

How this kind of bug works

Browsers attach cookies to requests based on the destination origin, not on who caused the request. If a state-changing endpoint authenticates the request solely by a cookie, or in this case by the credentials in the body, a page on any other origin can make the victim's browser send that request. The attacker cannot read the response because of the same-origin policy, but for login CSRF reading the response is unnecessary: the side effect is the new session cookie that the server sets on the victim's browser.

The standard defences are a per-session, unpredictable anti-CSRF token validated on every state-changing request; checking the Origin or Referer header against the expected site; and setting session cookies with SameSite so that cross-site requests do not carry them. Login forms are sometimes left out of these protections on the assumption that they are harmless, which is exactly the gap this report describes.

How to test for it

  1. Identify state-changing endpoints, starting with authentication: login, logout, password change, email change, MFA enrolment, and account linking.
  2. Capture a legitimate request in a proxy and inspect the body and headers for an anti-CSRF token, and check whether the session cookie is SameSite protected.
  3. Replay the request after removing the token, or with a token from a different session, and see whether the server still accepts it.
  4. Build a page on a different origin that submits the same request automatically, and load it in a browser where the victim is in the required state (for login CSRF, logged out).
  5. A positive result is that the server processes the request and the browser ends up in the new state, for example authenticated as the account named in the forged form.

Common false positives: the endpoint rejects the request only because of a missing or malformed header that a real browser would send; the token is validated but the test removed it from the wrong place; the action has no security consequence; or the browser blocks the request because of SameSite cookies, in which case the finding does not reproduce in a real browser even though the raw request succeeds.

How it is fixed

Require a per-session anti-CSRF token on the login form and validate it server-side, rejecting requests without a valid token. As defence in depth, validate the Origin or Referer header on authentication requests and set session cookies with SameSite=Lax or SameSite=Strict. Frameworks usually provide this protection by default; the fix is to make sure the login path is covered like any other state-changing route.

Hunting notes

Login CSRF hides in endpoints that are treated as entry points rather than state changes: login, logout, SSO callbacks, account switching, and any form that sets a cookie. Recon signals include authentication paths that accept POST without a visible token field, and session cookies set without SameSite. State the precondition, such as the victim being logged out, plainly, because a program will check it.

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

What happened, in plain words

The target is a web application with a login page where you type a username and a password to get into your account. Like most such tools, it has a login page where you type a username and a password to get into your account. The researcher found that this login page could be triggered by a page on a completely different website, without the user doing anything deliberate. The result is that the victim ends up signed in to another account.

This kind of attack is called cross-site request forgery, or CSRF. To understand it, imagine that a bank teller knows you by sight and will accept any instruction that is handed over at your usual counter. If someone else can walk up to that counter and hand over a note while you happen to be standing there, the teller may treat the note as coming from you. A browser works in a similar way: it attaches your cookies (small pieces of data that identify your session) to requests based on where the request is going, not on who caused it. A malicious page can therefore make your browser send a request that looks like it came from you.

No severity rating or CVSS score is given.

What the report shows

The researcher states plainly that it is possible to log the user in to another account, and that the request carries no CSRF token. The proof of concept is a small HTML page containing a form that posts to the password login path. The Submit button is there only for demonstration; in a real attack the request would be sent automatically.

HTML
<html>
  <body>
    <form action="http://DOMAIN-WITH-PHABRICATOR/auth/login/password:self/" method="POST">
      <input type="hidden" name="&#95;&#95;dialog&#95;&#95;" value="1" />
      <input type="hidden" name="username" value="user3" />
      <input type="hidden" name="password" value="password3" />
      <input type="submit" value="Submit request" />
    </form>
  </body>
</html>

Line by line:

  1. <html> and <body> are the ordinary wrapper tags of any web page. Nothing here is unusual; that is the point. The page looks harmless.
  2. <form action="http://DOMAIN-WITH-PHABRICATOR/auth/login/password:self/" method="POST"> opens a form. The action is the address the browser will send the data to: the login path on the Phabricator installation. The method="POST" means the data travels in the body of the request rather than in the address bar, which is how login forms normally work.
  3. <input type="hidden" name="&#95;&#95;dialog&#95;&#95;" value="1" /> is a field the user never sees. The name is written with HTML entities (&#95; is an underscore), so it decodes to __dialog__, and its value is 1. Hidden fields are how a page carries extra information the server expects without showing it on screen.
  4. <input type="hidden" name="username" value="user3" /> supplies the username user3.
  5. <input type="hidden" name="password" value="password3" /> supplies the password password3.
  6. <input type="submit" value="Submit request" /> is the visible button. In a real attack this would not be needed, because the page would submit the form by itself as soon as it loads.

The report gives two preconditions. First, the victim must be logged out when the request is submitted. Second, an account user3 with password password3 must exist. The report stops there: it does not describe the server's response, the resulting session, any fix by the vendor, or further exploitation.

Why does each step matter? The hidden fields matter because they are the attacker's credentials, and the absence of any token field is the actual flaw. A CSRF token is a random value that the server gives to a genuine login form and checks when the form comes back; a page on another site cannot guess it. The report states that the request carries no CSRF token.

In general, how this kind of bug works

Browsers attach cookies to requests based on the destination site, not on who caused the request. If an endpoint that changes something important accepts a request without an unpredictable value proving it came from the site's own pages, any other site can make the victim's browser send that request. The attacker cannot read the response, because the browser's same-origin policy stops one site from reading another site's data. For login CSRF that does not matter: the side effect is the new session cookie the server sets on the victim's browser.

The usual defences are:

  • a per-session, unpredictable anti-CSRF token that is validated on every request that changes state;
  • checking the Origin or Referer header against the expected site;
  • setting session cookies with SameSite, so cross-site requests do not carry them.

Login forms are sometimes left out of these protections on the assumption that they are harmless. That assumption is the gap this report describes: logging in establishes a session, so it changes who the victim is authenticated as.

If you want to test for this yourself:

  1. List the endpoints that change something, starting with authentication: login, logout, password change, email change, MFA enrolment and account linking.
  2. Capture a legitimate request in a proxy (a tool that sits between browser and server and lets you read and edit traffic) and look for an anti-CSRF token in the body or headers, and check whether the session cookie is SameSite protected.
  3. Replay the request with the token removed, or with a token from a different session, and see whether the server still accepts it.
  4. Build a page on a different origin that submits the same request automatically, and load it in a browser where the victim is in the required state (for login CSRF, logged out).
  5. A positive result is that the server processes the request and the browser ends up in the new state, for example authenticated as the account named in the forged form.

Watch out for false positives: the endpoint may reject the request only because of a missing or malformed header that a real browser would send; the token may be validated but you removed it from the wrong place; the action may have no security consequence; or the browser may block the request because of SameSite cookies, in which case the finding will not reproduce in a real browser even though the raw request succeeds.

The fix is to require a per-session anti-CSRF token on the login form and validate it on the server, rejecting requests without a valid token. As defence in depth, validate the Origin or Referer header on authentication requests and set session cookies with SameSite=Lax or SameSite=Strict. Frameworks usually provide this protection by default; the fix is to make sure the login path is covered like any other state-changing route.

Glossary

  • Endpoint: a specific address on a server that accepts requests, such as a login path.
  • Request: a message a browser sends to a server asking it to do something or return something.
  • POST: an HTTP method that sends data in the body of the request, commonly used for forms.
  • Cookie: a small piece of data a site stores in your browser and that your browser sends back on later requests to that site.
  • Session: the period during which a site remembers that you are signed in, usually tracked by a cookie.
  • CSRF (cross-site request forgery): an attack where a page on one site makes your browser send a request to another site, relying on your browser's automatic behaviour.
  • CSRF token: a random, unpredictable value a site includes in its forms and checks on the server, so that requests forged by other sites are rejected.
  • Login CSRF: a CSRF attack against a login form, which signs the victim in to another account.
  • Hidden field: a form field that is sent with the request but not shown to the user.
  • HTML entity: a code such as &#95; that represents a character (here an underscore) in HTML.
  • Same-origin policy: the browser rule that stops one site from reading data belonging to another site.
  • Origin / Referer header: request headers that tell the server which site the request came from.
  • SameSite: a cookie setting that controls whether the cookie is sent with requests coming from other sites.
  • Proxy: a tool that sits between your browser and a server so you can inspect and modify the traffic.
  • False positive: a finding that looks like a vulnerability but is not exploitable in practice.
  • CVSS: a standard scoring system for rating the severity of vulnerabilities.

More by dawidczagan

View all

9 more disclosed reports, best first.

More from Phabricator

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.