CVE-2026-59200
Analyzed Analyzed - Analysis Complete

Memory Exhaustion in Pillow via FlateDecode PDF Stream

Vulnerability report for CVE-2026-59200, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-07-14

Last updated on: 2026-07-21

Assigner: GitHub, Inc.

Description

Pillow is a Python imaging library. From 5.1.0 until 12.3.0, PdfParser.PdfStream.decode() in PIL/PdfParser.py calls zlib.decompress() with bufsize set to the PDF stream Length field without bounding the decompressed output size, allowing a crafted FlateDecode PDF stream to exhaust memory from a small file. This issue is fixed in version 12.3.0.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-07-14
Last Modified
2026-07-21
Generated
2026-08-03
AI Q&A
2026-07-14
EPSS Evaluated
2026-08-02
NVD
EUVD

Affected Vendors & Products

Showing 1 associated CPE
Vendor Product Version / Range
python pillow From 5.1.0 (inc) to 12.3.0 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-770 The product allocates a reusable resource or group of resources on behalf of an actor without imposing any intended restrictions on the size or number of resources that can be allocated.
CWE-400 The product does not properly control the allocation and maintenance of a limited resource.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

CVE-2026-59200 is a denial-of-service vulnerability in the Pillow Python imaging library, specifically in the PdfParser.PdfStream.decode() function.

The vulnerability occurs because the function uses zlib.decompress() with the bufsize parameter set to the PDF stream's Length field without enforcing a maximum limit on the decompressed output size.

An attacker can exploit this by crafting a PDF file with a highly compressed stream that expands to a very large size (e.g., gigabytes) when decompressed, even if the Length field in the PDF is small. This can exhaust system memory, leading to server crashes or severe performance degradation.

The issue affects Pillow versions 5.1.0 through 12.2.0 and is fixed in version 12.3.0 by introducing a max_length parameter to limit the decompressed data size.

Detection Guidance

Detecting this vulnerability requires identifying systems or applications that use affected versions of the Pillow library (5.1.0 to 12.2.0) and process untrusted PDF files. Since the vulnerability is triggered by processing malicious PDFs with crafted FlateDecode streams, detection focuses on checking Pillow versions and monitoring for unusual memory consumption during PDF processing.

  • Check Pillow version: Run `pip show Pillow` or `python -c "import PIL; print(PIL.__version__)"` to verify the installed version. If the version is between 5.1.0 and 12.2.0, the system is vulnerable.
  • Monitor for suspicious PDF processing: Use system monitoring tools (e.g., `top`, `htop`, or `ps`) to observe memory usage spikes when processing PDFs. A sudden increase in memory consumption during PDF decompression may indicate exploitation attempts.
  • Scan for malicious PDFs: Use tools like `pdfid` or `peepdf` to analyze PDF files for suspicious FlateDecode streams or unusually high compression ratios, which could indicate a decompression bomb.
  • Network detection: If PDFs are processed after being received over a network, use intrusion detection systems (IDS) or network monitoring tools to flag unusually small PDF files that could expand into large memory payloads.
Impact Analysis

This vulnerability can impact you in several ways if you use an affected version of Pillow (5.1.0 to 12.2.0) to process untrusted PDF files:

  • Denial-of-Service (DoS): An attacker can craft a malicious PDF file that, when processed by your application, causes excessive memory consumption. This can lead to your application or server crashing due to out-of-memory errors.
  • Performance Degradation: Even if the system does not crash, the excessive memory usage can slow down your application or other processes running on the same system, leading to poor performance.
  • Resource Exhaustion: The uncontrolled decompression can consume all available system memory, potentially affecting other applications or services running on the same machine.

This is particularly risky for applications that automatically process PDF files from untrusted sources, such as web servers, document management systems, or any service that accepts PDF uploads.

Compliance Impact

This vulnerability can impact compliance with common standards and regulations in the following ways:

  • GDPR (General Data Protection Regulation): While GDPR primarily focuses on data privacy and protection, a denial-of-service vulnerability like this could lead to service unavailability. Under GDPR, organizations must ensure the availability and resilience of processing systems (Article 32). A successful attack exploiting this vulnerability could disrupt services, potentially violating these requirements.
  • HIPAA (Health Insurance Portability and Accountability Act): For organizations handling protected health information (PHI), HIPAA requires ensuring the confidentiality, integrity, and availability of electronic PHI (ePHI). A DoS attack exploiting this vulnerability could disrupt access to ePHI, violating the availability requirement under the HIPAA Security Rule.
  • Other Standards: Many compliance frameworks, such as ISO 27001, require organizations to implement controls to prevent and mitigate the impact of security vulnerabilities. Failure to patch this vulnerability or protect against its exploitation could result in non-compliance with such standards.

To maintain compliance, organizations should promptly update to Pillow version 12.3.0 or later, which includes the fix for this vulnerability. Additionally, they should implement measures to monitor and mitigate the risk of DoS attacks.

Mitigation Strategies

To mitigate CVE-2026-59200, follow these immediate steps to reduce the risk of exploitation:

  • Upgrade Pillow: Update to Pillow version 12.3.0 or later, which includes the fix for this vulnerability. Use `pip install --upgrade Pillow` to install the latest version.
  • Apply input validation: If upgrading is not immediately possible, ensure that all PDF files processed by the application are from trusted sources. Reject or quarantine PDFs with suspicious characteristics, such as unusually small file sizes or high compression ratios.
  • Limit memory usage: Implement resource limits (e.g., using `ulimit` or container resource constraints) to restrict the amount of memory available to the application processing PDFs. This can prevent out-of-memory crashes even if the vulnerability is exploited.
  • Use a sandbox: Run PDF processing in a sandboxed environment (e.g., a container or virtual machine) with strict resource limits to contain potential exploitation attempts.
  • Monitor for exploitation: Set up alerts for abnormal memory usage or crashes in applications that process PDFs, as these could indicate exploitation attempts.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-59200. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart