Pillow Package OS Command Injection Vulnerability on Windows
An early warning has been issued regarding a potential OS command injection vulnerability in the Pillow package's WindowsViewer.get_command() method on Windows systems. This vulnerability, tracked as GHSA-4X4J-2G7C-83W6, is reportedly due to the method constructing a shell command by directly embedding a file path into an f-string without proper escaping, which could allow for OS command injection on Windows. The vulnerability appears to affect multiple versions of Pillow, from version 0 to 12.3.0, inclusive. It is recommended to avoid using the affected method on Windows until a fix is released.
What happened
The Pillow package, a popular Python imaging library, is under investigation for a potential security vulnerability. The WindowsViewer.get_command() method in Pillow is reportedly constructing a shell command by directly embedding a file path into an f-string without escaping, which could allow an attacker to perform OS command injection on Windows systems. This vulnerability, if exploited, could lead to unauthorized execution of arbitrary commands on the affected system.
The vulnerability is associated with the GHSA-4X4J-2G7C-83W6 advisory and is classified as a critical CVE. The affected versions of Pillow range from version 0 to 12.3.0, inclusive. The primary sources indicate that the issue was introduced in version 0 and has not yet been fixed in any version as of the latest advisory.
To assess your exposure, check if your application uses the Pillow package and specifically the WindowsViewer.get_command() method on Windows. If so, you may be at risk. It is recommended to upgrade to the latest version of Pillow once a fix is released and to avoid using the affected method on Windows in the interim. For the most accurate and up-to-date information, consult the primary sources linked in the advisory.
How 0Day mitigates this
pillow is anywhere in your dependency tree, the engineers who own the affected repositories get a push alert the moment it is flagged — no manual audit to remember to run.Read how this differs from waiting on a scanner to catch a known advisory, or see the exact, read-only access 0Day needs to do this for an organization.