CVE-2023-50447
Description
Pillow through 10.1.0 allows PIL.ImageMath.eval Arbitrary Code Execution via the environment parameter, a different vulnerability than CVE-2022-22817 (which was about the expression parameter).
AI Insight
LLM-synthesized narrative grounded in this CVE's description and references.
CVE-2023-50447 is a critical arbitrary code execution vulnerability in Pillow versions up to 10.1.0, exploitable through the `environment` parameter of `PIL.ImageMath.eval`.
CVE-2023-50447 is an arbitrary code execution vulnerability in the Pillow Python imaging library, affecting versions through 10.1.0. The flaw resides in the PIL.ImageMath.eval function, which evaluates mathematical expressions on images. Unlike the earlier CVE-2022-22817, which was about unrestricted expression strings, this vulnerability is triggered via the environment parameter [2][3]. Pillow's ImageMath.eval function is a wrapper around Python's built-in eval, and prior to version 10.2.0 it did not restrict the keys passed in the environment dictionary [1][3].
Exploitation
An attacker who can control the keys of the environment dictionary passed to ImageMath.eval can achieve arbitrary code execution. Because the function uses Python's eval, allowing keys that match built-in names or contain double underscores (e.g., __builtins__) enables access to dangerous Python internals. The attacker does not need to control the expression string itself; the environment keys provide the injection vector [3]. The vulnerability is network-exploitable if an application passes user-controlled data into the environment argument.
Impact
Successful exploitation grants an attacker arbitrary code execution in the context of the Python process using Pillow [3]. This can lead to full compromise of the application, including data theft, ransomware, or lateral movement within the environment. The CVSS v3.1 score is 8.1 (High), reflecting low attack complexity and high impact [2][3].
Mitigation
The vulnerability is fixed in Pillow version 10.2.0, released on 2024-01-02 [1][4]. The fix restricts environment keys by raising a ValueError if a key matches a built-in name or contains double underscores. Users are strongly advised to upgrade to Pillow 10.2.0 or later [1][4]. No workarounds are currently recommended; upgrading is the safest course of action.
AI Insight generated on May 20, 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 | < 10.2.0 | 10.2.0 |
Affected products
47- Pillow/Pillowdescription
- osv-coords46 versionspkg:apk/chainguard/kubeflow-pipelines-visualization-serverpkg:apk/chainguard/py3.10-pillowpkg:apk/chainguard/py3.10-seabornpkg:apk/chainguard/py3.11-pillowpkg:apk/chainguard/py3.11-seabornpkg:apk/chainguard/py3.12-pillowpkg:apk/chainguard/py3.12-seabornpkg:apk/chainguard/py3.13-pillowpkg:apk/chainguard/py3.13-seabornpkg:apk/chainguard/py3-pillowpkg:apk/chainguard/py3-seabornpkg:apk/chainguard/py3-supported-pillowpkg:apk/chainguard/py3-supported-seabornpkg:apk/chainguard/pytorchpkg:apk/wolfi/kubeflow-pipelines-visualization-serverpkg:apk/wolfi/py3.10-pillowpkg:apk/wolfi/py3.10-seabornpkg:apk/wolfi/py3.11-pillowpkg:apk/wolfi/py3.11-seabornpkg:apk/wolfi/py3.12-pillowpkg:apk/wolfi/py3.12-seabornpkg:apk/wolfi/py3.13-pillowpkg:apk/wolfi/py3.13-seabornpkg:apk/wolfi/py3-pillowpkg:apk/wolfi/py3-seabornpkg:apk/wolfi/py3-supported-pillowpkg:apk/wolfi/py3-supported-seabornpkg:apk/wolfi/pytorchpkg:bitnami/pillowpkg:pypi/pillowpkg:rpm/almalinux/python3-pillowpkg:rpm/almalinux/python3-pillow-develpkg:rpm/almalinux/python3-pillow-docpkg:rpm/almalinux/python3-pillow-tkpkg:rpm/opensuse/python-Pillow&distro=openSUSE%20Leap%2015.5pkg:rpm/suse/python-Pillow&distro=HPE%20Helion%20OpenStack%208pkg:rpm/suse/python-Pillow&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP4-ESPOSpkg:rpm/suse/python-Pillow&distro=SUSE%20Linux%20Enterprise%20High%20Performance%20Computing%2015%20SP4-LTSSpkg:rpm/suse/python-Pillow&distro=SUSE%20Linux%20Enterprise%20Module%20for%20Python%203%2015%20SP5pkg:rpm/suse/python-Pillow&distro=SUSE%20Linux%20Enterprise%20Server%2015%20SP4-LTSSpkg:rpm/suse/python-Pillow&distro=SUSE%20Linux%20Enterprise%20Server%20for%20SAP%20Applications%2015%20SP4pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%208pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%209pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%20Crowbar%208pkg:rpm/suse/python-Pillow&distro=SUSE%20OpenStack%20Cloud%20Crowbar%209pkg:rpm/suse/python-Pillow&distro=SUSE%20Package%20Hub%2015%20SP5
< 2.4.1-r2+ 45 more
- (no CPE)range: < 2.4.1-r2
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 2.1.2-r3
- (no CPE)range: < 2.4.1-r2
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 10.2.0-r0
- (no CPE)range: < 0.13.2-r0
- (no CPE)range: < 2.1.2-r3
- (no CPE)range: < 10.1.1
- (no CPE)range: < 10.2.0
- (no CPE)range: < 5.1.1-18.el8_9.1.alma.1
- (no CPE)range: < 5.1.1-18.el8_9.1.alma.1
- (no CPE)range: < 5.1.1-18.el8_9.1.alma.1
- (no CPE)range: < 5.1.1-18.el8_9.1.alma.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 4.2.1-3.26.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 9.5.0-150400.5.9.1
- (no CPE)range: < 4.2.1-3.26.1
- (no CPE)range: < 5.2.0-3.23.1
- (no CPE)range: < 4.2.1-3.26.1
- (no CPE)range: < 5.2.0-3.23.1
- (no CPE)range: < 8.4.0-bp155.3.3.1
Patches
0No patches discovered yet.
Vulnerability mechanics
AI mechanics synthesis has not run for this CVE yet.
References
11- github.com/advisories/GHSA-3f63-hfp8-52jqghsaADVISORY
- nvd.nist.gov/vuln/detail/CVE-2023-50447ghsaADVISORY
- www.openwall.com/lists/oss-security/2024/01/20/1ghsamailing-listWEB
- devhub.checkmarx.com/cve-details/CVE-2023-50447ghsaWEB
- duartecsantos.github.io/2023-01-02-CVE-2023-50447ghsaWEB
- duartecsantos.github.io/2024-01-02-CVE-2023-50447ghsaWEB
- github.com/python-pillow/Pillow/commit/45c726fd4daa63236a8f3653530f297dc87b160aghsaWEB
- lists.debian.org/debian-lts-announce/2024/01/msg00019.htmlghsamailing-listWEB
- pillow.readthedocs.io/en/stable/releasenotes/10.2.0.htmlghsaWEB
- devhub.checkmarx.com/cve-details/CVE-2023-50447/mitre
- duartecsantos.github.io/2024-01-02-CVE-2023-50447/mitre
News mentions
0No linked articles in our index yet.