Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessUpload crafted SOF3 JPEG to image service
-
DeliveryApplication calls draft()/thumbnail() for downscaling
-
Exploitlibjpeg-turbo 3.x ignores draft geometry
-
ExecutionFull-width scanline overflows draft-sized heap buffer
-
ImpactHeap 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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- 89,616 pypi packages depend on pillow (20,283 direct, 70,825 indirect)
Ecosystem-wide dependent count for version 13.0.0.
Articles & Coverage 1
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
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.
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
libImaging/TgaRleDecode.c in Pillow 9.1.0 has a heap buffer overflow in the processing of invalid TGA image files. Rated
Denial of service in Python Pillow (versions 8.2.0 through 12.2.0) allows remote attackers to exhaust memory during JPEG
Out-of-bounds memory disclosure in Python Pillow before 12.3.0 lets an attacker who supplies a crafted McIdas AREA image
Heap out-of-bounds write in Python Pillow prior to 12.3.0 lets an attacker who controls the rank-filter size parameter c
Uncontrolled memory consumption in Python Pillow (PIL) versions 5.1.0 through 12.2.x allows a remote attacker to cause d
The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb
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
Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in Pillow before 3.1.1 allows remote
Python Image Library (PIL) 1.1.7 and earlier and Pillow 2.3 might allow remote attackers to execute arbitrary commands v
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
Pillow through 8.2.0 and PIL (aka Python Imaging Library) through 1.1.7 allow an attacker to pass controlled parameters
An issue was discovered in Pillow before 8.1.1. Rated critical severity (CVSS 9.8), this vulnerability is remotely explo
EUVD-2026-104642
GHSA-8g5g-8vmr-9782
NVD
CVE.org
EPSS
Exploit-DB