PyPI: pillow
CVE-2026-112892
Safety vulnerability ID: SFTY-20261021-81271
Affected versions of the Pillow package are vulnerable to Improper Handling of Highly Compressed Data (Data Amplification) due to the MSP RLE decoder expanding run-length encoded data without any bound tied to the declared image size. The MSP decoder, located in `MspImagePlugin.py`, writes each decoded run into an unbounded `io.BytesIO` buffer, allowing each run to expand data by roughly 85x, independent of the pixel-count validation performed earlier and unconstrained by `MAX_IMAGE_PIXELS`. An attacker can craft a tiny MSP image file that passes the initial pixel-count check but triggers massive in-memory expansion when decoded, exhausting available memory and causing a Denial of Service in any application that loads pixel data from untrusted MSP files.
Overview
Pillow: MSP RLE decoder expands a tiny file into unbounded memory
Advisory
pillow – Improper Handling of Highly Compressed Data (Data Amplification)
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20261021-81271/CVE-2026-112892
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-gg2r-wvfm-q9rx
- https://nvd.nist.gov/vuln/detail/CVE-2026-112892
- https://github.com/python-pillow/Pillow/commit/5dcb630b9798efd91929cb873d677aeee6ed0bb3
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/advisories/GHSA-gg2r-wvfm-q9rx
Verified by Safety
Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.
Learn more
