Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted PDF to append-enabled service
-
DeliveryReach Image.save PDF append path
-
ExploitPdfParser recurses page tree / trailer chain without cycle guard
-
ExecutionPython stack or CPU/memory exhausted
-
ImpactUncaught RecursionError or hang causes denial of service
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Recursion depth limits
|
| Exploitation Conditions | Exploitation requires the target application to call Pillow's Image.save with PDF append enabled (append=True) against an existing PDF whose contents the attacker can influence or supply - this is the specific feature/deployment prerequisite, and applications that do not append to PDFs are unaffected. The malicious PDF must contain a deep or cyclic page tree, a long chain of unique previous-trailer offsets, or repeated non-cyclic /Kids references to defeat PdfParser's missing cycle/duplication tracking. No authentication, user interaction, or special attack condition is otherwise needed (PR:N/UI:N/AT:N). The principal limiting factor is that PDF append is a non-default, application-specific operation; impact is confined to availability (crash/hang via RecursionError or CPU/memory exhaustion) with no confidentiality or integrity consequence. |
| Impact | All provided signals point to an availability-only denial-of-service issue, not a code-execution or data-exposure threat. The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N) describes a network-reachable, low-complexity, unauthenticated vector with no required attack conditions, and sets VC:N/VI:N/VA:H - confidentiality and integrity are explicitly untouched while availability impact is High, yielding the vendor score of 8.7. CWE-674 (Uncontrolled Recursion) is consistent with the description: unbounded page-tree/trailer-chain traversal exhausts the Python stack or CPU/memory. No EPSS score, KEV listing, SSVC decision, or public POC was supplied; per the input, there is no public exploit identified at time of analysis and no evidence of active exploitation. The headline 8.7 should be read with important caveats the raw CVSS metrics obscure: exploitation is NOT against default usage - it only triggers when an application deliberately calls Image.save with PDF append enabled against an attacker-influenced existing PDF, which is an uncommon code path. The AV:N/PR:N/UI:N metrics therefore describe worst-case exposure, but the realistic attack surface is narrower than the score alone implies. Net: a genuine, easy-to-weaponize DoS for the specific minority of deployments using PDF append, but a lower practical priority than an 8.7 suggests for the broad Pillow install base, since impact is confined to availability and gated by a non-default operation. |
| Exploit ScenarioDerived | An attacker submits a specially crafted PDF (with a deeply nested or cyclic page tree, or many unique trailer offsets, or repeated non-cyclic /Kids references) to an application that appends new pages to it via Pillow's Image.save with PDF append enabled. When PdfParser parses the existing document, it recurses without cycle/duplication tracking and exhausts the Python stack (uncaught RecursionError) or consumes super-linear CPU and memory, crashing or hanging the service before any output is written. No public exploit code is referenced, but the malformed-PDF trigger is simple to construct from the advisory and test additions. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 19, 2026
Denial of service in Pillow (Python imaging library) versions 5.1.0 through 12.x allows remote attackers to crash or hang applications that append images to attacker-influenced PDFs. PdfParser lacks cycle and duplication tracking when following page-tree /Kids references and only guards against exact repeated trailer offsets, so a crafted PDF with a deep or cyclic page tree, repeated non-cyclic /Kids entries, or a long chain of unique previous-trailer offsets can raise an uncaught RecursionError or drive super-linear CPU and memory consumption before any output is written. Exploitation requires the target application to call Image.save with PDF append enabled against a PDF the attacker can supply; no public exploit code has been identified at time of analysis and the issue is not in CISA KEV, though the availability-only impact and trivial prerequisites justify prompt patching to 13.0.0.
RemediationAI
Upgrade to Pillow 13.0.0, the vendor-released patch that removes the recursive page-tree walk, adds /Type validation for page tree nodes, and fixes processed_ids scoping (commit e2ae7eacad6de68c37eb28b633a97bebacf2c5bf; advisory GHSA-p4wg-p73j-c528; release notes at https://github.com/python-pillow/Pillow/releases/tag/13.0.0). If upgrading immediately is not possible, stop passing attacker-supplied or attacker-influenced PDFs to Image.save(..., append=True) - either build new PDFs from scratch (append=False, which never parses an existing trailer/page tree) or fully re-generate the document instead of appending, at the cost of losing incremental-update semantics such as preserved annotations and signatures. Also enforce size and structural limits on uploaded PDFs before they reach Pillow and run PDF-writing code in a worker process with a memory cap and a wall-clock timeout so a RecursionError or runaway CPU/memory growth is contained as a failed job rather than an outage; the trade-off is added latency and the need to restart workers, but no application availability loss. Note that catching RecursionError alone is insufficient because the trailer-chain and duplicate-/Kids paths consume CPU and memory without necessarily recursing.
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's PdfParser (src/PIL/PdfParser.py) resolves the PDF document catalog's page tree by recursively descending /Kids arrays in linearize_page_tree(), and it reconstructs the cross-reference structure by walking /Prev trailer chains. Both traversals are built on recursion and, per CWE-674 (Uncontrolled Recursion), lack depth limits: page-tree descent has no visited-set and trailer-chain following only rejects an exactly repeated offset, so deep or cyclic structures exhaust the Python call stack. An additional logic gap allows repeated references to the same kid object to be expanded multiple times, producing super-linear (roughly quadratic or worse) CPU and memory growth because processed_ids is not shared across the whole traversal. The upstream fix (commit e2ae7eacad6de68c37eb28b633a97bebacf2c5bf, released in 13.0.0) replaces the recursive page-tree walk with an explicit iterator stack, validates that /Type of page tree nodes is /Pages, and scopes processed_ids correctly; the accompanying test writes a 2000-level acyclic page tree and asserts it linearizes without stack exhaustion. PdfParser is the parsing backend used when Pillow writes a PDF in append mode, i.e. Image.save(..., append=True) or the equivalent PdfImagePlugin path, so only applications using that specific write mode reach the vulnerable code. The CPE cpe:2.3:a:python-pillow:pillow:*:*:*:*:*:*:*:* covers the affected version range 5.1.0 up to, but not including, 13.0.0.
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:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
Attacker-supplied PDF processed by an append-enabled service needs no auth or interaction (AV:N/AC:L/PR:N/UI:N); impact is availability-only (A:H, C:N/I:N), matching CWE-674 resource exhaustion.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
Pillow is a Python imaging library. From 5.1.0 until 13.0.0, Pillow can exhaust resources while parsing an existing PDF during an append operation. PdfParser follows page-tree child references without cycle or duplication tracking and follows previous-trailer chains with only an exact repeated-offset guard, so deep or cyclic page trees and long chains of unique trailer offsets can exhaust the Python stack. Repeated non-cyclic /Kids references can also cause super-linear CPU and memory use. An attacker can supply such a PDF to an application that calls Image.save with PDF append enabled. This can raise an uncaught RecursionError or consume excessive CPU and memory before output is written, causing denial of service. This issue is fixed in version 13.0.0.
Blast Radius
ecosystem impact- 21 pypi packages depend on pillow (15 direct, 6 indirect)
Ecosystem-wide dependent count for version 5.1.0.
Technical POC Analysis
CWE-674 (Uncontrolled Recursion) in Pillow's PDF reader, src/PIL/PdfParser.py.
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
Pillow, a widely used Python imaging library, contains a high-severity denial-of-service vulnerability that can crash or hang applications when they append images to attacker-supplied PDFs. Any service or workflow that processes untrusted PDFs through Pillow's PDF save/append functionality faces potential availability loss, which could disrupt customer-facing services and internal operations. Although no public exploit has been identified, the low attack complexity and broad deployment of Pillow make this a priority for remediation.
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
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
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-104657
GHSA-p4wg-p73j-c528
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB