CVE-2026-112898: Pillow: Image.quantize() with empty palette leaks uninitialized stack memory
Pillow is a Python imaging library. From 9.1.0 until 13.0.0, Pillow can disclose uninitialized stack memory when Image.quantize() uses an empty palette. ImagingPaletteCacheUpdate() leaves a local cache array uninitialized when the palette has zero entries, and the conversion path emits those bytes as output pixel indices. An attacker who controls the palette image can obtain stack contents from a returned PNG or GIF. This can disclose addresses and stack-canary data without an out-of-bounds access, memory corruption, or process crash. This issue is fixed in version 13.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which applications are realistically exposed?
Applications using Pillow 9.1.0 through versions before 13.0.0 are exposed if they process an attacker-controlled palette image with Image.quantize() and return the resulting PNG or GIF to the attacker.
What does an attacker need to exploit this issue?
The attacker needs to control the palette image supplied to the quantization operation. The CVSS vector indicates network reachability, low attack complexity, no privileges, and no user interaction requirements.
What information can be disclosed?
The generated image can contain uninitialized stack bytes emitted as pixel indices. Disclosed data may include memory addresses and stack-canary data.
How can I determine whether an installation is affected?
Check the installed Pillow version and whether the application uses Image.quantize() on untrusted palette images. Versions from 9.1.0 up to, but not including, 13.0.0 are affected; version 13.0.0 fixes the issue.