CVE-2026-59204
Modified Modified - Updated After Analysis

Memory Exhaustion in Pillow via JPEG2000 Tiles

Vulnerability report for CVE-2026-59204, 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 8.2.0 through 12.2.0, src/libImaging/Jpeg2KDecode.c accumulates total_component_width across every tile in a JPEG2000 image instead of recomputing it per tile, allowing a crafted tiled JPEG2000 file to force substantially higher transient memory usage and trigger out-of-memory failures during decoding. 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 8.2.0 (inc) to 12.3.0 (exc)

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-789 The product allocates memory based on an untrusted, large size value, but it does not ensure that the size is within expected limits, allowing arbitrary amounts of memory to be allocated.
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.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

CVE-2026-59204 is a vulnerability in the Pillow Python imaging library, specifically in its JPEG2000 image decoding functionality. The issue occurs in the src/libImaging/Jpeg2KDecode.c file, where the variable total_component_width is incorrectly accumulated across all tiles in a JPEG2000 image instead of being recalculated for each tile individually.

This flaw allows a specially crafted tiled JPEG2000 file to force the decoder to use significantly more memory than intended. The total_component_width variable is initialized once before processing tiles and is never reset, causing it to grow with each tile processed. This leads to an incorrect calculation of tile_bytes, which determines memory allocation for decoding.

As a result, the decoder allocates memory proportional to the combined size of all tiles rather than the size of individual tiles. A malicious file with many small tiles can exploit this to trigger excessive memory usage, potentially causing out-of-memory failures or denial of service during decoding.

The vulnerability affects Pillow versions 8.2.0 through 12.2.0 and was fixed in version 12.3.0 by resetting total_component_width to zero at the start of each tile iteration.

Detection Guidance

Detecting this vulnerability on your system involves checking for the presence of vulnerable versions of the Pillow library and testing for the specific behavior that triggers excessive memory usage during JPEG2000 image decoding.

  • Check the installed version of Pillow. If it is between 8.2.0 and 12.2.0, the system is vulnerable. You can check the version using the following Python command: pip show Pillow or python -c "import PIL; print(PIL.__version__)"
  • Test for the vulnerability by attempting to decode a crafted JPEG2000 file designed to exploit the flaw. If the system experiences unusually high memory usage or crashes during decoding, it may indicate the presence of the vulnerability. Note: This should be done in a controlled environment to avoid unintended denial of service.

There are no specific network-based detection methods for this vulnerability, as it is triggered by processing malicious image files locally or on a server handling image uploads.

Impact Analysis

This vulnerability can impact you in several ways if you use an affected version of the Pillow library (8.2.0 through 12.2.0) to process JPEG2000 images:

  • Denial of Service (DoS): An attacker could craft a malicious JPEG2000 file that, when processed by your application, causes excessive memory usage. This could exhaust system memory, leading to crashes or unresponsiveness in your application or even the entire system.
  • Resource Exhaustion: The vulnerability can cause your application to consume abnormally high amounts of memory during image decoding. This may slow down other processes on the system or trigger out-of-memory errors, disrupting normal operations.
  • Application Instability: If your application relies on Pillow for image processing, this vulnerability could make it unstable when handling certain JPEG2000 files. This might result in unexpected crashes or failures in image-related workflows.

The impact is primarily limited to denial of service scenarios. There is no evidence that this vulnerability leads to memory corruption, arbitrary code execution, or data leakage. However, the disruption caused by a DoS attack can still be significant, especially in production environments or services that process user-uploaded images.

Compliance Impact

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

  • GDPR (General Data Protection Regulation): While this vulnerability does not directly involve data leakage, a denial of service attack could disrupt services that process personal data. Under GDPR, organizations must ensure the availability and resilience of processing systems. Prolonged downtime or service disruption caused by this vulnerability could be seen as a failure to implement appropriate technical measures, potentially leading to non-compliance.
  • HIPAA (Health Insurance Portability and Accountability Act): For organizations handling protected health information (PHI), this vulnerability could pose risks if it disrupts access to critical systems. HIPAA requires covered entities to ensure the confidentiality, integrity, and availability of PHI. A denial of service attack exploiting this vulnerability could compromise availability, potentially violating HIPAA's Security Rule if proper safeguards are not in place.
  • Other Standards (e.g., ISO 27001, NIST): Compliance frameworks like ISO 27001 and NIST emphasize the importance of managing vulnerabilities and ensuring system availability. Failure to patch this vulnerability or mitigate its risks could be viewed as a lapse in vulnerability management, potentially leading to non-compliance with these standards.

The primary compliance risk stems from the potential for service disruption rather than direct data exposure. However, organizations should still address this vulnerability promptly to maintain compliance with regulations that require system availability, resilience, and proper vulnerability management.

Mitigation Strategies

To mitigate this vulnerability, follow these immediate steps:

  • Upgrade Pillow to version 12.3.0 or later, which contains the fix for this issue. Use the following command to upgrade: pip install --upgrade Pillow
  • If upgrading is not immediately possible, restrict the processing of JPEG2000 files from untrusted sources. Implement input validation to block or sanitize potentially malicious JPEG2000 files.
  • Monitor systems for unusual memory usage spikes during image processing, particularly when handling JPEG2000 files. Set up alerts for abnormal memory consumption to detect potential exploitation attempts.
  • Apply temporary mitigations such as limiting the size of JPEG2000 files processed by the system or using alternative image processing libraries that do not exhibit this vulnerability.

Chat Assistant

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

EPSS Chart