CVE-2026-55798

Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path

Published Jul 6, 2026 CVSS 3.1 · 4.5 Medium EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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.

Remediation

No solution or workaround provided in the CVE record.

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
Type Values Removed Values Added
Metrics ssvc

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

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow
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'}

Weaknesses
  • CWE-78

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Jul 7, 2026, 3:19 PM
Reserved
Jun 17, 2026, 2:40 PM
Status
Analyzed
Published
Jul 6, 2026, 7:17 PM
Modified
Oct 25, 2026, 8:10 PM
Severity
Moderate
Public date
Jul 6, 2026, 6:44 PM