Time-Based Google OAuth Account Takeover: Adventures in Bug Bounties
The Google OAuth state parameter was predictable, being the same for all users within a time frame. An attacker could perform a CSRF attack to take over a user's account.
Published on medium.com
Feeling demotivated by these easy bugs, I decided to try something different. I wanted to find something significant, so I began my hunt.
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
Impact
An attacker could perform a CSRF attack and take full control of a user’s account, though the report rates it P3.
What the attacker needed
Victim uses Google OAuth login; attacker can predict state within time frame
The fix
The OAuth state parameter should be generated as a unique, unpredictable value for each user session.
How it was found
- Sign in with a first Google account and note the OAuth state code.
- Log out and sign in with a second Google account.
- Observe that the state code is the same for both accounts.
- Create another main account and sign in using the secondary login to confirm the state value is still the same.
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 log in with Google, the website sends a random code called a 'state' to prevent someone from tricking you into logging in as them. Here, that code was not random but repeated for everyone during a time window, so an attacker could guess it and hijack your login.
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.