2fa Bypass by changing Request method
The two-factor authentication disable endpoint accepted a DELETE request sent to the resend-SMS path, and because the request was validated only by the session cookie issued after the first login step, an attacker could disable a victim's 2FA without knowing the OTP. This allowed bypassing the second login factor for any account.
Published on medium.com
Hello Everyone My name is Arth Bajpai, I’m from Lucknow, India, and I’m back with my third write-up about a 2fa Bypass which I Found a while ago.
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.
Context
This is a write-up about a two-factor authentication bypass found on a private Bugcrowd program, referred to here as target.com. The feature in question is SMS-based 2FA: the account settings page offers an option to set an SMS code on a phone number as the second factor, and there is a button next to it to disable 2FA.
The login flow has two steps. First the user enters an ID and password, then an OTP to get access to the account. The 2FA disable function sits behind that login, and the request that performs it is validated based on a cookie that is generated at the time of login. So a user who has completed only the first step, the password step, already holds a valid cookie for the 2FA endpoints.
Setup
The researcher received an invitation to a private program on Bugcrowd. Testing was done with Burp, using a second browser or account to replay a CSRF proof of concept. No tool versions are given. The precondition that matters for the exploit is simply an account with SMS 2FA enabled, plus the ability to reach the 2FA screen, which requires only the ID and password.
Finding it
The researcher first went through the usual 2FA bypass ideas. The OTP was not leaked in the response or anywhere else, response manipulation did not work, and none of the known methods of the day worked either.
Attention then moved to the disable functionality. The disable button sat in front of the 2FA setting, required no password, and disabled 2FA in a single click. That immediately suggested CSRF, so the researcher clicked disable, captured the request in Burp and built a CSRF proof of concept from it, expecting to disable 2FA cross-site. Opening the proof of concept in a second browser or account produced an error and it did not work at all.

Changing the request method to get around the CSRF protection did not help either, because the request was validated based on the cookie, so that function was left alone and the site was left after reporting a few other vulnerabilities.
Some time later the researcher came back, found only low-hanging fruit, reported it and moved on to other websites. Almost two months after the invitation, a conversation with a friend about the 2FA implementation of another website, which was similar in how one might bypass it, restarted the thinking. That other site was not bypassed either, but the conversation led to an idea on the way home: why not try changing the request method on the 2FA screen itself. The reasoning was that there is only a slight difference between the request that resends the SMS and the request that deletes 2FA, there is no password confirmation on disabling 2FA, and the request is validated by a cookie that is generated at login, which the attacker already has after step one.

Exploitation
Step 1: Compare the two requests
The resend SMS request looked like this:
POST /api/v2/mfa/resend
The delete request looked like this:
DELETE /api/v2/mfa
The two paths differ only by the trailing resend segment, and the methods differ. Both are validated by the cookie, and the researcher holds that cookie after completing the first of the two login steps.
Step 2: Reach the 2FA screen
The researcher entered the ID and password and arrived at the 2FA screen, where a correct OTP is needed to get into the account. No OTP was entered.
Step 3: Turn resend into delete
On the 2FA screen the researcher clicked Resend SMS, captured the request in Burp, changed the method from POST to DELETE, removed resend from the path, and forwarded it. The result was that 2FA was disabled.

With this, the researcher notes, the 2FA of anyone could be bypassed easily within seconds.
Step 4: Report
The issue was reported immediately but turned out to be a duplicate.

Root cause
The 2FA screen exposes an endpoint that resends the SMS code, and that endpoint is reachable with only the first login factor completed. The delete endpoint for 2FA lives at the same path prefix and is protected only by the same login cookie, with no password confirmation and no check that the second factor has been completed. Because the routing and authorisation logic treats the method and the path suffix as the only distinction between the two operations, a request to the resend endpoint can be rewritten into a request to the delete endpoint. The server then appears to perform the destructive action for a session that has not passed 2FA.
Likely, the authorisation check on /api/v2/mfa verifies only that a valid session cookie exists, not that the session is fully authenticated, . The report does not describe the server-side code, so the exact mechanism is inferred from behaviour.
Impact
An attacker who knows a victim's ID and password can log in, stop at the 2FA prompt, and disable the victim's 2FA without ever supplying an OTP. After that, the account can be accessed with the password alone. The researcher states this could bypass the 2FA of anyone easily within seconds. The precondition is knowledge of the credentials, so this removes the second factor for that account.
Fix
The report does not say what the program changed, if anything, since the issue was closed as a duplicate. What should be done is to require the second factor to be completed before any 2FA management endpoint, including disable, can be called, and to require password confirmation for disabling 2FA. The resend endpoint should be restricted to the resend action only, so that a method or path change cannot reach the delete handler, and the delete handler should validate the request independently of the login cookie alone.
Variants to test
- Method switching on authenticated endpoints: take a harmless request available before full authentication, such as an OTP resend, and change
POSTtoDELETE,PUTorPATCH, adjusting the path to a sensitive sibling. A positive result is the sensitive action succeeding without the second factor. - Path suffix removal: where one endpoint is
/resource/actionand another is/resource, try calling the parent path with the method of the child. A positive result is the parent action executing. - Pre-2FA session scope: enumerate every endpoint reachable with the cookie issued after the password step and check whether any of them change account security settings. A positive result is a settings change, such as disabling 2FA or changing the phone number, before the OTP is entered.
- CSRF on the same endpoints: build a proof of concept for the disable request and replay it from another browser, as was done here. A positive result is the request succeeding cross-site, which would remove the need for the password entirely.
- Password confirmation gaps: look for security-sensitive actions, such as disabling 2FA or changing credentials, that do not ask for the password again. A positive result is the action completing with only the session cookie.
What happened, in plain words
A security researcher found a way to switch off another person's two-factor authentication (2FA) without ever knowing the one-time code that 2FA is supposed to demand. He did it by taking a harmless request that the login page makes ("please send me the SMS code again") and editing it slightly so that the server treated it as a completely different request ("delete this account's 2FA"). The server accepted the edited request because the only thing it checked was a cookie that the user already has after typing their password, before the code is entered. The bug was reported and closed as a duplicate, meaning someone else had already reported the same thing.
This article walks through the whole story from zero: what 2FA is, what a cookie is, what an API request looks like, and why changing one word in a request can turn a harmless action into a dangerous one.
Background concepts, before we start
Before the story makes sense, here are the ideas it relies on. Each one is explained as it first becomes relevant, but a quick map helps.
- Two-factor authentication (2FA): a second proof of identity on top of a password. The first factor is something you know (the password). The second is something you have (a phone that receives a code). Even if someone steals your password, they still need the code.
- OTP (one-time password): the short numeric code sent by SMS in this story. It is valid once and expires quickly.
- API: the set of addresses a website's own pages talk to behind the scenes. Think of a restaurant: the menu and the waiter are the website you see, and the kitchen is the API. You never walk into the kitchen yourself, but every order you place is a message sent there.
- HTTP request: the message your browser sends to the server. It has a method (a verb saying what kind of action you want), a path (which thing you want to act on) and sometimes a body (extra data).
- HTTP methods:
GETmeans "give me something",POSTmeans "here is some data, do something with it",DELETEmeans "remove this". They are like verbs in a sentence: the same noun means something different depending on the verb in front of it. - Cookie: a small piece of text the server gives your browser after you log in, and which your browser sends back with every later request. It works like a wristband at a festival: you show your ticket once at the gate, get the wristband, and after that the staff only look at the wristband. If someone else gets your wristband, they can walk around as you.
- Session: the server-side record that a particular cookie belongs to a particular logged-in user. "Validated based on the cookie" means the server decides who you are purely from that wristband.
- Burp (Burp Suite): a tool that sits between your browser and the server and lets you pause, read and edit requests before they are sent. Think of it as an interceptor who lets you rewrite a letter before it reaches the recipient.
- CSRF (Cross-Site Request Forgery): tricking a logged-in victim's browser into sending a request to a site where they are logged in, without them meaning to. The classic example is a hidden form on an attacker's page that submits to the victim's bank. The browser attaches the victim's cookie automatically, so the bank thinks the victim asked.
- CSRF proof of concept (PoC): a small test page the researcher builds to check whether such a forged request actually goes through.
- Response manipulation: editing what the server sends back (for example, changing a "code incorrect" reply into "code correct") to see whether the front end trusts it blindly.
- Duplicate: a report for a bug the program has already received from someone else. It is closed as a duplicate.
- Low-hanging fruit: easy, well-known bugs such as cross-site scripting (injecting script into a page) or HTML injection (injecting markup), which take little effort to find.
The target and the feature
The researcher received an invitation to a private program on Bugcrowd, a platform where companies invite selected researchers to test their systems. In the write-up the company is called target.com, a stand-in name.
While exploring, he found several easy issues: a few cross-site scripting bugs, HTML injection and similar. He had a feeling there was more, so he kept looking and noticed the 2FA feature. It let a user set an SMS code on a phone number as the second factor. Next to that setting was a button to disable 2FA.
The login had two steps:
- Enter the ID and password.
- Enter the OTP to get into the account.
The important detail is where the disable function sits. It is behind the login, and the request that performs it is validated based on a cookie generated at login. So a user who has completed only step one, the password step, already holds a valid cookie for the 2FA endpoints. In wristband terms: the wristband is handed out at the password gate, not at the code gate, and the 2FA management endpoints only look at the wristband.
First attempts: the usual 2FA bypass ideas
Before the real finding, the researcher tried the standard tricks, and all of them failed:
- He checked whether the OTP was leaked in the server's response or anywhere else. It was not.
- He tried response manipulation, editing the server's reply to make the site believe the code was correct. That did not work either.
- None of the known 2FA bypass methods of the day worked.
This matters for a beginner: most of the time, the obvious paths are closed. The interesting bug came from looking at a different part of the feature, the disable button, rather than the code prompt itself.
The disable button and the CSRF attempt
The disable button sat in front of the 2FA setting. It required no password and disabled 2FA in a single click. A single-click, password-free, security-changing action is exactly the shape of a CSRF candidate, so the researcher tested that first.
He clicked disable, captured the request in Burp, and built a CSRF proof of concept from it, expecting to disable 2FA from another site. He opened the proof of concept in a second browser or account. It showed an error and did not work at all.

He then tried to get around the CSRF protection by changing the request method, but that did not help either, because the request was validated based on the cookie. With no way in through that door, he left the function alone and left the site after reporting a few other vulnerabilities.
Why did the CSRF fail? A CSRF attack works when the server trusts any request that carries the victim's cookie, no matter which page it came from. Here the request was validated based on the cookie, and the forged cross-site request did not work. The lesson is that a password-free button is suspicious but not automatically exploitable.
The idea, two months later
Some time later he came back, found only low-hanging fruit, reported it and moved on to other websites. Almost two months after the invitation, he had a conversation with a friend about the 2FA implementation of another website, similar in how one might bypass it. That other site was not bypassed either, but the conversation planted an idea.
On the way home on his bike, he thought: why not try changing the request method on the 2FA screen itself? His reasoning had three parts:
- There is only a slight difference between the request that resends the SMS and the request that deletes 2FA.
- There is no password confirmation when disabling 2FA.
- The request is validated by a cookie generated at login, and after step one he already had that cookie.

This is the core insight of the whole report, and it is worth restating in plain words: the login screen offers a harmless action (resend the code) to anyone who has passed step one. If the dangerous action (delete 2FA) lives at a nearly identical address and is guarded by the same wristband, then perhaps the harmless request can be edited into the dangerous one.
Exploitation
Step 1: Compare the two requests
The resend SMS request looked like this:
POST /api/v2/mfa/resend
Line by line:
POSTis the method. It says "I am sending you some data, please act on it". Resending an SMS is an action, soPOSTfits./api/v2/mfa/resendis the path.apisays this is a machine-facing endpoint,v2is a version number,mfastands for multi-factor authentication (the general name for 2FA and similar schemes), andresendnames the specific action: send the code again.
The delete request looked like this:
DELETE /api/v2/mfa
Line by line:
DELETEis the method. It says "remove this thing"./api/v2/mfais the path, the same as above but without the trailingresendsegment. It points at the 2FA setting itself rather than at the resend action.
The two paths differ only by the trailing resend segment, and the methods differ. Both are validated by the cookie, and the researcher holds that cookie after completing the first of the two login steps. In other words, the harmless request and the dangerous request are neighbours in the same building, and the same wristband opens both doors.
Step 2: Reach the 2FA screen
He entered the ID and password and arrived at the 2FA screen, where a correct OTP is needed to get into the account. He did not enter any OTP. This is the key position: he is logged in enough to hold the cookie, but not logged in enough to be inside the account.
Step 3: Turn resend into delete
On the 2FA screen he clicked Resend SMS, captured the request in Burp, changed the method from POST to DELETE, removed resend from the path, and forwarded it. The result was that 2FA was disabled.

In effect, he took the letter that said "please send the code again" and crossed out the last word and the verb, so the recipient read "please remove the 2FA setting". The server did not notice that the sender had never proved the second factor.
With this, he notes, the 2FA of anyone could be bypassed easily within seconds. The only thing an attacker needs is the victim's ID and password, which is exactly the thing 2FA exists to make insufficient on its own.
Step 4: Report
The issue was reported immediately but turned out to be a duplicate.

A duplicate means the program had already received the same finding from another researcher. It is still a valid bug.
Why it worked
The 2FA screen exposes an endpoint that resends the SMS code, and that endpoint is reachable with only the first login factor completed. The delete endpoint for 2FA lives at the same path prefix and is protected only by the same login cookie, with no password confirmation and no check that the second factor has been completed. Because the routing and authorisation logic treats the method and the path suffix as the only distinction between the two operations, a request to the resend endpoint can be rewritten into a request to the delete endpoint. The server then appears to perform the destructive action for a session that has not passed 2FA.
Likely, the authorisation check on /api/v2/mfa verifies only that a valid session cookie exists, not that the session is fully authenticated, . The report does not describe the server-side code, so the exact mechanism is inferred from behaviour.
In beginner terms: the server had two doors side by side, one labelled "resend" and one labelled "delete", and it checked only the wristband, not whether the visitor had finished the whole entry procedure. The wristband is issued after the password, so anyone with the password can reach the delete door.
Impact
An attacker who knows a victim's ID and password can log in, stop at the 2FA prompt, and disable the victim's 2FA without ever supplying an OTP. After that, the account can be accessed with the password alone. The researcher states this could bypass the 2FA of anyone easily within seconds. The precondition is knowledge of the credentials, so this removes the second factor for that account.
Put simply: 2FA is the lock that makes a stolen password useless. This bug lets an attacker remove the lock using only the stolen password, which is the one thing they already have.
Fix
The report does not say what the program changed, if anything, since the issue was closed as a duplicate. What should be done is to require the second factor to be completed before any 2FA management endpoint, including disable, can be called, and to require password confirmation for disabling 2FA. The resend endpoint should be restricted to the resend action only, so that a method or path change cannot reach the delete handler, and the delete handler should validate the request independently of the login cookie alone.
In everyday terms: the delete door should ask for the second key, not just the wristband, and the resend door should not be a doorway to the delete room at all.
Variants to test
If you want to look for similar bugs on your own, here are the patterns to try. Each one is a variation on the same theme: a request you are allowed to make, edited into one you are not.
- Method switching on authenticated endpoints: take a harmless request available before full authentication, such as an OTP resend, and change
POSTtoDELETE,PUTorPATCH, adjusting the path to a sensitive sibling. A positive result is the sensitive action succeeding without the second factor. - Path suffix removal: where one endpoint is
/resource/actionand another is/resource, try calling the parent path with the method of the child. A positive result is the parent action executing. - Pre-2FA session scope: enumerate every endpoint reachable with the cookie issued after the password step and check whether any of them change account security settings. A positive result is a settings change, such as disabling 2FA or changing the phone number, before the OTP is entered.
- CSRF on the same endpoints: build a proof of concept for the disable request and replay it from another browser, as was done here. A positive result is the request succeeding cross-site, which would remove the need for the password entirely.
- Password confirmation gaps: look for security-sensitive actions, such as disabling 2FA or changing credentials, that do not ask for the password again. A positive result is the action completing with only the session cookie.
Glossary
- 2FA (two-factor authentication): a login that needs two different proofs, usually a password plus a code from your phone.
- API: the set of addresses a website's pages use to talk to its server behind the scenes.
- Authorisation: the server's decision about whether a given user is allowed to perform a given action.
- Burp Suite: a tool that intercepts and lets you edit requests between your browser and a server.
- Cookie: a small piece of text a server gives your browser after login, sent back with later requests to identify you.
- CSRF (Cross-Site Request Forgery): tricking a logged-in user's browser into sending an unwanted request to a site where they are logged in.
- CSRF proof of concept: a test page built to check whether a forged cross-site request succeeds.
- DELETE: an HTTP method meaning "remove this thing".
- Duplicate: a bug report for an issue the program has already received from someone else.
- Endpoint: a specific address on a server that accepts requests, such as
/api/v2/mfa. - HTML injection: inserting markup into a page so that it is rendered as part of the page.
- HTTP method: the verb at the start of a request (
GET,POST,DELETEand so on) saying what kind of action is wanted. - Low-hanging fruit: easy, well-known bugs that take little effort to find.
- MFA (multi-factor authentication): the general name for logins that require more than one proof of identity; 2FA is the common case.
- OTP (one-time password): a short code valid for a single use, often sent by SMS.
- Path: the part of a request address naming what it acts on, such as
/api/v2/mfa/resend. - POST: an HTTP method meaning "here is some data, act on it".
- Response manipulation: editing the server's reply to see whether the site trusts it blindly.
- Session: the server-side record linking a cookie to a logged-in user.
- XSS (cross-site scripting): injecting script into a page so that it runs in other users' browsers.