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

# Burlando o Cache Manipulando Caminhos

### Explorando o mapeamento de caminhos para Web Cache Deception

#### Objetivo do Laboratório

Recuperar \*\*chave de API\*\* do usuário **carlos**. / Credenciais fornecidas: **wiener:peter**.

#### Observações

* Em **Minha conta** (my-account), a \*\*chave de API\*\* aparece **em texto simples** para o nosso próprio usuário.

<figure><img src="/files/6f00f78304d7f5c1bd282b704a2ba685a5ee8511" alt=""><figcaption></figcaption></figure>

* Inicialmente, não há indicação direta (na resposta) de que haja **cache**.

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

* No entanto, ao adicionar segmentos à URL, a aplicação continua exibindo a **my-account** página, sugerindo uma **lógica de mapeamento de rotas** potencialmente compatível com o cache.

Exemplos testados:

* `/my-account/TESTTTTTT` → A aplicação sempre trata isso como **my-account**

<figure><img src="/files/914dd6b2fa80569042d2a5d4642f4a01d213cb90" alt=""><figcaption></figcaption></figure>

* `/my-account/TESTTT.js` → extensão **.js** é aceito e interpretado (útil para enganar as regras de cache)

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

Do**Servidor de exploração**, force uma vítima a carregar uma URL do tipo "static" apontando para 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/8db0dada75064dc540195504fb96a4bad0114c80" alt=""><figcaption></figcaption></figure>

1. Ao acessar:

* `/my-account/jordan.js`/ obtém-se uma resposta que exibe a \*\*chave de API do carlos\*\*.

#### Resultado

A chave de API de **carlos** é exibida por meio de uma URL camuflada (com `.js` extensão), o que permite aproveitar o comportamento de cache/roteamento (`/my-account/<alguma_coisa>.js`).

<figure><img src="/files/20e2fdb7bcc6f0e941b3e334df06600f055eb033" 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/pt-br/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.
