Grammarly Keyboard for Android "Authorization Code with PKCE" flow implementation vulnerability that allows account takeover
The Grammarly Keyboard for Android app used a weak pseudo-random number generator to create the PKCE code verifier during OAuth authorisation. A malicious app on the same device could guess that verifier and exchange the authorisation code for an access token, leading to account takeover.
Originally disclosed on HackerOne
- Triaged in 17 hours
- Fixed in 2 months
- Paid in 11 days
- Disclosed after 4 months
Summary by the program
@tomtenisse identified a vulnerability in Grammarly Keyboard for Android that allowed malicious application installed on the device to guess the PKCE code verifier value and consequently obtain access to OAuth access_token (grauth cookie). The vulnerability was fixed by moving from PRNG to SecureRandom
Thank you, @tomtenisse, for the detailed report and collaboration!
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 app used a non-cryptographic pseudo-random number generator (PRNG) to create the PKCE code verifier, making it predictable.
Impact
A malicious app installed on the same Android device could obtain an OAuth access token and take over the user's Grammarly account.
What the attacker needed
Malicious app installed on the same device
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 to an app using another service (like Google), a security check called PKCE makes sure only your app can finish the login. This app created the secret part of that check using a predictable random number generator, so another app on your phone could guess it. With that guess, the other app could steal your login token and access your 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.