Skip to content
Account takeover Write-up Intermediate

#BugBounty — ”I don’t need your current password to login into your account” - How could I completely takeover any user’s account in an online classified ads company.

The password reset flow relied on a client-side JSON response to decide whether the OTP was correct. By tampering with the response to include a success flag, an attacker could bypass OTP verification and set a new password for any user, leading to full account takeover.

Avinash Jain Follow

Published on medium.com

{{media:0}}

Avinash Jain (@logicbomb_1), 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.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 4 min read.

Context

The target was an online classified ads company described as India's most popular. The feature in scope was the account recovery flow: a "Forgot Password" page that asks for the registered mobile number, sends an OTP to that number, and, once the correct OTP is entered, redirects the user to a "New password page" where a new password can be set for the account.

Image for post
Forgot Password Page From the original on medium.com

Forgot Password Page

The researcher's framing is that an OTP is stronger than a static, user-chosen password, but only if the verification step is actually enforced. The question he set out to answer was whether the OTP check could be bypassed rather than brute-forced.

Setup

No special tooling, accounts or versions are described; the researcher captured and modified HTTP responses. The flow starts from the registered mobile number alone.

Finding it

Browsing the site, the researcher went to the "Forget Password" functionality and entered the registered mobile number.

Image for post
OTP Verification Page From the original on medium.com

OTP Verification Page

Entering the number triggered an OTP, and submitting the correct OTP redirected to the "New password page" where a new password could be set.

The first attempt was the obvious one: brute-forcing the OTP to see whether rate limiting or a captcha was in place. That failed, as the researcher expected, and a captcha appeared after three consecutive wrong attempts. So the OTP value itself was not the weak point.

The interesting observation came from the response to a wrong OTP. The server returned a JSON body containing a status parameter with the value 401, meaning an unauthorised error response. That raised the question of whether the decision to accept or reject the OTP was made on the client side, in which case the response could simply be rewritten.

Image for post
Wrong OTP HTTP Response From the original on medium.com

Wrong OTP HTTP Response

Exploitation

Step 1: Rewrite the status code in the response

The researcher captured the response to the wrong OTP, changed the status JSON parameter value to 200, and forwarded the modified response.

Changed HTTP Response

This did not work. Some validation was still present and the application threw an error message instead of proceeding.

Image for post
Invalid OTP Error Message From the original on medium.com

Invalid OTP Error Message

Step 2: Replace the JSON body with a success flag

The reasoning at this point was that other parameters in the JSON body might be causing the validation error. So the researcher removed all the JSON parameters and added a success parameter with the value true. The modified response JSON therefore looked like this:

Image for post
Modified HTTP Response From the original on medium.com

Modified HTTP Response

With this body in place, the application redirected to the "Set Password Page".

Image for post
Forgot Password Page From the original on medium.com

Forgot Password Page

Step 3: Set a new password and log in

From the set password page the researcher set a new password for the victim account, and then logged in successfully with that new password. The full chain was: know the registered mobile number, request an OTP, submit any wrong OTP, rewrite the response to carry success: true, land on the set password page, choose a new password, and sign in.

Root cause

Modifying the response body was enough to move the flow forward to the set password page. The report does not describe the server-side implementation behind this. The brute-force protection (a captcha after three wrong attempts) was real, but they defend the OTP value, not the state transition that follows verification, so they did nothing against this attack. The report does not show the server-side implementation, so the precise mistake in the code is not described.

Impact

An attacker who knows a victim's registered mobile number could take over the account completely: bypass OTP authentication, set a new password, and log in as the victim. The researcher describes this as complete account compromise using only the mobile number. No further conditions, such as prior access to the phone or the OTP, are described as necessary.

Fix

The report records that the bug was reported to the company on 07-Jan-2018, marked fixed on 27-Jan-2018, re-tested and confirmed fixed on 03-Feb-2018, and rewarded on 28-Feb-2018. The specific code change is not described. The fix that addresses the root cause is to enforce OTP verification server-side, so that the set password step is only reachable after the server itself has validated the OTP for that session, and to never rely on client-supplied response fields such as status or success to authorise a state change.

Variants to test

  1. Rewrite the JSON body of a failed verification response to a success shape (for example a success: true field) and see whether the next step loads. A positive result is being redirected to the password reset or account setup page without a valid OTP.
  2. Change only the status code field in the response and observe whether the application still validates other parameters. A positive result is reaching the next step with just the status change.
  3. Remove all JSON parameters and add a single success flag, as in this report. A positive result is the same redirect to the set password page.
  4. Test the same response tampering on other OTP-gated flows, such as login with OTP, mobile number change, or email verification. A positive result is completing the protected action without the correct code.
  5. Check whether the set password endpoint can be called directly, skipping the OTP step entirely. A positive result is a successful password change without a prior verified OTP.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

What happened, in plain words

A security researcher found a way to take over any user account on an online classified ads website (a site where people post ads to buy and sell things). The site let users reset their password by receiving a one-time code (OTP) on their mobile phone. The researcher discovered that by intercepting and changing the response from the server, he could skip the OTP check entirely and set a new password for any account, as long as he knew the mobile number linked to it. He reported the bug, it was marked fixed, re-tested and confirmed, and he was rewarded.

Background: how password reset works

Many websites let you reset your password if you forget it. A common method is:

  1. You go to a "Forgot Password" page and enter your registered mobile number (or email).
  2. The site sends a one-time password (OTP) to that number via SMS.
  3. You enter the OTP on a verification page.
  4. If the OTP is correct, you are allowed to set a new password.

This is considered safer than a static password because the OTP is sent to your phone, which only you should have. But the security depends on the site actually checking the OTP on its own servers, not just trusting what your browser says.

The vulnerability: trusting the client

In this case, the researcher found that modifying the server's response to a wrong OTP let him reach the set password page. In other words, the site was trusting the client (the browser) to enforce the OTP check, rather than enforcing it on the server side.

This is a classic "authentication bypass" vulnerability: you bypass the authentication step (the OTP) and get access without knowing the secret.

Step-by-step: how the researcher did it

Step 1: Find the password reset flow

The researcher went to the "Forgot Password" page and entered a mobile number. The site sent an OTP to that number. He then entered the correct OTP and was redirected to a page where he could set a new password. This was the normal flow.

Image for post
Forgot Password Page From the original on medium.com

Forgot Password Page

Image for post
OTP Verification Page From the original on medium.com

OTP Verification Page

Step 2: Try brute force (and fail)

First, he tried the obvious attack: brute-forcing the OTP. Brute-forcing means trying many different codes until you guess the right one. But the site had protections: after three wrong attempts, a CAPTCHA appeared (a challenge to prove you are human). So brute force was not going to work.

Step 3: Look at the server's response to a wrong OTP

He entered a wrong OTP and captured the response from the server. The response was in JSON format (a way of structuring data that computers can easily read). It contained a status parameter with the value 401, which means "Unauthorized" (i.e. the OTP was wrong).

Image for post
Wrong OTP HTTP Response From the original on medium.com

Wrong OTP HTTP Response

He wondered: what if the site is only checking this status value in the browser to decide whether to show the next page? If so, he could change it to 200 (which means "OK") and trick the site into thinking the OTP was correct.

Step 4: Change the status code in the response

He intercepted the response (using a tool that lets you pause and modify HTTP traffic between your browser and the server) and changed the status value from 401 to 200. Then he forwarded the modified response to the browser.

Changed HTTP Response

But it didn't work. The site still showed an error message: "Invalid OTP". So there was some other validation happening.

Image for post
Invalid OTP Error Message From the original on medium.com

Invalid OTP Error Message

Step 5: Replace the entire JSON with a success flag

He thought that maybe other parameters in the JSON were causing the validation error. So he removed all the JSON parameters and added a single parameter: success with the value true. The modified response looked like this:

Image for post
Modified HTTP Response From the original on medium.com

Modified HTTP Response

This time, he was redirected to the "Set Password Page".

Image for post
Forgot Password Page From the original on medium.com

Forgot Password Page

Step 6: Set a new password and log in

From the Set Password Page, he set a new password for the victim's account. Then he logged in with that new password. He had successfully taken over the account using only the victim's mobile number.

Why this worked

The site was making a decision based on data that came from the client (the browser). When the server sent back a response saying the OTP was wrong, changing that response to a success flag led to the set password page. The report does not describe what the server checked before allowing the password change. This is a critical mistake: the server should always enforce security checks, not rely on the client.

Impact

An attacker who knows a victim's mobile number could take over their account completely: bypass the OTP, set a new password, and log in as the victim. No other information or access to the victim's phone was needed.

Timeline

  • 07-Jan-2018: Bug reported to the company.
  • 27-Jan-2018: Bug marked as fixed.
  • 03-Feb-2018: Re-tested and confirmed fixed.
  • 28-Feb-2018: Rewarded by the company.

How to fix it

The fix is to enforce OTP verification on the server side. The server should check the OTP itself and only allow the password reset if the OTP is correct. It should never trust client-supplied data like status or success to authorise a state change. The report does not describe the exact code change, but the principle is clear: always validate on the server.

Variants to test

If you are testing a similar flow, here are some variations to try:

  1. Rewrite the JSON body of a failed verification response to a success shape (e.g. {"success": true}) and see if the next step loads.
  2. Change only the status code field in the response and see if the application still validates other parameters.
  3. Remove all JSON parameters and add a single success flag, as in this report.
  4. Test the same response tampering on other OTP-gated flows, such as login with OTP, mobile number change, or email verification.
  5. Check if the set password endpoint can be called directly, skipping the OTP step entirely.

Glossary

  • OTP (One-Time Password): A code sent to your phone or email that you must enter to prove it's you. It can only be used once and expires after a short time.
  • Brute force: Trying many different combinations (like guessing passwords) until you find the right one.
  • CAPTCHA: A challenge (like identifying pictures) to prove you are human and not a computer program.
  • JSON: A way of formatting data so computers can easily read it, often used in web responses.
  • HTTP response: The message a server sends back to your browser after you make a request.
  • Status code: A number in an HTTP response that indicates what happened (e.g. 200 means OK, 401 means Unauthorized).
  • Client-side: Anything that happens in your browser (the client), as opposed to on the server.
  • Server-side: Anything that happens on the web server, which is under the control of the website owner.
  • Authentication bypass: A vulnerability where an attacker can skip or defeat a login or verification step.
  • Account takeover: When an attacker gains full control of someone else's account.
  • Intercepting proxy: A tool that sits between your browser and the server, allowing you to view and modify the traffic.
  • Parameter: A piece of data in a request or response, often in JSON format.
  • Success flag: A parameter that indicates whether an operation succeeded (e.g. success: true).
  • Set Password Page: The page where you choose a new password after verifying your identity.
  • Registered mobile number: The phone number linked to your account, used for verification and communication.

More by Avinash Jain

View all

29 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.