Skip to main content

Python Pillow CVE-2026-112393

| EUVDEUVD-2026-104603 CRITICAL
Heap-based Buffer Overflow (CWE-122)
2026-10-19 GitHub_M GHSA-332p-7hrc-92wf
9.2
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Submit crafted image to in-memory TIFF save
  2. Delivery
    Trigger libtiff seek past buffer end
  3. Exploit
    Undersized realloc in _tiffWriteProc copies out-of-bounds
  4. Execution
    Corrupt heap or disclose stale bytes
  5. Impact
    Crash process or execute code

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Heap buffer bounds checking
MITRE ATT&CK

1 technique across 1 tactic: Execution

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

Exploitation Conditions

Exploitation requires the application to SAVE a COMPRESSED TIFF (e.g. PackBits or LZW compression) through libtiff to a write target that lacks a usable fileno() - specifically an in-memory stream such as io.BytesIO rather than a filesystem path or real file descriptor. The attacker must control either an out-of-line TIFF tag value or a retained ICC profile so that libtiff seeks forward past the current buffer during directory writing, triggering the undersized reallocation in _tiffWriteProc. The separate stale-heap disclosure variant additionally requires compressed TIFF output larger than 64 KiB (producing unwritten alignment gaps) but needs no crafted tag. LIMITING FACTORS: file paths and targets backed by real file descriptors are explicitly unaffected; uncompressed saves fall outside the described path; and the CVSS AC:H/AT:P reflect that the precise seek-past-end timing and buffer layout must be met, raising the bar beyond a trivial trigger.

Impact

The input CVSS 4.0 vector (AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H) yields a 9.2 (Critical) driven by full triad impact and unauthenticated network reachability, but two attenuating metrics are explicitly present: AC:H (high complexity) and AT:P (a specific attack requirement). This is consistent with the description, which conditions exploitation on a narrow, non-default code path - saving COMPRESSED TIFF through libtiff to an in-memory target lacking a usable fileno() (e.g. BytesIO), with attacker influence over an out-of-line TIFF tag or a retained ICC profile. There is no EPSS score, no CISA KEV listing, and no SSVC decision data in the input, so real-world exploitation probability cannot be quantified from the provided signals. No public exploit was identified; the GitHub 'source code evidence' is the vendor fix commit and its regression test, NOT weaponized exploit code, and must not be conflated with a POC or with active exploitation. Net assessment: the raw score overstates immediate priority. The RCE claim is itself hedged by the advisory ('may allow code execution'), and the more reliably reproducible outcome is a process crash (DoS) or stale-heap memory disclosure. This is a genuine, patch-worthy memory-safety flaw in a very widely used library, but the specific trigger conditions make it closer to a high-CVSS / moderate-real-risk issue absent evidence of exploitation. Verify applicability against your own code paths: environments that only save to real file descriptors/paths are unaffected.

Exploit ScenarioDerived

A web service uses Pillow to re-encode user-supplied images to compressed TIFF in memory (BytesIO) - for example a thumbnail or format-conversion pipeline - and returns or stores the result. An attacker submits an image carrying a crafted out-of-line TIFF tag or an oversized retained ICC profile so that, when libtiff seeks forward while writing the directory, the _tiffWriteProc callback copies data beyond an allocation sized from the stale prior buffer length, corrupting the heap. No public exploit code exists; realistic outcomes range from a reliable process crash (DoS) and disclosure of stale heap bytes to, less reliably, code execution, and the high attack complexity (AC:H/AT:P) means the specific in-memory save path and tag layout must be met.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available 0.5% exploitation probability (EPSS)

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

Alert me

AnalysisAIv1 – Oct 19, 2026

Heap buffer overflow and stale-heap disclosure in Pillow's compressed TIFF save path can crash the process and potentially enable code execution when an application writes TIFF data to an in-memory stream such as io.BytesIO. Affected are Pillow versions 2.0.0 through 12.x (fixed in 13.0.0) that use libtiff and process attacker-influenced out-of-line TIFF tags or retained ICC profiles; file paths and targets with real file descriptors are not affected. The flaw requires a specific combination of compressed saving, seek-past-end behavior, and controlled tag data (AC:H/AT:P), and no public exploit code has been identified at time of analysis.

RemediationAI

Upgrade to Pillow 13.0.0, which contains the vendor fix for _tiffWriteProc and is available at https://github.com/python-pillow/Pillow/releases/tag/13.0.0; the patch commit is https://github.com/python-pillow/Pillow/commit/11582e5ffbdceb973d5ee593f3105af5a9852b40 and the advisory is https://github.com/python-pillow/Pillow/security/advisories/GHSA-332p-7hrc-92wf. If immediate upgrade is not possible, avoid saving compressed TIFF data to io.BytesIO or other non-fileno targets-write to a temporary file path or a real file descriptor instead, though this changes in-memory workflow design and may introduce filesystem I/O overhead. Additionally, avoid processing attacker-controlled TIFF tag values or ICC profiles until patched, or disable TIFF saving from untrusted input entirely; this prevents the seek-past-end trigger but may break legitimate TIFF export features. Note that the stale-heap disclosure variant can occur with compressed TIFF output larger than 64 KiB even without a crafted tag, so restricting compressed TIFF saves to trusted, non-sensitive contexts is advisable as a compensating control.

Affected VersionsENISA

Pillow 2.0.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 delegates TIFF encoding to libtiff through a callback, _tiffWriteProc, which manages an in-memory write buffer for targets without a usable fileno(), such as io.BytesIO. The root cause is CWE-122 (heap-based buffer overflow): the callback sizes its reallocation from the prior buffer size (state->size) instead of the current write position (state->loc). When libtiff seeks forward past the current buffer during directory writing-triggered by an attacker-controlled out-of-line TIFF tag value or a retained ICC profile-the subsequent write is copied beyond the allocated heap buffer. This can crash the process and may allow code execution. Independently, compressed TIFF output larger than 64 KiB can contain unwritten alignment gaps that disclose stale heap bytes without requiring a crafted tag. The CPE cpe:2.3:a:python-pillow:pillow:*:*:*:*:*:*:*:* confirms all Pillow versions are in scope, with the vendor advisory and commit showing the fix zeroes new buffer space and bases growth on the current location. File paths and targets backed by real file descriptors bypass the vulnerable in-memory callback path.

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 9.2 CRITICAL
CVSS:4.0/AV:N/AC:H/AT:P/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
vuln.today AI 8.1 HIGH

AV:N because attacker-influenced image/ICC data can arrive remotely and PR:N/UI:N as no auth or interaction is stated; AC:H because the in-memory compressed-TIFF save path and seek-past-end layout must be met.

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

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
High
Attack Requirements
Present
Privileges Required
None
User Interaction
None
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

2
Patch available
Oct 19, 2026 - 22:03 EUVD
CVE Published
Oct 19, 2026 - 20:46 cve.org
CRITICAL 9.2

DescriptionCVE.org

Pillow is a Python imaging library. From 2.0.0 until 13.0.0, Pillow has a heap buffer overflow and stale-heap disclosure in _tiffWriteProc when saving compressed TIFF data through libtiff to a target without a usable fileno(), such as BytesIO. The callback sizes its allocation from the prior buffer size instead of the current write position, allowing an attacker-controlled out-of-line TIFF tag or retained ICC profile to be copied beyond the allocation after libtiff seeks forward. This overflow can crash the process and may allow code execution. Independently, unwritten alignment gaps in compressed TIFF output larger than 64 KiB can disclose stale heap bytes without a crafted tag. File paths and targets with real file descriptors are unaffected. This issue is fixed in version 13.0.0.

Technical POC Analysis

CWE-122 heap buffer overflow in Pillow's libtiff in-memory write callback tiffWriteProc in src/libImaging/TiffDecode.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 versions 2.0.0 through 12.x carry a critical heap-handling flaw in the compressed TIFF save path used with in-memory streams such as io.BytesIO, creating a credible risk of service crashes and, under narrow conditions, code execution in applications that process attacker-influenced TIFF tags or ICC profiles. Leadership should treat this as a high-priority remediation item for image-processing pipelines because a single crafted TIFF could disrupt availability or compromise a host, even though no public exploit has been identified at time of analysis. The vendor-released fix is Pillow 13.0.0; environments that save TIFFs only to real file paths are not affected by this specific path.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.5%
Top 56% exploitable
Prevalence
High
Pillow is the de facto Python imaging library, embedded across countless web and data services
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 CRITICAL
CISA KEV No
Public POC No
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
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
No
Human Impact
High
Technical Impact
Total

Priority Score

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

A heap overflow occurs when a program writes data beyond the bounds of a buffer allocated in the heap memory region.

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-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