CVE-2026-112397
8.7HighPublished 19 Oct 2026 · NVD status: Received · AI triage by gemini-3.8-flash
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
- Impact
- High impact on availability
- Weakness
- CWE-787
Impact
Remote attackers can crash applications processing untrusted images by triggering an out-of-bounds memory write. They just need to submit a specially crafted zero-width PPM or PGM image that gets passed to Pillow's morphology routine.
Root cause
ImageMorph.MorphOp.apply() writes to outrow[width - 1] without validating against zero-width images, causing an out-of-bounds write before the row buffer.
Affected systems
Pillow versions prior to 13.0.0
CVSS v4.0 · CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
Fix & remediation
Upgrade Pillow to version 13.0.0 or higher. If upgrading is delayed, reject or sanitize zero-width PPM and PGM images before applying ImageMorph operations.
$ pip install --upgrade 'Pillow>=13.0.0'AI-suggested. Run it in staging first and check it against the vendor advisory. Why?
NVD description
Pillow is a Python imaging library. Prior to 13.0.0, Pillow's ImageMorph.MorphOp.apply() can access memory before a row buffer for a zero-width image. PPM and PGM input can create an image with width zero, and the native morphology routine indexes outrow[width - 1] without rejecting that geometry. An attacker can supply such an image to an application that applies a morphology operation. This can crash the process. This issue is fixed in version 13.0.0.
References
- https://github.com/python-pillow/Pillow/commit/18f7c0dfee93063c51db6ed0ca8c4da2999dcb64
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8