OTP Bypass - Developer’s Check
The application validated the one-time password entirely in client-side JavaScript, with the expected OTP hard-coded in the page source. Anyone could read the correct OTP from the code and log in without receiving it.
Published on medium.com
{{media:0}}
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
The OTP comparison was performed in client-side JavaScript with the expected value hard-coded, instead of being verified on the server.
Impact
An attacker could bypass the OTP step and complete login or registration without access to the victim's phone.
What the attacker needed
Access to the registration page; a browser with developer tools
How it was found
- Open the target website and start registration, which triggers an OTP to be sent
- Right-click the Continue button and inspect the element to find the validation function
- Note the checkOTP(event) function attached to the button
- Call the function from the browser console
- Open the file shown in the debugger to see the OTP that was sent to the mobile
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 short code sent to your phone to prove it is really you. Here the website checked that code inside the browser rather than on its own server, and the correct code was written into the page's code. So anyone could open the page's code, read the code, and type it in without ever owning the phone.
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.