> 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/web-cache-deception/cheating-the-cache-with-delimiters-in-the-path.md).

# 利用路径中的分隔符欺骗缓存

面向 PortSwigger Web Security Academy 实验室的利用路径中的分隔符欺骗缓存笔记，包括利用流程、载荷测试、Burp Suite 验证和修复背景。

### 利用路径分隔符进行 Web 缓存欺骗

#### 上下文

**实验：** Web 缓存欺骗的操作路径限制 / **目标：** 从用户处获取 \*\*API 密钥\*\* **carlos**. / **提供的访问权限：** 可能与 `wiener:peter`. / **帮助：** 实验室提供了一个可能的分隔符列表。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7d2d25b19759891c924f495db86cec9b8731efcd%2F%7B1E6EFECE-A0F3-4DF6-9D0E-1A6EBE6482B1%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 初始观察

* 在 **我的账户** 页面，我们看到一个标志，清楚地显示了我们自己的 API 密钥\*\*。
* 在后台，正常访问会触发一个请求：

```bash
GET /my-account HTTP/2
```

在这种情况下， **该答案不是从缓存中提供的** （没有可见/可解释的缓存行为）。

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-166e3bc6025b41ab76cff764fc9c09a0de8b3b97%2F%7BE95ADD51-26B1-4D3C-A48F-3A6C758D04ED%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### 分隔符测试

* 通过添加一个 \*\*分号\*\* `;` 到路径中，\*\*应用程序仍然会解析该路由\*\* 为 `my-account`，但这一次 **带有缓存行为**.

使用 **Intruder**，我们检查了几个分隔符，发现 **分号有效**.

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-233c87ff615198c217cbd53a6ad57f98c19360fd%2F%7B8DFE85D2-8813-472D-AD26-0AB0AF4E77B9%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

有效路径示例：

* `/my-account;test.js`

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-71b1b7ef57caa58a9faa5a3c6ea16f2bb9ef223e%2Fimage%20(80).png?alt=media" alt=""><figcaption></figcaption></figure>

#### 利用

目的：确保受害者访问一个陷阱 URL，使 **/my-account** 响应 \*\*被缓存\*\*，然后用另一个变体重新读取它以获取 **carlos** 数据。

从**利用服务器**，受害者被重定向到：

```javascript
<script>
    document.location="https://0a5e005c048218fb80a3f0ec00c2000d.web-security-academy.net/my-account/my-account;test.js";
</script>
```

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-40626dbcbbd1ff8d5619a793bc771da69b710f3f%2F%7BF05779E6-A4C1-45E9-BE49-3D311E98BCA0%7D.png?alt=media" alt=""><figcaption></figcaption></figure>

#### API 密钥恢复

* 然后我们更改 URL 并访问：
* `/my-account;jordan.js`

然后这个答案包含 **Carlos 的 API 密钥**.

<figure><img src="https://1574813340-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl4EVJpcOrsgjSGsLI7p2%2Fuploads%2Fgit-blob-7f21b64eb382c6456ce24a4bd1a5ba3f8f561123%2F%7B44422477-9CA3-462E-8C7E-951F71853DB6%7D.png?alt=media" 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://hacking-notes.jord4n.pro/zh/web/web-cache-deception/cheating-the-cache-with-delimiters-in-the-path.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
