CVE-2026-112892: Pillow MSP RLE Decoder Memory Exhaustion Vulnerability

pillow Updated 21 Oct 2026

Summary

21/10/2026
Yes i
High
8.7

CVE-2026-112892: Pillow: MSP RLE decoder expands a tiny file into unbounded memory. Affects pillow versions >= 4.1.0, < 13.0.0. Fixed in 13.0.0. How to fix ↓

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

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

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. The library is known for its ease of use and extensive functionality, making it a popular choice among developers. However, a recent vulnerability in the MSP RLE decoder has raised concerns regarding memory management, potentially allowing crafted images to exhaust system memory.

Vulnerability Detail

The vulnerability arises from the MSP RLE decoder's handling of run-length encoded data, which expands into an in-memory buffer without a cap based on the declared image size. This means that a small, specially crafted image file can lead to excessive memory allocation, potentially exhausting system resources and causing a denial of service. The issue is located in the MspImagePlugin.py file, where the decoder writes each run into an unbounded io.BytesIO object. The expansion factor can be as high as 85 times per run, making it possible for a tiny image to consume hundreds of megabytes of memory.

How To Fix

Latest published version: 13.0.0 as of 22 Oct 2026

pip install --upgrade "pillow==13.0.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, you can implement checks in your application to limit the size of images being processed. For example, you can set a maximum pixel count or restrict the types of images that can be uploaded or processed. Here is a sample code snippet to limit image size:

from PIL import Image

MAX_IMAGE_PIXELS = 1000000  # Set a maximum pixel limit

def load_image(file_path):
    img = Image.open(file_path)
    if img.size[0] * img.size[1] > MAX_IMAGE_PIXELS:
        raise ValueError('Image exceeds maximum allowed size')
    return img

Conclusion

In summary, CVE-2026-112892 is a significant vulnerability in the Pillow library that can lead to memory exhaustion through crafted image files. It is crucial for developers using Pillow to update to the latest version to mitigate this risk. Implementing additional checks can also help safeguard applications against potential exploitation.

See every vulnerability recorded for pillow →

Share this vulnerability

FAQ

CVE-2026-112892 is a vulnerability in the Pillow library that allows a crafted image to cause excessive memory allocation, leading to potential denial of service.

If your application uses Pillow to process images, a malicious user could upload a specially crafted image that exhausts system memory, potentially crashing your application.

The vulnerability affects Pillow versions from 4.1.0 up to, but not including, 13.0.0.

You can use Vulert to monitor your application for vulnerabilities. It analyzes your Pipfile.lock to alert you in real-time about any open-source vulnerabilities.

The CVSS score for this vulnerability is 8.7, indicating a high severity level.

Related vulnerabilities

Recent vulnerabilities recorded for pillow.

How To Fix

Latest published version: 13.0.0 as of 22 Oct 2026

pip install --upgrade "pillow==13.0.0"

The newest release already contains this fix.

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