CVE-2023-50447: Pillow Arbitrary Code Execution Vulnerability

pillow Updated 29 Jun 2026

Summary

29/06/2026
Yes i
Critical
8.1

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.

Free scan

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.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Share this vulnerability

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.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

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 →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback