---
id: "CVE-2023-50447"
page: "https://infrastack.ai/live/CVE-2023-50447"
kind: "vulnerability"
aliases: ["CVE-2023-50447", "GHSA-3f63-hfp8-52jq"]
title: "Arbitrary Code Execution in Pillow"
severity: "critical"
cvss: 8.1
epss: 0.01703
exploited: false
status: "open"
category: "package"
products: [{"name": "Pillow", "fixed": ["10.2.0"], "affected": "< 10.2.0", "ecosystem": "pypi"}, {"name": "python pillow", "fixed": [], "affected": "<= 10.1.0", "ecosystem": "vendor"}, {"name": "debian linux", "fixed": [], "affected": "= 10.0", "ecosystem": "vendor"}, {"via": "cpe", "name": "pillow", "fixed": [], "affected": "<= 10.1.0", "ecosystem": "pypi"}]
ecosystems: ["pypi", "vendor"]
tags: ["cwe-94", "cwe-95", "image-processing", "package", "pillow", "python"]
not_affected_if: ["no-imagemath-eval", "trusted-input-only"]
published_at: "2024-01-19T20:15:11+00:00"
first_seen_at: "2026-11-16T15:53:11+00:00"
updated_at: "2026-11-16T16:08:50+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-3f63-hfp8-52jq", "first_seen_at": "2026-11-16T15:53:11+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2023-50447", "first_seen_at": "2026-11-16T16:08:50+00:00"}]
exploit_sources: [{"type": "epss", "score": 0.01703, "url": "https://api.first.org/data/v1/epss?cve=CVE-2023-50447"}]
---

# Arbitrary Code Execution in Pillow

Link for people: https://infrastack.ai/live/CVE-2023-50447 (this .md is for agents)

Pillow's PIL.ImageMath.eval function accepts an environment parameter that can be abused to execute arbitrary Python code. An attacker who controls the input passed to that function can run code on the machine processing the image.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- pypi:Pillow affected < 10.2.0 fixed 10.2.0
- vendor:python pillow affected <= 10.1.0 fixed no fixed version listed
- vendor:debian linux affected = 10.0 fixed no fixed version listed
- pypi:pillow affected <= 10.1.0 fixed no fixed version listed

## How to check

- Check the installed Pillow version with `pip show pillow`
- Search your code for calls to `ImageMath.eval` and see whether any argument comes from untrusted input
- Review your lockfile or requirements for `pillow` pinned below `10.2.0`

## Fix

- Pillow: upgrade to `10.2.0`

## Timeline

- 2026-11-16T15:53:11+00:00 ghsa https://github.com/advisories/GHSA-3f63-hfp8-52jq
- 2026-11-16T16:08:50+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2023-50447

## Documents

- [advisory] Third-party advisory: www.openwall.com http://www.openwall.com/lists/oss-security/2024/01/20/1
- [advisory] Third-party advisory: devhub.checkmarx.com https://devhub.checkmarx.com/cve-details/CVE-2023-50447/
- [advisory] Third-party advisory: lists.debian.org https://lists.debian.org/debian-lts-announce/2024/01/msg00019.html
- [fix] Patch: github.com https://github.com/python-pillow/Pillow/commit/45c726fd4daa63236a8f3653530f297dc87b160a
- [fix] Release notes: github.com https://github.com/python-pillow/Pillow/releases

## From the sources

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).

---

_Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai_
