CVE-2026-114501: Pillow: Arrow export leaks stale heap memory when PILLOW_ALIGNMENT > 1
Summary
When PILLOWALIGNMENT is set above 1, exporting an image to Arrow returns uninitialized heap memory mixed in with the pixel data. That memory can include pixels from images the process freed earlier.
Details
With an alignment above 1, the default allocator pads each row up to alignedlinesize and starts the first row at an aligned offset into the block. It then exports im->blocks[0].ptr as xsize ysize tightly packed pixels, so exported data includes the padding bytes, and can include a few bytes from before the first row.
Tested vulnerable on 11.2.1, 12.3.0, 4c1ed27a5.
PoC
Whether things leak may depend on allocator configuration. This does show a leak on my Mac.
python import os
os.environ["PILLOWALIGNMENT"] = "64"
from PIL import Image
Image A: 64 px wide, so its rows fill the whole aligned stride a = Image.new("L", (64, 40), 0x41).transpose(Image.Transpose.FLIPLEFTRIGHT) del a
Image B: 61 px wide, so each row has 3 bytes of padding; its pixels are all 0 b = Image.new("L", (61, 40), 0).transpose(Image.Transpose.FLIPLEFTRIGHT)
try: exported = Image.fromarrow(b, b.mode, b.size).tobytes() except ValueError as e: print("Not vulnerable:", e) else: if leaked := len(exported) - exported.count(0): raise RuntimeError(f"{leaked} of {len(exported)} exported bytes are not B's pixels")
Impact
Information disclosure for applications that set PILLOWALIGNMENT and export images to Arrow. Likely any image whose row length isn't a multiple of the alignment will do. In a service handling several users' images, one user's exported data can contain pixels from another user's image, or other stale heap contents.
Other sources
Pillow is a Python imaging library. From 11.2.1 until 13.0.0, Arrow export assumes that an image's rows are tightly contiguous and exports from im->blocks[0].ptr even when PILLOWALIGNMENT makes alignedlinesize include row padding or an aligned offset before the first row. The resulting Arrow buffer can include uninitialized padding, bytes preceding the first row, or stale heap contents from previously freed images. Applications that configure alignment and export images to Arrow can therefore disclose one user's pixels or other process memory to another user. This issue is fixed in version 13.0.0.
— Ubuntu
Pillow is a Python imaging library. From 11.2.1 until 13.0.0, Arrow export assumes that an image's rows are tightly contiguous and exports from im-blocks[0].ptr even when PILLOWALIGNMENT makes alignedlinesize include row padding or an aligned offset before the first row. The resulting Arrow buffer can include uninitialized padding, bytes preceding the first row, or stale heap contents from previously freed images. Applications that configure alignment and export images to Arrow can therefore disclose one user's pixels or other process memory to another user. This issue is fixed in version 13.0.0.
— IBM
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/Pillowto a version that resolves this vulnerability.Fixed in 13.0.0 - Upgrade
Upgrade
bitnami/pillowto a version that resolves this vulnerability.Fixed in 13.0.0 - Upgrade
Upgrade
pip/pillowto a version that resolves this vulnerability.Fixed in 13.0.0 - Upgrade
Upgrade
debian/pillowto a version that resolves this vulnerability.Fixed in 13.0.0-1 - Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which deployments are exposed to this disclosure?
Applications using Pillow versions from 11.2.1 up to, but not including, 13.0.0 are affected when they configure PILLOW_ALIGNMENT greater than 1 and export images to Arrow. The impact is disclosure of image data from another user or other stale process memory.
What must happen for an attacker to obtain leaked data?
The application must export an image to Arrow while aligned row sizes or offsets cause the image storage not to be tightly contiguous. The exported buffer may then contain uninitialized row padding, bytes before the first image row, or stale heap contents from previously freed images.
Is the default configuration affected?
The described condition requires PILLOW_ALIGNMENT to be greater than 1. The provided information does not indicate that deployments using the default alignment setting are affected.
What is the remediation?
Upgrade Pillow to version 13.0.0, which fixes the issue. If an immediate upgrade is not possible, avoid configuring PILLOW_ALIGNMENT greater than 1 or avoid exporting affected images to Arrow.