Junglewise Threat Intelligence

CVE-2026-59199: Pillow heap out-of-bounds write in image coordinate APIs

CVE-2026-59199 · Severity: high · CVSS 7.5 · Published 2026-07-14

Technologies: Python-Pillow Pillow. Vendors: PyPI.

Executive brief

Pillow, a popular Python library for image processing, contains a vulnerability that can cause a system crash or allow unauthorized memory modification. By providing specific, extreme coordinates to image functions like cropping or pasting, an attacker could trigger a memory error. This could lead to application instability or potentially be used as a building block for more complex attacks if the application processes untrusted coordinate data.

Technical details

A heap out-of-bounds write exists in Pillow's native C extension due to signed integer overflow in coordinate arithmetic. In `src/libImaging/Paste.c`, the `ImagingPaste()` function calculates image dimensions using signed 32-bit integers; providing coordinates near `INT_MIN` or `INT_MAX` causes these calculations to wrap around, bypassing boundary checks. In 4-byte pixel modes like RGBA, this results in a controlled backward heap underwrite via `memcpy`. The vulnerability is reachable through public APIs including `Image.paste()`, `Image.crop()`, and `Image.alpha_composite()`. The issue is fixed in version 12.3.0 by implementing checked arithmetic and wider integer types for coordinate calculations.

Affected products

  • python-pillow Pillow < 12.3.0

Timeline

  • 2026-07-07: advisory: Initial GitHub Advisory published
  • 2026-07-20: disclosed
  • 12.3.0: patched

References

Related threats