Executive brief
pypdf is a Python library used to process and manipulate PDF files. An attacker can craft a specially designed PDF with deeply nested or heavily duplicated outline entries that causes the library to consume excessive memory and CPU time when reading the document's outline (table of contents). This can lead to application hangs or crashes, disrupting any service that processes untrusted PDF files.
Technical details
This vulnerability is a denial-of-service (DoS) condition caused by asymmetric resource consumption and excessive iteration (CWE-405, CWE-834) in the outline parsing logic. When pypdf retrieves a document's outlines (bookmarks/table of contents), it does not adequately limit iteration depth or detect re-used nesting paths, allowing an attacker to craft a PDF that triggers quadratic or exponential processing time. The attack requires only local file access or the ability to supply a malicious PDF to an application; no authentication or user interaction beyond the victim opening/processing the file is needed. The affected versions are prior to 6.16.1, where the issue was remediated. A patch is available, and the fix was implemented in commit d91ab70.
Affected products
- py-pdf pypdf < 6.16.1
Timeline
- 2026-09-01: disclosed
- 2026-09-01: patched: Fixed in pypdf 6.16.1