CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-59199

CVE-2026-59199: Signed 32-Bit Integer Overflow and Heap Backward Underwrite in Pillow

Alon Barad
Alon Barad
Software Engineer

Jul 21, 2026·6 min read·14 visits

Executive Summary (TL;DR)

A signed integer overflow in Pillow before 12.3.0 allows unauthenticated remote attackers to bypass memory safety checks and perform a native heap out-of-bounds write via crafted coordinates, leading to a denial of service.

A critical signed 32-bit integer overflow vulnerability was identified in Pillow (Python Imaging Library) versions prior to 12.3.0. The vulnerability resides within the native C extension library (libImaging) during coordinate and bounding box calculations in functions like ImagingPaste and ImagingFill2. Exploitation can bypass bounds and clipping safety checks, leading to a controlled heap backward underwrite and application crash.

Vulnerability Overview

Pillow, the standard Python Imaging Library fork, processes digital images using a high-performance native C extension layer named libImaging. This layer is responsible for intensive pixel manipulations, layout calculations, and coordinate transformation mapping. Because these operations are executed in native C, any parsing or calculation of dimensions must be strictly validated before memory is allocated or accessed.

The vulnerability is classified as a signed 32-bit integer overflow (CWE-190) that cascades into an out-of-bounds write (CWE-787). It affects multiple high-level, coordinate-based APIs, including Image.paste, Image.crop, and Image.alpha_composite. When an application accepts untrusted coordinates from external inputs, it exposes this internal native layer to arbitrary input manipulation.

By supplying coordinates close to the bounds of a signed 32-bit integer, an attacker can manipulate the internal dimension calculations. This manipulation bypasses safety boundaries and allows write access outside the allocated target row buffers. The consequence is native heap memory corruption, typically leading to immediate program termination.

Root Cause Analysis

The root cause of this vulnerability lies in the mathematical subtraction used to calculate the height and width of image bounding boxes within Pasteurization and Filling utilities. Specifically, the functions ImagingPaste and ImagingFill2 in src/libImaging/Paste.c calculate the xsize and ysize of the destination region using the equations: xsize = dx1 - dx0 and ysize = dy1 - dy0. Because dx0, dy0, dx1, and dy1 are standard signed 32-bit integers, their values can range from -2147483648 to 2147483647.

When dx0 is set to a large positive value such as 2147483646 and dx1 is set to a large negative value such as -2147483648, the subtraction results in -4294967294. In signed 32-bit two's complement representation, this mathematical value wraps around and is interpreted as positive 2. This wrapped value matches the positive width of the incoming source image, successfully bypassing the inequality mismatch safety checks.

Furthermore, the subsequent boundary check compares dx0 + xsize against the target output image width. Since dx0 is 2147483646 and xsize is evaluated as 2, their sum is 2147483648, which wraps around to -2147483648. Because this negative value is mathematically smaller than the target output image width, the boundary check fails to identify an out-of-bounds condition and permits the execution flow to continue unchecked.

Code Analysis

To understand the exact flaw and its resolution, we must analyze the code structure before and after the security patch. In the vulnerable version of src/libImaging/Paste.c, variables storing sizes are declared as standard 32-bit signed integers, which are susceptible to overflow.

// VULNERABLE CODE PATH (Paste.c)
int xsize, ysize;
 
// Subtraction performed in 32-bit signed arithmetic
xsize = dx1 - dx0;
ysize = dy1 - dy0;

The corresponding fix, introduced in commit ceefc348eb3c3844c7f9796ef2cc3a7dd5fbba7b, promotes the size tracking variables to 64-bit integers and introduces explicit casting. This prevents the wraparound behavior during subtraction.

// PATCHED CODE PATH (Paste.c)
int64_t xsize, ysize;
 
// Subtraction promoted to 64-bit space to prevent overflow
xsize = (int64_t)dx1 - dx0;
ysize = (int64_t)dy1 - dy0;

By casting dx1 to a 64-bit signed integer before subtraction, the compiler executes the operation in 64-bit space. The intermediate value of -4294967294 is preserved accurately as a negative 64-bit integer, which fails the mismatch comparison against the positive 32-bit source image size and triggers an early error exit.

Exploitation Methodology

Exploitation of this vulnerability requires the ability to supply coordinate parameters to Pillow APIs. When the coordinates bypass the boundary checks, the application proceeds to the pixel copying stage, calculating a target memory address via pointer arithmetic: Row Destination + (dx0 * pixelsize).

If the color mode is RGBA, the pixelsize is 4 bytes. For a dx0 value of 2147483646, the multiplication is computed as 2147483646 * 4, which equals 8589934584. In 32-bit signed math, this calculation wraps around to -8, which is then sign-extended on 64-bit systems to a large negative offset. Consequently, the destination pointer is adjusted backward by 8 bytes.

When memcpy is invoked to copy the row data, the write operation begins exactly 8 bytes before the beginning of the allocated heap row buffer, corrupting metadata or adjacent heap chunks. The overall process and physical memory layout can be visualized in the diagram below:

Impact Assessment

The security consequences of a native heap backward underwrite are severe. Memory corruptions occurring in heap chunk headers can compromise the integrity of the dynamic memory allocator. This corruption typically triggers immediate application termination or a segmentation fault when the affected or adjacent heap blocks are later freed by the system.

An attacker can utilize this vulnerability to perform targeted denial of service attacks against services processing user-supplied images or bounding boxes. If the environment operates in a multi-threaded process or within a persistent worker architecture, a single exploit payload can terminate the processing daemon and disrupt service availability.

While remote code execution is theoretically possible by overwriting adjacent function pointers or critical class metadata, the level of precision required depends heavily on the specific allocator behavior and surrounding heap layout. No weaponized exploits for remote code execution have been publicly observed in active campaigns, classifying the threat maturity primarily as a denial of service vector.

Remediation & Mitigation

The primary remediation for this vulnerability is upgrading the Pillow dependency to version 12.3.0 or higher. This release integrates the 64-bit integer calculation patch, which completely mitigates the integer overflow condition.

If upgrading immediately is not feasible, application-layer coordinate validation must be enforced. Any coordinate inputs passed to Image.paste, Image.crop, or Image.alpha_composite must be restricted to safe, realistic limits corresponding to the physical boundaries of the canvas. The following validation check illustrates how to intercept unsafe inputs:

def validate_coordinates(box, max_width, max_height):
    if box:
        for coord in box:
            if not (-65536 <= coord <= 65536):
                raise ValueError("Coordinate exceeds safe limit")

Additionally, high-risk image parsing workflows should run within isolated, sandboxed environments with low privileges. Restricting container memory space and applying seccomp profiles can limit the potential blast radius of native heap memory corruption exploits.

Official Patches

Python PillowFix coordinate calculation overflows in Paste and Fill
Python PillowGHSA security advisory for Pillow integer overflow

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
EPSS Probability
0.39%
Top 69% most exploited

Affected Systems

Pillow prior to version 12.3.0

Affected Versions Detail

Product
Affected Versions
Fixed Version
Pillow
Python Pillow
< 12.3.012.3.0
AttributeDetail
CWE IDCWE-190, CWE-787
Attack VectorNetwork (Remote)
CVSS Score7.5 (High)
EPSS Score0.0039 (Percentile: 31.40%)
ImpactDenial of Service, Native Heap Corruption
Exploit StatusProof of Concept
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1203Exploitation for Client Execution
Execution
T1068Exploitation for Privilege Escalation
Privilege Escalation
CWE-190
Integer Overflow or Wraparound

The software performs an calculation that can produce an integer overflow or wraparound, which can lead to unexpected behavior or security issues.

Vulnerability Timeline

Initial drafting of the STRIDE threat model by Pillow developers
2026-04-14
Security patch submitted via Pull Request #9703
2026-06-22
Official publication of CVE-2026-59199 and advisory GHSA-6r8x-57c9-28j4
2026-07-14
Public release of Pillow version 12.3.0 containing the fix
2026-07-14

References & Sources

  • [1]NVD CVE-2026-59199 Record
  • [2]Pillow Security Advisory GHSA-6r8x-57c9-28j4
  • [3]Fix Pull Request #9703
  • [4]Fix Commit ceefc348
  • [5]Pillow Release 12.3.0 Notes

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•41 minutes ago•CVE-2026-10740
5.3

CVE-2026-10740: Denial of Service in s2n-quic CryptoStream Reassembly

An unauthenticated Denial of Service vulnerability exists in the s2n-quic library's CryptoStream reassembler due to a lack of buffer limits on out-of-order cryptographic frames. An attacker can transmit a crafted CRYPTO frame with an extremely high offset and nominal payload, forcing the receiver to execute unbounded memory allocations and causing service crashes.

Amit Schendel
Amit Schendel
2 views•7 min read
•about 2 hours ago•CVE-2026-55153
7.1

CVE-2026-55153: JNDI Injection and Deserialization Gadget Abuse in mchange-commons-java

A JNDI Injection and Deserialization Gadget vulnerability exists in mchange-commons-java prior to version 0.6.0. The com.mchange.v2.naming.JavaBeanObjectFactory component permits arbitrary class instantiation and setter invocation, allowing attackers to perform Server-Side Request Forgery (SSRF) and remote class loading.

Alon Barad
Alon Barad
5 views•5 min read
•about 3 hours ago•GHSA-8RW6-P7M8-63JP
6.5

GHSA-8RW6-P7M8-63JP: Array Element-Level SELECT Permissions Leak in SurrealDB

SurrealDB versions supporting element-level SELECT permissions on arrays are vulnerable to a logical authorization bypass. Due to an index-shifting error during array filtration, restricted elements can skip permission checks and leak to unauthorized record users.

Alon Barad
Alon Barad
5 views•6 min read
•1 day ago•CVE-2026-12243
7.5

CVE-2026-12243: Incomplete Path Traversal Validation and Percent-Encoding Bypass in NLTK

CVE-2026-12243 is a path traversal vulnerability in the Natural Language Toolkit (NLTK) version 3.9.4. The flaw exists because the input validation routine fails to account for percent-encoded directory traversal sequences like '..%2f' before passing them to urllib.request.url2pathname(), which decodes them into active traversal sequences.

Amit Schendel
Amit Schendel
5 views•8 min read
•1 day ago•CVE-2026-73654
8.5

CVE-2026-73654: Prototype Pollution in Trigger.dev leading to Cascading Denial of Service

CVE-2026-73654 is a high-severity prototype pollution vulnerability in Trigger.dev. The flaw occurs during the handling of run-metadata updates through the PUT /api/v1/runs/:runId/metadata endpoint. Because user-supplied keys are parsed directly by the @jsonhero/path library without sanitization, an authenticated attacker with low privileges can pollute the global Object.prototype. This causes database queries via Prisma ORM to fail validation and induces unhandled exceptions in the Prometheus metrics client, resulting in a process-wide denial of service.

Alon Barad
Alon Barad
11 views•6 min read
•1 day ago•CVE-2026-73559
6.5

CVE-2026-73559: Uncontrolled Resource Consumption in vLLM API completions

CVE-2026-73559 is an uncontrolled resource consumption vulnerability in the vLLM engine, specifically within the /v1/completions API endpoint, allowing authenticated attackers to cause application-level denial of service via unbounded prompt arrays.

Amit Schendel
Amit Schendel
10 views•5 min read