Skip to main content

Pillow EUVDEUVD-2026-104642

| CVE-2026-112403 CRITICAL
Heap-based Buffer Overflow (CWE-122)
2026-10-19 GitHub_M GHSA-8g5g-8vmr-9782
9.2
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Upload crafted SOF3 JPEG to image service
  2. Delivery
    Application calls draft()/thumbnail() for downscaling
  3. Exploit
    libjpeg-turbo 3.x ignores draft geometry
  4. Execution
    Full-width scanline overflows draft-sized heap buffer
  5. Impact
    Heap corruption, crash, or potential code execution

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Heap buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires ALL of the following concrete conditions: (1) the target application must call Pillow's draft() or thumbnail() API to request JPEG downscaling; (2) the Pillow build must be linked against libjpeg-turbo 3.x - builds using libjpeg-turbo 2.x or IJG reject the SOF3 input and are not affected; (3) the attacker must supply a crafted 8-bit lossless SOF3-encoded JPEG. The primary limiting factor is the libjpeg-turbo 3.x dependency (a specific, non-universal build configuration), which is why CVSS assigns AC:H. No authentication is required (PR:N) and no explicit user interaction beyond the application ingesting the attacker-supplied image (UI:N), making services that auto-generate thumbnails from untrusted uploads the realistic exposure surface.

Impact

This is a genuine heap buffer overflow (CWE-122) in Pillow's JPEG decoder with plausible paths to crash and potential remote code execution, but several signals temper the raw 9.2 CVSS 4.0 score into a conditional rather than universal priority. The CVSS 4.0 vector (AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H) correctly captures high complexity (AC:H): exploitation is NOT universal because it requires the specific combination of a build linked to libjpeg-turbo 3.x AND an 8-bit lossless SOF3 JPEG AND an application calling draft() or thumbnail() to request downscaling - older libjpeg-turbo 2.x and IJG builds reject the input entirely. No EPSS score, KEV listing, or public POC was provided in the input, so there is no public exploit identified at time of analysis and no evidence of active exploitation. The vendor advisory (GHSA-8g5g-8vmr-9782) and fixing commit are confirmed, and the committed regression test demonstrates the vulnerable condition, but weaponizing a corrupted heap into reliable code execution is non-trivial. Net: treat as a high-priority patch for any environment that processes untrusted images with Pillow on a libjpeg-turbo 3.x build, but the AC:H prerequisites and absence of exploitation signals suggest this is not yet a mass-exploitation threat.

Exploit ScenarioDerived

An attacker uploads a maliciously crafted 8-bit lossless SOF3 JPEG to a web service that uses Pillow's thumbnail() or draft() to downscale user images for previews. On a server whose Pillow is linked against libjpeg-turbo 3.x, libjpeg ignores the requested downscale geometry and emits a full-width scanline into a buffer sized for the smaller draft scale, corrupting the heap. No public exploit code was identified at time of analysis, though the vendor's regression test demonstrates the triggering condition.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 19, 2026

Heap buffer overflow in Pillow's JPEG decoder (all versions prior to 13.0.0) lets a crafted 8-bit lossless SOF3 JPEG corrupt heap memory, crash the process, and potentially achieve code execution when an application requests downscaling through draft() or thumbnail(). Exploitation is unauthenticated but conditional: the Pillow build must be linked against libjpeg-turbo 3.x, because libjpeg-turbo 2.x and IJG builds reject the SOF3 input outright, and the application must actually call draft()/thumbnail() on attacker-supplied images - a common pattern in upload/thumbnail pipelines, which is the realistic exposure surface. No public exploit code has been identified at time of analysis and the issue is not in CISA KEV; the CVSS 4.0 score of 9.2 reflects high confidentiality/integrity/availability impact, tempered by the AC:H rating derived from the narrow build-configuration prerequisite.

RemediationAI

Vendor-released patch: Pillow 13.0.0. Upgrade with pip install --upgrade 'Pillow>=13.0.0' (or pin Pillow==13.0.0 in your requirements/lockfile) and rebuild any wheels or containers that vendor the library; the fix is upstream commit 242a059aedc1935097d9aa1dc3f099750467ba75 and details are in advisory GHSA-8g5g-8vmr-9782 and the 13.0.0 release notes. If an immediate upgrade is not possible, the most effective compensating control is to link Pillow against libjpeg-turbo 2.x or IJG libjpeg, both of which reject SOF3 lossless input before the vulnerable scanline check - at the cost of the 3.x performance and API improvements and the need to rebuild Pillow from source. Alternatively, avoid calling draft() or thumbnail() on untrusted JPEGs: decode first with a trusted/pinned backend (for example, re-encode uploads with an external transcoder or ImageMagick configured with an IJG build) and only then hand the normalized image to Pillow, accepting the extra CPU cost and pipeline complexity. Another option is to gate JPEG uploads behind a format allowlist that rejects lossless SOF3 markers or to enforce strict pixel-dimension validation before any scaling request, though marker-level filtering is fragile because JPEG parsing itself is delegated to libjpeg. Presizing images with a separate service so Pillow never receives attacker-controlled JPEGs mitigates the exposure regardless of whether the patch has been applied.

Affected VersionsENISA

Pillow < 13.0.0

Affected Packages

pypi pillow fix: 13.0.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Pillow's JPEG codec (src/libImaging/JpegDecode.c, ImagingJpegDecode) allocates its scanline output buffer based on the tile extents (state->xsize) and the pixel format implied by the unpacker, not on the dimensions the libjpeg decompressor actually reports after libjpeg_set_scale_num_denom or the scaled-decode path is engaged. When draft() or thumbnail() requests downscaling, Pillow trusts that libjpeg will emit a proportionally narrower image. An 8-bit lossless SOF3 JPEG decoded by a Pillow build linked against libjpeg-turbo 3.x can ignore that requested scaling geometry and produce a full-width scanline plus a different component count, which libjpeg then writes into the undersized buffer - a classic CWE-122 heap-based buffer overflow (write). The upstream fix adds an explicit post-scaling validation in ImagingJpegDecode that compares cinfo.output_width against state->xsize and cinfo.output_components * output_width against state->bytes, destroying the decompressor and returning IMAGING_CODEC_BROKEN if the actual output does not fit; the accompanying regression test test_wider_than_tile forges a 64x64 tile on a wider JPEG and asserts an OSError('broken data stream'). Older libjpeg-turbo 2.x and IJG releases reject the SOF3 lossless input during marker processing, so the vulnerable code path is never reached on those builds.

Know when Pillow gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 9.2 CRITICAL
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
vuln.today AI 8.1 HIGH

AC:H because exploitation needs a libjpeg-turbo 3.x build plus a crafted SOF3 JPEG and a draft/thumbnail call; PR:N/UI:N since untrusted images are processed automatically; C/I/A:H for heap-corruption-to-RCE potential.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
High
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Oct 19, 2026 - 23:18 EUVD
CVE Published
Oct 19, 2026 - 21:22 cve.org
CRITICAL 9.2

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 89,616 pypi packages depend on pillow (20,283 direct, 70,825 indirect)

Ecosystem-wide dependent count for version 13.0.0.

Technical POC Analysis

CWE-122 heap-based buffer overflow in Pillow's JPEG decoder, src/libImaging/JpegDecode.c, function ImagingJpegDecode().

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

Pillow, the Python imaging library used across our content-ingestion and thumbnail pipelines, carries a critical heap memory corruption flaw in its JPEG decoder that can crash image-processing services and may permit code execution on hosts that handle untrusted uploads. Because the defect is reached through routine upload-and-resize workflows rather than privileged access, any internet-facing service that thumbnails customer-supplied images represents a plausible entry point, putting both service availability and the data those workers can reach at risk. No public exploit code or active exploitation has been identified, and successful abuse depends on a specific JPEG library build and code path, which narrows but does not remove the exposure for teams running affected configurations.

Business Impact: High
Compensating Controls

No vendor patch available: disable or sandbox draft()/thumbnail() processing of untrusted images, reject SOF3 lossless JPEG uploads at ingress, re-encode inbound images with an independent decoder, cap image dimensions and memory limits, run image workers in isolated unprivileged containers with restricted egress, and pin to libjpeg-turbo 2.x where feasible, since that build rejects the malformed input outright.

Threat Intelligence Overview

EPSS Score
0.3%
Top 76% exploitable
Prevalence
High
Pillow is among the most widely deployed Python image libraries in web backends
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

46
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

A heap overflow occurs when a program writes data beyond the bounds of a buffer allocated in the heap memory region.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

More in Pillow

View all
CVE-2022-30595 CRITICAL POC
9.8 May 25

libImaging/TgaRleDecode.c in Pillow 9.1.0 has a heap buffer overflow in the processing of invalid TGA image files. Rated

CVE-2026-59204 HIGH POC
8.7 Jul 14

Denial of service in Python Pillow (versions 8.2.0 through 12.2.0) allows remote attackers to exhaust memory during JPEG

CVE-2026-54058 HIGH POC
8.3 Jul 14

Out-of-bounds memory disclosure in Python Pillow before 12.3.0 lets an attacker who supplies a crafted McIdas AREA image

CVE-2026-59197 HIGH POC
8.2 Jul 14

Heap out-of-bounds write in Python Pillow prior to 12.3.0 lets an attacker who controls the rank-filter size parameter c

CVE-2026-59200 HIGH POC
7.5 Jul 14

Uncontrolled memory consumption in Python Pillow (PIL) versions 5.1.0 through 12.2.x allows a remote attacker to cause d

CVE-2021-23437 HIGH POC
7.5 Sep 03

The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb

CVE-2025-48379 HIGH POC
7.1 Jul 01

Pillow is a Python imaging library. In versions 11.2.0 to before 11.3.0, there is a heap buffer overflow when writing a

CVE-2016-4009 CRITICAL
9.8 Apr 13

Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in Pillow before 3.1.1 allows remote

CVE-2014-3007 CRITICAL
10.0 Apr 27

Python Image Library (PIL) 1.1.7 and earlier and Pillow 2.3 might allow remote attackers to execute arbitrary commands v

CVE-2026-96639 CRITICAL
9.8 Oct 21

Pillow versions 11.0.0 through 12.x (fixed in 13.0.0) can reuse a stale native ImagingCore buffer when a multi-frame ima

CVE-2021-34552 CRITICAL
9.8 Jul 13

Pillow through 8.2.0 and PIL (aka Python Imaging Library) through 1.1.7 allow an attacker to pass controlled parameters

CVE-2021-25289 CRITICAL
9.8 Mar 19

An issue was discovered in Pillow before 8.1.1. Rated critical severity (CVSS 9.8), this vulnerability is remotely explo

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy