Skip to content
Account takeover Write-up Beginner

I Bypassed OTP Verification by Changing One Response

The application trusted a client-side status value to decide whether an OTP had been verified. An attacker could change the response from FAILED to VERIFIED and continue registration without a valid OTP.

medium.com

Published on medium.com

Bug Bounty

Sahil maurya, 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 is a registration flow on a web application. The feature under test is OTP verification: after entering account details, the user requests an OTP, receives it by email or phone, submits it, and the application verifies it before letting the user complete registration. The normal sequence described in the report is:

```text
Enter Details     ↓Request OTP     ↓Enter OTP     ↓Verify OTP     ↓Complete Registration
```

The step of interest is OTP Verification, because that is the gate between an unverified registration and a completed account.

## Setup

The only tool named in the report is Burp Suite, used to intercept the OTP verification response. No account roles, versions, endpoints, parameters or headers are given. The precondition is simply that the tester has reached the OTP entry step of the registration flow and can intercept the response to the verification request.

## Finding it

The researcher submitted an incorrect OTP deliberately, to observe how the application responded to a failed verification. The intercepted response contained a status value similar to:

```json
{  "data": {    "request_token": "original_token",    "status": "FAILED"  }}
```

At that point the behaviour looked normal: the OTP was wrong, so `status` was `FAILED`. The verification outcome was delivered to the browser as a value the browser acted on.

## Exploitation

### Step 1: Submit an incorrect OTP and intercept the response

With Burp Suite intercepting, an incorrect OTP was submitted and the response was held before reaching the browser. The response carried `"status": "FAILED"` together with a `request_token`.

### Step 2: Change only the status value

The researcher changed one value in the response, from:

```json
"status": "FAILED"
```

to:

```json
"status": "VERIFIED"
```

The original `request_token` was left untouched.

### Step 3: Forward the modified response

The modified response was forwarded to the browser. The application accepted it and moved the user to the **Complete Your Registration** step, even though the OTP that had been entered was incorrect.

### Proof of concept

The Burp Suite screenshots show the three stages. Screenshot 1 is the invalid OTP response:


{{media:0}}



{{media:1}}


Screenshot 2 is the modified response:


{{media:2}}



{{media:3}}


Screenshot 3 shows registration continuing after the modification:


{{media:4}}


## Root cause

The report describes this as a client-side flow: the browser received `"status": "VERIFIED"` and behaved as if the OTP had been successfully verified. The browser trusted a value in the response, so changing that value in transit changed the outcome.

The researcher's analogy is a teacher who should mark an answer, but where the student is allowed to change the result from `Wrong ❌` to `Correct �
` and the system simply trusts it. The report does not show how the server handled the verification state. The report does not show the server-side code, so the exact implementation mistake is not stated.

## Impact

Modifying the OTP verification response let the researcher continue registration without a valid OTP. In the flow shown, this means reaching the Complete Your Registration step with an incorrect OTP. The report was closed as out of scope, so no severity or bounty is recorded.

## Fix

The report states that the server should make the final decision. The correct flow should be:

```text
User enters OTP       ↓Server checks OTP       ↓Is OTP correct?   ↙          ↘ YES           NO  ↓             ↓Verified      Reject  ↓Registration
```

Even if someone changes something inside the browser, the server should still say that the OTP was never successfully verified. The application should:

- Verify the OTP on the server.
- Store the verification state server-side.
- Bind the verification to the correct user/request.
- Make OTPs short-lived and single-use.
- Check the verification status again when registration is submitted.
- Never trust a client-side value like `status: VERIFIED` as proof of authentication.

In the researcher's words: the browser can show the result, but the server should decide the result.

## Variants to test

1. **Flip the status field on other OTP or verification endpoints.** Intercept the response to a failed verification and change the status value to the success value used by the application. A positive result is the client advancing to the next step (registration completion, password reset, login) without a valid code.
2. **Change boolean success flags.** Where the response contains a field such as `success`, `verified` or `valid`, set it to the success value and forward. A positive result is the same state transition on the client.
3. **Modify the HTTP status code.** Change a failure response code to a success code and observe whether the client proceeds. A positive result is the client treating the request as successful.
4. **Replay a successful response with a different request token.** Take a response from a genuinely verified session and replay it against a new registration attempt. A positive result is the second attempt being accepted, which would indicate the verification is not bound to the correct user or request.
5. **Test the same manipulation at the final submission.** After reaching the completion step, submit registration and intercept any verification check. A positive result is the account being created without a server-side verification record.
6. **Check OTP reuse and expiry.** Submit the same OTP twice, and submit an OTP after a long delay. A positive result is a second acceptance or acceptance after the intended lifetime, which would show the OTP is not single-use or short-lived.

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. 11 min read.

## What happened, in plain words

A website asked people to prove they owned an email address or phone number by typing a short code, called an OTP. The researcher typed a wrong code on purpose. The website's reply to the browser said the check had failed. The researcher caught that reply before it reached the browser, changed one word in it, and sent it on. The application then accepted the edited reply and moved the researcher to the Complete Your Registration step.

Nothing about the code itself was guessed or stolen. The only thing that changed was a message travelling from the website's server to the browser, and the browser believed it.

## The pieces you need to know

Before the steps make sense, here are the few ideas the whole story rests on.

- **Server and browser.** The browser is the program on your computer that shows web pages. The server is the computer somewhere else that holds the accounts and makes the real decisions. When you fill in a form, the browser sends your answers to the server, and the server sends back a reply.
- **Request and response.** A request is the message the browser sends ("here is a code, please check it"). A response is the message the server sends back ("that code is wrong"). Every action on a website is a pair of these.
- **OTP.** A one-time password. A short code, usually a handful of digits, sent to your email or phone. You type it in to prove the email or phone is really yours. It is meant to be used once and to expire quickly.
- **Registration flow.** The sequence of screens you go through to create an account. Here it is: enter your details, ask for a code, type the code, have it checked, then finish creating the account.
- **Burp Suite.** A tool used by security testers. It sits between your browser and the server like a post office worker who can open every letter, read it, change it, and then send it on. Normally your browser talks straight to the server; with Burp Suite in the middle, the tester can pause a message and edit it.
- **Intercepting.** Telling Burp Suite to hold a message instead of passing it straight through, so the tester can look at it and change it first.
- **JSON.** A way of writing data as text so programs can read it easily. It uses curly brackets for a group of values and pairs each name with a value, like `"status": "FAILED"`. Think of a labelled form: the label is the name, the entry next to it is the value.
- **Token.** A long random string that stands in for something, a bit like a cloakroom ticket. You hand it in and the server knows which registration or session it belongs to, without you having to send your password again. Here it is called `request_token`.
- **Client-side.** Anything that happens in the browser, on your own computer. The opposite is **server-side**, meaning it happens on the server, where the user cannot reach it. A rule enforced client-side can be changed by anyone who controls the browser; a rule enforced server-side cannot.
- **Response manipulation.** The vulnerability class in this report. The tester does not attack the code or the password; they edit the server's reply on its way to the browser, and the browser accepts the edited version as truth.

## The normal flow

The report describes the registration sequence like this:

```text
Enter Details     ↓Request OTP     ↓Enter OTP     ↓Verify OTP     ↓Complete Registration
```

Line by line:

1. **Enter Details**: you fill in the information the site needs to create an account.
2. **Request OTP**: you ask the site to send a code to your email or phone.
3. **Enter OTP**: you type the code you received into the form.
4. **Verify OTP**: the site checks whether the code you typed is the right one.
5. **Complete Registration**: only after a successful check does the site let you finish and create the account.

The interesting step is the fourth one, **Verify OTP**. It is the gate. Everything after it is supposed to be reachable only by someone who proved they hold the email address or phone number. If that gate can be walked around, the proof means nothing.

## Testing with Burp Suite

The researcher wanted to see what the site did when the code was wrong, so they typed an incorrect OTP on purpose. That is a deliberate choice: you learn how a system behaves at its edges by pushing it to the edge. With Burp Suite intercepting, the reply from the server was paused before it reached the browser.

The paused response contained a status value similar to this:

```json
{  "data": {    "request_token": "original_token",    "status": "FAILED"  }}
```

Reading it in plain words:

- The outer `{ }` is the whole message, one group of data.
- `"data"` is a label whose value is another group, the inner `{ }`. So everything useful sits inside `data`.
- `"request_token": "original_token"` is the cloakroom ticket for this particular registration attempt. The server uses it to know which attempt the message is about. In a real capture this would be a long random string; the report shows a placeholder.
- `"status": "FAILED"` is the verdict. The server is telling the browser that the code did not match.

At this point nothing looked wrong. A wrong code produced a failed status, which is exactly what should happen. The question the researcher was really asking was not "is the verdict correct?" but "who acts on the verdict?". The answer, as the next step shows, was the browser.

## The interesting part

The researcher changed one value in the response. From:

```json
"status": "FAILED"
```

to:

```json
"status": "VERIFIED"
```

Line by line:

- The label `"status"` stayed the same. Only the value after the colon changed.
- `"FAILED"` became `"VERIFIED"`. In plain words, the message now claims the code was checked and accepted.
- Nothing else was touched. The `request_token` was left exactly as it was, so the message still referred to the same registration attempt.

That last point matters. The researcher did not need a valid token from somewhere else, and did not need to guess anything. The same message, with one word swapped, was enough.

The modified response was then forwarded to the browser, meaning Burp Suite released it and the browser received it as if it had come straight from the server.

## And something interesting happened

The browser accepted the edited message and moved the researcher to a screen headed **Complete Your Registration**, even though the code that had been typed was wrong.

Think about what that means. The site had asked for proof, received the wrong proof, and the application still moved the researcher on after the reply was changed from "FAILED" to "VERIFIED". The gate was not really a gate. It was a sign on the browser's side of the door.

## Proof of concept

The report includes Burp Suite screenshots of the three stages. The first shows the response to the invalid OTP:


{{media:0}}



{{media:1}}


The second shows the same response after the status value was changed:


{{media:2}}



{{media:3}}


The third shows registration continuing after the change:


{{media:4}}


## Why did this happen?

The report explains it with a school exam. A teacher marks your answer and decides whether it is right. Now imagine the student is allowed to change the teacher's result from:

```text
Wrong ❌
```

to:

```text
Correct �

```

and the system simply trusts the changed result. The mark would mean nothing, because the person being marked controls the marking.

That is what was happening here. The report calls it a client-side flow: the browser received `"status": "VERIFIED"` and behaved as if the OTP had really been verified. The browser received `"status": "VERIFIED"` and behaved as if the OTP had really been verified. Change the value on the way past, and the outcome changes with it.

The report does not show the server-side code, so it does not say exactly where the implementation went wrong. What it does show is the effect: the browser acted on a value that could be changed in transit.

## What should happen instead?

The server should make the final decision. The correct flow should be:

```text
User enters OTP       ↓Server checks OTP       ↓Is OTP correct?   ↙          ↘ YES           NO  ↓             ↓Verified      Reject  ↓Registration
```

Reading the diagram in plain words:

1. The user types the code and the browser sends it to the server.
2. The **server** compares it with the code it generated. This comparison happens on the server, not in the browser.
3. The server asks itself: is the code correct?
4. If yes, it records that this registration attempt is verified, and the user can continue to registration.
5. If no, it rejects the attempt.

Even if someone changes something inside the browser, the server should still say that this OTP was never successfully verified. The browser can display a result, but it should not be the thing that decides it.

## How can it be fixed?

The report lists what the application should do:

- Verify the OTP on the server.
- Store the verification state server-side.
- Bind the verification to the correct user/request.
- Make OTPs short-lived and single-use.
- Check the verification status again when registration is submitted.
- Never trust a client-side value like `status: VERIFIED` as proof of authentication.

In plain words, each of those means:

1. **Verify on the server**: the comparison between the typed code and the real code happens on the server, where the user cannot edit it.
2. **Store the state server-side**: once a code is accepted, the server writes down that this attempt is verified, in its own records. The browser does not carry the proof; the server holds it.
3. **Bind it to the right user or request**: the note saying "verified" is tied to one specific registration attempt, so a success from one attempt cannot be used for another.
4. **Short-lived and single-use**: a code stops working after a short time and cannot be used twice, which limits how long a leaked or guessed code is useful.
5. **Check again at submission**: when the user finally submits the registration, the server looks at its own record once more, rather than trusting anything the browser sends.
6. **Never trust a client-side value**: a message that travelled through the browser can be edited by whoever controls the browser, so it cannot be treated as proof of anything.

In the researcher's words: the browser can show the result, but the server should decide the result. The report does not say whether any of these changes were made.

## What happened to the report

The issue was reported through the security program. It was later closed with the message that the bug was out of the scope of the program, meaning the program's rules did not cover this part of the application. The report was therefore not accepted, and no severity or bounty is recorded. The researcher notes that the testing still taught a useful lesson.

## Other things worth trying

These are variations on the same idea, useful if you want to test a similar flow yourself. Each one changes something in the conversation between browser and server and watches whether the browser carries on as if the check had passed.

1. **Flip the status field on other verification steps.** Intercept the response to a failed check and change the status to whatever value the application uses for success. You have a result if the browser moves to the next step, such as finishing registration, resetting a password or logging in, without a valid code.
2. **Change true/false flags.** Some responses carry a field such as `success`, `verified` or `valid`. Set it to the success value and forward. A result is the same kind of jump to the next step.
3. **Change the HTTP status code.** Every response carries a numeric code saying broadly whether it worked. Change a failure code to a success code and see whether the browser proceeds.
4. **Replay a successful response against a new attempt.** Take a response from a session where the code really was verified, and send it again during a fresh registration. If the second attempt is accepted, the verification is not tied to the right user or request.
5. **Test the final submission.** After reaching the completion step, submit the registration and intercept any check that happens then. A result is an account being created without the server having a record that the code was ever verified.
6. **Check reuse and expiry.** Submit the same code twice, and submit a code after a long delay. A result is a second acceptance, or acceptance after the code should have expired, which would show the code is neither single-use nor short-lived.

## Glossary

- **API**: the set of messages a program accepts and answers, so other programs can talk to it. Here, the request and response between the browser and the server.
- **Browser**: the program on your computer that displays web pages and sends your input to the server.
- **Burp Suite**: a testing tool that sits between browser and server and can pause, read and edit messages in both directions.
- **Client-side**: happening in the browser, on the user's own machine, where the user can change it.
- **Complete Your Registration**: the screen shown after a successful OTP check, where the account is finished.
- **Cookie**: a small piece of data a site stores in your browser so it can recognise you on later requests.
- **HTTP status code**: a number in every response saying broadly whether the request succeeded or failed.
- **Intercept**: to hold a message in transit so it can be inspected or changed before it is passed on.
- **JSON**: a text format for data, made of labelled values inside curly brackets.
- **OTP**: a one-time password, a short code sent to your email or phone to prove you control it.
- **Out of scope**: outside the parts of a system a bug bounty program has agreed to pay for or accept reports about.
- **Payload**: the part of a request or response that carries the data, as opposed to the addressing around it.
- **Registration flow**: the sequence of screens used to create an account.
- **Request**: the message the browser sends to the server.
- **Response**: the message the server sends back to the browser.
- **Response manipulation**: editing a server's reply on its way to the browser so the browser acts on the edited version.
- **Root cause**: the underlying reason a bug exists, as opposed to its visible effect.
- **Server**: the remote computer that stores accounts and makes the real decisions.
- **Server-side**: happening on the server, where the user cannot reach or edit it.
- **Token**: a long random string that stands in for a session or attempt, so the server knows which one a message belongs to.
- **Verification state**: the record of whether a particular attempt has passed its check.
- **Vulnerability class**: a family of bugs that share the same underlying mistake, such as trusting something the user can change.

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.