CVE-2022-24303
Description
Pillow before 9.0.1 allows attackers to delete files because spaces in temporary pathnames are mishandled.
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
Pillow before 9.0.1 mishandles spaces in temporary pathnames, allowing attackers to delete arbitrary files.
Vulnerability
In Pillow versions prior to 9.0.1, the ImageShow module's show_file function used tempfile.mkstemp() to create a temporary file path. When the path contained spaces, the filename was not properly quoted in shell commands, leading to a command injection-like scenario where an attacker could manipulate the temporary file name to delete arbitrary files on the system. The affected component is PIL.ImageShow in Pillow/ImageShow.py. The vulnerability was introduced in an unknown version and fixed in version 9.0.1. [1][2]
Exploitation
An attacker must be able to influence the input file name or the environment such that the temporary path includes spaces. The typical attack vector involves a user opening a malicious image file with a crafted name that includes spaces and shell metacharacters. When Pillow's ImageShow creates a temporary file and passes it to a shell command (e.g., open on macOS or xdg-open on Linux), the space in the path causes the shell to interpret parts of the path as separate arguments, potentially allowing deletion of other files. The attacker does not need authentication, only the ability to supply a file path with spaces. [2][3]
Impact
Successful exploitation allows an attacker to delete arbitrary files on the system with the privileges of the user running the Pillow application. This can lead to denial of service, data loss, or privilege escalation if critical system files are removed. The vulnerability does not allow reading or modifying files, only deletion. [2]
Mitigation
Pillow version 9.0.1, released on 2022-03-28, fully addresses the vulnerability by rewriting the show_file methods to avoid using temporary files with shell commands and instead directly passing the file to the viewer program. Users should upgrade to Pillow 9.0.1 or later. No workarounds are available for versions prior to 9.0.1. The vulnerability is not currently listed in CISA's Known Exploited Vulnerabilities (KEV) catalog. [1][4]
AI Insight generated on May 21, 2026. Synthesized from this CVE's description and the cited reference URLs; citations are validated against the source bundle.
Affected packages
Versions sourced from the GitHub Security Advisory.
| Package | Affected versions | Patched versions |
|---|---|---|
PillowPyPI | < 9.0.1 | 9.0.1 |
Affected products
3- Pillow/Pillowdescription
- osv-coords2 versions
< 9.0.1+ 1 more
- (no CPE)range: < 9.0.1
- (no CPE)range: < 9.0.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
15- github.com/advisories/GHSA-9j59-75qj-795wghsaADVISORY
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/W4ZUXPKEX72O3E5IHBPVY5ZCPMJ4GHHV/mitrevendor-advisory
- lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/XR6UP2XONXOVXI4446VY72R63YRO2YTP/mitrevendor-advisory
- nvd.nist.gov/vuln/detail/CVE-2022-24303ghsaADVISORY
- security.gentoo.org/glsa/202211-10ghsavendor-advisoryWEB
- github.com/pypa/advisory-database/tree/main/vulns/pillow/PYSEC-2022-168.yamlghsaWEB
- github.com/python-pillow/Pillow/blob/e8ab5640774716c5486d3cb05167f74f742ad6ef/CHANGES.rstghsaWEB
- github.com/python-pillow/Pillow/commit/10c4f75aaa383bd9671e923e3b91d391ea12d781ghsaWEB
- github.com/python-pillow/Pillow/commit/143032103c9f2d55a0a7960bd3e630cb72549e8aghsaWEB
- github.com/python-pillow/Pillow/commit/427221ef5f19157001bf8b1ad7cfe0b905ca8c26ghsaWEB
- github.com/python-pillow/Pillow/pull/3450ghsaWEB
- github.com/python-pillow/Pillow/pull/6010ghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W4ZUXPKEX72O3E5IHBPVY5ZCPMJ4GHHVghsaWEB
- lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XR6UP2XONXOVXI4446VY72R63YRO2YTPghsaWEB
- pillow.readthedocs.io/en/stable/releasenotes/9.0.1.htmlghsaWEB
News mentions
0No linked articles in our index yet.