> For the complete documentation index, see [llms.txt](https://hacking-notes.jord4n.pro/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hacking-notes.jord4n.pro/web/authentication/simple-2fa-bypass.md).

# Simple 2FA Bypass

Simple 2FA Bypass notes for PortSwigger Web Security Academy labs, including exploitation workflow, payload testing, Burp Suite validation, and remediation context.

### 2FA Simple Bypass

This lab uses two-factor authentication that can be bypassed. We already have a valid user name and password, but we do not have access to the 2FA code sent to the victim. The goal is to access Carlos' account page.

```bash
Your credentials: wiener:peter
Victim's credentials carlos:montoya
```

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bdc1aa5af305ccb244a863d2e3d49d6361fb8291%2F%7B0BE8A5AC-9311-40A2-A0D5-1AC4BF391230%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

After connecting with Carlos IDs, the server sends a 2FA code by e-mail. By entering this 4-digit code, the query is sent in **POST** to the endpoint **/login2**.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9cea1846d26674ea0ce830bdb8cd84eb6b1039f2%2F%7B6DA8DC74-3130-4AB7-98CE-BA6C0AA0A5C4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-8bb66a79dacacabd4c561c64ff6c87a94b4e34f2%2F%7BE0B7211B-BDC9-45EF-BFFC-D15F6E9BFF90%7D.png?alt=media" alt="" width="499"><figcaption></figcaption></figure>

However, it is possible to completely bypass this step. Instead of submitting code 2FA, simply request access directly to **/my-account**. The server does not check the 2FA validation state correctly and allows access despite the lack of code.

<figure><img src="https://131707722-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-61291969d8a04913a7e5fc71615822c891c912f8%2F%7BBBE6644C-6869-4046-9B20-37F42B4188C1%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/web/authentication/simple-2fa-bypass.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
