Skip to main content

Python Pillow CVE-2026-59197

| EUVDEUVD-2026-43734 HIGH
Out-of-bounds Write (CWE-787)
2026-07-14 GitHub_M GHSA-xj96-63gp-2gmr
8.2
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Reach image endpoint exposing filter size
  2. Delivery
    Submit oversized odd rank-filter size
  3. Exploit
    image.expand computes overflowed margin
  4. Execution
    ImagingExpand under-allocates buffer
  5. Persist
    Native heap out-of-bounds write
  6. Impact
    Worker crash or memory corruption

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 that the application pass an attacker-influenced filter size into ImageFilter.RankFilter (or its MedianFilter/MinFilter/MaxFilter subclasses), or otherwise reach im.expand() with an attacker-controlled margin, on Pillow before 12.3.0; the concrete trigger is a very large odd filter size (the regression test uses 23171) whose size//2 margin overflows signed-int arithmetic in native ImagingExpand(). What limits exploitation: in typical deployments the rank-filter size is a fixed developer constant, not user-supplied, so the vulnerable path is unreachable unless the app explicitly exposes the size parameter to untrusted input; there is no authentication or user-interaction requirement at the Pillow level (PR:N/UI:N), but reachability is the real gating factor rather than raw network access.

Impact

The NVD CVSS 3.1 base is 8.2 (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H): network vector, no privileges, no user interaction, low integrity impact and high availability impact, with no confidentiality loss - consistent with a memory-corruption bug that most reliably yields a crash/DoS and only conditionally something more. No EPSS score, KEV entry, or POC was supplied, so exploitation-in-the-wild signal is absent: treat this as 'no public exploit identified at time of analysis,' not a low-risk issue by default. The key caveat is the AV:N/PR:N/UI:N rating assumes an attacker can supply the filter size; in practice the rank-filter size is almost always a fixed, developer-chosen constant, not attacker-controlled input, so real-world reachability depends heavily on whether an application exposes RankFilter/MedianFilter/MinFilter/MaxFilter size to untrusted callers. Where it is exposed, this is a genuine remote memory-corruption priority; where size is hard-coded (the common case), practical risk drops to near-zero regardless of the high base score. Verify the data flow in your own code before triaging as network-exploitable.

Exploit ScenarioDerived

An application exposes an image-processing endpoint that lets a user choose a rank/median filter radius, and passes that value into ImageFilter.RankFilter without an upper bound. An attacker submits a very large odd filter size, causing image.expand() to trigger the unchecked signed-int overflow in ImagingExpand() and a heap out-of-bounds write, crashing the worker process (denial of service) with the potential for further memory corruption. No public POC is identified at time of analysis, though the fixing PR includes a regression test demonstrating the triggering size (23171).

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 – Jul 14, 2026

Heap out-of-bounds write in Python Pillow prior to 12.3.0 lets an attacker who controls the rank-filter size parameter corrupt native heap memory and crash or potentially manipulate the process. ImageFilter.RankFilter.filter() calls image.expand(size // 2, size // 2) before validating the filter size, and the native ImagingExpand() routine computes output dimensions using unchecked signed-int arithmetic, so a very large odd size overflows and drives an out-of-bounds write (CWE-787). No public exploit is identified at time of analysis; the flaw is fixed in Pillow 12.3.0.

RemediationAI

Vendor-released patch: upgrade Pillow to 12.3.0 or later (pip install --upgrade 'Pillow>=12.3.0'), which adds bounds validation in both ImageFilter.py and the native ImagingExpand() path; see the advisory at https://github.com/python-pillow/Pillow/security/advisories/GHSA-xj96-63gp-2gmr and the tagged release https://github.com/python-pillow/Pillow/releases/tag/12.3.0. If you cannot upgrade immediately, the effective compensating control is to ensure the rank-filter size is never derived from untrusted input: hard-code or clamp the size argument to RankFilter, MedianFilter, MinFilter, and MaxFilter (for example reject any size where size*size*4 exceeds 2**31-1, mirroring the upstream check) at the application boundary before the value reaches Pillow. The trade-off is minimal since legitimate rank-filter sizes are tiny; the only side effect is rejecting the abnormally large sizes that legitimate image processing never uses.

Affected VersionsENISA

Pillow < 12.3.0

Affected Packages

pypi pillow fix: 12.3.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 the dominant Python imaging library (a maintained fork of PIL) used for loading, transforming, and filtering images across web apps, ML pipelines, and desktop tooling. The defect lives in the C acceleration layer (src/libImaging/Filter.c): ImagingExpand(imIn, margin) grows an image by a margin equal to size // 2 to accommodate the rank filter's neighborhood, then allocates and writes an expanded buffer. Output dimensions and the allocation size are derived from margin * margin * sizeof(FLOAT32) using signed 32-bit int math with no overflow guard, so a large margin wraps past INT_MAX and yields an undersized allocation relative to the write loop - a classic CWE-787 out-of-bounds write. Because the Python-level RankFilter.__init__ performed no upper-bound check on size before reaching native code, the guard could be bypassed entirely. The fix adds two independent checks: a Python-side 'size * size * 4 > 2**31-1' rejection in ImageFilter.py and a native 'margin > INT_MAX / (margin * sizeof(FLOAT32))' guard in Filter.c, both raising 'filter size too large'.

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.2 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
vuln.today AI 6.5 MEDIUM

Network-reachable only where the app exposes filter size to untrusted input, so AC:H; no auth at Pillow level (PR:N); crash-dominant (A:H) with limited memory-write integrity impact (I:L) and no confidentiality loss.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:L/A:H
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:L/VA:H/SC:N/SI:N/SA:N
SUSE 6.8 MEDIUM
AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H
Red Hat 8.2 HIGH

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
Low
Availability
High

Lifecycle Timeline

2
Patch available
Jul 14, 2026 - 18:20 EUVD
CVE Published
Jul 14, 2026 - 16:25 cve.org
HIGH 8.2

DescriptionCVE.org

Pillow is a Python imaging library. Prior to 12.3.0, Pillow's public rank-filter API can trigger a native heap out-of-bounds write when given a very large odd filter size because ImageFilter.RankFilter.filter() calls image.expand(size // 2, size // 2) before rank-filter size validation and ImagingExpand() computes output dimensions with unchecked signed int arithmetic. This issue is fixed in version 12.3.0.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 6,879 pypi packages depend on pillow (1,431 direct, 5,517 indirect)

Ecosystem-wide dependent count for version 12.3.0.

Executive ViewAI

Why It Matters

Python Pillow versions prior to 12.3.0 contain a heap memory corruption vulnerability in image filtering that could lead to service crashes or code execution when processing attacker-controlled image parameters. Organizations relying on Pillow for image processing operations face immediate risk of denial of service and potential system compromise. Prompt upgrade to version 12.3.0 is required to eliminate this exposure.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 68% exploitable
Prevalence
Ubiquitous
core imaging library across most Python web, ML, and tooling stacks
Threat Intel
1
1 source
Exploit
POC
Public exploit code exists
Data Quality
6 sources
Confidence: High
EUVD NVD CVE.org EPSS GHSA Vendor GitHub VulDB

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 Yes
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· derived
Out-of-Cycle
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

61
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: +20
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-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

CVE-2020-5312 CRITICAL
9.8 Jan 03

libImaging/PcxDecode.c in Pillow before 6.2.2 has a PCX P mode buffer overflow. Rated critical severity (CVSS 9.8), this

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Module for Package Hub 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS Affected
SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS Affected
SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS Affected
SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS Affected

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