PyPI: pillow
CVE-2026-112900
Safety vulnerability ID: SFTY-20261021-11431
Affected versions of the Pillow package are vulnerable to OS Command Injection due to insufficient sanitization of the input filename used when invoking Ghostscript. The `PIL.EpsImagePlugin.Ghostscript()` function assigns the attacker-controllable `fp.name` directly to the `infile` variable, which is then passed unmodified to the `-f` option of the Ghostscript command list executed via `subprocess.check_call()`, allowing a filename beginning with `-`, `--`, or `@` to be interpreted by Ghostscript as a command-line option or argument file rather than a plain filename. An attacker who can control the filename passed to `Image.open()`, such as through a file-upload feature that preserves user-supplied names, can craft a filename like `@arg` referencing a malicious argument file to inject additional Ghostscript parameters (for example `-sOutputFile=%pipe%/bin/id`), resulting in arbitrary command execution on the host even with Pillow's default `-dSAFER` sandboxing enabled.
Overview
Pillow: Argument Injection in Ghostscript call, potentially leading into RCE
Advisory
pillow – OS Command Injection
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261021-11431/CVE-2026-112900
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-w889-685w-c8fh
- https://nvd.nist.gov/vuln/detail/CVE-2026-112900
- https://github.com/python-pillow/Pillow/commit/a2c363141da31a265dd536c945677db4b64f3ec9
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/advisories/GHSA-w889-685w-c8fh
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
