CVE-2026-119203
Infinite loop in pypdf when parsing incomplete PDF missing trailer (pre‑6.21.4).
- CVSS 7.1
- CWE-835
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.21.4, pypdf can enter an infinite loop while opening a crafted incomplete PDF whose standard cross-reference table reaches the end of the file without a trailer. The trailer search can repeatedly rewind to the same stream position instead of terminating when parsing makes no progress, blocking the processing thread. This issue is fixed in version 6.21.4.
- CWE
- CWE-835
- CVSS base score
- 7.1
- Published
- 2026-10-29
- OWASP
- A06 Vulnerable and Outdated Components
- 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.4 or later.
Vulnerable code sample
from pathlib import Path
from pypdf import PdfReader
def load_pdf(file_path: str) -> PdfReader:
# VULNERABLE: infinite loop on malformed PDF without trailer
pdf_path = Path(file_path)
return PdfReader(pdf_path)Patched code sample
from pathlib import Path
from pypdf import PdfReader
def load_pdf(file_path: str) -> PdfReader:
# FIX: disable strict parsing to avoid endless trailer search
pdf_path = Path(file_path)
return PdfReader(pdf_path, strict=False)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: Detect EOF when reading standard xref table trailer (#4289) (py-pdf/pypdf)
pypdf/_reader.py,pypdf/_reader.py · PdfReader._read_standard_xref_table
Cite this entry
@misc{vaitp:cve2026119203,
title = {{Infinite loop in pypdf when parsing incomplete PDF missing trailer (pre‑6.21.4).}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-119203},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119203/}}
}
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 ::
