> 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

Notas sobre normalização de URL para os laboratórios do PortSwigger Web Security Academy, incluindo fluxo de exploração, teste de payload, validação no Burp Suite e contexto de remediação.

### Normalização de URL

Este laboratório contém uma **XSS** vulnerabilidade que não é explorável diretamente, pois o navegador aplica uma **dURL** codificação. / Portanto, o **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 ela a URL maliciosa.

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-924dc3b440ac56cd48934f83f912310005d50560%2F%7B52591DD1-9E12-45A2-812C-3E47D549F1AB%7D.png?alt=media" 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 resposta HTML.

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

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

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-42e0199c3c5daab9da221f946c67f82e554a1326%2F%7BACB59D9B-3776-4314-A88D-599A8DC970A4%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 2) Problema Encontrado

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

<figure><img src="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-f1c4f08d1dd4ac265a27d642342ef2312b5e1d7f%2F%7B3A9DB60A-3A74-4826-80B7-FB0F49F6D1A2%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

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

* A requisição maliciosa é enviada via **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) Disparando o XSS

Uma vez que a resposta esteja 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="https://783634792-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-08eb81aca79a89302f4550dbba0975de9ce5b2d8%2F%7B2A6C09FF-C1B0-4EAB-A5E8-A248B6FB611F%7D.png?alt=media" 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 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/pt-br/web/cache-poisoning/url-normalization.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.
