Skip to content
CSRF Disclosed report Intermediate

Login CSRF using Twitter OAuth

The Twitter login flow in Phabricator did not keep any state between starting and finishing authentication, so a crafted callback link could log a victim into the attacker's account. An attacker could then trick a victim into acting inside the attacker's account, which is a login CSRF issue.

mathias Follow

Originally disclosed on HackerOne

  • Triaged in 6 hours
  • Fixed in 8 hours
  • Paid in 8 hours
  • Disclosed after 30 days

This bug is related to bug report #774 (Log in a user to another account) by @dawidczagan as this bug also allows a user to be logged in as the attacker. The main reason is that no state is maintained in the authentication flow. Although the Twitter flow still uses OAuth 1.0A, which has no state parameter as in OAuth 2, it is still possible to prevent this type of attack by setting an additional parameter in the oauth_callback value.

An attacker could exploit this bug as follows:

  1. Attacker initiates Twitter OAuth process with Phabricator
  2. Attacker allows access to Phabricator app
  3. Attacker records and drops redirection to Phabricator (in order not to consume token)
  4. Attacker directs victim to /auth/login/twitter:twitter.com/?oauth_token={attacker_token}&oauth_verifier={attacker_verifier}
  5. Victim is now logged in as attacker

To mitigate this vulnerability, either maintain state in the authentication flow by adding a parameter in the callback value or, as Twitter seems to support OAuth 2, use that instead.

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

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the OAuth callback was accepted without any per-session state value, so the application could not tell whether the login was started by the same browser.

Impact

A victim could be silently logged into the attacker's account, so anything the victim then does happens inside that account.

What the attacker needed

Attacker has a Twitter account; victim clicks the crafted login link

The fix

The login flow should keep state by adding a parameter to the callback value, or move to OAuth 2 which supports a state parameter.

How it was found

  1. The attacker starts the Twitter OAuth flow with Phabricator.
  2. The attacker approves access to the Phabricator app.
  3. The attacker captures the redirect back to Phabricator and stops it so the token is not used up.
  4. The attacker sends the victim a login URL containing the attacker's token and verifier.
  5. The victim is logged in as the attacker.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you log in with another service, the site should remember that it was you who started the login. Here it did not, so an attacker could prepare a login link tied to their own account and send it to someone else. The victim then ends up logged in as the attacker without noticing.

What is CSRF?

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

More by mathias

View all

1 more disclosed report, 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.