Skip to content
Business logic Write-up Beginner

How response Manipulation got me a little, but sweet Bounty

The two-factor authentication setup endpoint returned a validation error when the wrong password was supplied, but the client-side flow could be tricked by editing the HTTP response to look like a success. An attacker who was already logged in could then enable 2FA on the account without knowing the password.

Tommaso De Ponti Follow

Published on infosecwriteups.com

Hi everyone, I’ve not been writing on Medium for a while(busy months here), however today I wanted to share with you how Response manipulation got me a Low severity bug, going hand in hand with a quickly earned bounty. When targeting a Website/Web App(or Both :D), you usually spend a while on it and search mainly for…

Tommaso De Ponti, on infosecwriteups.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. 5 min read.

Context

This is a short case study about a low severity finding on a web application: the two-factor authentication (2FA) enablement flow asked for the account password before it would generate a 2FA secret and QR code, and that password check could be skipped by editing the HTTP response in an intercepting proxy. The researcher describes it as a violation of secure web application design principles, and notes that it still earned a bounty, which in his view probably depends on who receives the report.

The technique at the centre of the write-up is response manipulation: changing what the server sent back so that the browser displays UI elements it should not, reveals new endpoints and buttons, triggers new requests, and sometimes bypasses password restrictions or OTPs. The author points to a separate write-up by Sriram Kesavan on OTP bypass on a video sharing site for the OTP variant, and explicitly frames his own finding as much lower impact.

Setup

The researcher was already authenticated on the target when he tested the 2FA enablement feature. He states plainly that the bug only worked if the attacker was already authenticated, and he asks the obvious question himself: why would an attacker enable 2FA on a victim's account? The answer he gives is that the issue is a design principle violation rather than a direct account takeover primitive.

Tools used: an intercepting proxy to edit responses, and Google Authenticator to scan the returned QR code during the normal, successful flow. The host names and cookie values in the captured traffic are redacted in the write-up.

Finding it

Before touching the target, the author lays out how he decides whether response manipulation is worth trying against an authentication step. The test is about what happens after the protected action completes:

  1. If the endpoint triggers another action before the process finishes, or if the process completes immediately after the auth form, manipulation is unlikely to help. For an OTP flow, if the correct code produces a message like "Ok you have completed the OTP process, now login", bypassing the OTP with response manipulation will not work.
  2. If the flow asks for something else afterwards, such as a password, then it might be possible.
  3. Even then, check whether the value you wanted to bypass is still present in the response body after the second step. If submitting the second step returns something like:
Text
otp=1111&other_data=other_data

then it is not possible, but if it returns only:

Text
other_data=other_data

then the earlier check can potentially be bypassed by manipulating the response.

On the target, enabling 2FA first asked for password confirmation. After entering the correct password, the response returned the 2FA secret and QR code, which the researcher scanned with Google Authenticator, clicked next, entered the authenticator code, and confirmed that 2FA was enabled. That completed the normal flow and made the password step the only gate worth attacking.

Exploitation

Step 1: capture the successful password confirmation

With 2FA disabled again, the researcher started the enablement flow and submitted the correct password to record what a valid response looks like:

The body is a JSON:API style document of type createtwofa carrying the 2FA secret, a qr value and a qr_url. The response also sets a __cfduid cookie and includes a Z-Redacted-Password-Auth-Valid-Until header with a Unix timestamp, which suggests the server tracks how long the password confirmation stays valid. The client uses this body to render the QR code and move on to the authenticator code step.

Step 2: submit a wrong password

The researcher disabled 2FA and started again, this time entering a wrong password. The server rejected it:

HTTP
HTTP/1.1 422 Unprocessable EntityDate: Tue, 28 Jul 2020 11:41:27 GMTContent-Type: application/jsonContent-Length: 177Connection: closeSet-Cookie: __cfduid=somecookie; expires=Thu, 27-Aug-20 11:41:26 GMT; path=/; domain=redacted.com; HttpOnly; SameSite=Lax; SecureCache-Control: no-cache, privateAccess-Control-Allow-Headers: origin, content-type, access-token, x-tracking-idAccess-Control-Allow-Origin: *X-RateLimit-Limit: 100X-RateLimit-Remaining: 99X-BRedacted-Password-Auth-Valid-Until: 1595935589Strict-Transport-Security: max-age=31536000; includeSubDomainsCF-Cache-Status: DYNAMICExpect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"Server: cloudflare{"errors":[{"status":422,"code":"user.validation.exception","title":"Validation exception"}],"last_user_action":{"date_iso8601":"2020-07-28T13:41:27+02:00","unix":"1595936487"}}

The status is 422 with a user.validation.exception error object and no data member, so the client has nothing to render a QR code from. Note that the error response still carries the same X-BRedacted-Password-Auth-Valid-Until header value as the successful one.

Step 3: replace the error with the captured success

In the proxy, the researcher replaced the 422 body and status with the 200 response captured in step 1:

He forwarded it and followed the rest of the process. He forwarded the modified response and followed the rest of the process, and 2FA was enabled without a valid password. The design principle the feature was supposed to enforce, that enabling 2FA requires proving knowledge of the password, was bypassed.

Root cause

Because the enablement process continues after the password form (it asks for the authenticator code next), and because the password value is not echoed back in the response body, the flow matches the author's own precondition for a manipulable check.

Impact

The impact is low. The attacker must already be authenticated in the victim's account, and the outcome is that 2FA gets enabled without knowing the password. The author is explicit that this is a violation of secure web application design principles rather than a route to account takeover, and he notes that whether it earns a bounty probably depends on the receiving program. In this case it did earn a small bounty, which he describes as little but sweet.

Fix

The write-up does not describe any fix or vendor response.

Variants to test

The author's decision procedure generalises to any multi-step flow where a check is followed by another action:

  1. Find a step that gates a sensitive action, such as password confirmation before enabling 2FA.
  2. Check whether the flow continues after that step with another request, and whether the checked value is absent from the response body. A positive sign is a response that contains only the data needed for the next step, as in the other_data=other_data example.
  3. Capture the success response, submit a wrong value, and replace the error with the captured success in the proxy.
  4. Try the same on OTP flows, but only where the OTP is followed by a further step and the code is not echoed back; where the flow completes immediately after the code, the author says manipulation will not work.

Closing

The author ends by thanking readers and wishing them good hunting.

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 security researcher found a small flaw in a website's two-factor authentication (2FA) setup. 2FA is the extra step some sites ask for after your password, usually a six-digit code from a phone app, so that a stolen password alone is not enough to get in. To turn 2FA on for your account, the site asked the researcher to type his password again as a confirmation. He discovered that he could type a wrong password, catch the server's rejection message in a tool that sits between his browser and the site, and rewrite that rejection into the success message the server had sent earlier. He forwarded the modified response and followed the rest of the process, and 2FA was switched on without a correct password.

This is called response manipulation: editing the reply that comes back from the server so the page shows things it should not. The impact here is low. The attacker has to be logged in to the victim's account already, and the result is only that 2FA gets enabled without the password. The researcher calls it a violation of secure web application design principles, and it still earned him a small bounty. He notes that whether such a report gets paid probably depends on who receives it.

Photo by Josh Appel on Unsplash From the original on infosecwriteups.com

The photo at the top of the original article is by Josh Appel on Unsplash.

The idea: response manipulation

Every time you use a website, your browser sends a request to a server and the server sends back a response. The response has two parts that matter here: a status code (a number saying whether things went well, such as 200 for success or 422 for a rejected form) and a body (the actual content, often in a format called JSON, which is just structured text made of names and values). The page you see is built by the browser from that response.

Response manipulation means intercepting the response on its way back and changing it before the browser sees it. A tool called an intercepting proxy does this: it sits between browser and server, lets you pause each message, edit it, and then forward it. Think of it like a postal worker who opens a letter, rewrites the answer, and delivers the rewritten version, so the recipient acts on words the sender never wrote.

Why does this matter? Because if the browser decides what to show based only on the response, and the server does not check things again later, you can make the site display buttons, forms and pages it would normally hide. That can reveal new endpoints (addresses the site responds to), new buttons, and can trigger requests you were not meant to be able to make. Sometimes it lets you skip a password check or a one-time code (OTP). The author points to a separate write-up by Sriram Kesavan about bypassing an OTP on a video sharing site for that variant, and says his own finding is much lower impact.

When is this worth trying?

Before touching a target, the author explains how he decides whether response manipulation could work against a login-style check. The question is what happens after the protected step finishes.

  1. If the step completes the whole process right away, manipulation is unlikely to help. For an OTP flow, if the correct code produces a message like "Ok you have completed the OTP process, now login", then faking the response will not get you past the OTP, because there is no later step to unlock.
  2. If the flow asks for something else afterwards, such as a password, then it might be possible.
  3. Even then, check whether the value you wanted to bypass is still present in the response body after that second step. If submitting the second step returns something like:
Text
otp=1111&other_data=other_data

then it is not possible, but if it returns only:

Text
other_data=other_data

then the earlier check can potentially be bypassed by manipulating the response.

In plain words: the first snippet still carries the OTP value back to the browser, and in that case it is not possible. The second snippet carries only unrelated data, which suggests the later step does not re-check the code, so the browser's belief about the earlier step is all that stands between you and the protected action.

The normal flow on the target

The researcher was already logged in to the target when he tested the 2FA enablement feature. He says plainly that the bug only worked if the attacker was already authenticated, and he asks the obvious question himself: why would an attacker enable 2FA on a victim's account? His answer is that the issue is a design principle violation, not a way to take over an account.

On the target, enabling 2FA first asked for password confirmation. After entering the correct password, the response returned the 2FA secret and a QR code. He scanned the QR code with Google Authenticator (a phone app that generates the six-digit codes), clicked next, entered the authenticator code, and confirmed that 2FA was enabled. That completed the normal flow and made the password step the only gate worth attacking.

Step 1: capture the successful password confirmation

With 2FA disabled again, the researcher started the enablement flow and submitted the correct password to record what a valid response looks like:

Line by line, in plain words:

  • HTTP/1.1 200 OK is the status line. 200 means the server accepted the request. This is the success reply the researcher will reuse later.
  • Date, Content-Type: application/json, Connection: close and Content-Length: 480 are standard headers: when the reply was made, what format the body is in, that the connection can close, and how many bytes the body has.
  • Set-Cookie: __cfduid=somecookie; ... tells the browser to store a small piece of data called a cookie. A cookie is a label the browser keeps and sends back on later requests so the server can recognise the same visitor. The HttpOnly, SameSite=Lax and Secure parts are restrictions on when and how the cookie may be used.
  • Cache-Control: no-cache, private says the reply should not be stored in shared caches.
  • X-RateLimit-Limit: 100 and X-RateLimit-Remaining: 99 are rate-limit headers: the server is saying how many requests are allowed and how many are left.
  • Z-Redacted-Password-Auth-Valid-Until: 1595935589 is a custom header carrying a Unix timestamp (a number counting seconds since 1 January 1970). It suggests the server tracks how long the password confirmation stays valid.
  • Strict-Transport-Security, CF-Cache-Status, Expect-CT and Server: cloudflare are infrastructure headers, mostly about HTTPS enforcement and the Cloudflare service in front of the site.
  • The body is a JSON document. "type":"createtwofa" names the kind of object, "attributes" holds the secret, a qr value and a qr_url, and "id" is an identifier. The client uses this body to render the QR code and move on to the authenticator code step.
  • last_user_action records when the user last did something, in two formats.

Step 2: submit a wrong password

The researcher disabled 2FA and started again, this time entering a wrong password. The server rejected it:

HTTP
HTTP/1.1 422 Unprocessable EntityDate: Tue, 28 Jul 2020 11:41:27 GMTContent-Type: application/jsonContent-Length: 177Connection: closeSet-Cookie: __cfduid=somecookie; expires=Thu, 27-Aug-20 11:41:26 GMT; path=/; domain=redacted.com; HttpOnly; SameSite=Lax; SecureCache-Control: no-cache, privateAccess-Control-Allow-Headers: origin, content-type, access-token, x-tracking-idAccess-Control-Allow-Origin: *X-RateLimit-Limit: 100X-RateLimit-Remaining: 99X-BRedacted-Password-Auth-Valid-Until: 1595935589Strict-Transport-Security: max-age=31536000; includeSubDomainsCF-Cache-Status: DYNAMICExpect-CT: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"Server: cloudflare{"errors":[{"status":422,"code":"user.validation.exception","title":"Validation exception"}],"last_user_action":{"date_iso8601":"2020-07-28T13:41:27+02:00","unix":"1595936487"}}

Line by line:

  • HTTP/1.1 422 Unprocessable Entity is the status line. 422 is a standard code meaning the server understood the request but refused it because the data was not acceptable, here a wrong password.
  • The headers are similar to the success reply: a cookie, cache rules, rate limits, security headers and Cloudflare.
  • Access-Control-Allow-Headers and Access-Control-Allow-Origin: * are cross-origin rules that tell browsers which other sites may read the reply.
  • X-BRedacted-Password-Auth-Valid-Until: 1595935589 is the same kind of timestamp header as before, and it carries the same value as in the successful reply.
  • The body has an errors list with status: 422, code: "user.validation.exception" and title: "Validation exception", and no data member. So the client has nothing to render a QR code from.

Step 3: replace the error with the captured success

In the proxy, the researcher replaced the 422 body and status with the 200 response captured in step 1:

This is the same reply as in step 1, pasted over the rejection. The status line now says 200, and the body now contains the createtwofa object with the secret and QR values.

He forwarded it and followed the rest of the process. The client accepted the fabricated createtwofa payload, moved to the authenticator code step, and 2FA was enabled without a valid password ever being checked. The design principle the feature was supposed to enforce, that enabling 2FA requires proving knowledge of the password, was bypassed.

Why it worked

Because the enablement process continues after the password form (it asks for the authenticator code next), and because the password value is not echoed back in the response body, the flow matches the author's own precondition for a manipulable check. The server's 422 is only a signal to the client; replacing it with a 200 carrying a createtwofa object is enough for the UI to proceed.

Impact

The impact is low. The attacker must already be authenticated in the victim's account, and the outcome is that 2FA gets enabled without knowing the password. The author is explicit that this is a violation of secure web application design principles rather than a route to account takeover, and he notes that whether it earns a bounty probably depends on the receiving program. In this case it did earn a small bounty, which he describes as little but sweet.

Fix

The write-up does not describe any fix or vendor response.

Variants to test

The author's decision procedure generalises to any multi-step flow where a check is followed by another action:

  1. Find a step that gates a sensitive action, such as password confirmation before enabling 2FA.
  2. Check whether the flow continues after that step with another request, and whether the checked value is absent from the response body. A positive sign is a response that contains only the data needed for the next step, as in the other_data=other_data example.
  3. Capture the success response, submit a wrong value, and replace the error with the captured success in the proxy.
  4. Try the same on OTP flows, but only where the OTP is followed by a further step and the code is not echoed back; where the flow completes immediately after the code, the author says manipulation will not work.

Closing

The author ends by thanking readers and wishing them good hunting.

Glossary

  • 2FA (two-factor authentication): a second proof of identity after the password, usually a code from a phone app, so a stolen password alone is not enough.
  • OTP (one-time password): a code that is valid once, often sent by SMS or generated by an app, used as a second factor.
  • Response manipulation: intercepting the server's reply and editing it before the browser sees it, so the page shows or does things it should not.
  • Intercepting proxy: a tool that sits between browser and server, pauses each message, and lets you read, edit and forward it.
  • Request: the message a browser sends to a server asking for a page or an action.
  • Response: the message a server sends back, made of a status code, headers and a body.
  • Status code: a number at the start of a response saying how it went, such as 200 for success or 422 for a rejected form.
  • Header: a named line of extra information in a request or response, such as the date or the content type.
  • Body: the main content of a response, often the data the page is built from.
  • JSON: a text format for structured data, made of names and values in curly braces and square brackets.
  • Endpoint: an address on a server that accepts requests and does something, such as a login or a settings action.
  • Cookie: a small piece of data the server asks the browser to store and send back on later requests, so the server can recognise the visitor.
  • Session: the server's record of a logged-in user, usually tied to a cookie, so the user does not have to log in on every request.
  • Authenticated: logged in, with the server knowing who you are.
  • Rate limit: a cap on how many requests a client may make in a period, to stop abuse.
  • Unix timestamp: a number counting seconds since 1 January 1970, used to record times.
  • HTTPS: the encrypted version of the web protocol, so traffic cannot be read or changed in transit by others.
  • Cloudflare: a service that sits in front of websites to filter and speed up traffic.
  • QR code: a square barcode that a phone camera can read, here used to transfer the 2FA secret into an authenticator app.
  • Google Authenticator: a phone app that stores 2FA secrets and generates the six-digit codes.
  • Secret: the shared value behind 2FA that the app and the server both know, used to compute the codes.
  • Bounty: a payment a company makes to a researcher who reports a security flaw.
  • Severity: how serious a flaw is judged to be, from low to critical.
  • Account takeover: an attacker gaining full control of someone else's account.
  • Design principle violation: a flaw where the feature does not follow the safety rules it was supposed to enforce, even if the direct harm is small.

More by Tommaso De Ponti

View all

1 more disclosed report, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.