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.

Created at: Oct 22, 2026Updated at: Oct 22, 2026

Overview

Pillow: MSP RLE decoder expands a tiny file into unbounded memory

Advisory

pillow – Improper Handling of Highly Compressed Data (Data Amplification)

Affected Package

Affecting pillow package, versions>= 4.1.0, < 13.0.0

Also affects

---

How to Fix

Upgradepillowto13.0.0or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

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