Skip to content
Account takeover Write-up Beginner

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.

Shrey Shah Follow

Published on medium.com

{{media:0}}

Shrey Shah (Jerry), on medium.com

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

  1. Open the target website and start registration, which triggers an OTP to be sent
  2. Right-click the Continue button and inspect the element to find the validation function
  3. Note the checkOTP(event) function attached to the button
  4. Call the function from the browser console
  5. 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.

More by Shrey Shah

View all

6 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Account takeover

The lesson behind this report.

Getting into someone else's account through a flaw in sign-in, password reset, second factor, single sign-on or session handling.