- by x32x01 ||
When testing two-factor authentication (2FA), changing an HTTP response in Burp Suite can help you identify whether an application incorrectly trusts client-side data instead of verifying authentication on the server.
For example, an API might return 401 Unauthorized with "success": false when a verification code is invalid. Changing the response to 200 OK and "success": true can reveal whether the frontend relies on those values to decide what happens next.
However, changing an HTTP response in Burp Suite does not automatically bypass 2FA on the server. The important question is whether the application grants access based on a modified client-side response or independently verifies the authentication result.
The request contains an invalid verification code:
The server rejects the request and returns:
This is the expected behavior when the submitted code is invalid.
For example, intercept the response and change it to:
Now observe the application's behavior.
This is a client-side logic weakness, but its impact depends on what the server permits afterward.
A secure application must enforce authentication and authorization on the server for every protected operation. It should never rely solely on frontend state, HTTP status codes modified by the client, or a client-controlled success flag.
For example, an API might return 401 Unauthorized with "success": false when a verification code is invalid. Changing the response to 200 OK and "success": true can reveal whether the frontend relies on those values to decide what happens next.
However, changing an HTTP response in Burp Suite does not automatically bypass 2FA on the server. The important question is whether the application grants access based on a modified client-side response or independently verifies the authentication result.
🔍 Example: Testing a 2FA Verification Endpoint
Suppose an application uses the following endpoint to verify a two-factor authentication code:POST /api/auth/2fa/verifyThe request contains an invalid verification code:
Code:
POST /api/auth/2fa/verify HTTP/1.1
Host: target.example
Content-Type: application/json
{
"code": "000000"
} Code:
HTTP/1.1 401 Unauthorized
Content-Type: application/json
{
"success": false
} 🧪 What Happens If You Modify the Response?
During an authorized security test, you can use Burp Suite to examine how the application handles the response.For example, intercept the response and change it to:
Code:
HTTP/1.1 200 OK
Content-Type: application/json
{
"success": true
} - The frontend displays a success message: This may indicate that the interface trusts the response values. Further testing is needed to determine whether authentication was actually bypassed.
- The application opens a protected page, but API requests still fail: The frontend may have changed its state without establishing an authenticated server-side session.
- Protected resources become accessible: This could indicate a serious authentication flaw, but verify that the server genuinely grants access rather than merely displaying a page.
🛡️ How to Determine Whether 2FA Is Actually Bypassed
The key is to test server-side authorization, not just the visual behavior of the frontend.- Submit an invalid 2FA code and record the original response.
- Modify the response in your authorized test environment and observe the frontend's behavior.
- Make a separate request to a protected API endpoint using the resulting session or authentication state.
- Check whether the server grants access to protected data or actions.
- Repeat the test in a clean session to rule out an already authenticated session or another source of access.
⚠️ Common Mistake: Confusing Client-Side Success With Authentication
An application may use JavaScript to interpret a response and redirect the user to a dashboard. If the frontend trusts a locally modified response, the dashboard might appear even though the server never authenticated the user.This is a client-side logic weakness, but its impact depends on what the server permits afterward.
A secure application must enforce authentication and authorization on the server for every protected operation. It should never rely solely on frontend state, HTTP status codes modified by the client, or a client-controlled success flag.
✅ How Developers Can Prevent This Issue
To protect a 2FA implementation:- Verify the submitted code on the server.
- Create an authenticated session only after successful verification.
- Enforce authorization on protected API endpoints.
- Never treat a client-side success flag as proof of authentication.
- Ensure that pending 2FA sessions cannot access protected resources.
- Test authentication flows with invalid codes, modified responses, expired challenges, and reused verification codes.