
Apache Solr VelocityResponseWriter 会将用户提供的模板作为代码渲染。已在 8.3.1 中修复。差异对比:该指令在存在漏洞的版本上被执行,在修复后的版本上被拒绝。
| CVE | CVE-2019-17558 |
| 组件 | Apache Solr — VelocityResponseWriter |
| 受影响版本 | 5.0.0 至 8.3.0 |
| 修复版本 | 8.3.1 |
| CWE | CWE-94(代码注入) |
| 影响 | 用户自定义的 configset 可能包含带有可执行指令的 Velocity 模板。VelocityResponseWriter 会渲染该模板,从而导致远程代码执行。 |
| 攻击向量 | 通过 configset 或参数构造的 Velocity 模板 |
| 触发条件 | 模板中的 #set 等 Velocity 指令 |
存在漏洞的路径:
# pre-fix (model from Apache Solr security bulletin)
attacker input accepted without the required protection
派生出的防护:
# derived from observed behaviour, not copied from a vendor fix
if '#set(' in template or '@java' in template: reject
用户提供的模板被当作代码渲染。该修复默认禁用了这条路径。
| 服务 | 镜像 | 角色 |
|---|---|---|
s58-vuln | cve-2019-17558:vuln | 存在漏洞行为 |
s58-guard | cve-2019-17558:guard | 修复后行为 |
poc | cve-2019-17558-poc:local | 仅使用标准库的 Python 驱动程序 |
两侧均为 Python 3.12 镜像。漏洞行为依据 Apache Solr 安全公告建模;防护措施源自实验室观察,即该影响可被复现。修复后的构建应用了已发布的上游变更。
./run-lab.sh build
./run-lab.sh up
./run-lab.sh sweep
./run-lab.sh down
该实验环境使用隔离的 cve17558lab 网络和有界容器。
poc/poc.py 接收一个模式和一个可选的 --host=...:
| 模式 | 结果 |
|---|---|
check | 指令执行时退出码为 1,模板被拒绝时退出码为 0 |
exploit | 运行完整链条并报告观察到的影响 |
probe | 打印 rce 标志 |
mitigation | 解释推导出的防护机制 |
独立漏洞利用程序位于 exploit/exploit.py:
python3 exploit/exploit.py --host=s58-vuln
在确认发现时退出码为 1,在受防护目标上退出码为 0。
s58-vuln(修复前) | s58-guard(派生版本) | |
|---|---|---|
| 构造的请求 | RCE | 被拒绝 |
| 普通请求 | 正常工作 | 正常工作 |
捕获的运行记录位于 evidence/check-*-run.txt、evidence/exploit-*-run.txt、
evidence/probe-*-run.txt、evidence/mitigation-*-run.txt、
evidence/exploit-standalone-run.txt、
evidence/exploit-standalone-fixed-run.txt、evidence/versions.txt 和
evidence/0day-sweep.txt。
Podman 或 Docker,并带有 cve17558lab 网络。不涉及任何生产系统。真实世界的利用需要存在受影响的安装。
普通请求在修复后的构建上仍然成功。
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
exploit/exploit.py standalone exploit
lab/harness-*.py vulnerable behaviour / derived guard
lab/lab.Dockerfile builds both sides
lab/service.py HTTP wrapper (POST /check)
evidence/ captured runs on both sides
TRACKING.md working record, excluded from the repo