GHSA-v9pv-5gc8-w2m6
Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious PSD/MPO/DCX/MIC image
-
DeliverySubmit file to Pillow-based application
-
ExploitAdvance to frame that changes mode/size
-
ExecutionStale narrow buffer reused, wider pixels written
-
ImpactNative out-of-bounds write: crash, memory leak, or code execution
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, read limits
MITRE ATT&CK
1 technique across 1 tactic: Collection The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires an application using Pillow 11.0.0 up to (not including) 13.0.0 to open an attacker-supplied multi-frame image in PSD, MPO, DCX, or MIC format and to advance past the first frame (seek/load a later frame). The specific trigger is a later frame of the same dimensions whose logical mode widens to RGB or CMYK (or whose size changes) relative to an earlier narrow-mode frame, causing load_prepare() to reuse the stale native allocation because _im is non-null. Limiting factors: the application must actually process multi-frame files and iterate frames rather than reading only the first frame; no authentication is required (PR:N), and no end-user interaction is needed in an automated pipeline. The crash and out-of-bounds read are reliably reachable, but code execution is limited to the MPO path and specific runtime/heap profiles, so most deployments realistically face DoS or memory disclosure rather than RCE. |
| Impact | The input CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N) yields a 9.8 Critical and, taken alone, implies trivial remote unauthenticated exploitation. However, the description reveals this is a memory-safety flaw in a parsing library triggered only when an application opens and advances through frames of an attacker-supplied multi-frame image (PSD, MPO, DCX, or MIC), so real-world risk hinges on whether the consuming application processes untrusted multi-frame files and seeks later frames. No EPSS score was provided and the CVE is not listed in CISA KEV, so there is no signal of widespread active exploitation; the matched phrase is 'no public exploit identified at time of analysis' (the patch-commit and test diffs on GitHub demonstrate the fix, not a weaponized exploit). The most reliable outcomes are native out-of-bounds writes (crash/DoS) and, on the MPO path, an over-read (information disclosure); the claimed command execution is explicitly scoped to 'demonstrated runtime-specific profiles' and is heap-layout-dependent, so RCE should be treated as conditional rather than guaranteed. Net: a genuinely high-severity memory-corruption bug in an extremely common library, but exploitation is gated by application behavior and the RCE claim is not independently confirmed - prioritize patching, but the 9.8 overstates the likelihood of reliable remote code execution against arbitrary deployments. |
| Exploit ScenarioDerived | An attacker submits a crafted multi-frame image (PSD, MPO, DCX, or MIC) to a service built on Pillow 11.0.0-12.x that opens the file and iterates frames; an earlier narrow-mode frame allocates a small ImagingCore buffer, and a later same-size frame that switches the logical mode to wider RGB/CMYK causes load_prepare() to reuse the stale allocation, writing wider pixels past the buffer. This produces native out-of-bounds writes (crash or memory corruption) or, via the MPO path, an over-read leaking memory, with command execution possible in specific runtime profiles. No public exploit code was identified in the provided data. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – Oct 21, 2026
Pillow versions 11.0.0 through 12.x (fixed in 13.0.0) can reuse a stale native ImagingCore buffer when a multi-frame image is advanced to a later frame whose pixel mode widens from a narrow format to RGB or CMYK, or whose dimensions change, producing native out-of-bounds writes and crashes; the MPO path can additionally over-read memory and, on specific runtime/heap profiles, achieve command execution. Exploitation requires the application to open an attacker-supplied PSD, MPO, DCX, or MIC file and actually seek/load past the first frame, since reading only the initial frame does not trigger the bug; no credentials or user interaction are needed in an automated image-processing pipeline. No public exploit code has been identified at time of analysis and the issue is not in CISA KEV, although the 9.8 CVSS and the trivially craftable file format make weaponization plausible for any service that validates or thumbnails multi-frame uploads.
Earlier versions of this analysis (1)
Stale native image buffer reuse in Pillow before 13.0.0 can corrupt memory or disclose information when an application loads an attacker-supplied image and then performs a pixel-mode transition such as Image.convert(). This Critical-rated flaw (GHSA-v9pv-5gc8-w2m6) affects all Pillow builds prior to 13.0.0 and can be reached by unauthenticated remote input only when the host application invokes a mode-changing operation on untrusted images. No public exploit code or confirmed active exploitation was identified at time of analysis.
RemediationAI
Upgrade to Pillow 13.0.0 (Vendor-released patch: 13.0.0), which is the first release containing the fix; the change is upstream commit 78d97d994579aef81aafe123773d525f40f2522a and pull request https://github.com/python-pillow/Pillow/pull/10105, with release notes at https://pillow.readthedocs.io/en/stable/releasenotes/13.0.0.html. Because the defect is in the C extension, rebuilding any wheels, lambda layers, or frozen binaries against 13.0.0 is required - a pure-Python overlay or site-packages hot-patch will not correct the native code path unless the compiled extension is replaced. If an immediate upgrade is not possible, the highest-value compensating control is to never advance past the first frame on untrusted input: read exactly one frame and avoid patterns like ImageSequence.Iterator, im.seek(n) loops, or save_all re-encoding on user-supplied files, at the cost of losing animated/multi-page support and any thumbnail derived from later frames. A second option is to block the vulnerable plugins outright - for example by removing or refusing PSD, MPO, DCX, and MIC from Image.OPEN / registered extensions so those files fail to open - which stops the attack at the cost of rejecting legitimate Photoshop, stereo JPEG, and multi-page fax-style inputs; note that MIC and DCX are rarely needed in most web workloads, so this is usually low-impact. Where format support must remain, run the decode step in a memory-isolated worker (separate process, container, or seccomp-limited sandbox with restricted syscalls) so an out-of-bounds write becomes a contained worker crash rather than host compromise, accepting the operational overhead of process isolation and the residual memory-disclosure risk from the MPO over-read. Rejecting uploads whose later frames change mode or dimensions requires parsing the container itself and is fragile, so it should not be relied on as a primary mitigation.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Pillow's C extension exposes image data through an ImagingCore object (the Python-level _im attribute), which is allocated once per image and cached on the ImageFile instance. ImageFile.load_prepare() is meant to reuse that native storage across frame loads, but it only checks whether _im is non-null rather than verifying that the allocation's mode and size still match the frame currently being decoded. In multi-frame containers such as PSD, MPO, DCX (concatenated PCX frames) and MIC, each frame carries its own mode and tile/decoder configuration, so a first frame decoded as a 1-bit or P-mode image can leave behind a narrow buffer that a subsequent same-size frame decodes into as RGB or CMYK, causing decoders to write wider pixels past the end of the smaller allocation. The upstream fix (commit 78d97d994579aef81aafe123773d525f40f2522a, PR 10105) clears _im on seek so the next load_prepare() reallocates correctly, and the accompanying regression tests in test_file_dcx.py, test_file_mic.py, test_file_mpo.py, test_file_psd.py and test_imagefile.py explicitly assert that _im is None after a mode or size change. Although the CVE is classified CWE-125 (out-of-bounds read) and the MPO path does permit a native over-read, the DCX/PSD/MIC paths described are fundamentally out-of-bounds writes into an undersized heap allocation, which is why the record also carries a Buffer Overflow tag; the two classes stem from the same lifetime/caching defect.
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
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
A service auto-processing an uploaded crafted image needs no auth or user interaction (PR:N/UI:N/AV:N), the OOB write and crash are trivially triggered (AC:L), and worst-case impacts span disclosure, corruption, and crash (C/I/A:H).
Primary rating from Vendor (CNA).
CVSS VectorVendor
Lifecycle Timeline
4Description PRE-NVD
Articles & Coverage 1
Technical POC Analysis
The flaw is stale native ImagingCore buffer reuse, producing out-of-bounds memory access.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
A critical memory-safety defect in Pillow (versions 11.0.0 through 12.x) can allow a crafted multi-frame image to corrupt memory and, under certain runtime conditions, execute commands on the host running the Python image-processing service. The exposure is concentrated in automated upload-validation and thumbnail pipelines that accept PSD, MPO, DCX, or MIC files and walk beyond the first frame - typically internet-facing, fully automated systems where a single malicious file needs no credentials or user interaction. Leadership should care because the affected library is a shared dependency across many services, so one unpatched consumer can expose common processing infrastructure and downstream customer data.
Apply vendor patch: upgrade to Pillow 13.0.0. Where the upgrade cannot be deployed immediately, interim mitigations are: reject or quarantine PSD, MPO, DCX, and MIC uploads at the edge; force single-frame decode paths and never seek past frame zero on untrusted input; re-encode untrusted images to a flat single-frame format in a disposable, non-privileged, memory- and CPU-capped sandbox with no outbound network access; and monitor image workers for crashes, restarts, and memory anomalies as a detection signal. Exploitation status: no public exploit identified at time of analysis.
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.
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
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 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
libImaging/PcxDecode.c in Pillow before 6.2.2 has a PCX P mode buffer overflow. Rated critical severity (CVSS 9.8), this
EUVD-2026-107573
NVD
CVE.org
EPSS
Exploit-DB