OTP Bypass via Client-Side Encryption Flaw
The OTP verification workflow relied on client-side encryption with exposed keys in a JavaScript file, allowing an attacker to tamper with the encrypted OTP response. This enabled account registration using an incorrect OTP.
medium.com
Published on medium.com
A critical flaw in the OTP verification workflow of a customer registration portal allowed account creation without a valid One-Time Password. The root cause was client-side cryptographic handling and exposed keys, enabling manipulation of the OTP verification process.
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 server trusted a client-encrypted OTP value without independently verifying the OTP against the expected value, and the encryption keys were exposed client-side.
Impact
An attacker could create accounts without a valid OTP, bypassing phone verification.
What the attacker needed
Access to the registration portal; ability to intercept HTTP traffic; a mobile number
The fix
OTP verification should be enforced server-side, with the client only handling display and input, and cryptographic keys should not be exposed client-side.
How it was found
- Access the registration page and enter a mobile number.
- Submit an incorrect OTP and observe the failure.
- Intercept the OTP verification request using Burp Suite and send it to Repeater.
- Capture a separate request with a different mobile number and a valid OTP to compare responses.
- Review source files and find crypto.js containing encryption logic and keys.
- Recreate the encryption externally, alter the encrypted OTP value, and submit a wrong but properly encrypted 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.
A one-time password (OTP) is a code sent to your phone to prove it's you. Here, the app checked the code using logic that ran in the user's browser, and the secret keys were visible to anyone. So an attacker could change the code and still create an 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.