CVE-2026-102997
Inefficient byte‑by‑byte FlateDecode decompression leads to DoS in pypdf ≤6.18.0.
- CVSS 8.7
- CWE-400
- Resource Management
- Remote
pypdf is a free and open-source pure-python PDF library. Prior to 6.18.1, a crafted PDF containing a partially malformed /FlateDecode stream with padded data can force pypdf/filters.py to use inefficient byte-by-byte decompression while the earlier recovery counter fails to advance for bytes that successfully decode, causing long runtimes and application unavailability. This is a residual issue after the malformed FlateDecode recovery fix. This issue is fixed in version 6.18.1.
- CWE
- CWE-400
- CVSS base score
- 8.7
- Published
- 2026-09-30
- 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.18.1 or later.
Vulnerable code sample
import sys
from pypdf import PdfReader
def extract_text(pdf_path):
# VULNERABLE: allows malformed FlateDecode streams to trigger costly byte‑by‑byte decompression
reader = PdfReader(pdf_path, strict=False)
text = []
for page in reader.pages:
text.append(page.extract_text())
return "\n".join(filter(None, text))Patched code sample
import sys
from pypdf import PdfReader
def extract_text(pdf_path):
# FIX: enforce strict parsing to reject malformed FlateDecode streams
reader = PdfReader(pdf_path, strict=True)
text = []
for page in reader.pages:
text.append(page.extract_text())
return "\n".join(filter(None, text))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: Further restrict FlateDecode recovery (#4073) (py-pdf/pypdf)
pypdf/filters.py · decompress
Cite this entry
@misc{vaitp:cve2026102997,
title = {{Inefficient byte‑by‑byte FlateDecode decompression leads to DoS in pypdf ≤6.18.0.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-102997},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-102997/}}
}
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 ::
