Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessDeliver crafted filename containing cmd.exe metacharacters
-
DeliveryUser or application triggers WindowsViewer on the file
-
Exploitget_command() interpolates raw path into shell command string
-
Executionsubprocess.Popen executes injected cmd.exe commands
-
ImpactArbitrary command execution as invoking user
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization OS command sanitization, avoid shell exec
MITRE ATT&CK
2 techniques 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 is strictly limited to Windows systems, as WindowsViewer targets cmd.exe and is not invoked on Linux or macOS. The attacker must control or meaningfully influence the file path - specifically the filename - passed to WindowsViewer.get_command(); this is the concrete triggering condition stated in the CVE description (direct embedding of a file path without escaping). A user must actively trigger the image viewing operation (UI:R per CVSS). High attack complexity (AC:H) reflects the prerequisite that an attacker-controlled filename must reach this specific code path - applications that source filenames exclusively from trusted internal sources are not exploitable. Pillow deployments that do not use the WindowsViewer component at all (the majority of server-side and cross-platform use cases) have no exposure. |
| Impact | The CVSS 3.1 score of 4.5 with vector AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L reflects a realistic but bounded threat. The local attack vector (AV:L) constrains exploitation to scenarios where the attacker can place or influence a file path on the target system - ruling out direct remote exploitation over the network. High attack complexity (AC:H) further limits the attack surface to cases where an attacker-controlled filename reaches the WindowsViewer code path. User interaction (UI:R) is required, meaning a user must actively trigger the image viewer. The impact triad of C:L/I:L/A:L indicates that commands execute in the context of the invoking user, not as elevated privilege. No EPSS data was provided, no KEV listing exists, and no public POC has been identified - all consistent with a low-urgency but real vulnerability in a specific Windows code path. This is a genuine issue for Windows-based Python applications that pass user-influenced file paths to Pillow's viewer functionality, but not a broad-scope emergency for server-side or non-Windows deployments. |
| Exploit ScenarioDerived | An attacker uploads or delivers a file with a crafted name such as legitimate.jpg & net user backdoor P@ssw0rd /add to a Windows environment where a Python application uses Pillow's WindowsViewer to open images. When a user or automated process triggers image display via get_command(), the unsanitized filename is embedded into the cmd.exe command string, causing the appended shell command to execute with the permissions of the invoking process. No public POC has been identified at time of analysis, but the attack primitive is straightforward for anyone familiar with Windows shell injection. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Jul 06, 2026
Command injection in Pillow's WindowsViewer component (all versions prior to 12.3.0) allows arbitrary cmd.exe command execution when a user opens an image with a crafted filename containing shell metacharacters. The root cause is in WindowsViewer.get_command(), which embeds an unsanitized file path directly into an f-string and passes the result to subprocess.Popen with shell=True on Windows. No public exploit has been identified at time of analysis, and this vulnerability is not listed in the CISA KEV catalog.
RemediationAI
Upgrade Pillow to version 12.3.0 or later, which addresses this vulnerability via three commits: 8404ea5fe5df40fc34aa1e51403dd6fce0778b8a, 88194166691b7b603529b8b036ab3ab9cedd2de4, and b0e06caa64c1405aa3da0bb1d2bd9a77ca22de7f, as confirmed by the vendor advisory at https://github.com/python-pillow/Pillow/security/advisories/GHSA-4x4j-2g7c-83w6. If upgrading immediately is not possible, the most effective workaround is to avoid invoking WindowsViewer.get_command() with any file path derived from untrusted input - for example, by sanitizing filenames to strip or reject shell metacharacters before they reach this code path; note that blocklist-based sanitization carries inherent bypass risk and should be considered a temporary measure only. Applications on Linux or macOS are not affected and require no action.
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 (python-pillow/Pillow) is the dominant Python imaging library, forked from PIL. The affected component, WindowsViewer.get_command(), is Windows-specific and invokes cmd.exe to open images using the native Windows viewer. The vulnerability stems from unsafe use of Python's subprocess.Popen with shell=True combined with f-string interpolation of an attacker-influenced file path - a textbook instance of CWE-78 (Improper Neutralization of Special Elements used in an OS Command). Characters such as &, |, and ; are not escaped or sanitized, allowing them to be interpreted by cmd.exe as command separators or chain operators. The CPE cpe:2.3:a:python-pillow:pillow:*:*:*:*:*:*:*:* covers all pre-12.3.0 versions across platforms, though exploitation is limited to Windows deployments that invoke this viewer code path.
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:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L
Local vector and high complexity reflect that attacker-controlled filename must reach the Windows-only viewer code path; no system privileges required but user must trigger viewing.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
Pillow is a Python imaging library. Prior to 12.3.0, WindowsViewer.get_command() constructed a cmd.exe shell command by directly embedding a file path into an f-string without escaping and passed the result to subprocess.Popen(..., shell=True), allowing shell metacharacters in the file path to inject arbitrary cmd.exe commands. This issue is fixed in version 12.3.0.
Blast Radius
ecosystem impact- 6,879 pypi packages depend on pillow (1,431 direct, 5,517 indirect)
Ecosystem-wide dependent count for version 12.3.0.
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
OS command injection occurs when an application passes unsanitized user input directly into system shell commands.
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-41898
GHSA-4x4j-2g7c-83w6
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB