> 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/web-cache-poisoning-via-unkeyed-query-string.md).

# Отравление веб-кэша через неключевую строку запроса

### Отравление веб-кэша через строку запроса, не входящую в ключ кэша

В этой лабораторной работе показана уязвимость к отравлению веб-кэша из-за того, что **строка запроса не включается в ключ кэша**. Обычный пользователь регулярно посещает главную страницу сайта, используя **Google Chrome**.

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

***

**Шаг 1: Перехват главной страницы**

Запрос к корню сайта (`/`) перехватывается. / В ответе мы наблюдаем наличие канонического **ссылку**, что указывает на то, что некоторые элементы URL могут отражаться в HTML.

***

**Шаг 2: Проверка строки запроса**

В URL добавляется произвольная строка запроса:

```bash
/?test
```

Значение хорошо **отражается в ответе**, что подтверждает, что строка запроса влияет на возвращаемое содержимое.

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

**Шаг 3: Внедрение HTML**

Затем строка запроса изменяется для внедрения HTML:

```bash
/?test'/><h1>JORDAN</h1>
```

У `<h1>` тег корректно интерпретируется браузером, демонстрируя работоспособное \*\*внедрение HTML\*\*.

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

<figure><img src="/files/1972fa6fd29e9b7ab48ca6762f6c08aa0d715c68" alt=""><figcaption></figcaption></figure>

**Шаг 4: Внедрение JavaScript (отравление кэша)**

Замените внедрение HTML на полезную нагрузку JavaScript:

```bash
/?test'/><script>alert(1)</script>
```

Ответ теперь содержит скрипт, который \*\*выполняется браузером\*\*.

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

**Результат**

Поскольку строка запроса **не включена в ключ кэша**, отравленный ответ сохраняется и выдается другим пользователям, посещающим главную страницу. / Затем жертва автоматически запускает выполнение `alert(1)` во время своего посещения, что подтверждает выполнение лабораторной работы.

<figure><img src="/files/63d881a00addd149ba7f70deb8c3bdcef9afd5f1" 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 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/web-cache-poisoning-via-unkeyed-query-string.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.
