Pillow CVE-2026-42311
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
ReconAttacker crafts malicious PSD file with overflow-inducing tile dimensions
-
DeliveryUploads PSD to vulnerable application endpoint
-
ExploitApplication calls Image.open() on attacker file
-
InstallPillow parses PSD tile metadata
-
C2Integer overflow bypasses extent validation
-
ExecuteOut-of-bounds write corrupts heap memory
-
ImpactCode execution achieved via overwritten pointers
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Integer overflow checks
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 the target application to use Pillow versions 10.3.0 through 12.1.1 for processing PSD (Photoshop Document) format images. The vulnerable code path triggers when calling Image.open() on a PSD file followed by operations that invoke tile decoding/encoding (load(), save(), seek() to specific frames in multi-layer PSD files). Applications that explicitly filter image formats using the Image.open(formats=[...]) parameter to exclude PSD are NOT vulnerable. The attack succeeds against default Pillow configurations with no special settings required. Attack complexity is low (CVSS AC:L) - the attacker only needs to craft tile dimensions that produce integer overflow during extent sum calculations, achievable through standard PSD file format manipulation tools. On 32-bit Python interpreters (sys.maxsize <= 2^32), overflow conditions trigger OverflowError exceptions in some code paths, potentially limiting exploitation. On 64-bit systems (most production environments), overflow wraps silently and the out-of-bounds write proceeds to memory corruption. No authentication required (PR:N) and no user interaction needed (UI:N) beyond normal application functionality that processes uploaded or received PSD files. Attack vector is local (AV:L) only in the sense that file processing occurs within the application context, but file delivery commonly happens via network upload/download mechanisms, making this effectively remotely exploitable for internet-facing services accepting image uploads. |
| Impact | CVSS 4.0 score of 8.6 (AV:L/AC:L/PR:N/UI:N) indicates high severity with local attack vector, low complexity, and no privilege requirements. However, CVSS categorization as 'local' is misleading for this vulnerability class - the attack occurs through file processing, not system access. Real-world risk is HIGH for applications processing untrusted PSD files from network sources (web uploads, email attachments, API endpoints), where remote attackers can deliver malicious images. Attack complexity is genuinely low: attackers only need to craft tile dimensions that produce integer overflow during extent calculation. No authentication or user interaction required beyond normal file processing workflows. The vulnerability represents a patch bypass scenario (incomplete fix for CVE-2026-25990), demonstrating sophisticated exploitation potential. Arbitrary code execution impact elevates risk substantially compared to denial-of-service-only crashes. EPSS data not provided but would likely be moderate given the specific file format requirement and Python ecosystem scope. No CISA KEV listing indicates exploitation is not yet widespread, though proof-of-concept exists in the patch test suite (Tests/images/psd-oob-write-overflow.psd). Priority is HIGH for services processing PSD files, MEDIUM for desktop applications with limited PSD exposure, LOW for environments that never handle PSD format. Key risk factor: this bypasses a previous security fix, suggesting adversaries tracking Pillow vulnerabilities may already understand the attack pattern. |
| Exploit ScenarioDerived | An attacker uploads a malicious PSD file to a web application that uses Pillow for image processing (thumbnail generation, format conversion, metadata extraction). The crafted PSD contains tile dimensions carefully calculated to cause integer overflow during extent validation - for example, a tile with xoff=0x7FFFFFF0 and xsize=0x20, which when added produce 0x80000010 that wraps to a small negative value in 32-bit signed arithmetic, bypassing the bounds check. When Pillow processes this image via Image.open().load(), the flawed validation passes but the subsequent memory write in decode.c attempts to write tile data beyond the allocated buffer, corrupting heap structures. The attacker leverages this memory corruption to overwrite function pointers or return addresses, achieving arbitrary code execution within the Python process context. Proof-of-concept image exists in the patch test suite (Tests/images/psd-oob-write-overflow.psd), demonstrating exploitation feasibility. From code execution, the attacker can steal application secrets, modify data, pivot to internal networks, or establish persistence depending on service privileges. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv2 – May 09, 2026
Integer overflow in Pillow 10.3.0 through 12.1.1 bypasses bounds checks during PSD tile extent validation, enabling memory corruption and arbitrary code execution when processing malicious PSD files. This vulnerability (CVE-2026-42311) exploits an incomplete fix for CVE-2026-25990, where the original patch added tile extent validation but used overflow-prone integer types. Attackers craft PSD images with tile dimensions that wrap around during extent sum calculations, defeating the bounds checks and triggering out-of-bounds writes in decode.c and encode.c. Pillow 12.2.0 patches this by avoiding extent addition before comparison. No active exploitation confirmed (not in CISA KEV); publicly available exploit code exists via proof-of-concept test images in the patch commit.
Earlier versions of this analysis (1)
Integer overflow in Pillow 10.3.0 through 12.1.1 bypasses bounds checks during PSD file processing, enabling out-of-bounds memory writes that can crash the interpreter or achieve arbitrary code execution. This is a patch bypass of CVE-2026-25990: the original fix computed tile extents using overflow-prone integer types, allowing attackers to craft PSD files with tile dimensions that wrap around and evade validation. Pillow 12.2.0 resolves this by avoiding extent summation before comparison. Upstream fix confirmed via GitHub PR #9520 with test cases demonstrating the overflow condition on both 32-bit and 64-bit systems.
RemediationAI
Upgrade immediately to Pillow 12.2.0 or later, released with commit 58f9a1d166dcb0c274807d4423522d205b0c35ea applying the integer overflow fix from PR #9520 at https://github.com/python-pillow/Pillow/pull/9520. For Python environments, execute: pip install --upgrade pillow>=12.2.0 or update requirements.txt/pyproject.toml dependencies. Vendor advisory available at https://github.com/python-pillow/Pillow/security/advisories/GHSA-cfh3-3jmp-rvhc and related GHSA-pwv6-vv43-88gr. If immediate upgrade is blocked by compatibility constraints, implement defense-in-depth compensating controls: (1) Use Image.open() with formats parameter to explicitly exclude PSD format (formats=['PNG', 'JPEG', 'GIF'] whitelist approach), trading PSD functionality for security. (2) Validate file magic bytes before processing and reject PSD headers (38 42 50 53 hex signature) at ingress points, though this prevents legitimate PSD usage. (3) Run Pillow image processing in sandboxed containers with restricted memory and no network access, limiting RCE impact but not preventing crashes. (4) Implement file size limits (reject PSD files >10MB) to constrain exploit delivery, though small crafted files may still trigger overflow. Note: Pillow versions 10.0.0-10.2.0 are NOT vulnerable to this specific integer overflow but may be vulnerable to the original CVE-2026-25990. Versions <10.3.0 predate the flawed tile extent validation code entirely. All workarounds sacrifice PSD format support; upgrade remains the only complete mitigation.
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 is a Python Imaging Library (PIL) fork providing comprehensive image processing capabilities. The vulnerability stems from CWE-190 (Integer Overflow or Wraparound) in the PSD (Adobe Photoshop Document) codec implementation. When processing PSD files, Pillow validates tile extents by computing sums of tile coordinates and dimensions to ensure they remain within image bounds. The flawed implementation in versions 10.3.0-12.1.1 used integer types susceptible to overflow when adding tile extents (e.g., xoff + xsize, yoff + ysize). Carefully chosen tile dimensions cause these sums to wrap around to small positive values or negative values that pass bounds checks, while the actual memory access attempts to write beyond allocated buffer boundaries in the C-level decode.c and encode.c modules. The affected package identifier is pkg:pip/pillow, impacting Python environments where Pillow handles untrusted PSD image input. The fix in PR #9520 restructures the validation logic to compare tile coordinates and sizes separately rather than computing potentially overflowing sums.
Know when Python 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:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Primary rating from Vendor (https://github.com/python-pillow/Pillow).
CVSS VectorVendor: https://github.com/python-pillow/Pillow
Lifecycle Timeline
2DescriptionCVE.org
Impact
Processing a malicious PSD file could lead to memory corruption, potentially resulting in a crash or arbitrary code execution.
Patches
Patched version: 12.2.0
Pillow 12.1.1 addressed CVE-2026-25990 by adding checks for tile extents in PSD image decoding/encoding to prevent an out-of-bounds write. However, the bounds checks computed tile extent sums using types susceptible to integer overflow, meaning a PSD image with carefully chosen tile dimensions could produce values that wrap around and bypass the checks, still triggering an out-of-bounds write in src/decode.c and src/encode.c. The fix avoids adding extents together before comparison.
Workarounds
Use any version but affected versions: >= 10.3.0, < 12.2.0
Resources
- Fix: https://github.com/python-pillow/Pillow/pull/9520
- Original issue: CVE-2026-25990 (Pillow 12.1.1)
Executive ViewAI
Pillow image processing library versions 10.3.0 through 12.1.1 contain a critical integer overflow flaw that allows attackers to execute arbitrary code by submitting malicious PSD image files, potentially compromising any application or service using this library to process user-supplied images. Organizations using Pillow for image handling must update immediately, as publicly available exploit code exists and the vulnerability bypasses critical memory safety controls.
Vendor-released patch: Pillow 12.2.0. Interim mitigations if immediate patching is infeasible: (1) Disable PSD file upload/processing in user-facing features; (2) Restrict PSD processing to trusted, pre-validated internal images only; (3) Implement strict file type validation and reject PSD uploads until patched; (4) Run Pillow processes in sandboxed or containerized environments with minimal privilege to limit code execution impact.
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.
Integer overflow occurs when an arithmetic operation produces a result that exceeds the maximum value a given integer type can store.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)CVE.org
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
Same weakness CWE-190 – Integer Overflow or Wraparound
View allVendor StatusVendor
SUSE
Severity: Important| Product | Status |
|---|---|
| SUSE Linux Enterprise Server 16.0 SUSE Linux Enterprise Server for SAP applications 16.0 | Fixed |
| openSUSE Leap 16.0 | Fixed |
| openSUSE Tumbleweed | Fixed |
| SUSE Linux Enterprise Desktop 15 SP7 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Server 16.0 | Affected |
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Not-Affected |
| SUSE Linux Enterprise Server for SAP applications 16.0 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
| openSUSE Leap 16.0 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP5 | Not-Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP5 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Not-Affected |
| SUSE Linux Enterprise Server 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Not-Affected |
| SUSE Manager Proxy 4.3 | Not-Affected |
| SUSE Manager Retail Branch Server 4.3 | Not-Affected |
| SUSE Manager Server 4.3 | Not-Affected |
| SUSE Linux Enterprise Desktop 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Desktop 15 SP5 | Not-Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Not-Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Module for Package Hub 15 SP6 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Not-Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Not-Affected |
| openSUSE Leap 15.3 | Not-Affected |
| openSUSE Leap 15.4 | Not-Affected |
| openSUSE Leap 15.5 | Not-Affected |
| openSUSE Leap 15.6 | Not-Affected |
GHSA-pwv6-vv43-88gr
NVD
CVE.org
EPSS
VulDB
Exploit-DB