> 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/cache-poisoning/url-normalization.md).

# URL正規化

URL正規化の PortSwigger Web Security Academy ラボ向けノート。攻撃フロー、ペイロードテスト、Burp Suite による検証、および是正策の文脈を含みます。

### URLの正規化

このラボには **XSS** 直接悪用できない脆弱性があり、ブラウザが自動的に **dURL** エンコードします。/ したがって、 **キャッシュのURL正規化プロセス** この欠陥を悪用するには使用しなければなりません。

目的は、実行されるペイロードを注入することです `alert(1)` を被害者のブラウザに送り込み、その後悪意のあるURLを与えることです。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-924dc3b440ac56cd48934f83f912310005d50560%2F%7B52591DD1-9E12-45A2-812C-3E47D549F1AB%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 1) 注入ポイントの特定

存在しないページにアクセスすると（例： `/test`）、サイトは **エラーページ** を返し、HTMLレスポンス内で要求されたパスを再利用します。

HTMLタグが閉じられ、スクリプトが注入されると、次のように解釈されます：

```javascript
/test</p><script>alert(1)</script>
```

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-42e0199c3c5daab9da221f946c67f82e554a1326%2F%7BACB59D9B-3776-4314-A88D-599A8DC970A4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2) 問題の発生

このURLをブラウザに直接入力すると、ペイロードは **nは実行されません**。/ 理由は、ブラウザが **自動的にエンコードする** 特殊文字（`<`, `>`, `/`、など）をエンコードするため、スクリプトの実行が妨げられるからです。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f1c4f08d1dd4ac265a27d642342ef2312b5e1d7f%2F%7B3A9DB60A-3A74-4826-80B7-FB0F49F6D1A2%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 3) キャッシュの標準化による操作

この保護を回避するために、 **キャッシュ** が使用されます：

* 悪意のあるリクエストは **Burp Suite**を介して送信され、ブラウザのアドレスバーを経由せずに。
* キャッシュは **正規化し** URLを正規化し、それに対応するレスポンスを保存します。
* すると、キャッシュされた応答にはペイロードが含まれます **エンコードされていない**.

#### (4) XSSの発生

応答がキャッシュに汚染されると：

* URLを被害者に送ります。
* キャッシュはページの標準版を返します。
* スクリプトが解釈され、 `alert(1)` 被害者のブラウザで実行されます。

<figure><img src="https://2001299964-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-08eb81aca79a89302f4550dbba0975de9ce5b2d8%2F%7B2A6C09FF-C1B0-4EAB-A5E8-A248B6FB611F%7D.png?alt=media" alt="" width="507"><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/cache-poisoning/url-normalization.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.
