> 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/zh/web/authentication/simple-2fa-bypass.md).

# 简单的 2FA 绕过

### 2FA 简单绕过

这个实验室使用可以被绕过的双因素认证。我们已经有了有效的用户名和密码，但无法获取发送给受害者的 2FA 代码。目标是访问 Carlos 的账户页面。

```bash
你的凭据：wiener:peter
受害者的凭据：carlos:montoya
```

<figure><img src="/files/660b7764d66b0a966923f975e65cf9b4ced2dd65" alt=""><figcaption></figcaption></figure>

在使用 Carlos 的 ID 连接后，服务器会通过电子邮件发送一个 2FA 代码。输入这个 4 位代码后，请求会被发送到 **POST** 到端点 **/login2**.

<figure><img src="/files/8799cf9acfa081ce91ec6ee4f7b21ba1f238d828" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/5a2765979edccd971961c1e4a468d303f29fbe17" alt="" width="499"><figcaption></figcaption></figure>

然而，可以完全绕过这一步。不要提交 2FA 代码，而是直接请求访问 **/my-account**。服务器没有正确检查 2FA 验证状态，即使没有代码也会允许访问。

<figure><img src="/files/f0518d2ea12b7ed36481a1100915f0041e914042" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
