Client Side Encryption Bypass
The application encrypted the password and OTP on the client side using a hardcoded AES key, and the server response was also encrypted. An attacker could bypass authentication and OTP by modifying the decrypted response in the browser's developer tools to change the status value from 0 to 1.
bhattsameer.github.io
Published on bhattsameer.github.io
Hi, this is Debugger ready to debug JavaScript.
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 encryption key was hardcoded in client-side JavaScript, and the server trusted the client-side decryption and status check to decide whether authentication succeeded.
Impact
An attacker could bypass the login authentication and reach the OTP page without valid credentials, and the same technique could likely bypass the OTP check as well.
What the attacker needed
Access to the web application; browser developer tools; valid email address (for some steps)
The fix
The encryption key should not be hardcoded in client-side code, and authentication decisions must be made on the server, not based on client-side status values.
How it was found
- Intercept the login request and observe that the password parameter and the whole response are encrypted.
- Search the JavaScript source files for keywords like 'encrypt' or 'OTP' to find the encryption logic.
- Identify the logear() function, which contains a hardcoded AES key and performs encryption and decryption.
- Set a breakpoint in the logear() function and submit invalid credentials to observe the decrypted response.
- Modify the value of the status variable (or the condition check) in the browser's developer tools to make it indicate success.
- Submit invalid credentials again and observe that the application redirects to the OTP page, bypassing authentication.
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.
The website scrambled the password and one-time code in your browser before sending them, using a secret key that was written directly in the page's code. Because the key was visible, someone could use the browser's built-in tools to unscramble the server's reply and change a 'denied' message into a 'success' message, getting past the login and the one-time code check.
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.