CVE-2026-115572
Crafted PDF repeatedly references missing object, causing prolonged file recovery loads.
- CVSS 7.1
- CWE-400
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.21.2, an attacker can craft a PDF that repeatedly references the same nonexistent indirect object, causing relevant file parts such as pages to trigger repeated full-file recovery loads and long runtimes when accessed. This issue is fixed in version 6.21.2.
- CWE
- CWE-400
- CVSS base score
- 7.1
- Published
- 2026-10-23
- 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.2 or newer.
Vulnerable code sample
import sys
from pypdf import PdfReader
def extract_text(pdf_path):
# VULNERABLE: unbounded repeated access to potentially missing indirect objects
reader = PdfReader(pdf_path)
text = ""
for i in range(len(reader.pages)):
# each access may trigger full-file recovery if the page object is missing
page = reader.pages[i]
text += page.extract_text() or ""
return textPatched code sample
import sys
from pypdf import PdfReader
def extract_text(pdf_path):
# FIX: cache page objects to avoid repeated recovery loads
reader = PdfReader(pdf_path)
text = ""
cached_pages = [None] * len(reader.pages)
for i in range(len(reader.pages)):
if cached_pages[i] is None:
cached_pages[i] = reader.pages[i]
page = cached_pages[i]
text += page.extract_text() or ""
return textPublished 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: Avoid repeated full file loads (#4240) (py-pdf/pypdf)
pypdf/_doc_common.py · PdfDocCommon._replace_object,pypdf/_reader.py,pypdf/_reader.py · PdfReader.get_object,pypdf/_reader.py · PdfReader._read_standard_xref_table,pypdf/_utils.py
Cite this entry
@misc{vaitp:cve2026115572,
title = {{Crafted PDF repeatedly references missing object, causing prolonged file recovery loads.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-115572},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-115572/}}
}
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 ::
