
POC for CVE-2026-24688
本仓库包含用于触发CVE-2026-24688的验证概念代码。
pypdf的目录(书签)解析逻辑中存在严重的拒绝服务漏洞。当处理带有循环目录引用的PDF时,解析器进入无限循环,持续分配内存,在我的机器上每秒消耗数百MB内存,并导致系统完全崩溃。
这是一个系统级的拒绝服务,而不仅仅是应用程序挂起。
malicious_circular_outline.pdf - 带有循环目录的利用PDF(754字节)create_malicious_pdf.py - 生成利用PDF的脚本simple_read_pdf.py - 复现漏洞的简单测试脚本test_pypdf.sh - 自动化测试脚本(安装pypdf并运行测试)README.md - 本文件警告: 如果您不密切关注内存消耗并及时取消,这些测试可能会使您的系统崩溃。
# Run the automated test script (with timeout protection)
chmod +x test_pypdf.sh
./test_pypdf.sh
# This will:
# 1. Install the vulnerable version of pypdf
# 2. Run test with 15-second timeout
# 3. Show memory consumption behavior
# Install pypdf (vulnerable version 6.6.0)
pip install "pypdf==6.6.0"
# Run with timeout
timeout 10s python3 simple_read_pdf.py malicious_circular_outline.pdf
# Install pypdf (vulnerable version 6.6.0)
pip install "pypdf==6.6.0"
# Run without timeout
python3 simple_read_pdf.py malicious_circular_outline.pdf
位置: pypdf/_doc_common.py - _get_outline() 方法(第858-873行)
def _get_outline(self, node, outline=None):
while True: # ❌ NO cycle detection!
outline_obj = self._build_outline_item(node)
if outline_obj:
outline.append(outline_obj) # ❌ Heap allocation in loop!
if "/Next" not in node:
break
node = node["/Next"] # ❌ Follows circular references
根本原因: 没有访问集合,没有迭代限制,持续内存分配
实际测试:
攻击特征:
在版本6.6.2中修复
https://github.com/py-pdf/pypdf/security/advisories/GHSA-2q4j-m29v-hq73