CVE-2026-112403

Pillow: Heap buffer overflow in ImagingJpegDecode

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 JPEG decoder can write a full-width scanline into a buffer sized for a requested draft scale. ImagingJpegDecode does not verify libjpeg's actual output width and component count after scaling is requested, and an 8-bit lossless SOF3 JPEG decoded by a build linked to libjpeg-turbo 3.x can ignore the requested downscaling geometry. An attacker can supply such a JPEG to an application that uses draft() or thumbnail() to request downscaling. This can corrupt heap memory, crash the process, or potentially allow code execution. Older libjpeg-turbo 2.x and IJG builds reject the SOF3 input. 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 JPEG decoder when processing certain 8‑bit lossless SOF3 images. The flaw occurs during downscaling via draft() or thumbnail() because the decoder does not verify that the decoded width and component count match the requested size. If an attacker supplies a malicious JPEG, the program can corrupt heap memory, crash, or potentially execute arbitrary code.

Affected Systems

Any system running Pillow prior to version 13.0.0 is potentially affected. The issue is tied to builds of Pillow linked with libjpeg‑turbo 3.x; older libjpeg‑turbo 2.x or IJG builds reject the problematic SOF3 input. The fix is delivered in Pillow 13.0.0 and later.

Risk and Exploitability

The CVSS score of 9.2 indicates critical severity. Although the EPSS score is not available, the vulnerability is not listed in CISA's KEV catalog. The attack vector is likely local or remote depending on how the application receives JPEG input; a compromised image can trigger heap corruption and lead to code execution. As the failure mode is a buffer overflow, exploiting it generally requires the attacker to provide a crafted JPEG that the application will process, making prevention through input validation a key mitigation factor.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Pillow to version 13.0.0 or later
  • Avoid using draft() or thumbnail() on untrusted JPEG images; if needed, validate image parameters before processing
  • Implement additional input validation or sanitization to confirm image dimensions and component counts before decoding

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

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-8g5g-8vmr-9782 Pillow: Heap buffer overflow in ImagingJpegDecode
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 JPEG decoder can write a full-width scanline into a buffer sized for a requested draft scale. ImagingJpegDecode does not verify libjpeg's actual output width and component count after scaling is requested, and an 8-bit lossless SOF3 JPEG decoded by a build linked to libjpeg-turbo 3.x can ignore the requested downscaling geometry. An attacker can supply such a JPEG to an application that uses draft() or thumbnail() to request downscaling. This can corrupt heap memory, crash the process, or potentially allow code execution. Older libjpeg-turbo 2.x and IJG builds reject the SOF3 input. This issue is fixed in version 13.0.0.
Title Pillow: Heap buffer overflow in ImagingJpegDecode
Weaknesses CWE-122
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
  • CWE-122

    Heap-based Buffer Overflow

Sources

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