> 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/flawed-password-reset-logic.md).

# 密码重置中的错误逻辑

密码重置中的错误逻辑，PortSwigger Web Security Academy 实验笔记，包括利用流程、载荷测试、Burp Suite 验证以及修复上下文。

### 密码重置逻辑缺陷

该实验展示了密码重置机制中的一个漏洞。目标是重置……的密码 **Carlos** 然后访问其“我的账户”页面。/ 提供的标识符：

* **wiener:peter**
* 受害者姓名： **carlos**

### 分析与步骤

#### 1. 忘记密码功能

应用程序通过“忘记密码”提供恢复功能。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ffa5f83b14077705c0d0769a86c877677f8796dd%2F%7B59329F4F-68B6-406A-80DC-7512DC57895F%7D.png?alt=media" alt="" width="436"><figcaption></figcaption></figure>

在此部分可以更改与该账户关联的电子邮件地址

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e7df7be39e21df89b1b2deff0bc8e8f1b407c0bf%2F%7BB0134D2A-71C9-4B46-A02F-ECE8D8E30759%7D.png?alt=media" alt="" width="563"><figcaption></figcaption></figure>

#### 2. 收到重置邮件

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dc83ecdfc81bd0862f3da572e70e66ff8bf4d0e1%2F%7B94555F78-AEF9-48D4-908D-2A9C3A417138%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

一旦电子邮件被更改，就会发送一条包含重置链接的消息。/ 该邮件包含一个临时 **令牌** 在 URL 中：

```http
发送时间：     2025-12-09 19:42:17 +0000
发件人：     "No reply" <no-reply@0ae200710383c04f868b0866005e0000.web-security-academy.net>
收件人：       wiener@exploit-0a46000003d9c0a086ee072901710023.exploit-server.net
主题：  账户恢复

你好！

请点击下面的链接重置您的密码。

https://0ae200710383c04f868b0866005e0000.web-security-academy.net/forgot-password?temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj

谢谢，
支持团队
```

#### 3. 表单提交

访问此链接后，应用程序会要求输入新密码。/ 发送的参数类似于：

```bash
temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj
username=wiener
new-password-1=test
new-password-2=test
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1116ba483a2f759c50e46ed5c1159705a4e53abf%2F%7B77097069-21AA-454D-BBB7-62E13FB4B5EA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 4. 利用缺陷逻辑

服务器不检查 **不** 该令牌实际上是否与查询中提到的用户匹配。/ 只需将字段 **username=wiener** 替换为 **username=carlos**:

```bash
temp-forgot-password-token=nec3070jgtmwcvnxt5b0ipmdh9746umj
username=carlos
new-password-1=test
new-password-2=test
```

应用程序接受该请求，从而允许为 Carlos 设置新密码。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2dfca4ea158f385e8c036227f052b500eb98faa3%2F%7BA10F3C95-2F8F-43BA-8B5C-BD7F82CF70C8%7D.png?alt=media" alt=""><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/zh/web/authentication/flawed-password-reset-logic.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.
