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.
OpenCVE Enrichment
Github GHSA