> 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/cache-poisoning-via-unindexed-query-parameter.md).

# Отравление кэша через неиндексируемый параметр запроса

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

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

**Первичный анализ**

* Перехватив ответ корневой страницы,  **канонический** обнаружена ссылка.
* Если открыть URL с произвольным параметром, например `/?hello`, значение корректно отражается в ответе

<figure><img src="/files/650c38312326483634770ce5e6d6ad22f87ac0dd" alt=""><figcaption></figcaption></figure>

При внедрении полезной нагрузки, например:

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

* HTML-код интерпретируется в ответе, но на стороне жертвы не срабатывают alert-окна.

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

**Выявленная проблема**

Кэш рассматривает каждую вариацию `?test` параметра как новый ввод. / Таким образом, при каждом изменении значения кэш пересоздаётся, и отравление не сохраняется.

Однако некоторые параметры **полностью игнорируются** ключом кэша:

* Их имя и значение не учитываются.
* Кэшированный ответ остаётся прежним, даже если их значение меняется.

**Определение неиндексируемого параметра**

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

Используя **Param Miner** (функция Guess query parameters), `utm_content` параметр определяется.

<figure><img src="/files/3bedf3771b71b53c0b4768c18f55751cb7285427" alt=""><figcaption></figcaption></figure>

* Проверяя разные значения этого параметра, мы видим, что кэш остаётся неизменным, подтверждая, что он не включён в ключ кэша.

<pre class="language-bash"><code class="lang-bash"><strong>/?utm_content=test
</strong></code></pre>

<figure><img src="/files/483a080936d792d0de4668e6e5b803c8af5505b5" alt=""><figcaption></figcaption></figure>

**Эксплуатация**

Затем вредоносная полезная нагрузка внедряется в этот неиндексируемый параметр:

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

Отравленный ответ сохраняется в кэше и выдаётся последующим посетителям.

<figure><img src="/files/3042c1981aad63cd5a0282da190ed17ae85ea500" 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/cache-poisoning-via-unindexed-query-parameter.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.
