CVE-2026-112397

Pillow: Out-of-bounds access in _imagingmorph on a zero-width image

Published Oct 19, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

Pillow's morphology routine, ImageMorph.MorphOp.apply(), performs an out-of-bounds read on a zero-width image. Attackers can craft a PPM or PGM file with a width of zero and supply it to any application that processes images using Pillow. The library then attempts to read beyond the bounds of the row buffer, causing a crash. This vulnerability leads to a denial of service but does not provide code execution or data exfiltration.

Affected Systems

Python Pillow (pillow) is affected. All releases prior to version 13.0.0 are vulnerable. Upgrading to Pillow 13.0.0 or later resolves the issue.

Risk and Exploitability

The CVSS score of 8.7 indicates high severity. No EPSS score is available, and the vulnerability is not listed in CISA’s KEV catalog. The attack vector requires an attacker to deliver a malicious image to an application that calls MorphOp.apply(). If the application is exposed to untrusted input (e.g., a web upload), the exploit can be performed remotely. Even in a local context, the crash can be triggered by an attacker with access to the image file. The vulnerability is therefore considered high risk due to the likelihood of widespread use of Pillow and the potential for denial of service.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Pillow to version 13.0.0 or later to apply the vendor fix.
  • Validate image dimensions before invoking MorphOp.apply(), rejecting any images with zero width or other invalid geometry.
  • Patch or reconfiguring applications that use legacy Pillow versions to eliminate calls to MorphOp.apply() for untrusted images.

Generated by OpenCVE AI on October 20, 2026 at 06:30 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-58r4-6rv3-gfh8 Pillow: Out-of-bounds access in _imagingmorph on a zero-width image
History
Type Values Removed Values Added
First Time appeared Python
Python pillow
CPEs cpe:2.3:a:python:pillow:*:*:*:*:*:*:*:*
Vendors & Products Python
Python pillow
Type Values Removed Values Added
Weaknesses CWE-124
References
Metrics threat_severity

None

cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'}

threat_severity

Important

Type Values Removed Values Added
First Time appeared Python-pillow
Python-pillow pillow
Vendors & Products Python-pillow
Python-pillow pillow
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
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.
Title Pillow: Out-of-bounds access in _imagingmorph on a zero-width image
Weaknesses CWE-787
References
Metrics cvssV4_0

{'score': 8.7, 'vector': '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'}

Weaknesses
  • CWE-124

    Buffer Underwrite ('Buffer Underflow')

  • CWE-787

    Out-of-bounds Write

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Oct 19, 2026, 9:38 PM
Reserved
Oct 19, 2026, 4:58 PM
Status
Analyzed
Published
Oct 19, 2026, 10:17 PM
Modified
Oct 27, 2026, 9:00 PM
Severity
Important
Public date
Oct 19, 2026, 9:17 PM