> 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-by-path-manipulation.md).

# Обман веб-кэша путем манипуляции путями

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

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

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

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-108b38e85bcc7723d3655ed256ab94e6d6ab23ed%2F%7B6D0C2C89-1F6B-48CA-B915-C9EDF0F5E9DE%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-29183f864d0e6633e8eec334dd43f232517f9326%2F%7BA44A17EA-B46B-4E3B-89DF-96104A9B1F59%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-2b3e00bdbf8e94e2755b444e3c6e8968ff9597eb%2F%7B3B320FBE-E2BE-43DB-8AEC-6223464C1F8E%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-3b7e90f784764ff27fd8de94be4cbafb6aca535d%2Fimage%20(3133).png?alt=media" alt=""><figcaption></figcaption></figure>

Из**Сервер эксплойта**, заставить жертву загрузить 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="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-5ee7d2cf564ad6368a92b92c410e95cc212a7ce5%2F%7B6ABD89DC-A971-48F3-8542-76823C922CFC%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

1. Перейдя по адресу:

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

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

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

<figure><img src="https://4248209978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7aed730f89d4e5583776766836cb14dca0d58b14%2F%7BA88CD920-5D43-48A2-834E-F59F2D901B5F%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/web-cache-deception/web-cache-deception-by-path-manipulation.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.
