> 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/cache-poisoning-via-an-unindexed-query-string.md).

# Cache-Poisoning über eine nicht indizierte Query-String

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

### Web-Cache-Poisoning über einen nicht berücksichtigten Query-String

Dieses Lab zeigt eine Anfälligkeit für die Vergiftung des Web-Caches, da der **Query-String nicht im Cache-Schlüssel enthalten ist**. Ein legitimer Benutzer besucht regelmäßig die Startseite der Website mit **Google Chrome**.

Ziel ist es, die Startseite zu vergiften, sodass sie eine Antwort zurückgibt, die ein **laufendes JavaScript `alert(1)`** im Browser des Opfers ausführt.

***

**Schritt 1: Abfangen der Startseite**

Die Anfrage an das Stammverzeichnis der Website (`/`) **Link**, was darauf hinweist, dass einige Elemente der URL in HTML reflektiert werden können.

***

**Schritt 2: Test des Query-Strings**

Der URL wird ein beliebiger Query-String hinzugefügt:

```bash
/?test
```

Der Wert wird korrekt **in der Antwort übernommen**, was bestätigt, dass der Query-String den zurückgegebenen Inhalt beeinflusst.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2edac0238e60404a2095ff1a7ea707191fe84fe2%2F%7BF4380530-5577-4C17-81E1-72A4F44209FD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Schritt 3: HTML-Injektion**

Der Query-String wird dann geändert, um HTML einzuschleusen:

```bash
/?test'/><h1>JORDAN</h1>
```

Das `<h1>` Tag wird vom Browser korrekt interpretiert, was eine nutzbare \*\*HTML-Injektion\*\* demonstriert.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-64a4c271dcfb6dfdeb1a04038b3df9236e5a187b%2F%7BB9746F67-1733-44BE-9C4D-DE7C12128D48%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-d9db563f4e632385fbdec7d98601a459dbb8f8ed%2F%7BA8006643-5C60-46F6-959E-A7C7195FB8BD%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Schritt 4: JavaScript-Injektion (Cache-Vergiftung)**

Ersetze die HTML-Injektion durch eine JavaScript-Payload:

```bash
/?test'/><script>alert(1)</script>
```

Die Antwort enthält nun das Skript, das vom Browser \*\*ausgeführt wird\*\*.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-c1d50621264ed9b43341def8b6f65030f5987a0b%2F%7B789452C2-9E94-4AC9-B846-69E03388E23A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Ergebnis**

Da der Query-String **nicht im Cache-Schlüssel enthalten ist**, wird die vergiftete Antwort gespeichert und anderen Benutzern, die die Startseite besuchen, ausgeliefert. / Das Opfer löst dann automatisch die Ausführung von `alert(1)` während seines Besuchs aus, was die Funktionsweise des Labs bestätigt.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-188a11ff05f7fa2c605133ed854079e5cec26ff1%2F%7B42C67203-FBC2-45CF-8CC8-6502A3A33DD4%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/cache-poisoning-via-an-unindexed-query-string.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.
