Description
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.
Published: 2026-07-06
Score: 4.5 Medium
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

Pillow, a widely used Python imaging library, has a flaw in WindowsViewer.get_command() that builds a cmd.exe command by embedding a file path directly into an f‑string and then calls subprocess.Popen with shell=True. Because the path is not escaped, any shell metacharacters present in the file name or path can be injected, allowing an attacker to execute arbitrary cmd.exe commands. The weakness is identified as a CWE‑78 input validation issue that can lead to remote code execution if an attacker can influence the image path.

Affected Systems

All Windows systems running Pillow versions older than 12.3.0 are affected. Any Python process that invokes WindowsViewer.get_command can trigger the flaw, so applications that load images—web servers, desktop utilities, or other image‑handling scripts—could be vulnerable depending on how the image paths are supplied.

Risk and Exploitability

The CVSS score of 4.5 indicates moderate severity, while the EPSS score of <1% suggests a low probability of exploitation in the wild. The vulnerability is not listed in CISA’s KEV catalog. The likely attack vector is local or possibly remote if an application accepts image paths from an uncontrolled source, such as user uploads or network file shares. An attacker would supply a malicious file name or path containing shell metacharacters to WindowsViewer.get_command; execution of the injected commands would occur with the privileges of the running Python process, potentially leading to system‑wide compromise if elevated privileges exist.

Generated by OpenCVE AI on August 1, 2026 at 18:25 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Pillow to 12.3.0 or later to ensure proper escaping of file paths.
  • If upgrading is not possible, modify WindowsViewer.get_command to sanitize or quote the file path before passing it to cmd.exe, or replace subprocess.Popen with a call that does not use shell=True.
  • Run any image‑processing applications with the least privilege necessary to limit damage from a successful injection.

Generated by OpenCVE AI on August 1, 2026 at 18:25 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-4x4j-2g7c-83w6 Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path
History

Wed, 08 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
References
Metrics threat_severity

None

threat_severity

Moderate


Tue, 07 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Mon, 06 Jul 2026 21:00:00 +0000

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow

Mon, 06 Jul 2026 19:15:00 +0000

Type Values Removed Values Added
Description 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.
Title Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path
Weaknesses CWE-78
References
Metrics cvssV3_1

{'score': 4.5, 'vector': 'CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L'}


Subscriptions

Python Pillow
Python-pillow Pillow
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-07T15:19:40.072Z

Reserved: 2026-06-17T14:40:28.381Z

Link: CVE-2026-55798

cve-icon Vulnrichment

Updated: 2026-07-07T15:19:15.419Z

cve-icon NVD

Status : Analyzed

Published: 2026-07-06T19:17:08.830

Modified: 2026-07-07T18:58:33.570

Link: CVE-2026-55798

cve-icon Redhat

Severity : Moderate

Publid Date: 2026-07-06T18:44:38Z

Links: CVE-2026-55798 - Bugzilla

cve-icon OpenCVE Enrichment

Updated: 2026-08-01T18:30:05Z

Weaknesses
  • CWE-78

    Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')