Skip to main content
Vulnerability Database/CVE-2026-113791

CVE-2026-113791: pypdf DOS Vulnerability in PDF Parsing

CVE-2026-113791 is a denial of service vulnerability in pypdf that allows attackers to craft malicious PDFs causing excessive memory consumption. This post covers technical details, affected versions, and mitigation.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-113791 Overview

CVE-2026-113791 is a resource exhaustion vulnerability in pypdf, a free and open-source pure-Python PDF library. Versions prior to 6.21.0 fail to bound the amount of work performed while parsing PDF content streams. An attacker can craft a PDF containing a content stream with many small operations, causing the parser to consume large amounts of memory. The flaw is tracked under [CWE-400: Uncontrolled Resource Consumption] and is fixed in pypdf version 6.21.0.

Critical Impact

Processing a single attacker-supplied PDF can exhaust available memory on the host, leading to denial of service in applications and services that embed pypdf for document ingestion.

Affected Products

  • pypdf versions prior to 6.21.0
  • Python applications and services that use pypdf to parse untrusted PDF input
  • Downstream libraries and pipelines that embed vulnerable pypdf releases

Discovery Timeline

  • 2026-10-21 - CVE-2026-113791 published to NVD
  • 2026-10-22 - Last updated in NVD database

Technical Details for CVE-2026-113791

Vulnerability Analysis

The vulnerability affects pypdf's content stream parser. PDF content streams are sequences of operators and operands that describe page content. The parser did not cap the number of operations, array elements, or dictionary entries that a single stream could request. A small, cheap-to-generate PDF file can therefore force the parser to allocate large numbers of in-memory objects. The result is memory exhaustion of the Python process performing the parse.

This class of flaw maps to [CWE-400] because the input size is not proportional to the resources consumed during parsing. The impact is limited to availability; confidentiality and integrity are not affected per the CVSS vector.

Root Cause

The root cause is missing upper bounds on parsed structures inside stream objects. The library did not enforce ceilings on array element counts or dictionary key-value pair counts while decoding stream contents. The patch adds explicit configuration limits and a parsing budget to constrain this work. See the GitHub Security Advisory GHSA-cgf9-327m-v77c for the maintainer-authored description.

Attack Vector

Exploitation requires an attacker to deliver a crafted PDF to an application that parses it with a vulnerable pypdf version. Typical delivery paths include file upload endpoints, email ingestion pipelines, document conversion services, and automated indexing jobs. User interaction is required to the extent that the target system must open or process the file. No authentication is required when the processing service accepts anonymous uploads.

The fix in Pull Request #4218 introduces configurable element-count ceilings and a StreamParsingBudget to bound parsing work:

python
     """The maximum allowed declared ``/Length`` value for streams."""
     array_based_stream_maximum_output_length: int = 75_000_000
     """The maximum allowed output length for array-based streams."""
+    array_maximum_element_count: int = 100_000
+    """The maximum allowed number of elements inside an array."""
+    dictionary_maximum_element_count: int = 100_000
+    """The maximum allowed number of key-value pairs inside a dictionary."""

     jbig2_maximum_output_length: int = 75_000_000

Source: GitHub Commit 18bd2981

Detection Methods for CVE-2026-113791

Indicators of Compromise

  • Python worker processes using pypdf showing sudden memory spikes followed by MemoryError exceptions or OOM-killer events.
  • Repeated crashes or restarts of document-processing services shortly after accepting a specific PDF upload.
  • PDF files whose on-disk size is small but whose content streams declare an unusually high density of operators or array elements.

Detection Strategies

  • Inventory Python environments and container images to identify installed pypdf versions below 6.21.0 using pip list or software composition analysis tooling.
  • Instrument document-ingestion services with per-request memory and CPU accounting and alert on parsing jobs that exceed baseline resource usage.
  • Review application logs for unhandled exceptions originating in pypdf.generic or stream-parsing code paths.

Monitoring Recommendations

  • Monitor cgroup and container memory metrics for processes handling user-supplied PDFs.
  • Track OOM-killer events on hosts running document pipelines and correlate with recent file uploads.
  • Capture and retain samples of PDFs that trigger parser failures for offline analysis.

How to Mitigate CVE-2026-113791

Immediate Actions Required

  • Upgrade pypdf to version 6.21.0 or later across all applications, containers, and virtual environments.
  • Audit dependency manifests (requirements.txt, pyproject.toml, Pipfile.lock) to confirm no transitive dependency pins a vulnerable release.
  • Place PDF parsing workloads in resource-limited sandboxes to contain any residual denial-of-service risk.

Patch Information

The fix is available in pypdf release 6.21.0 and was merged via Pull Request #4218. The patch introduces array_maximum_element_count, dictionary_maximum_element_count, and a StreamParsingBudget mechanism to cap parsing work. Install the fixed version with pip install --upgrade "pypdf>=6.21.0".

Workarounds

  • Enforce strict file-size limits on PDF uploads at the application or reverse-proxy layer to reduce exposure before patching.
  • Run pypdf parsing in a subprocess with memory ceilings using resource.setrlimit(resource.RLIMIT_AS, ...) on Linux.
  • Reject PDFs from untrusted sources until the upgrade is deployed across the environment.
bash
# Upgrade pypdf to a fixed version in the target environment
pip install --upgrade "pypdf>=6.21.0"

# Verify the installed version
python -c "import pypdf; print(pypdf.__version__)"

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.