Skip to main content

CVE-2026-96638 — Vulnerability in pillow — CVE Details

MEDIUM

Pillow: BMP RLE decoder memory-amplification DoS via unbounded delta escape / absolute mode

Published October 22, 2026Updated October 29, 2026Source: OSV

What Should I Do?

Address in Next Maintenance Window

Low exploitation probability (0.46%). Schedule for your next planned update.

Does your project use an affected pillow version?

Paste your requirements.txt to check it for CVE-2026-96638 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.

Check my requirements.txt

Summary

Summary

BmpRleDecoder can be forced to allocate gigabytes of memory from a kilobyte-sized crafted BMP file via unbounded growth in the delta escape and absolute mode branches.

Affected versions

All versions up to and including current HEAD (v13.0.0.dev0, commit e7a7ea84)

Root cause

BmpRleDecoder.decode() (BmpImagePlugin.py:327-395) builds a Python bytearray data with dest_length = xsize*ysize, looping while len(data) < dest_length. The loop condition is only checked at the TOP; individual branches append attacker-controlled amounts UNBOUNDED by dest_length:

  • delta escape (line 370): data += b"\x00" * (right + up * self.state.xsize) with right,up in 0..255 -> up to ~255*xsize bytes in ONE iteration.
  • absolute mode (line 385): data += bytes_read (up to 255).

Because a single delta can push len(data) to ~256 * (row size), a tiny RLE stream combined with a large-but-legal xsize (xsize*ysize just under MAX_IMAGE_PIXELS, ~89M) yields a multi-GB data bytearray (then copied again by bytes(data) and set_as_raw). No heap OOB (bytearray/set_as_raw are bounds-safe), but a severe memory-amplification DoS: the attacker file stays tiny.

Reproduction

Python 3.13, Pillow HEAD e7a7ea84

Attached: pillow_poc_bmp_rle_dos.py

A 1084-byte BMP (BI_RLE8, width=3,000,000, height=1 -> 3M px, passes bomb check) with one delta escape (00 02 00 150) produces ~429 MB data; measured peak RSS 911 MB. Scaling width toward the bomb limit and up=255 produces tens of GB from a ~1 KB file.

Suggested fix

Cap growth at dest_length in the delta and absolute branches, e.g. clamp the delta fill to (dest_length - len(data)) and stop appending once len(data) >= dest_length; reject deltas that would move the cursor beyond the image, matching the existing per-row clamp at line 341-343.

Credit: Yazan Balawneh - CyStack Security Team (GitHub: sonicnew)

pillow_poc_bmp_rle_dos.py

Advisory Timeline

  • First published October 22, 2026 (36 days ago).
  • Last revised October 29, 2026 — 7 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

pip
Update pillow to 13.0.0 or later
pip install "pillow>=13.0.0"

After upgrading, scan your dependencies again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: PyPI (1).

PackageFixed In
pillow PyPI · Affected: 10.0.0, 10.0.1, 10.1.0, 10.2.0 (+17 more)13.0.0

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

  • CWE-400
    Uncontrolled Resource ConsumptionMITRE
  • CWE-770
    Allocation of Resources Without LimitsMITRE

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 6.5 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H

Frequently Asked Questions

What is CVE-2026-96638?
Pillow: BMP RLE decoder memory-amplification DoS via unbounded delta escape / absolute mode. This vulnerability has been assigned a severity rating of MEDIUM (CVSS score: 6.5/10).
How do I check if my project is affected by CVE-2026-96638?
CVE-2026-96638 affects pillow. It has a 0.5% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-96638 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
6.5

Exploitation requires specific conditions, or the impact is limited.

EPSS Score (30-day exploit probability)
0.46%
EPSS percentile: 31.8

This is a below-median EPSS score — only 31.8% of tracked vulnerabilities score at or below it, so most tracked vulnerabilities are considered more likely to be exploited than this one.

Also Known As

GHSA-24rc-8hj2-v98c
BIT-pillow-2026-96638

Related CVEs

  • CVE-2026-54058
    HIGH

    Pillow: Out-of-bounds read via attacker-controlled row stride on Pillow's mmap path (McIdas AREA files)

  • CVE-2026-59200
    HIGH

    Pillow: Decompression Bomb DoS via PdfParser.PdfStream.decode()

  • CVE-2026-55379
    HIGH

    Pillow `BdfFontFile`: `Image.new()` called without `_decompression_bomb_check()` — bomb protection bypass via font loading

  • CVE-2026-112896
    HIGH

    Pillow: TIFF encoder ColorMap plane-size mismatch causes a heap out-of-bounds read

  • CVE-2026-59198
    MEDIUM

    Pillow TGA RLE encoder can serialize up to ~57 KB of adjacent heap data into generated images

  • CVE-2026-112394
    MEDIUM

    Pillow: P;2L and P;4L decoders may read 1 to 3 bytes past the passed buffer size

  • CVE-2026-112395
    MEDIUM

    Pillow tiled-TIFF decoder reads past tile buffer in copy4 (Unpack.c:1290)

  • CVE-2026-96636
    MEDIUM

    Pillow: Decompression-bomb protection bypass via multi-frame seek() in MPO and DCX (MpoImageFile.seek / DcxImageFile.seek)

Check your own dependencies

Free, with no signup for up to 10 packages.

Check my requirements.txt