CVE-2023-50447: Pillow Arbitrary Code Execution Vulnerability
Summary
CVE-2023-50447: Arbitrary Code Execution in Pillow. Affects pillow versions < 10.2.0. Fixed in 10.2.0. How to fix ↓
Also tracked for
The same CVE-2023-50447 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Pillow is a widely-used Python Imaging Library that adds image processing capabilities to your Python interpreter. It supports opening, manipulating, and saving many different image file formats. However, versions up to 10.1.0 are vulnerable to an arbitrary code execution flaw, which can be exploited through the 'environment' parameter in the PIL.ImageMath.eval function.
Vulnerability Detail
The vulnerability arises from the way Pillow handles the 'environment' parameter in the PIL.ImageMath.eval function. Attackers can exploit this flaw to execute arbitrary code on the host system, leading to severe security risks, including unauthorized access to sensitive data and system compromise. This issue is distinct from CVE-2022-22817, which involved the 'expression' parameter. The vulnerability has a CVSS score of 8.1, indicating a high severity level.
How To Fix
Latest published version: 13.0.0 as of 22 Oct 2026
pip install --upgrade "pillow==13.0.0"
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
10.2.0
This is the first release that contains the fix.
pip install --upgrade "pillow==10.2.0"
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
If you cannot immediately upgrade Pillow, consider avoiding the use of the PIL.ImageMath.eval function with the 'environment' parameter until you can apply the patch.
Conclusion
In summary, CVE-2023-50447 is a critical vulnerability in the Pillow library that allows for arbitrary code execution. Users are strongly advised to upgrade to version 10.2.0 or later to mitigate this risk. For those unable to upgrade immediately, it is recommended to avoid using the affected function until a patch can be applied.
See every vulnerability recorded for pillow →
FAQ
CVE-2023-50447 is a vulnerability in the Pillow library that allows for arbitrary code execution through the 'environment' parameter in the PIL.ImageMath.eval function.
You can check if your application is affected by using the Vulert playground at Vulert Scanner, which monitors and alerts for open-source vulnerabilities in real-time.
If an immediate upgrade is not possible, avoid using the vulnerable function (PIL.ImageMath.eval with 'environment') until you can apply the patch.
Exploitation of this vulnerability can lead to arbitrary code execution, which may result in unauthorized access to sensitive data and compromise of the host system.
The CVSS score of this vulnerability is 8.1, indicating a high level of severity.
Related vulnerabilities
Recent vulnerabilities recorded for pillow.