> 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 no incluido en la clave

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

Este laboratorio es vulnerable a un ataque de envenenamiento de caché web, ya que un parámetro de consulta no se incluye en la clave de caché. / Un usuario visita regularmente la página de inicio del sitio usando Chrome. / El objetivo es envenenar la caché para que la página de inicio 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 correctamente en la respuesta

<figure><img src="/files/12cb7e2ef4486b2b42646eec5515282c03672f1b" 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 ejecutan alertas en el lado de la víctima.

<figure><img src="/files/83aa3eecd6b5679d1571c077ad963298ccfaf81a" alt=""><figcaption></figcaption></figure>

**Problema identificado**

La caché considera cada variación de `?test` el 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 están **totalmente ignorados** por la clave de caché:

* No se tiene en cuenta su nombre ni su valor.
* La respuesta almacenada en caché permanece igual, incluso si su valor cambia.

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

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

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

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

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

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

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

**Explotación**

A continuación, la carga útil 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="/files/75af38164b1c1e8df45dc7648bd0536c5be16959" 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/es/web/cache-poisoning/web-cache-poisoning-via-unkeyed-query-parameter.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.
