> 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/parameter-cloaking.md).

# Ocultación de parámetros

### Ocultación de parámetros

Este laboratorio es vulnerable a **envenenamiento de caché web** porque un parámetro específico se excluye de la clave de caché. / Además, existe una **incoherencia en la interpretación de los parámetros** entre el sistema de caché y el backend. / Un usuario visita regularmente la página de inicio del sitio con **Google Chrome**.

Objetivo:/ Envenenar la caché usando la **ocultación de parámetros** técnica para ejecutar `alert(1)` en el navegador de la víctima.

**Observación inicial**

La siguiente cookie aparece en la solicitud:

```bash
Cookie: country=[object Object]
```

En la respuesta del servidor, se carga un **geolocalización** se carga. / Este script usa el valor de la cookie para definir el país del usuario en el lado del cliente.

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

**Identificación del parámetro vulnerable**

Usando **Param Miner (Adivinar parámetros de consulta)**, detectamos un comportamiento de **ocultación de parámetros**.

<figure><img src="/files/91b7bbe4345e2f31032a674d497a1721857a592a" alt=""><figcaption></figcaption></figure>

El parámetro descubierto es:

```bash
utm_content
```

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

Si accedes a la siguiente URL:

```bash
/?utm_content=z9qc51
```

<figure><img src="/files/1b5aa7097755ae387aa32086a446657cdb60c791" alt=""><figcaption></figcaption></figure>

Observamos que:

* El valor del parámetro puede cambiarse libremente
* La caché \*\*no se invalida\*\*
* La respuesta permanece igual para los siguientes usuarios

Esto confirma que `utm_content` es **excluido de la clave de caché**.

**Funcionamiento mediante script de geolocalización**

El script cargado por la página es:

```bash
/js/geolocate.js?callback=setCountryCookie
```

Añadiendo el parámetro ignorado por la caché:

```bash
/js/geolocate.js?callback=setCountryCookie=test?utm_content=z9111
```

Se observa el siguiente comportamiento:

* El `prueba` el valor se refleja en la respuesta
* La caché permanece sin cambios

Esto indica que el backend interpreta los parámetros de forma diferente a la caché.

<figure><img src="/files/9d35bfc182894c921588f5dafce152e30c297a10" alt=""><figcaption></figcaption></figure>

**Inyección mediante ocultación de parámetros**

Esta diferencia de análisis se explota inyectando un **segundo parámetro callback** enmascarado por `utm_content`:

```bash
/js/geolocate.js?callback=setCountryCookie&utm_content=z9111;callback=alert(1)
```

Resultado:

* La caché siempre considera la solicitud idéntica

<figure><img src="/files/9a4b2c1b6129952443351e173b0c51fc0f27ad3a" alt=""><figcaption></figcaption></figure>

El backend interpreta `callback=alert(1)` como un nuevo parámetro válido

El JavaScript generado se ejecuta `alert(1)`

<figure><img src="/files/90f4d70cdf24cbcafd541c03676d62c380fe7e73" 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/parameter-cloaking.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.
