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

# Normalización de URL

Notas sobre Normalización de URL para los laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payload, validación en Burp Suite y contexto de mitigación.

### Normalización de URL

Este laboratorio contiene una **XSS** vulnerabilidad que no es explotable directamente, ya que el navegador aplica automáticamente una **dURL** codificación. / Por lo tanto, la **proceso de normalización de URL de la caché** debe usarse para explotar esta falla.

El objetivo es inyectar un payload que se ejecute `alert(1)` en el navegador de la víctima y luego proporcionarle la URL maliciosa.

<figure><img src="https://754079710-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) Identificación del punto de inyección

Cuando accedes a una página inexistente (p. ej. `/test`), el sitio devuelve una **página de error** que reutiliza la ruta solicitada en la respuesta HTML.

Si se cierra una etiqueta HTML y se inyecta un script, se interpreta como:

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

<figure><img src="https://754079710-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

Si esta URL se introduce directamente en el navegador, el payload **n no se ejecuta**. / La razón es que el navegador **codifica automáticamente** caracteres especiales (`<`, `>`, `/`, etc.), lo que impide la ejecución del script.

<figure><img src="https://754079710-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) Operación mediante la estandarización de la caché

Para eludir esta protección, se **caché** utiliza:

* La solicitud maliciosa se envía a través de **Burp Suite**, sin pasar por la barra de direcciones del navegador.
* La caché **normaliza** la URL y almacena la respuesta asociada.
* La respuesta almacenada en caché entonces contiene el payload **sin codificar**.

#### (4) Activación del XSS

Una vez que la respuesta está envenenada en la caché:

* Se proporciona la URL a la víctima.
* La caché devuelve la versión estándar de la página.
* El script se interpreta y `alert(1)` se ejecuta en el navegador de la víctima.

<figure><img src="https://754079710-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/es/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.
