> 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/pt-br/web/cache-poisoning/parameter-cloaking.md).

# Ocultação de parâmetros

### Ocultação de parâmetros

Este laboratório é vulnerável a **envenenamento de cache da web** porque um parâmetro específico é excluído da chave do cache. / Além disso, há uma **incoerência na interpretação dos parâmetros** entre o sistema de cache e o back-end. / Um usuário visita regularmente a página inicial do site com **Google Chrome**.

Objetivo:/ Envenenar o cache usando a **ocultação de parâmetros** técnica para executar `alert(1)` no navegador da vítima.

**Observação inicial**

O seguinte cookie aparece na solicitação:

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

Na resposta do servidor, um **geolocate** script é carregado. / Esse script usa o valor do cookie para definir o país do usuário no lado do cliente.

<figure><img src="/files/82a7a3f7f05b13f09988664d1e45cf281ca56763" alt=""><figcaption></figcaption></figure>

**Identificação do parâmetro vulnerável**

Usando **Param Miner (Adivinhar parâmetros de consulta)**, detectamos um comportamento de **ocultação de parâmetros**.

<figure><img src="/files/90fe4c4237525044bac7ce70bd5bdfc975b91ac3" alt=""><figcaption></figcaption></figure>

O parâmetro descoberto é:

```bash
utm_content
```

<figure><img src="/files/7038820e7b121df97939bf89537f0ed974894a78" alt=""><figcaption></figcaption></figure>

Se você acessar a seguinte URL:

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

<figure><img src="/files/6e6f340723fd8b11cdaab097514bf4ada49cf9c9" alt=""><figcaption></figcaption></figure>

Observamos que:

* O valor do parâmetro pode ser alterado livremente
* O cache \*\*não é invalidado\*\*
* A resposta continua a mesma para os seguintes usuários

Isso confirma que `utm_content` é **excluído da chave do cache**.

**Operação via script geolocate**

O script carregado pela página é:

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

Adicionando o parâmetro ignorado pelo cache:

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

O seguinte comportamento é observado:

* O `teste` o valor é refletido na resposta
* O cache permanece inalterado

Isso indica que o back-end interpreta os parâmetros de forma diferente do cache.

<figure><img src="/files/749196831e6b71447d09f6fc786491ed9364beb0" alt=""><figcaption></figcaption></figure>

**Injeção via ocultação de parâmetros**

Essa diferença de parsing é explorada injetando um **segundo parâmetro callback** mascarado por `utm_content`:

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

Resultado:

* O cache sempre considera a solicitação idêntica

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

O back-end interpreta `callback=alert(1)` como um novo parâmetro válido

O JavaScript gerado é executado `alert(1)`

<figure><img src="/files/03d2b1bf260a8b51ea8ef30134bdd674cde46306" 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/pt-br/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.
