Heap-based Buffer Overflow Affecting pillow package, versions [,13.0.0)


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.32% (24th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-PILLOW-21279300
  • published20 Oct 2026
  • disclosed19 Oct 2026
  • creditAlex Bouffard

Introduced: 19 Oct 2026

NewCVE-2026-112398  (opens in a new tab)
CWE-122  (opens in a new tab)

How to fix?

Upgrade pillow to version 13.0.0 or higher.

Overview

Affected versions of this package are vulnerable to Heap-based Buffer Overflow in the FlashPix JPEG tile decoding spanning src/PIL/FpxImagePlugin.py and src/libImaging/JpegDecode.c, where the tile buffer is sized from the rawmode that the MODES table selects from the FPX color IDs, while rawmodes such as LA and YCC;P are unrecognized in the colorspace mapping and fall through to setting jpeg_color_space and out_color_space to JCS_UNKNOWN, under which libjpeg applies no conversion and emits cinfo.num_components bytes per pixel taken from the embedded SOF marker. An attacker can write past the allocation with controlled length and contents, and reach code execution, by having an application open a single file with Image.open whose color IDs select a two byte per pixel rawmode while the embedded JPEG declares four components, so jpeg_read_scanlines writes 4 * width bytes per row into a buffer allocated for 2 * width. Reaching the decoder requires the optional olefile dependency to be installed, which is what enables FPX support, and files are identified by the OLE2 magic rather than by extension, so any service that opens or thumbnails untrusted uploads is exposed without user interaction, while turning the overflow into execution depends on heap layout and on interpreter specifics such as a non-PIE binary with known offsets.

CVSS Base Scores

version 4.0
version 3.1