2FA Bypass via OAuth Linking
The application allowed a user to link a social login to an existing account by entering that account's email and password, but the linking flow did not enforce the second factor that was enabled on the account. An attacker who already knew the victim's password could therefore log in through the OAuth linking path and reach the account without supplying a 2FA code.
Sharat Kaikolamthuruthil Follow
Published on medium.com
This is a write-up explaining how I was able to bypass 2FA via OAuth linking on a popular private bug bounty program.
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
Likely the OAuth account-linking flow authenticated the user with the password but did not run the same second-factor check that the normal login flow enforces.
Impact
An attacker who already knew the victim's password could bypass the second factor and take over the account through the OAuth linking flow.
What the attacker needed
Victim has 2FA enabled; attacker knows victim's password; attacker has a social login account
The fix
The OAuth linking flow should require the same second-factor verification as the normal login before granting access to an account with 2FA enabled.
How it was found
- Create a normal account with the victim's email and enable 2FA on it.
- Start signing in with Facebook and choose not to share the Facebook email address.
- When asked for an email, enter the victim account's email address.
- Enter the victim account's password at the prompt.
- Observe that the application grants access without asking for a 2FA code.
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.
Two-factor authentication (2FA) is a second proof of identity, usually a short code from an app or SMS, asked for after the password. Here the site let people sign in with a social account such as Facebook, and when that social account was tied to an existing account the site asked for the password but skipped the 2FA step. So anyone who already had the password could get in without the extra code.
What is Account takeover?
Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.