Skip to main content

Pillow EUVDEUVD-2026-107566

| CVE-2026-96778 HIGH
Out-of-bounds Write (CWE-787)
7.7
CVSS 4.0 · Vendor
View

Attack ChainAIDerived

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

  1. Access
    Craft JPEG with buffer-filling ICC profile and comment
  2. Exploit
    Victim application re-saves image as JPEG preserving ICC and comment
  3. Execution
    COM marker write overruns 65536-byte encoder buffer
  4. Impact
    Overwrite adjacent heap memory, crash or execute code

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 an application to re-save an attacker-supplied JPEG using Pillow (9.4.0 through 12.x) while preserving BOTH the image's ICC profile AND a forwarded COM comment. The triggering condition is highly specific: the ICC profile must be sized so it exactly fills the 65536-byte encoder buffer, leaving the COM marker to be written when libjpeg's free_in_buffer counter has been exhausted and then wraps. LIMITING FACTORS: the attack depends on this precise buffer-fill boundary (reflected as AT:P in the CVSS 4.0 vector) and on the host application actively re-encoding/round-tripping the image with metadata preserved (UI:P), making it application-behavior-dependent rather than exploitable against a passive library install; reliable code execution further depends on runtime and heap layout, so a process crash is the more consistently achievable impact.

Impact

This is a genuine memory-corruption flaw (CWE-787 out-of-bounds write) with a write primitive confirmed directly in the source diff: ImagingJpegEncode() in JpegEncode.c wrote a COM marker without first checking free_in_buffer against comment_size+5, and the fix adds exactly that bounds check. The CVSS 4.0 base score is 7.7 (High) with AV:N/AC:L/AT:P/PR:N/UI:P and full H/H/H vulnerable-system impact, reflecting a network-reachable, unauthenticated issue that nonetheless carries a real attack requirement (AT:P) and passive user/application interaction (UI:P). Several real-world mitigating signals cut against treating this as top-priority: no EPSS score was supplied in the input (exploitation probability unknown), the CVE is NOT in CISA KEV, and no public POC/exploit code is referenced - so exploitation status is 'no public exploit identified at time of analysis.' The precondition is narrow and precise: the ICC profile must exactly fill the 65536-byte encoder buffer so that libjpeg writes one byte past an exhausted counter that then wraps - a fragile, heap-layout-dependent condition. The description itself hedges RCE as 'may enable code execution in suitable runtime and heap layouts,' so reliable code execution is unconfirmed and a process crash (DoS) is the more probable practical outcome. Net: a real bug worth patching promptly given Pillow's enormous footprint, but currently a high-CVSS issue without evidence of weaponization or widespread exploitation.

Exploit ScenarioDerived

An attacker uploads a crafted JPEG whose ICC profile is sized to exactly fill Pillow's 65536-byte JPEG encoder buffer and which also carries a forwarded COM comment, to a web service that uses Pillow to re-save uploaded images as JPEG while preserving metadata. When the server re-encodes the image, the COM marker write overruns the buffer and corrupts adjacent heap memory, crashing the worker and potentially enabling code execution depending on heap layout. No public exploit code is referenced in the provided intelligence.

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

AnalysisAIv2 – Oct 21, 2026

Heap-based out-of-bounds write in Pillow's JPEG encoder (9.4.0 through 12.x) can crash a process and may enable code execution when an application re-saves an attacker-supplied image while preserving both an ICC profile and a forwarded COM comment. The flaw is triggered only when the ICC profile exactly fills the 65536-byte encoder buffer, causing libjpeg's free_in_buffer accounting to wrap before the comment is written; exploitation is application-behavior-dependent and heap-layout-sensitive. Vendor-released patch: 13.0.0; no public exploit identified at time of analysis.

Earlier versions of this analysis (1)
v1 Oct 21, 2026 - 20:19

A heap buffer overflow in Pillow's JPEG encoder occurs when an ICC profile large enough to fill the encoder's internal output buffer is supplied together with a JPEG comment, causing the comment write to run past the end of that already-filled buffer. Only applications that pass attacker-influenced ICC profile data and comment strings into Pillow's JPEG save path are reachable - merely opening or decoding a malicious image does not trigger it. Affected are Pillow versions prior to 13.0.0; the Pillow maintainers rate this issue High (GHSA-g7cr-3p24-7wf7), and no CVSS vector, CWE, EPSS score, KEV entry, or public exploit code was available at time of analysis.

RemediationAI

Upgrade to Pillow 13.0.0 or later (vendor-released patch: 13.0.0), which adds a comment-length limit that raises ValueError for overly long comments and a free_in_buffer bounds check before writing the COM marker. If upgrading immediately is not possible, avoid re-saving untrusted JPEGs with ICC profiles and forwarded comments; strip the COM comment and/or ICC profile before encoding, or reject images whose comment exceeds the JPEG marker limit of 65533 bytes. As compensating controls, run image re-encoding in a low-privilege, memory-limited worker and monitor for crashes, accepting the trade-off of metadata loss and possible color-profile fidelity loss when stripping ICC or comment data. See https://github.com/python-pillow/Pillow/security/advisories/GHSA-g7cr-3p24-7wf7 and https://pillow.readthedocs.io/en/stable/releasenotes/13.0.0.html.

Affected VersionsENISA

Pillow 9.4.0, < 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 binds libjpeg through src/libImaging/JpegEncode.c. In ImagingJpegEncode(), a COM marker is emitted with jpeg_write_marker() without ensuring the destination buffer has room for the comment; libjpeg writes one byte before checking free_in_buffer, so if an ICC profile has exactly consumed the 65536-byte buffer, the exhausted counter wraps and attacker-controlled comment data plus subsequent compressed image data can overwrite adjacent heap memory. This is CWE-787 (out-of-bounds write) in a native C extension reachable from Python's JPEG save path in JpegImagePlugin.py when an application round-trips untrusted images with metadata preserved. The source diff confirms the root fix: reject comments above the marker limit and add a comment_size + 5 > free_in_buffer bounds check before writing the COM marker. The CVSS 4.0 vector's AT:P/UI:P and the independent CVSS 3.1 AV:N/AC:H/PR:N/UI:R assessment reflect the precise buffer-fill boundary and the requirement that the host application actively re-encode the image.

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 (CNA) PRIMARY 7.7 HIGH
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 7.5 HIGH

AV:N as the image arrives over the network and PR:N as no authentication is needed; AC:H because the ICC profile must exactly fill the 65536-byte buffer, and UI:R because the application must re-save preserving metadata.

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

Primary rating from Vendor (CNA).

CVSS VectorVendor

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

Lifecycle Timeline

4
Patch available
Oct 21, 2026 - 22:03 EUVD
Analysis Updated
Oct 21, 2026 - 21:33 vuln.today
v2 - CVSS changed
CVSS changed
Oct 21, 2026 - 21:23 NVD
7.7 (HIGH)
CVE Published
Oct 21, 2026 - 19:14 oss-security
MEDIUM

Description PRE-NVD

Disclosed via oss-security. NVD scoring and full description are pending.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 284 pypi packages depend on pillow (263 direct, 21 indirect)

Ecosystem-wide dependent count for version 9.4.0.

Technical POC Analysis

CWE-787 heap-based out-of-bounds write in ImagingJpegEncode() in src/libImaging/JpegEncode.c (state 4, line 330).

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

A high-severity memory corruption flaw in Pillow, the Python imaging library embedded in many web upload, content moderation, and media-processing pipelines, can crash services and, under narrow conditions, enable code execution when untrusted images are re-saved. Any team that ingests and re-encodes user-supplied JPEGs while preserving ICC profiles and forwarded COM comments is in scope, creating a broad availability risk and a potential integrity concern for customer-facing platforms. Because Pillow is often a transitive dependency, leadership should treat this as a supply-chain remediation priority rather than an isolated engineering ticket.

Business Impact: High
Compensating Controls

Apply vendor patch (upgrade to Pillow 13.0.0).

Threat Intelligence Overview

EPSS Score
0.4%
Top 67% exploitable
Prevalence
High
Pillow is the de facto Python imaging library used across countless web apps
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High

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· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
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.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

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-59205 HIGH POC
7.5 Jul 14

Denial-of-service and controlled heap corruption in Python's Pillow imaging library (all versions prior to 12.3.0) occur

CVE-2026-59203 HIGH POC
7.5 Jul 14

Denial of service in Python Pillow 12.0.0 through 12.2.0 lets a remote attacker hang an application by supplying a craft

CVE-2026-59199 HIGH POC
7.5 Jul 14

Denial of service (and potential memory corruption) in Python Pillow before 12.3.0 arises when public image coordinate A

CVE-2026-55379 HIGH POC
7.5 Jul 06

Uncontrolled memory allocation in Python Pillow before 12.3.0 lets a crafted BDF font file exhaust available memory and

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-2026-55380 HIGH POC
7.5 Jul 06

Denial-of-service via memory exhaustion in Python Pillow before 12.3.0 allows a crafted GD-format (.gd) image to trigger

CVE-2026-54060 HIGH POC
7.5 Jul 06

Uncontrolled memory allocation in Python Pillow before 12.3.0 allows a maliciously crafted font file to trigger excessiv

CVE-2026-54059 HIGH POC
7.5 Jul 06

Uncontrolled memory allocation in the Python Pillow imaging library (all versions prior to 12.3.0) allows a crafted PCF

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