CVE-2026-59199
Modified Modified - Updated After Analysis

Heap Out-of-Bounds Write in Pillow Image Processing

Vulnerability report for CVE-2026-59199, 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-15

Assigner: GitHub, Inc.

Description

Pillow is a Python imaging library. Prior to 12.3.0, Pillow public image coordinate APIs can trigger a native heap out-of-bounds write when given coordinates near the signed 32-bit integer limits in Image.paste(), Image.crop(), or Image.alpha_composite(). 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-15
Generated
2026-08-04
AI Q&A
2026-07-14
EPSS Evaluated
2026-08-03
NVD
EUVD

Affected Vendors & Products

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

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-787 The product writes data past the end, or before the beginning, of the intended buffer.
CWE-190 The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

CVE-2026-59199 is a heap out-of-bounds write vulnerability in the Pillow library, a Python imaging library. The issue occurs in functions like Image.paste(), Image.crop(), and Image.alpha_composite() when processing coordinates near the signed 32-bit integer limits.

When large negative or positive coordinates are provided, the library performs calculations that can lead to signed integer overflow. This causes the library to write data beyond the allocated heap memory, resulting in heap corruption. For example, passing a box like ((1 << 31) - 2, 0, -2147483648, 1) to Image.paste() can trigger a backward heap underwrite, writing data before the intended destination row.

The vulnerability arises from improper handling of signed integer arithmetic in Pillow's native C code. Operations like dx1 - dx0 can wrap around due to integer overflow, bypassing bounds checks and leading to memory corruption. This can potentially cause crashes or arbitrary code execution if an attacker controls the coordinates passed to these functions.

The issue is fixed in Pillow version 12.3.0 by using int64_t for coordinate calculations to prevent overflow. The fix ensures that large coordinate values do not cause overflow when determining the size of the paste area.

Detection Guidance

Detecting this vulnerability requires checking if your system is running an affected version of the Pillow library. Since the vulnerability is present in Pillow versions prior to 12.3.0, you can inspect installed Python packages to identify the version.

  • Use the following command to check the installed Pillow version in a Python environment: pip show Pillow. Look for the 'Version' field in the output.
  • If you are using a system-wide installation, you may also check with: python -c "import PIL; print(PIL.__version__)".

To detect potential exploitation attempts, monitor for unusual image processing activity, particularly calls to Image.paste(), Image.crop(), or Image.alpha_composite() with extreme coordinate values near the signed 32-bit integer limits (e.g., values close to 2147483647 or -2147483648). However, this may require custom logging or instrumentation in your application.

Network-level detection is challenging because the vulnerability is triggered by local processing of maliciously crafted image data. Focus on identifying vulnerable versions of Pillow in your environment.

Impact Analysis

This vulnerability can impact you in several ways if you use an affected version of the Pillow library (12.2.0 or earlier) in your applications or systems.

  • Heap corruption: The vulnerability can cause heap memory corruption, leading to crashes or unexpected behavior in your application. This can result in denial-of-service conditions where your application becomes unresponsive or terminates abruptly.
  • Arbitrary code execution: In some cases, the heap corruption can be exploited to execute arbitrary code. This means an attacker could potentially take control of your application or system, leading to unauthorized access, data theft, or further compromise of your infrastructure.
  • Data integrity issues: The vulnerability can cause attacker-controlled data to be written to unintended memory locations. This could corrupt sensitive data or manipulate the behavior of your application in malicious ways.
  • Exploitation via untrusted input: If your application processes untrusted image files or coordinates (e.g., user-uploaded images), an attacker could craft malicious input to trigger the vulnerability. This makes web applications, image processing services, or any software handling external image data particularly vulnerable.

The impact is severe because the vulnerability does not require any privileges or user interaction to exploit. It can be triggered remotely if an attacker can provide crafted input to the affected functions.

Compliance Impact

This vulnerability can affect compliance with common standards and regulations in several ways, depending on how the affected Pillow library is used in your systems.

  • GDPR (General Data Protection Regulation): If your application processes personal data of EU citizens and uses Pillow to handle images containing such data, this vulnerability could lead to unauthorized access or corruption of that data. Under GDPR, you are required to implement appropriate security measures to protect personal data. A breach resulting from this vulnerability could lead to non-compliance, potential fines, and mandatory breach notifications if personal data is compromised.
  • HIPAA (Health Insurance Portability and Accountability Act): For organizations handling protected health information (PHI) in the U.S., this vulnerability could pose a risk if Pillow is used to process medical images or related data. HIPAA requires safeguards to ensure the confidentiality, integrity, and availability of PHI. Exploitation of this vulnerability could lead to unauthorized access or corruption of PHI, resulting in non-compliance and potential penalties.
  • Other standards (e.g., ISO 27001, NIST): Many security standards require organizations to maintain secure software and promptly address vulnerabilities. Failure to patch this vulnerability could result in non-compliance with requirements for vulnerability management, risk assessment, and secure coding practices. This could affect certifications or audits under frameworks like ISO 27001 or NIST guidelines.

To maintain compliance, it is critical to update to Pillow version 12.3.0 or later, which fixes this vulnerability. Additionally, you should assess whether any sensitive data processed by the affected functions was exposed or corrupted due to this issue and take appropriate remedial actions as required by the relevant regulations.

Mitigation Strategies

The primary mitigation for this vulnerability is to upgrade the Pillow library to version 12.3.0 or later, where the issue has been fixed.

  • Run the following command to upgrade Pillow: pip install --upgrade Pillow>=12.3.0.

If upgrading is not immediately possible, consider the following temporary measures:

  • Restrict input to the Image.paste(), Image.crop(), and Image.alpha_composite() functions to ensure coordinates are within safe bounds. Avoid passing untrusted or user-controlled values directly to these functions.
  • Validate all image processing inputs to ensure coordinates do not approach the signed 32-bit integer limits (e.g., reject values near 2147483647 or -2147483648).
  • Monitor applications using Pillow for crashes or unusual behavior, which may indicate exploitation attempts.

For environments where upgrading is not feasible, consider isolating systems running vulnerable versions of Pillow to limit exposure.

Chat Assistant

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

EPSS Chart