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.
- 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:
- Attacker initiates Twitter OAuth process with Phabricator
- Attacker allows access to Phabricator app
- Attacker records and drops redirection to Phabricator (in order not to consume token)
- Attacker directs victim to
/auth/login/twitter:twitter.com/?oauth_token={attacker_token}&oauth_verifier={attacker_verifier} - 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.
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
- The attacker starts the Twitter OAuth flow with Phabricator.
- The attacker approves access to the Phabricator app.
- The attacker captures the redirect back to Phabricator and stops it so the token is not used up.
- The attacker sends the victim a login URL containing the attacker's token and verifier.
- 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.