pypdf Circular Outline Reference Infinite-Loop DoS (CVE-2026-24688)
by Fomovet · 2026-07-05
- Severity
- High
- CVE
- CVE-2026-24688
- Category
- misc
- Affected product
- pypdf (Python PDF library)
- Affected versions
- Up to and including 6.6.0 (fixed in 6.6.2)
- Disclosed
- 2026-07-05
- Patch status
- patched
Tags
References
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-06 |
| Author / Researcher | Fomovet |
| CVE / Advisory | CVE-2026-24688 |
| Category | misc |
| Severity | High |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | pypdf, python, denial-of-service, infinite-loop, malicious-pdf, memory-exhaustion, outline-parsing, cwe-835 |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | pypdf (Python PDF library) |
| Versions Affected | Up to and including 6.6.0 (fixed in 6.6.2) |
| Language / Platform | Python 3 (PoC), cross-platform |
| Authentication Required | No |
| Network Access Required | No (local file processing; any application that parses attacker-supplied PDFs with pypdf is affected) |
Summary
pypdf’s outline (bookmark) parser walks the linked list of outline entries via the /Next pointer without any cycle detection or iteration cap. A PDF crafted with a circular outline reference (an entry whose /Next chain loops back on itself) causes _get_outline() to spin forever, allocating heap memory on every iteration. On the researcher’s test machine this drove memory consumption into the tens of gigabytes within minutes and forced a hard reboot, making it more than a simple application hang. The repo ships a script to generate the malicious 754-byte PDF, a minimal reader script that triggers the bug, and a wrapper shell script that installs the vulnerable pypdf version and runs a time-boxed test.
Vulnerability Details
Root Cause
pypdf/_doc_common.py’s _get_outline() method follows node["/Next"] in an unbounded while True loop with no visited-node tracking, so a circular /Next chain in the PDF’s outline dictionary never terminates and continuously appends to an in-memory list.
Attack Vector
- Attacker crafts a PDF whose outline (bookmark) entries form a circular
/Nextreference chain. - Victim application uses pypdf (directly or via a wrapper) to read the PDF’s outline/table of contents, e.g. by calling
reader.outlineor equivalent. _get_outline()enters an infinite loop, allocating memory on each pass with no bound.- Process memory grows unbounded until the process or, in the researcher’s test, the entire host runs out of memory and crashes.
Impact
Any service that parses untrusted PDFs with a vulnerable pypdf version can be forced into unbounded memory growth, resulting in denial of service ranging from process OOM-kill to full system crash requiring a hard reboot.
Environment / Lab Setup
Target: Python environment with pypdf==6.6.0 installed
Attacker: Python 3, pip
Proof of Concept
PoC Script
See
create_malicious_pdf.py,simple_read_pdf.py,test_pypdf.sh, andmalicious_circular_outline.pdfin this folder.
| |
create_malicious_pdf.py generates the circular-outline PDF; simple_read_pdf.py opens it with pypdf and reads the outline, triggering the infinite loop; test_pypdf.sh automates installing the vulnerable version and running the test under a timeout to observe the memory-growth behavior without crashing the host.
Detection & Indicators of Compromise
Signs of compromise:
- A PDF-processing service (upload handler, document indexer, etc.) suddenly consuming abnormal and growing amounts of memory
- Host-level OOM events or hard crashes correlated with recent PDF ingestion
- Application logs showing a hang while calling pypdf outline/bookmark APIs
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to pypdf 6.6.2 or later |
| Interim mitigation | Sandbox/resource-limit (cgroups, ulimit, container memory caps) any process that parses untrusted PDFs with pypdf; reject or pre-scan PDFs with abnormal outline structures |
References
Notes
Mirrored from https://github.com/Fomovet/cve-2026-24688 on 2026-07-05.
| |