Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted image to in-memory TIFF save
-
DeliveryTrigger libtiff seek past buffer end
-
ExploitUndersized realloc in _tiffWriteProc copies out-of-bounds
-
ExecutionCorrupt heap or disclose stale bytes
-
ImpactCrash 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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.
Articles & Coverage 1
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
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.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
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.
libImaging/TgaRleDecode.c in Pillow 9.1.0 has a heap buffer overflow in the processing of invalid TGA image files. Rated
Denial of service in Python Pillow (versions 8.2.0 through 12.2.0) allows remote attackers to exhaust memory during JPEG
Out-of-bounds memory disclosure in Python Pillow before 12.3.0 lets an attacker who supplies a crafted McIdas AREA image
Heap out-of-bounds write in Python Pillow prior to 12.3.0 lets an attacker who controls the rank-filter size parameter c
Uncontrolled memory consumption in Python Pillow (PIL) versions 5.1.0 through 12.2.x allows a remote attacker to cause d
The package pillow 5.2.0 and before 8.3.2 are vulnerable to Regular Expression Denial of Service (ReDoS) via the getrgb
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
Integer overflow in the ImagingResampleHorizontal function in libImaging/Resample.c in Pillow before 3.1.1 allows remote
Python Image Library (PIL) 1.1.7 and earlier and Pillow 2.3 might allow remote attackers to execute arbitrary commands v
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
Pillow through 8.2.0 and PIL (aka Python Imaging Library) through 1.1.7 allow an attacker to pass controlled parameters
An issue was discovered in Pillow before 8.1.1. Rated critical severity (CVSS 9.8), this vulnerability is remotely explo
EUVD-2026-104603
GHSA-332p-7hrc-92wf
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB