| CVE | CVE-2014-0160 |
| 组件 | OpenSSL — TLS/DTLS Heartbeat 扩展 |
| 受影响版本 | 1.0.1 至 1.0.1g 之前 |
| 修复版本 | 1.0.1g |
| CWE | CWE-125(越界读取) |
| 影响 | 精心构造的 heartbeat 数据包声明的长度大于其实际负载,导致服务器返回相邻的进程内存,其中包括私钥和会话数据。 |
| 向量 | 畸形的 TLS heartbeat 请求 |
| 触发条件 | 声明的长度大于实际负载 |
存在漏洞的代码路径:
# pre-fix (model from OpenSSL security advisory 2014-04-07)
attacker input accepted without the required protection
派生出的守卫:
# derived from observed behaviour, not copied from a vendor fix
if requested > payload_len: reject
声明的长度被用于复制回复,而未检查载荷大小。修复方案对其进行了边界限制。
| 服务 | 镜像 | 角色 |
|---|---|---|
hb-vuln | cve-2014-0160:vuln | 存在漏洞行为 |
hb-guard | cve-2014-0160:guard | 已修复行为 |
poc | cve-2014-0160-poc:local | 仅使用标准库的 Python 驱动程序 |
两侧均为 Python 3.12 镜像。漏洞行为依据 OpenSSL 安全公告 2014-04-07 建模;防护措施源自实验室观察, 即影响已被复现。修复构建应用了已发布的上游变更。
./run-lab.sh build
./run-lab.sh up
./run-lab.sh sweep
./run-lab.sh down
该实验环境使用隔离的 cve0160lab 网络和有界容器。
poc/poc.py 接收一个模式和一个可选的 --host=...:
| 模式 | 结果 |
|---|---|
check | 发生越界读取时退出码为 1,请求被拒绝时退出码为 0 |
exploit | 运行完整攻击链并报告观察到的影响 |
probe | 打印泄露标志 |
mitigation | 解释推导出的防护机制 |
独立漏洞利用程序位于 exploit/exploit.py:
python3 exploit/exploit.py --host=hb-vuln
确认发现时退出码为 1,目标受防护时退出码为 0。
hb-vuln(修复前) | hb-guard(派生版本) | |
|---|---|---|
| 构造的请求 | 内存泄露 | 被拒绝 |
| 普通请求 | 正常工作 | 正常工作 |
捕获的运行记录位于 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,并带有 cve0160lab 网络。不涉及任何生产系统。
真实世界的利用需要存在受影响的安装实例。
普通请求在修复后的构建上仍然成功。
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