CVE-2026-41312 Overview
CVE-2026-41312 is a Memory Exhaustion vulnerability affecting pypdf, a free and open-source pure-python PDF library. An attacker can craft a malicious PDF document that causes the system's RAM to be exhausted when processed by vulnerable versions of pypdf (prior to 6.10.2). The vulnerability is triggered when the library processes a stream compressed using /FlateDecode with a /Predictor value not equal to 1 and excessively large predictor parameters.
Critical Impact
Processing a specially crafted PDF document can lead to denial of service through complete RAM exhaustion, potentially crashing applications and impacting system stability.
Affected Products
- pypdf versions prior to 6.10.2
Discovery Timeline
- 2026-04-22 - CVE CVE-2026-41312 published to NVD
- 2026-04-22 - Last updated in NVD database
Technical Details for CVE-2026-41312
Vulnerability Analysis
This vulnerability (CWE-789: Memory Allocation with Excessive Size Value) allows an attacker to trigger uncontrolled memory consumption in applications that use pypdf to process PDF files. The root cause lies in the handling of FlateDecode compressed streams with specific predictor configurations.
When pypdf encounters a stream with /FlateDecode compression and a /Predictor parameter set to a value other than 1, the library performs memory allocation based on predictor parameters supplied within the PDF. By providing abnormally large predictor values, an attacker can force the library to allocate excessive amounts of memory, leading to RAM exhaustion and denial of service.
Root Cause
The vulnerability stems from insufficient validation of predictor parameters in FlateDecode stream decompression. The library accepts user-controlled values for predictor parameters without adequately checking whether the resulting memory allocation request is reasonable. This allows malicious PDFs to specify arbitrarily large allocation sizes, overwhelming system memory resources.
Attack Vector
The attack requires local access where a user must open or process a malicious PDF file. The exploitation flow involves:
- An attacker creates a specially crafted PDF containing a stream with /FlateDecode compression
- The stream specifies /Predictor with a value other than 1 (e.g., PNG predictor values 10-15)
- Large predictor parameters (such as /Columns with excessive values) are included
- When the victim's application processes the PDF using a vulnerable pypdf version, the library attempts to allocate memory based on these malicious parameters
- The excessive memory allocation exhausts available RAM, causing denial of service
The vulnerability is exploited through malformed PDF structure rather than executable code. See the GitHub Security Advisory for detailed technical specifications.
Detection Methods for CVE-2026-41312
Indicators of Compromise
- Abnormal memory consumption spikes when processing PDF files
- Application crashes or system slowdowns during PDF parsing operations
- PDF files containing streams with /FlateDecode filter and unusual /Predictor parameters
- Error logs indicating memory allocation failures in pypdf operations
Detection Strategies
- Monitor application memory usage patterns when processing PDF documents
- Implement file scanning to detect PDFs with abnormally large predictor parameters in FlateDecode streams
- Deploy application-level logging to track pypdf stream decompression operations
- Use SentinelOne Singularity platform to detect anomalous memory consumption patterns
Monitoring Recommendations
- Track memory consumption metrics for applications utilizing pypdf
- Alert on sudden RAM exhaustion events correlated with PDF processing activities
- Implement resource limits and timeouts for PDF parsing operations
- Review dependency versions in Python environments to identify vulnerable pypdf installations
How to Mitigate CVE-2026-41312
Immediate Actions Required
- Upgrade pypdf to version 6.10.2 or later immediately
- Audit all applications and services that utilize pypdf for PDF processing
- Implement input validation to reject suspicious PDF files before processing
- Consider implementing memory limits for PDF processing operations
Patch Information
The pypdf development team has released version 6.10.2 which addresses this vulnerability. The fix implements proper validation of predictor parameters before memory allocation. Organizations should update their pypdf dependencies to the patched version.
Patch references:
Workarounds
- Apply the security patch changes manually if immediate upgrade is not possible
- Implement resource limits (memory caps) on processes that handle PDF files
- Use process isolation or containerization to limit the impact of memory exhaustion
- Pre-screen PDF files for suspicious FlateDecode stream configurations before processing
# Upgrade pypdf to the patched version
pip install --upgrade pypdf>=6.10.2
# Verify installed version
pip show pypdf | grep Version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

