CVE-2025-55197: PyPDF's FlateDecode Stream Vulnerability Leading to RAM Exhaustion

pypdf Updated 14 Dec 2025

Summary

13/08/2025
Yes i
Moderate
6.6

CVE-2025-55197: PyPDF's Manipulated FlateDecode streams can exhaust RAM. Affects pypdf versions < 6.0.0. Fixed in 6.0.0. How to fix ↓

Also tracked for

The same CVE-2025-55197 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

PyPDF is a Python library that allows users to manipulate PDF files. It provides functionalities such as merging, splitting, and modifying PDF documents. The library is widely used for its ease of use and flexibility in handling PDF content. However, it is susceptible to a vulnerability that can be exploited through crafted PDF files, specifically involving FlateDecode streams.

Vulnerability Detail

The vulnerability arises from the way PyPDF handles FlateDecode filters in PDF files. An attacker can create a malicious PDF that, when processed, leads to excessive RAM consumption. This occurs when a series of FlateDecode filters are applied to a cross-reference stream, causing the application to exhaust available memory. The impact is significant as it can lead to application crashes or denial of service, especially in environments where memory resources are limited.

How To Fix

Latest published version: 6.21.2 as of 22 Oct 2026

pip install --upgrade "pypdf==6.21.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

6.0.0

This is the first release that contains the fix.

pip install --upgrade "pypdf==6.0.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading is not immediately possible, a temporary workaround can be implemented by modifying the decompress function in the filters module. The relevant code can be found here: https://github.com/py-pdf/pypdf/blob/0dd57738bbdcdb63f0fb43d8a6b3d222b6946595/pypdf/filters.py#L72-L143. Users are encouraged to review and adapt this code to mitigate the vulnerability until an upgrade is feasible.

Conclusion

CVE-2025-55197 is a moderate severity vulnerability in the PyPDF library that can lead to RAM exhaustion through crafted PDF files. Users are advised to upgrade to version 6.0.0 to mitigate this risk or implement the suggested workaround until an upgrade is possible.

See every vulnerability recorded for pypdf →

Share this vulnerability

FAQ

CVE-2025-55197 is a vulnerability in the PyPDF library that allows attackers to craft PDF files that can exhaust system RAM, leading to potential application crashes.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which monitors and alerts for open-source vulnerabilities without requiring installation.

If upgrading is not an option, consider implementing the provided workaround to mitigate the risk until you can update.

FlateDecode filters are used in PDF files to compress data. They can be exploited if not handled properly, leading to vulnerabilities like CVE-2025-55197.

While the primary risk is RAM exhaustion and potential application crashes, there is no direct indication of data loss associated with this vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for pypdf.

How To Fix

Latest published version: 6.21.2 as of 22 Oct 2026

pip install --upgrade "pypdf==6.21.2"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

6.0.0

This is the first release that contains the fix.

pip install --upgrade "pypdf==6.0.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback