> 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/cache-poisoning/web-cache-poisoning-via-unkeyed-query-parameter.md).

# Envenenamiento de caché web mediante un parámetro de consulta sin clave

Notas sobre Envenenamiento de caché web mediante un parámetro de consulta sin clave para los laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payload, validación en Burp Suite y contexto de mitigación.

### Envenenamiento de caché web mediante un parámetro de consulta no incluido en la clave

Esta práctica es vulnerable a un ataque de envenenamiento de caché web, ya que un parámetro de consulta no está incluido en la clave de caché. / Un usuario visita regularmente la página principal del sitio usando Chrome. / El objetivo es envenenar la caché para que la página principal sirva una respuesta que ejecute `alert(1)` en el navegador de la víctima.

**Análisis inicial**

* Al interceptar la respuesta de la página raíz, se observa un **canónica** enlace.
* Si accedes a la URL con un parámetro arbitrario, por ejemplo `/?hello`, el valor se refleja claramente en la respuesta

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1871d2fc701cc8b477a71d82641d280d6cb50a35%2F%7BF524D9FB-B23A-4150-81DA-8F20E7419FC7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Inyectando una carga útil como:

```bash
/?test'/><script>alert(1)</script>
```

* El código HTML se interpreta en la respuesta, pero no se ejecuta ninguna alerta en el lado de la víctima.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e4f554844d5146c3422aceb69e3dcced72fcb1fe%2F%7B734F33BC-EB04-480C-A19E-D18BE89A91C9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Problema identificado**

La caché considera cada variación de la `?test` parámetro como una nueva entrada. / Por lo tanto, con cada cambio de valor, la caché se regenera y el envenenamiento no persiste.

Sin embargo, algunos parámetros son **totalmente ignorados** por la clave de caché:

* Su nombre y valor no se tienen en cuenta.
* La respuesta almacenada en caché permanece igual, incluso si su valor cambia.

**Identificación del parámetro no indexado**

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-65505e828de6590eb1d67cb0861211ff661f7d53%2F%7B01DA2100-8C27-4CB0-BFF0-3EFE3043FE34%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Usando **Param Miner** (función Adivinar parámetros de consulta), el `utm_content` parámetro se identifica.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-20c44b2767ed05cc3d703e77327ef684da948c37%2F%7B05D74FEB-B745-45BE-B1A4-CC31B5C89F63%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

* Al probar diferentes valores para este parámetro, comprobamos que la caché permanece sin cambios, lo que confirma que no está incluido en la clave de caché.

<pre class="language-bash"><code class="lang-bash"><strong>/?utm_content=test
</strong></code></pre>

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58224d7a9841bc18b9b0c1d9e2da7bf5cd984cf2%2F%7B39C0B55B-4D1C-4D05-9E2F-10064DBBE52C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Explotación**

A continuación, la carga maliciosa se inyecta en este parámetro no indexado:

```bash
/?utm_content='/><script>alert(1)</script>
```

La respuesta envenenada se almacena en la caché y se sirve a los siguientes visitantes.

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-561c0564a9cc1ff15928ee60745fc1b1a454b91f%2F%7BB11F48CD-41CB-4DF8-8C99-A21C820C843B%7D.png?alt=media" 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 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/cache-poisoning/web-cache-poisoning-via-unkeyed-query-parameter.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.
