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

Published Oct 21, 2026
·
Updated

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 destlength = xsizeysize, looping while len(data) < destlength. The loop condition is only checked at the TOP; individual branches append attacker-controlled amounts UNBOUNDED by destlength:

- delta escape (line 370): data += b"\x00" (right + up self.state.xsize) with right,up in 0..255 -> up to ~255xsize bytes in ONE iteration. - absolute mode (line 385): data += bytesread (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 (xsizeysize just under MAXIMAGEPIXELS, ~89M) yields a multi-GB data bytearray (then copied again by bytes(data) and setasraw). No heap OOB (bytearray/setasraw are bounds-safe), but a severe memory-amplification DoS: the attacker file stays tiny.

Reproduction Python 3.13, Pillow HEAD e7a7ea84

Attached: pillowpocbmprledos.py

A 1084-byte BMP (BIRLE8, 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 destlength in the delta and absolute branches, e.g. clamp the delta fill to (destlength - len(data)) and stop appending once len(data) >= destlength; 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)

pillowpocbmprledos.py

Other sources

Pillow is a Python imaging library. From 9.1.0 until 13.0.0, BmpRleDecoder.decode() in src/PIL/BmpImagePlugin.py permits crafted RLE BMP delta escapes and absolute-mode runs to append beyond the remaining destlength without a per-branch cap. A delta can add roughly 255 image rows in one iteration, so a kilobyte-sized file with a large but permitted width can expand the data bytearray to hundreds of megabytes or more, causing memory-exhaustion denial of service. This issue is fixed in version 13.0.0.

— MITRE

Affected Software

12 affected componentsFixes available
pypi/Pillow>=9.1.0<13.0.0
pip/pillow>=9.1.0<13.0.0
13.0.0
Python Pillow>=9.1.0<13.0.0
bitnami/pillow>=9.1.0<13.0.0
13.0.0
debian/pillow*
debian/pillow*
debian/pillow*
debian/pillow<=9.4.0-1.1+deb12u1, <=11.1.0-5+deb13u4, <=11.1.0-5+deb13u3, <=12.3.0-1
13.0.0-1
ubuntu/pillow-python2*
ubuntu/pillow*
ubuntu/pillow*
ubuntu/pillow*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0
  2. Upgrade

    Upgrade bitnami/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0
  3. Upgrade

    Upgrade debian/pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0-1
  4. Upgrade

    Upgrade Pillow to a version that resolves this vulnerability.

    Fixed in 13.0.0

Event History

Oct 21, 2026
CVE Published
via MITRE·08:47 PM
Data Sourced
via MITRE·08:47 PM
DescriptionSeverityWeakness
Data Sourced
via OSV·09:20 PM
Affected Software
Data Sourced
via NVD·09:20 PM
RemedyDescriptionSeverityWeaknessAffected Software
Oct 22, 2026
Advisory Published
via GitHub·03:59 PM
Data Sourced
via GitHub·03:59 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are exposed?

Deployments using Pillow versions from 9.1.0 up to, but not including, 13.0.0 are affected when they decode attacker-controlled RLE-compressed BMP files.

2

What does an attacker need to exploit this issue?

An attacker needs to provide a crafted RLE BMP file for the application to decode. No authentication or special privileges are required, but user interaction is required according to the supplied severity vector.

3

What is the impact of successful exploitation?

A small crafted file can cause Pillow to grow an in-memory bytearray to hundreds of megabytes or more, potentially exhausting memory and causing a denial of service. The provided impact assessment indicates no confidentiality or integrity impact.

4

What should be done if an immediate upgrade is not possible?

Avoid decoding untrusted RLE-compressed BMP files until Pillow can be updated. The issue is fixed in Pillow 13.0.0.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203