CVE-2026-119209
Memory exhaustion via crafted PDF cross‑reference streams in pypdf.
- CVSS 7.1
- CWE-400
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.21.3, pypdf can consume excessive memory while opening a crafted PDF containing cross-reference streams that declare very large entry counts. Highly compressible streams and /Prev chains can multiply the number of parsed entries across a document, while negative /Index counts can bypass the existing per-stream clamp. This issue is fixed in version 6.21.3.
- CWE
- CWE-400
- CVSS base score
- 7.1
- Published
- 2026-10-29
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- 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.21.3 or later.
Vulnerable code sample
import io
from pypdf import PdfReader
def load_pdf(data: bytes):
# VULNERABLE: unbounded cross‑reference entry parsing
stream = io.BytesIO(data)
reader = PdfReader(stream) # no limit on entry count
return reader.metadataPatched code sample
import io
from pypdf import PdfReader
def load_pdf(data: bytes):
# FIX: enforce a maximum entry count to prevent exhaustion
stream = io.BytesIO(data)
reader = PdfReader(stream, max_entry_count=10000)
return reader.metadataPublished 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 total number of cross-reference stream entries (#4269) (py-pdf/pypdf)
pypdf/_reader.py,pypdf/_reader.py · PdfReader._read_pdf15_xref_stream,pypdf/_reader.py · PdfReader._read_xref_tables_and_trailers,pypdf/_reader.py · PdfReader._sanitize_pdf15_xref_stream_index_pairs,pypdf/_reader.py · PdfReader.__init__
Cite this entry
@misc{vaitp:cve2026119209,
title = {{Memory exhaustion via crafted PDF cross‑reference streams in pypdf.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-119209},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119209/}}
}
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 ::
