CVE-2026-84310
pypdf before 6.16.1 allows crafted PDFs to cause excessive CPU/memory via deep outline traversal.
- CVSS 4.8
- CWE-405
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.16.1, an attacker can craft a PDF that causes pypdf/_doc_common.py _get_outline to consume long runtimes and large amounts of memory when retrieving document outlines with large numbers of entries or deeply nested reused paths because the traversal lacked global entry-count and nesting-depth limits. This issue is fixed in version 6.16.1.
- CWE
- CWE-405
- CVSS base score
- 4.8
- Published
- 2026-09-01
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Timing Issues
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- pypdf
- Fixed by upgrading
- Yes
Solution
Upgrade pypdf to version 6.16.1 or later.
Vulnerable code sample
import itertools
from pypdf._page import PageObject # placeholder import to show real module usage
def _get_outline(outline, depth=0):
"""Recursively collect outline entries."""
# VULNERABLE: unbounded recursion and entry accumulation
entries = []
for item in outline:
entries.append(item.title)
if hasattr(item, "children"):
entries.extend(_get_outline(item.children, depth + 1))
return entries
def extract_titles(pdf):
"""Extract all outline titles from a PDF document."""
outline = pdf.get_outlines()
return _get_outline(outline)Patched code sample
import itertools
from pypdf._page import PageObject # placeholder import to show real module usage
_MAX_ENTRIES = 10000
_MAX_DEPTH = 100
def _get_outline(outline, depth=0, counter=None):
"""Recursively collect outline entries with limits."""
# FIX: enforce entry count and nesting depth limits
if counter is None:
counter = itertools.count()
if depth > _MAX_DEPTH:
return []
entries = []
for item in outline:
if next(counter) >= _MAX_ENTRIES:
break
entries.append(item.title)
if hasattr(item, "children"):
entries.extend(_get_outline(item.children, depth + 1, counter))
return entries
def extract_titles(pdf):
"""Extract all outline titles from a PDF document."""
outline = pdf.get_outlines()
return _get_outline(outline)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- SEC: Limit iterations for outline retrieval and XForm text extraction (#3966) (py-pdf/pypdf)
pypdf/_doc_common.py,pypdf/_doc_common.py · DocumentInformation.modification_date_raw,pypdf/_doc_common.py · PdfDocCommon._get_outline,pypdf/_page.py,pypdf/_page.py · PageObject.extract_xform_text,pypdf/_page.py · PageObject._extract_text,pypdf/_utils.py
Cite this entry
@misc{vaitp:cve202684310,
title = {{pypdf before 6.16.1 allows crafted PDFs to cause excessive CPU/memory via deep outline traversal.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-84310},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-84310/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
