Multi-factor Auth Bypass with Password Reset Function
The password reset token was a base64 encoding of the username, a SHA-256 hash of the password, and random padding, allowing an attacker who knows a user's password to forge a reset token. By visiting the reset link, the attacker could change the password and log in without the required multi-factor authentication.
Published on vj0shii.github.io
Recently when I was testing a web application, which is used for money transfer, wallet and banking, the scenario was that the multi factor authentication was compulsory, without enabling the user cannot use the application, I was able to login into someone’s account without MFA and with only username and password
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 password reset token was generated by base64-encoding the username, a SHA-256 hash of the password, and random padding, making it predictable for anyone who knows the password.
Impact
An attacker who knows a user's password could reset it and log in without the required MFA, and could later change the password back so the user does not notice.
What the attacker needed
Know the victim's password; victim has MFA enabled; attacker can visit the reset page first
How it was found
- Request a password reset and capture the reset link containing the base64 token.
- Decode the token to see the username and a long string.
- Identify that the long string is a SHA-256 hash of the account password.
- Generate a new token by base64-encoding the username, the SHA-256 hash of the password, and random padding.
- First visit the password reset page, then visit the reset link with the generated token.
- Change the password and get logged in without being asked for the MFA 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.
Multi-factor authentication (MFA) is an extra login step, like a code from an app, meant to stop someone who only has your password. Here, the password reset link contained a token that was built from the user's name and a scrambled version of their password, so anyone who knew the password could make a valid reset link. Using that link let them set a new password and get straight into the account without the MFA 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.