Skip to main content

Pillow CVE-2026-112397

| EUVDEUVD-2026-104640 HIGH
Out-of-bounds Write (CWE-787)
2026-10-19 GitHub_M GHSA-58r4-6rv3-gfh8
8.7
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Upload crafted zero-width PPM/PGM image
  2. Exploit
    Application invokes ImageMorph MorphOp.apply()
  3. Execution
    Routine indexes outrow[width-1] out of bounds
  4. Impact
    Process crashes (denial of service)

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Bounds checking, write limits
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Privilege Escalation

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires (1) the target application to decode an attacker-supplied PPM or PGM image that produces an image with width zero, and (2) the application to call Pillow's ImageMorph.MorphOp.apply() (a morphology operation such as erosion8/dilation) on that image. The limiting factor is the morphology code path: most Pillow deployments never invoke ImageMorph, so only applications explicitly performing morphological operations on untrusted images are affected. No authentication is required (PR:N) and no user interaction beyond supplying the image (UI:N); impact is confined to a process crash with no data exposure or code execution.

Impact

This is a denial-of-service memory-safety flaw with a narrow real-world risk profile despite its 8.7 (HIGH) CVSS 4.0 base score. The vector (CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H) correctly reflects the single meaningful consequence: availability impact only (VA:H) via a process crash, with no confidentiality or integrity impact (VC:N/VI:N). CWE-787 (out-of-bounds write) is listed, but the description and fix indicate an out-of-bounds memory access at outrow[width-1] when width is 0 - the demonstrated and fixed impact is a crash, not code execution, so the score's C:N/I:N is consistent. The network attack vector (AV:N) is realistic only indirectly: Pillow itself is a local library, so AV:N applies solely to applications that ingest attacker-supplied images over a network AND then invoke the morphology routine - a comparatively uncommon code path. There is NO EPSS score, NO CISA KEV listing, and NO public exploit (only a vendor fix commit and a test case are provided), so all active-exploitation and probability signals are absent rather than low. Net: this is a legitimate but low-urgency DoS to patch in the normal cycle for anyone using ImageMorph; it is not a high-real-risk emergency, and the HIGH severity reflects easy triggering conditions rather than severe impact. Note the signal tension: AV:N raises the paper score, but exploitability is gated by the application calling MorphOp.apply() on untrusted input - verify whether your deployment actually uses morphology operations.

Exploit ScenarioDerived

An application accepts user-uploaded images and passes them through Pillow's ImageMorph.MorphOp.apply() (e.g., for preprocessing or OCR cleanup). An attacker uploads a crafted PPM or PGM file decoded to a zero-width image; the native morphology routine indexes outrow[width-1], reads/writes out of bounds, and crashes the worker process, causing denial of service. No public exploit code is provided - only the vendor fix commit and a regression test demonstrate the condition.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 19, 2026

Process crash in Pillow before 13.0.0 can be triggered when an application decodes an attacker-supplied PPM or PGM image with zero width and then applies an ImageMorph morphology operation. The flaw is an out-of-bounds memory access in the native morphology routine, and unauthenticated remote attackers can exploit it only when that specific ImageMorph code path is used, resulting in denial of service rather than data exposure or code execution. Vendor-released patch: 13.0.0; no public exploit identified at time of analysis.

RemediationAI

Upgrade Pillow to version 13.0.0, which contains the vendor fix for zero-width and zero-height geometry in the ImageMorph native path. If immediate upgrade is not possible, avoid calling ImageMorph.MorphOp.apply() on untrusted or unvalidated images, and reject PPM/PGM files whose decoded dimensions include zero width or zero height before any morphology operation; these controls trade compatibility with malformed or unusual image inputs for safety. Running image parsing and morphology in a separate, resource-limited process can contain a crash but does not remove the underlying flaw. Refer to the vendor advisory https://github.com/python-pillow/Pillow/security/advisories/GHSA-58r4-6rv3-gfh8 and the 13.0.0 release https://github.com/python-pillow/Pillow/releases/tag/13.0.0 for patch details.

Affected VersionsENISA

Pillow < 13.0.0

Affected Packages

pypi pillow fix: 13.0.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Pillow is a Python imaging library with native C extensions for performance-sensitive operations. The affected code is ImageMorph.MorphOp.apply() in src/_imagingmorph.c, which performs morphology operations such as erosion or dilation on image buffers. PPM and PGM parsing can produce an image with width zero, and the native morphology routine indexes outrow[width - 1] without rejecting that geometry, producing an out-of-bounds memory access classified as CWE-787. The upstream fix adds an early return when width or height is zero and includes a regression test for zero-width images. Although the memory-safety class can include memory corruption, the assessed impact for this CVE is limited to a process crash with no confidentiality or integrity impact; exploitation is constrained to applications that explicitly call ImageMorph on untrusted PPM/PGM input.

Know when Pillow gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 8.7 HIGH
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
vuln.today AI 7.5 HIGH

Attacker-supplied image reaches the parser remotely with no auth or interaction (AV:N/PR:N/UI:N), trivially crafted zero-width input (AC:L), and the only impact is a crash (A:H, C:N/I:N).

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Oct 19, 2026 - 23:18 EUVD
CVE Published
Oct 19, 2026 - 21:17 cve.org
HIGH 8.7

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 89,616 pypi packages depend on pillow (20,283 direct, 70,825 indirect)

Ecosystem-wide dependent count for version 13.0.0.

Technical POC Analysis

CWE-787 (out-of-bounds write) in Pillow's native morphology extension, src/imagingmorph.c.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

Pillow, a widely used Python image processing library, contains a high-severity denial-of-service vulnerability (CVE-2026-112397) that can crash applications when processing maliciously crafted PPM or PGM images with zero width followed by an ImageMorph operation. This affects any service that decodes untrusted images, potentially disrupting availability for end users and downstream systems. Leadership should prioritize upgrading to Pillow 13.0.0 to prevent service outages.

Business Impact: Medium
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 63% exploitable
Prevalence
High
Pillow is the de facto imaging library across the Python ecosystem
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
Medium
Technical Impact
Partial

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

A buffer overflow occurs when a program writes more data to a memory buffer than it was allocated to hold, causing the excess data to spill into adjacent memory regions.

Memory corruption occurs when a program writes data beyond the boundaries of allocated memory regions or accesses memory in unintended ways, violating the integrity of the process's address space.

More in Pillow

View all
CVE-2022-30595 CRITICAL POC
9.8 May 25

libImaging/TgaRleDecode.c in Pillow 9.1.0 has a heap buffer overflow in the processing of invalid TGA image files. Rated

CVE-2026-59204 HIGH POC
8.7 Jul 14

Denial of service in Python Pillow (versions 8.2.0 through 12.2.0) allows remote attackers to exhaust memory during JPEG

CVE-2026-54058 HIGH POC
8.3 Jul 14

Out-of-bounds memory disclosure in Python Pillow before 12.3.0 lets an attacker who supplies a crafted McIdas AREA image

CVE-2026-59197 HIGH POC
8.2 Jul 14

Heap out-of-bounds write in Python Pillow prior to 12.3.0 lets an attacker who controls the rank-filter size parameter c

CVE-2026-59200 HIGH POC
7.5 Jul 14

Uncontrolled memory consumption in Python Pillow (PIL) versions 5.1.0 through 12.2.x allows a remote attacker to cause d

CVE-2021-23437 HIGH POC
7.5 Sep 03

The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb

CVE-2025-48379 HIGH POC
7.1 Jul 01

Pillow is a Python imaging library. In versions 11.2.0 to before 11.3.0, there is a heap buffer overflow when writing a

CVE-2016-4009 CRITICAL
9.8 Apr 13

Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in Pillow before 3.1.1 allows remote

CVE-2014-3007 CRITICAL
10.0 Apr 27

Python Image Library (PIL) 1.1.7 and earlier and Pillow 2.3 might allow remote attackers to execute arbitrary commands v

CVE-2026-96639 CRITICAL
9.8 Oct 21

Pillow versions 11.0.0 through 12.x (fixed in 13.0.0) can reuse a stale native ImagingCore buffer when a multi-frame ima

CVE-2021-34552 CRITICAL
9.8 Jul 13

Pillow through 8.2.0 and PIL (aka Python Imaging Library) through 1.1.7 allow an attacker to pass controlled parameters

CVE-2021-25289 CRITICAL
9.8 Mar 19

An issue was discovered in Pillow before 8.1.1. Rated critical severity (CVSS 9.8), this vulnerability is remotely explo

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy