CVE-2026-112892: Pillow: MSP RLE decoder expands a tiny file into unbounded memory
High
- OSV id
- GHSA-gg2r-wvfm-q9rx
- Also known as
- BIT-pillow-2026-112892, CVE-2026-112892
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| pillow PyPI |
>= 4.1.0, < 13.0.0 | 13.0.0 |
Versions we track that it affects: pillow 10.4.0
How to fix it
Upgrade pillow to 13.0.0 or later.
# in requirements.txt: change the line to pillow==13.0.0
pip install -r requirements.txt
- If it is an indirect dependency, upgrade the package that depends on it, or add a minimum version constraint for it (e.g. in constraints.txt, or as a dependency in pyproject.toml).
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
Not sure whether your project uses an affected version? Check your lockfile below for free.
Details
Summary
The MSP RLE decoder expands run-length data into an in-memory buffer with no cap tied to the declared image size. A small file that passes the pixel-count check can force hundreds of megabytes or more of allocation when the application loads pixels.
Details
The MSP decoder writes each run into an unbounded io.BytesIO and can expand roughly 85x per run:
src/PIL/MspImagePlugin.py:144-146
Impact
Memory-exhaustion denial of service from a tiny crafted image in any application that loads pixels. The expansion is decoupled from the declared pixel count, so MAX_IMAGE_PIXELS does not bound it.
References
- GHSA-gg2r-wvfm-q9rx on OSV.dev
- Web: https://github.com/python-pillow/Pillow/security/advisories/GHSA-gg2r-wvfm-q9rx
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2026-112892
- Web: https://github.com/python-pillow/Pillow/commit/5dcb630b9798efd91929cb873d677aeee6ed0bb3
- Package: https://github.com/python-pillow/Pillow
- Web: https://github.com/python-pillow/Pillow/releases/tag/13.0.0
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.