CVE-2026-102997: pypdf Long Runtime Vulnerability Due to Malformed FlateDecode Streams
Summary
CVE-2026-102997: pypdf: Possible long runtimes for partially malformed FlateDecode streams (Follow-up). Affects pypdf versions < 6.18.1. Fixed in 6.18.1. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
pypdf is a popular Python library used for manipulating PDF files. It provides functionalities such as reading, merging, and modifying PDF documents. However, like many libraries that handle external data formats, pypdf is susceptible to vulnerabilities that can be exploited through specially crafted inputs. This specific vulnerability arises from the handling of FlateDecode streams, which are used for compressing data in PDF files.
Vulnerability Detail
The vulnerability allows an attacker to create a PDF file with a partially malformed FlateDecode stream. When this PDF is processed, it can lead to excessively long runtimes due to the byte-by-byte decompression method employed by pypdf. This can result in denial of service as the application may hang or become unresponsive while attempting to process the malformed stream.
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.18.1
This is the first release that contains the fix.
pip install --upgrade "pypdf==6.18.1"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you are unable to upgrade to the patched version immediately, you can apply the changes from PR #4073 on GitHub. This involves modifying the decompression logic to handle malformed streams more gracefully, thus mitigating the impact of this vulnerability.
Conclusion
In summary, the vulnerability identified as CVE-2026-102997 in the pypdf library can lead to long runtimes when processing malformed FlateDecode streams. It is crucial to update to version 6.18.1 or later to mitigate this risk. For those unable to upgrade immediately, applying the changes from PR #4073 can serve as a temporary workaround.
See every vulnerability recorded for pypdf →
FAQ
The CVSS score of this vulnerability is 8.7, indicating a high severity level.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability without needing to sign up.
The main consequence is a denial of service, where the application may hang or become unresponsive when processing a specially crafted PDF.
Yes, you can apply the changes from PR #4073 on GitHub as a temporary workaround until you can upgrade.
FlateDecode is a compression method used in PDFs to reduce file size. It is essential for efficient storage and transmission of PDF documents.
References
Related vulnerabilities
Recent vulnerabilities recorded for pypdf.