> 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

### Normalización de URL

Este laboratorio contiene una **XSS** vulnerabilidad que no es explotable directamente, ya que el navegador aplica una automática **URL** 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="/files/a2024aa0d54007a75829c6cc0e07009de5aca662" 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="/files/6d1b205a1ec96fff0cb85ea851ebb613f6b2cfb4" alt=""><figcaption></figcaption></figure>

#### 2) Problema encontrado

Si esta URL se introduce directamente en el navegador, el payload **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="/files/34d51bd9e17b85b8d876ab4205f614b42ada4a21" alt=""><figcaption></figcaption></figure>

#### 3) Operación mediante la normalizació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 en caché entonces contiene el payload **sin codificar**.

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

Una vez que la respuesta queda envenenada en la caché:

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

<figure><img src="/files/0b8cc9219fa49ebcb1f0d50e0941d9dad3788bfe" 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/es/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.
