> 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

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

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

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

<figure><img src="/files/6e979f88284e87dfb70537d78b60bff4fdc9287d" alt=""><figcaption></figcaption></figure>

#### 1) Определение точки внедрения

Когда вы открываете несуществующую страницу (например, `/test`), сайт возвращает **страницу ошибки** которая повторно использует запрошенный путь в HTML-ответе.

Если HTML-тег закрыт и внедрён скрипт, это интерпретируется как:

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

<figure><img src="/files/dcd999e1fc4735e5ce345fea298f7b51cf002507" alt=""><figcaption></figcaption></figure>

#### 2) Возникшая проблема

Если этот URL ввести напрямую в браузер, полезная нагрузка **n не выполняется**. / Причина в том, что браузер **автоматически кодирует** специальные символы (`<`, `>`, `/`, и т. д.), что предотвращает выполнение скрипта.

<figure><img src="/files/97c2db6a6a74c7c0bbada62a4fe1f528267e9c2b" alt=""><figcaption></figcaption></figure>

#### 3) Эксплуатация через стандартизацию кэша

Чтобы обойти эту защиту,  **кэш** используется:

* Вредоносный запрос отправляется через **Burp Suite**, без прохождения через адресную строку браузера.
* Кэш **нормализует** URL и сохраняет связанный ответ.
* Затем кэшированный ответ содержит полезную нагрузку **без кодирования**.

#### (4) Активация XSS

После того как ответ отравлен в кэше:

* URL предоставляется жертве.
* Кэш возвращает стандартную версию страницы.
* Скрипт интерпретируется и `alert(1)` выполняется в браузере жертвы.

<figure><img src="/files/b1612a0ce0af98d0e190ef2a47058e5b07324b47" 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://hacking-notes.jord4n.pro/ru/web/cache-poisoning/url-normalization.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
