Skip to content
OAuth / SSO Write-up Beginner

I Hacked an Account Just by Tweaking an Email (OAuth Implicit F

The OAuth implicit flow's /authenticate endpoint accepted a client-supplied email address without verifying that the access token belonged to that user. An attacker could change their own email to another user's and be logged in as that user.

Sumanth Yerranagula Follow

Published on medium.com

PortSwigger Lab You know that moment when a site lets you log in with your Google or Facebook account? Feels smooth, right? 😎

Sumanth Yerranagula, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

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

How it worked

Root cause

The server trusted the email address supplied by the client in the /authenticate request instead of deriving the identity from the OAuth access token.

Impact

An attacker with a normal account could take over another user's account, in this lab the account of Carlos, without knowing their password.

What the attacker needed

A normal account on the site; ability to intercept and modify requests; victim's email address known

The fix

The server should verify that the OAuth access token belongs to the claimed user and derive the identity from the token rather than the client-supplied email.

How it was found

  1. Log in normally with the test account through the social OAuth login.
  2. Inspect the HTTP history and find the GET /auth request followed by the POST /authenticate request containing email and access token.
  3. Send the POST /authenticate request to Repeater and replace the email with the victim's email.
  4. Send the request; the server accepts it without error.
  5. Use 'Request in browser' in the original session and open the resulting URL, which logs you in as the victim.

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 write-up has not been written yet. The Original tab links to the source.

When you click 'Log in with Google', the site receives a token proving who you are. This site also let the browser say which email the token belonged to, and believed it. So someone could log in as themselves, then simply claim to be another user and get that user's account.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by Sumanth Yerranagula

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.