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

Source: https://junglewise.ai/threats/cve-2026-59199-pillow-heap-out-of-bounds-write-in-image-coordinate-apis  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-14. Updated: 2026-07-20  
License: CC BY 4.0 with a link back

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

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.

Technologies: [pillow (PyPI)](https://junglewise.ai/threats/technologies/pillow). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-59199 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-59199 being exploited in the wild.

**How severe is CVE-2026-59199?** High severity, with a CVSS score of 7.5, published 14 July 2026.

**Which products and versions are affected?** pillow (PyPI) < 12.3.0, ECOSYSTEM:introduced=0,fixed=12.3.0.

**Is there a fix for CVE-2026-59199?** Yes. pillow (PyPI): upgrade to 12.3.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-59199 attacked?** It is attacked with local access, in a software library.

**Am I affected by CVE-2026-59199?** Check whether you run pillow (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- pillow (PyPI): upgrade to 12.3.0 or later

  ```sh
  pip install "pillow>=12.3.0"
  ```


## 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

## Identifiers

- CVE-2026-59199
- GHSA-6r8x-57c9-28j4
- PYSEC-2026-3451

## Timeline

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

## References

- [https://api.github.com/users/Serotav](https://api.github.com/users/Serotav)
- [https://github.com/Serotav](https://github.com/Serotav)
- [https://api.github.com/users/Serotav/gists%7B/gist_id%7D](https://api.github.com/users/Serotav/gists%7B/gist_id%7D)
- [https://api.github.com/users/Serotav/repos](https://api.github.com/users/Serotav/repos)
- [https://avatars.githubusercontent.com/u/132073089?v=4](https://avatars.githubusercontent.com/u/132073089?v=4)
- [https://api.github.com/users/Serotav/events%7B/privacy%7D](https://api.github.com/users/Serotav/events%7B/privacy%7D)

## Related threats

- [Pillow heap buffer overflow in TIFF encoder with mismatched geometry tags](https://junglewise.ai/threats/cve-2026-128067-pillow-heap-buffer-overflow-saving-tiff-with-libtiff-when-tags)
- [Pillow memory denial of service in TIFF and EXIF parsing](https://junglewise.ai/threats/cve-2026-128066-pillow-memory-dos-in-tiff-and-exif-ifd-parsing-via-overlapping)
- [Pillow libtiff encoder memory disclosure and crash via crafted TIFF tags](https://junglewise.ai/threats/cve-2026-112902-pillow-memory-disclosure-and-segfault-in-libtiff-encoder-via)
- [Pillow EPS load decompression bomb check bypass in Ghostscript scaling](https://junglewise.ai/threats/cve-2026-112899-pillow-eps-load-scale-lets-ghostscript-render-past-the)
- [Pillow heap buffer overflow in bundled libopenjp2](https://junglewise.ai/threats/pillow-bundled-libopenjp2-2-5-4-in-all-wheels-since-11-1-0-carries-osv-cd00a842)
