> 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-parameter.md).

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

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

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

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-1871d2fc701cc8b477a71d82641d280d6cb50a35%2F%7BF524D9FB-B23A-4150-81DA-8F20E7419FC7%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

Внедрение полезной нагрузки, такой как:

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-e4f554844d5146c3422aceb69e3dcced72fcb1fe%2F%7B734F33BC-EB04-480C-A19E-D18BE89A91C9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

**Обнаруженная проблема**

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

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

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

**Выявление неиндексируемого параметра**

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-65505e828de6590eb1d67cb0861211ff661f7d53%2F%7B01DA2100-8C27-4CB0-BFF0-3EFE3043FE34%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-20c44b2767ed05cc3d703e77327ef684da948c37%2F%7B05D74FEB-B745-45BE-B1A4-CC31B5C89F63%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-58224d7a9841bc18b9b0c1d9e2da7bf5cd984cf2%2F%7B39C0B55B-4D1C-4D05-9E2F-10064DBBE52C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

```bash
/?utm_content='/><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-561c0564a9cc1ff15928ee60745fc1b1a454b91f%2F%7BB11F48CD-41CB-4DF8-8C99-A21C820C843B%7D.png?alt=media" 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 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/web-cache-poisoning-via-unkeyed-query-parameter.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.
