CVE-2026-112398

Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution

Published Oct 19, 2026 CVSS 4.0 · 9.2 Critical EPSS < 1% KEV · Not listed
Description
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 JCS_UNKNOWN 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.

Analysis

AI-generated

Technical impact

Pillow, a widely used Python imaging library, contains a heap buffer overflow in its FlashPix (FPX) JPEG tile decoder. The flaw arises when the decoder selects a raw mode with two bytes per pixel but an unrecognized JPEG mode is decoded with four components, leading to write operations beyond the allocated tile buffer. This causes memory corruption and may give an attacker arbitrary code execution. The weakness is a classic heap overflow (CWE-122) and also involves improper bounds checking (CWE-787).

Affected Systems

The vulnerability affects all Pillow installations prior to version 13.0.0 that have the optional olefile dependency. Applications that load or thumbnail untrusted input. This fix is included in Pillow 13.0.0 and newer.

Risk and Exploitability

With a CVSS score of 9.2 the flaw is considered critical. The EPSS score is not available, and the vulnerability is not listed in CISA's KEV catalog, but the nature of the heap overflow and the ability to execute injected code mean that once an attacker can supply a crafted image to a vulnerable application, the attack can succeed with minimal effort. The likely attack vector is the ingestion of a malicious OLE2 FlashPix file by an application that relies on Pillow's image handling and has the olefile module installed. The risk is high for systems that process user-supplied images without additional validation.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Update Pillow to version 13.0.0 or later to apply the vendor patch
  • If Pillow must remain at an older version, remove or disable the olefile dependency so that FlashPix JPEG files cannot be processed
  • Implement input validation or sandboxing for image processing to prevent untrusted files from reaching Pillow

Generated by OpenCVE AI on October 20, 2026 at 06:32 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-5x8w-8jj5-q52h Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution
History
Type Values Removed Values Added
First Time appeared Python
Python pillow
CPEs cpe:2.3:a:python:pillow:*:*:*:*:*:*:*:*
Vendors & Products Python
Python pillow
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow
Type Values Removed Values Added
Description 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 JCS_UNKNOWN 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.
Title Pillow: Heap buffer overflow in FlashPix (FPX) JPEG decoding leads to code execution
Weaknesses CWE-122
CWE-787
References
Metrics cvssV4_0

{'score': 9.2, 'vector': 'CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}

Weaknesses

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 22, 2026, 9:06 PM
Reserved
Oct 19, 2026, 4:58 PM
Status
Analyzed
Published
Oct 19, 2026, 10:17 PM
Modified
Oct 27, 2026, 9:01 PM