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

# Web-Cache-Poisoning über eine fettige GET-Anfrage

Notizen zum Web-Cache-Poisoning über eine fettige GET-Anfrage für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Behebungskontext.

### Web-Cache-Vergiftung durch eine Fat-GET-Anfrage

Dieses Lab ist anfällig für die Vergiftung des Web-Caches, da es **GET-Anfragen mit einem Body akzeptiert**, aber **der Body nicht im Cache-Schlüssel enthalten ist**. / Ein Benutzer besucht regelmäßig die Startseite der Website mit Chrome. / Das Ziel ist es, den Cache zu vergiften, damit die Antwort ausgeführt wird `alert(1)` im Browser des Opfers ausführt.

**Erste Analyse**

Durch das Abfangen der Anfrage an die Startseite beobachten wir das Vorhandensein des folgenden Cookies

<pre class="language-http"><code class="lang-http"><strong>Cookie: country=[object Object]
</strong></code></pre>

Dieses Cookie wird durch die von der Seite geladene JavaScript-Datei erzeugt:

```bash
/js/geolocate.js
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-bcbcc640c394fc2384de02c4fafc06bd30b9a89c%2F%7B37A0209B-9D6E-4FEF-BB1E-9D33093BCC00%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Analyse von `geolocate.js`**

Direktes Aufrufen von:/ `/js/geolocate.js?callback=setCountryCookie`

Folgender Code wird erhalten:

{% code overflow="wrap" %}

```javascript
const setCountryCookie = (country) => {
    document.cookie = 'country=' + country;
};
const setLangCookie = (lang) => {
    document.cookie = 'lang=' + lang;
};
setCountryCookie"({"country":"United Kingdom"});
```

{% endcode %}

Wir beobachten, dass:

* Das `Callback` Parameter wird verwendet, um die aufgerufene Funktion zu definieren.
* Der übergebene Wert wird dann clientseitig ausgeführt.

**Ausnutzung der Schwachstelle**

Beim Laden der Startseite ruft die Website automatisch auf:/ `/js/geolocate.js?callback=setCountryCookie`

Durch Ausnutzen der Tatsache, dass:

* Der Server akzeptiert GET-Anfragen mit einem Body.
* Der Body ist nicht im Cache-Schlüssel enthalten.

```bash
callback=alert(1)
```

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-56639cede1e2e7bc9edfb73ce61e8091963542f3%2F%7B772A3B06-9123-4953-BACB-06F8D08DABA6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Wir erzwingen einen **neuen Parameter `Callback`** im Body der GET-Anfrage, dem wir den folgenden Wert geben:

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2a056eac2d9d299e2e421dacd7ec919b83555923%2F%7BE92EC295-36D2-427D-8221-3BCC26B2A8BF%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Die zwischengespeicherte Antwort enthält jetzt den Aufruf von `alert(1)`.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0119b983ee06443632e146dfe72d0ee5e7c3bbdf%2F%7B234018E6-2202-4AE5-8C2D-E76CAC9D34C2%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/cache-poisoning/web-cache-poisoning-via-fat-get-request.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.
