2FA Bypass on private bug bounty program due to CSRF token misconfiguration
When the two-factor authentication code was removed from the login request, the application returned an error but still created a valid session. The attacker could then navigate directly to account pages and access everything without ever supplying the second factor.
Sharat Kaikolamthuruthil Follow
Published on medium.com
This is my first blog on web application security. In this I will share the first of many 2FA bypasses that I found on private bug bounty programs.
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 session was established before the 2FA check completed, and a CSRF token misconfiguration meant the failed login still left a usable authenticated session.
Impact
An attacker who already knew a victim's password could bypass the second factor entirely and access every page of the account, which matters greatly for a financial institution.
What the attacker needed
Valid username and password; 2FA enabled on the target account
How it was found
- Capture the login request containing the authentication token parameter in the body.
- Remove the authentication token from the request and forward it.
- Observe the error response pointing at the login URL.
- Change the URL to the account edit page and load it.
- Reach the account settings page and other pages without any 2FA prompt.
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, asked for after the password. Here the site checked the password, then showed an error when the code was missing, but had already logged the user in behind the scenes. So anyone with the password could skip the code and reach the account.
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.