CVE-2026-55798 Pillow: WindowsViewer.get_command() OS command injection via unescaped shell path

Medium 4.5 Published Updated

An attacker can execute arbitrary commands on Windows systems by providing a malicious file path to the Pillow library's viewer function.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2026-55798?

CVE-2026-55798 is a medium-severity command injection vulnerability in Python Pillow, published on 6 Jul 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

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

Weakness: CWE-78

Which versions are affected by CVE-2026-55798?

4 open source packages ship an affected version, including pillow and Pillow. It affects 1 product.

PackageAffectedFixed in
pillow BitnamiAll versions12.3.0
pillow PyPIAll versions12.3.0
pillow PyPIAll versions12.3.0
Pillow PyPIAll versions12.3.0

Products include Python Pillow.

How do I fix CVE-2026-55798?

Upgrade pillow to 12.3.0 or later.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2026-55798 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-55798 exists.

All Python Pillow vulnerabilities

Sources

Also known as BIT-pillow-2026-55798, CLSA-2026-1787903381, CLSA-2026-1788345043, CLSA-2026-1788863918, ECHO-c51d-efb4-9117, GHSA-4x4j-2g7c-83w6 and 12 more.

Is CVE-2026-55798 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free