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

# Нормализация URL

Заметки по лабораторным работам PortSwigger Web Security Academy о нормализации URL, включая рабочий процесс эксплуатации, тестирование полезной нагрузки, проверку в Burp Suite и контекст устранения уязвимости.

### Нормализация URL

Этот лабораторный стенд содержит **XSS** уязвимость, которую нельзя использовать напрямую, поскольку браузер автоматически применяет **dURL** кодирование. / Поэтому, **Процесс нормализации URL кэшем** должен использоваться для эксплуатации этой уязвимости.

Цель — внедрить полезную нагрузку, которая выполняется `alert(1)` в браузере жертвы, а затем предоставить ему вредоносный URL.

<figure><img src="https://4248209978-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://4248209978-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 ввести напрямую в браузере, полезная нагрузка **не выполняется**. / Причина в том, что браузер **автоматически кодирует** специальные символы (`<`, `>`, `/`, и т. д.), что препятствует выполнению скрипта.

<figure><img src="https://4248209978-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://4248209978-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/ru/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.
