CVE-2026-112398: Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution
Pillow is a Python imaging library. Prior to 13.0.0, Pillow's FlashPix JPEG-tile decoder can write decoded scanlines beyond the allocated tile buffer. FlashPix (FPX) JPEG decoding selects raw mode LA with two bytes per pixel, while an unrecognized JPEG mode can be decoded as JCSUNKNOWN with four components, causing ImagingJpegDecode to write four-component scanlines into the two-byte tile buffer. An attacker can supply a crafted OLE2 FlashPix file to an application with the optional olefile dependency installed that opens or thumbnails untrusted input. This can corrupt heap memory and may allow arbitrary code execution. This issue is fixed in version 13.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which deployments are exposed to this issue?
Deployments using Pillow versions before 13.0.0 are exposed when the optional olefile dependency is installed and the application opens or creates thumbnails for untrusted FlashPix (FPX) input.
What does an attacker need to exploit the vulnerability?
An attacker needs to provide a crafted OLE2 FlashPix file to an affected application. No authentication or user interaction is required according to the supplied CVSS vector, although successful exploitation has high attack complexity.
Is immediate upgrade the available remediation?
Yes. The issue is fixed in Pillow 13.0.0, so upgrading to version 13.0.0 or later remediates the vulnerable decoder behavior.
What can be done if Pillow cannot be upgraded immediately?
Avoid opening or thumbnailing untrusted FlashPix files in affected applications. The described attack path also requires the optional olefile dependency to be installed.