> 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

Notas sobre Envenenamento de Fila com H2.TE para laboratórios da PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payloads, validação no Burp Suite e contexto de remediação.

### 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 este envenenamento para acessar o `/admin` painel de administração.
* Recupere a requisição do administrador (e, assim, seu cookie de sessão) quando ele se conectar, então exclua o `carlos` usuário.

#### Contexto técnico

* A aplicação aceita requisições **HTTP/2** lado do front-end.
* O front-end **faz downgrade** dessas requisições HTTP/2 para HTTP/1, mesmo quando o comprimento é ambíguo.
* O ataque é baseado na 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 é **reiniciada 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ígua e utilizável.

#### Plano de 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` a 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 do administrador envenenada**, o que nos permite obter: seu **cookie de sessão**.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f8cb9656f46ad61c65345f4030871c2a00e0f9c3%2F%7B606041C0-7B5F-4BC8-A64C-6FCDB7449828%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ce994d5a72a05bd41fe1b2696e392f6acffc2e70%2F%7B856ABF65-A462-44BA-827E-E044AB503A36%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/pt-br/web/request-smuggling/queue-poisoning-with-h2-te.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
