Skip to main content

CVE-2025-55197: CWE-400: Uncontrolled Resource Consumption in py-pdf pypdf

Medium
VulnerabilityCVE-2025-55197cvecve-2025-55197cwe-400cwe-770
Published: Wed Aug 13 2025 (08/13/2025, 23:03:02 UTC)
Source: CVE Database V5
Vendor/Project: py-pdf
Product: pypdf

Description

pypdf is a free and open-source pure-python PDF library. Prior to version 6.0.0, an attacker can craft a PDF which leads to the RAM being exhausted. This requires just reading the file if a series of FlateDecode filters is used on a malicious cross-reference stream. Other content streams are affected on explicit access. This issue has been fixed in 6.0.0. If an update is not possible, a workaround involves including the fixed code from pypdf.filters.decompress into the existing filters file.

AI-Powered Analysis

AILast updated: 08/13/2025, 23:32:47 UTC

Technical Analysis

CVE-2025-55197 is a medium-severity vulnerability affecting versions of the pypdf library prior to 6.0.0. pypdf is a widely used open-source pure-Python library for handling PDF files. The vulnerability arises from uncontrolled resource consumption (CWE-400) due to the way the library processes certain PDF streams, specifically those using a series of FlateDecode filters on maliciously crafted cross-reference streams. When such a PDF is read, the decompression process can exhaust the system's RAM, leading to denial of service conditions. The issue also affects other content streams upon explicit access. This vulnerability does not require any authentication or user interaction to be exploited, as simply reading the malicious PDF triggers the resource exhaustion. The root cause lies in the decompression filters implementation, which was fixed in version 6.0.0 of pypdf. For environments where upgrading is not immediately feasible, a workaround involves manually patching the decompression code by incorporating the fixed code from pypdf.filters.decompress into the existing filters file. There are no known exploits in the wild at this time, but the vulnerability is publicly disclosed and could be weaponized by attackers targeting systems that parse untrusted PDFs using vulnerable pypdf versions.

Potential Impact

For European organizations, this vulnerability poses a risk primarily in environments where pypdf is used to process PDF files, such as document management systems, automated PDF processing workflows, or web applications that parse PDFs. An attacker could craft a malicious PDF that, when processed, consumes excessive memory, potentially causing application crashes or system instability. This could lead to denial of service, disrupting business operations, especially in sectors relying heavily on automated document handling like finance, legal, healthcare, and government agencies. While the vulnerability does not directly lead to data leakage or code execution, the availability impact can be significant if exploited at scale or against critical infrastructure. Organizations handling large volumes of PDFs or accepting user-submitted PDFs are at higher risk. Additionally, since exploitation requires no privileges or user interaction, the attack surface includes any automated system ingesting PDFs without prior validation.

Mitigation Recommendations

The primary mitigation is to upgrade pypdf to version 6.0.0 or later, where the vulnerability is fully patched. If upgrading is not immediately possible, organizations should apply the workaround by manually replacing the decompression filter code with the fixed implementation from pypdf.filters.decompress. Additionally, organizations should implement strict input validation and sandboxing for PDF processing components to limit resource usage and isolate failures. Employing rate limiting and monitoring for unusual memory consumption during PDF processing can help detect exploitation attempts. It is also advisable to restrict the acceptance of PDFs from untrusted sources or to preprocess PDFs using alternative tools that are not vulnerable. Regularly auditing dependencies and maintaining an up-to-date software inventory will help ensure timely patching of such vulnerabilities.

Need more detailed analysis?Get Pro

Technical Details

Data Version
5.1
Assigner Short Name
GitHub_M
Date Reserved
2025-08-08T21:55:07.964Z
Cvss Version
4.0
State
PUBLISHED

Threat ID: 689d1d1cad5a09ad0054d653

Added to database: 8/13/2025, 11:17:48 PM

Last enriched: 8/13/2025, 11:32:47 PM

Last updated: 8/15/2025, 6:20:37 PM

Views: 8

Actions

PRO

Updates to AI analysis are available only with a Pro account. Contact root@offseq.com for access.

Please log in to the Console to use AI analysis features.

Need enhanced features?

Contact root@offseq.com for Pro access with improved analysis and higher rate limits.

Latest Threats