VAITP Dataset

← Back to the dataset

CVE-2026-119207

Excessive memory usage via amplified error messages in pypdf < 6.21.3.

  • 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 when strict mode loads a crafted invalid PDF dictionary. Nested parsing failures add repeated exception text to newly raised errors, allowing a small malformed dictionary to amplify into very large error messages. This issue is fixed in version 6.21.3.

CVSS base score
7.1
Published
2026-10-29
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
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 sys
from io import BytesIO
from pypdf import PdfReader
from pypdf.errors import PdfReadError

def load_pdf(data: bytes) -> PdfReader:
    """
    Load a PDF document in strict mode.
    """
    try:
        # strict=True triggers detailed parsing errors
        return PdfReader(BytesIO(data), strict=True)
    except PdfReadError as e:
        # VULNERABLE: re‑raise with duplicated error text, enabling unbounded memory growth
        raise PdfReadError(str(e) + " | " + str(e)) from None

Patched code sample

import sys
from io import BytesIO
from pypdf import PdfReader
from pypdf.errors import PdfReadError

def load_pdf(data: bytes) -> PdfReader:
    """
    Load a PDF document in strict mode.
    """
    try:
        # strict=True triggers detailed parsing errors
        return PdfReader(BytesIO(data), strict=True)
    except PdfReadError as e:
        # FIX: re‑raise without concatenating the original message to prevent memory exhaustion
        raise PdfReadError(str(e)) from None

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: Avoid excessive error messages (#4265) (py-pdf/pypdf)
    .github/scripts/check_gh_pages_updates.py · main, .github/scripts/check_urls.py · check_url, make_release.py · is_semantic_version, pypdf/generic/_base.py · FloatObject.__new__, pypdf/generic/_base.py · NameObject.read_from_stream, pypdf/generic/_base.py · PdfObject._reference_clone, pypdf/generic/_data_structures.py · ArrayObject.clone, pypdf/generic/_data_structures.py · ContentStream.clone, pypdf/generic/_data_structures.py · ContentStream.replicate, pypdf/generic/_data_structures.py · Destination.__init__, pypdf/generic/_data_structures.py · DictionaryObject.clone, pypdf/generic/_data_structures.py · DictionaryObject.read_from_stream and 26 more

Cite this entry

@misc{vaitp:cve2026119207,
  title        = {{Excessive memory usage via amplified error messages in pypdf < 6.21.3.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-119207},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-119207/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.