Endpoint confusion lead to 2FA bypass
The signup endpoint for one user type accepted credentials for another user type and returned a session without checking two-factor authentication. An attacker who knew a victim's email and password could bypass the victim's 2FA and log in.
Published on medium.com
Hello everyone, Today I will talk about a bug I found in a BBP program on bugcrowd
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 signup endpoint for one user type also performed authentication for other user types and did not enforce the 2FA check that the normal login endpoint applied.
Impact
An attacker who knows a victim's email and password could bypass the victim's 2FA and take over the account for any user type on the platform.
What the attacker needed
Victim has 2FA enabled; attacker knows victim email and password; attacker can access the signup page
The fix
The signup endpoints should not authenticate existing accounts and should enforce the same 2FA check as the normal login endpoint.
How it was found
- Go to the parent signup page and enter a random unregistered email to reveal the other fields.
- Fill in a random password, first name and last name, then submit and intercept the signup request to /api/parent.
- In the intercepted request, change the email to the victim teacher's email and the password to the victim's password.
- Send the request and receive a 200 response containing the victim's data and a session.
- Use the returned session cookies to access the teacher subdomain as the victim without entering an OTP.
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 check, usually a code sent to your email or phone, after your password. Here, the normal login page asked for that code, but a different page meant for creating a new account did not. By sending the victim's email and password to that signup page, the attacker got a logged-in session without ever entering the 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.