> 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/cache-poisoning/url-normalization.md).

# Normalização de URL

### Normalização de URL

Este laboratório contém uma **XSS** vulnerabilidade que não é explorável diretamente, pois o navegador aplica uma codificação automática **URL** codificação. / Portanto, a **processo de normalização de URL do cache** deve ser usado para explorar essa falha.

O objetivo é injetar uma carga útil que seja executada `alert(1)` no navegador da vítima e então fornecer a ele a URL maliciosa.

<figure><img src="/files/388649b3ec7fcd558e226a9b960588da831aa1b5" alt=""><figcaption></figcaption></figure>

#### 1) Identificação do Ponto de Injeção

Quando você acessa uma página inexistente (por exemplo, `/test`), o site retorna uma **página de erro** que reutiliza o caminho solicitado na პასუხ HTML.

Se uma tag HTML é fechada e um script é injetado, ele é interpretado como:

```javascript
/test</p><script>alert(1)</script>
```

<figure><img src="/files/32c97623b90884a0bee8fbf24010e0d475268eaa" alt=""><figcaption></figcaption></figure>

#### 2) Problema Encontrado

Se esta URL for inserida diretamente no navegador, a carga útil **não é executada**. / O motivo é que o navegador **codifica automaticamente** caracteres especiais (`<`, `>`, `/`, etc.), o que impede a execução do script.

<figure><img src="/files/26774641e8a638aa4c269c97fbc70ae0d0e259a0" alt=""><figcaption></figcaption></figure>

#### 3) Operação via Padronização do Cache

Para contornar essa proteção, a **cache** é usada:

* A requisição maliciosa é enviada por meio de **Burp Suite**, sem passar pela barra de endereços do navegador.
* O cache **normaliza** a URL e armazena a resposta associada.
* A resposta em cache então contém a carga útil **sem codificação**.

#### (4) Acionando o XSS

Depois que a resposta é envenenada no cache:

* A URL é fornecida à vítima.
* O cache retorna a versão padronizada da página.
* O script é interpretado e `alert(1)` é executado no navegador da vítima.

<figure><img src="/files/1f3f54d4846330b10272de5b4a4d1f5a2e1a67c6" alt="" width="507"><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/cache-poisoning/url-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.
