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

# Envenenamento de Cache via Parâmetro de Consulta Não Indexado

### Envenenamento de cache da Web via um parâmetro de consulta sem chave

Este laboratório é vulnerável a um ataque de envenenamento de cache da Web, pois um parâmetro de consulta não é incluído na chave de cache. / Um usuário visita regularmente a página inicial do site usando o Chrome. / O objetivo é envenenar o cache para que a página inicial sirva uma resposta executando `alert(1)` no navegador da vítima.

**Análise inicial**

* Ao interceptar a resposta da página raiz, um **canônico** link é observado.
* Se você acessar a URL com um parâmetro arbitrário, por exemplo `/?hello`, o valor é bem refletido na resposta

<figure><img src="/files/21048b97fc25111808ac40d869a8ac3b5f8d5ab8" alt=""><figcaption></figcaption></figure>

Injetando um payload como:

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

* O código HTML é interpretado na resposta, mas nenhum alerta é executado no lado da vítima.

<figure><img src="/files/7b949066c0a1409e9c84aec692dc6f39257ef892" alt=""><figcaption></figcaption></figure>

**Problema identificado**

O cache considera cada variação do `?test` parâmetro como uma nova entrada. / Assim, com cada alteração de valor, o cache é regenerado e o envenenamento não persiste.

No entanto, alguns parâmetros são **totalmente ignorados** pela chave de cache:

* Seu nome e valor não são levados em consideração.
* A resposta em cache permanece a mesma, mesmo que o valor mude.

**Identificação do parâmetro não indexado**

<figure><img src="/files/887c1e0210f80a7e8c01c4707f836ce6a28bc60e" alt=""><figcaption></figcaption></figure>

Usando **Param Miner** (função Adivinhar parâmetros de consulta), o `utm_content` parâmetro é identificado.

<figure><img src="/files/396ee9b53fe671a1b1cb2926213538e146987c00" alt=""><figcaption></figcaption></figure>

* Ao testar valores diferentes para esse parâmetro, constatamos que o cache permanece inalterado, confirmando que ele não está incluído na chave de cache.

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

<figure><img src="/files/2052ddfe8780903f1078fa88d0430f0315f638e7" alt=""><figcaption></figcaption></figure>

**Exploração**

A carga maliciosa é então injetada nesse parâmetro não indexado:

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

A resposta envenenada é armazenada no cache e servida aos visitantes seguintes.

<figure><img src="/files/4f44b2882f8e3128034df606fce4847a125c4b28" 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/cache-poisoning-via-unindexed-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.
