> 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/cheating-the-cache-by-manipulating-paths.md).

# Обман кэша путём манипулирования путями

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

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

Получить \*\* ключ API\*\* от пользователя **carlos**. / Предоставленные учетные данные: **wiener:peter**.

#### Наблюдения

* В **Мой аккаунт** (my-account), появляется \*\* ключ API\*\* **в открытом виде** для нашего собственного пользователя.

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

* Сначала нет прямого указания (в ответе) на наличие **кэширования**.

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

* Однако, добавляя сегменты к URL, приложение продолжает отображать **my-account** страницу, что указывает на **логику сопоставления маршрутов** потенциально совместимую с кэшем.

Проверенные примеры:

* `/my-account/TESTTTTTT` → Приложение всегда рассматривает это как **my-account**

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

* `/my-account/TESTTT.js` → расширение **.js** принимается и интерпретируется (полезно для обмана правил кэша)

<figure><img src="/files/9043bbff7473373ad92ec0b6a00bbb6ca798f0d6" alt=""><figcaption></figcaption></figure>

С**Exploit Server**, заставить жертву загрузить URL типа "static", указывающий на my-account:

{% code overflow="wrap" %}

```javascript
<script>
    document.location="https://0afd005204a0683b803d1ce200320070.web-security-academy.net/my-account/jordan.js";
</script>
```

{% endcode %}

<figure><img src="/files/597160a4e1905e0428429cf2fea09a2856ffcac4" alt=""><figcaption></figcaption></figure>

1. Перейдя по:

* `/my-account/jordan.js`/ можно получить ответ, который отображает \*\* ключ API Карлоса\*\*.

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

Ключ API для **carlos** отображается через замаскированный URL (с `.js` расширением), что позволяет воспользоваться поведением кэша/маршрутизации (`/my-account/<что-то>.js`).

<figure><img src="/files/d788b611c831a193000384c02f20d9210b8e931c" 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/web-cache-deception/cheating-the-cache-by-manipulating-paths.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.
