CVE-2026-112892
Unbounded memory expansion via Pillow's MSP RLE decoder leads to DoS.
- CVSS 8.7
- CWE-409
- Resource Management
- Remote
Pillow is a Python imaging library. From 4.1.0 until 13.0.0, Pillow's MSP RLE decoder can expand a small file into an unbounded in-memory buffer. The decoder writes run-length output to BytesIO without limiting expansion to the declared image size. An attacker can supply a crafted MSP image to an application that loads its pixels. This can exhaust memory and deny service even when the declared pixel count passes the decompression-bomb check. This issue is fixed in version 13.0.0.
- CWE
- CWE-409
- CVSS base score
- 8.7
- Published
- 2026-10-19
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Algorithm
- Code defect classification
- Incorrect Algorithm
- Category
- Resource Management
- Subcategory
- Resource Exhaustion
- Accessibility scope
- Remote
- Impact
- Denial of Service (DoS)
- Affected component
- Pillow
- Fixed by upgrading
- Yes
Solution
Upgrade Pillow to version 13.0.0 or later.
Vulnerable code sample
from PIL import Image
import io
def load_msp_image(data: bytes) -> Image.Image:
# VULNERABLE: unbounded MSP RLE decompression can exhaust memory
stream = io.BytesIO(data)
img = Image.open(stream) # Pillow will decode MSP RLE without size checks
img.load() # triggers the vulnerable decoder
return imgPatched code sample
from PIL import Image
import io
def load_msp_image(data: bytes) -> Image.Image:
# FIX: enforce a maximum pixel count before decoding
Image.MAX_IMAGE_PIXELS = 10_000_000 # limit expansion to ~10 MP
stream = io.BytesIO(data)
img = Image.open(stream) # Pillow now respects the pixel limit
img.load()
return imgPublished fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Do not decode more MSP data than necessary (#10019) (python-pillow/Pillow)
src/PIL/MspImagePlugin.py · MspDecoder.decode
Cite this entry
@misc{vaitp:cve2026112892,
title = {{Unbounded memory expansion via Pillow's MSP RLE decoder leads to DoS.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-112892},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-112892/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
