> 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/web-cache-deception/cheating-the-cache-by-manipulating-paths.md).

# Den Cache durch Manipulation von Pfaden täuschen

Notizen dazu, den Cache durch Manipulation von Pfaden zu täuschen, für die Labs der PortSwigger Web Security Academy, einschließlich Ausnutzungsablauf, Payload-Tests, Burp-Suite-Validierung und Kontext zur Behebung.

### Ausnutzen von Pfadzuordnung für Web-Cache-Deception

#### Ziel des Labs

Benutzer-\*\*API-Schlüssel\*\* wiederherstellen **carlos**. / Bereitgestellte Zugangsdaten: **wiener:peter**.

#### Beobachtungen

* In **Mein Konto** (my-account), erscheint der \*\*API-Schlüssel\*\* **im Klartext** für unseren eigenen Benutzer.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-108b38e85bcc7723d3655ed256ab94e6d6ab23ed%2F%7B6D0C2C89-1F6B-48CA-B915-C9EDF0F5E9DE%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Zunächst gibt es keinen direkten Hinweis (in der Antwort) darauf, dass es **Caching**.

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-29183f864d0e6633e8eec334dd43f232517f9326%2F%7BA44A17EA-B46B-4E3B-89DF-96104A9B1F59%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Allerdings zeigt die Anwendung durch Hinzufügen von Segmenten zur URL weiterhin die **my-account** Seite an, was auf eine **Zuordnungslogik der Routen** möglicherweise mit dem Cache kompatibel.

Getestete Beispiele:

* `/my-account/TESTTTTTT` → Die Anwendung behandelt dies immer als **my-account**

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2b3e00bdbf8e94e2755b444e3c6e8968ff9597eb%2F%7B3B320FBE-E2BE-43DB-8AEC-6223464C1F8E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* `/my-account/TESTTT.js` → Erweiterung **.js** wird akzeptiert und interpretiert (nützlich, um Cache-Regeln zu täuschen)

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

Vom**Exploit-Server**, erzwinge, dass ein Opfer eine URL des Typs „statisch“ lädt, die auf my-account verweist:

{% code overflow="wrap" %}

```javascript
<script>
    document.location="https://0afd005204a0683b803d1ce200320070.web-security-academy.net/my-account/jordan.js";
</script>
```

{% endcode %}

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5ee7d2cf564ad6368a92b92c410e95cc212a7ce5%2F%7B6ABD89DC-A971-48F3-8542-76823C922CFC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

1. Beim Aufrufen von:

* `/my-account/jordan.js`/ erhält man eine Antwort, die den \*\*carlos-API-Schlüssel\*\* anzeigt.

#### Ergebnis

Der API-Schlüssel für **carlos** wird über eine getarnte URL angezeigt (mit `.js` Erweiterung), wodurch Sie das Cache-/Routing-Verhalten ausnutzen können (`/my-account/<etwas>.js`).

<figure><img src="https://2955439919-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7aed730f89d4e5583776766836cb14dca0d58b14%2F%7BA88CD920-5D43-48A2-834E-F59F2D901B5F%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/web-cache-deception/cheating-the-cache-by-manipulating-paths.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.
