Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessUpload crafted multi-frame APNG
-
DeliveryApplication calls Pillow save_all to PDF
-
ExploitQuadratic object-ID reservation loop triggered
-
ExecutionCPU exhaustion stalls worker
-
ImpactDenial of service
Vulnerability Assessment
| Weakness |
CWE
ASVS 5.0
V2 - Validation and Business Logic Algorithmic complexity limits
|
| Exploitation Conditions | Exploitation requires a consuming application that uses Pillow's Image.save with save_all=True to convert attacker-supplied multi-frame images (e.g. APNG, GIF, TIFF) into a multipage PDF; the quadratic cost scales with the declared/processed frame count, so a small APNG with a large declared frame count is sufficient. Limiting factors: the vulnerable PDF object-ID path is only reached during multi-frame PDF saving - applications that do not perform image-to-PDF conversion, that disable save_all, or that cap/validate frame counts or input size before conversion are not exposed. No authentication is required of the attacker per the CVSS (PR:N), but reachability depends entirely on the host application accepting untrusted images into this conversion workflow. Affected Pillow versions are 5.1.0 through 12.x; 13.0.0 contains the fix. |
| Impact | This is a denial-of-service flaw (CWE-407, inefficient algorithmic complexity) where PdfParser.next_object_id() runs in quadratic time, confirmed by the vendor GHSA-jg86-v3jv-hrpm advisory and the source commit f6a852555f which caches a _max_object_id instead of rescanning all reserved identifiers. The provided CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N) scores 8.7 and reflects a network-reachable, unauthenticated, low-complexity trigger with impact confined to availability (VA:H; VC:N/VI:N/VA:H - no confidentiality or integrity impact). Signals are consistent in direction but modest in real priority: there is NO EPSS score in the input, the CVE is NOT on CISA KEV, and no public exploit or POC is referenced, so there is no evidence of active or widespread exploitation. The high score is driven entirely by easy reachability, not by severe impact - this is a resource-exhaustion DoS, not RCE or data exposure. A meaningful caveat: the CVSS claims PR:N/AV:N, but exploitation is NOT against Pillow in isolation - it requires a downstream application that feeds attacker-supplied multi-frame images into Pillow's save_all PDF conversion path, so the network/unauthenticated rating depends on that application's exposure rather than Pillow itself. |
| Exploit ScenarioDerived | An attacker uploads a crafted multi-frame image - for example a small APNG that declares a very large frame count - to a web application that uses Pillow to convert user images into multipage PDFs with save_all enabled. During conversion, PdfParser reserves object identifiers in quadratic time, pinning a CPU core and stalling or exhausting the worker, degrading or denying service for other users. No public POC is referenced in the available data, and the low attack complexity means a single small file can trigger disproportionate CPU cost. |
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 5.1.0 through 12.x: when an application uses Image.save with save_all=True to convert a multi-frame image (APNG, GIF, TIFF) into a multipage PDF, PdfParser.next_object_id() rebuilds and rescans the entire set of previously reserved PDF object identifiers for every object, producing quadratic runtime in the number of frames. Because the cost scales with the declared frame count, an unauthenticated remote attacker can submit a very small APNG that advertises a huge number of frames and exhaust CPU on the converting service. Active exploitation has not been confirmed (no CISA KEV listing) and no public exploit code was identified at time of analysis, but the trigger is trivial for anyone who can reach an image-to-PDF conversion workflow; the vendor fixed it in Pillow 13.0.0 via GHSA-jg86-v3jv-hrpm.
RemediationAI
Vendor-released patch: upgrade to Pillow 13.0.0, which replaces the per-object max() rescan in PdfParser.next_object_id()/read_pdf_info() with the cached _max_object_id introduced in commit f6a852555f1a1bdff7781abf25f1a3b8bd6ce6cb (see https://github.com/python-pillow/Pillow/releases/tag/13.0.0 and https://github.com/python-pillow/Pillow/security/advisories/GHSA-jg86-v3jv-hrpm); if a full upgrade is blocked, backporting that commit is a low-risk, self-contained change. Where upgrading is not immediately possible, break the exploit chain instead: refuse to run image-to-PDF conversion for untrusted uploads (or drop save_all=True for PDF output), since the vulnerable code is only reached on the multi-frame PDF path - the trade-off is loss of multi-page PDF export. Alternatively, cap accepted frame counts and reject images whose declared n_frames or dimensions exceed a sane limit before calling save, accepting that legitimate long animations will be rejected. Add hard CPU and wall-clock limits (RLIMIT_CPU, request timeouts) or run conversions in an isolated worker/container with a process-level timeout so a quadratic run is killed rather than degrading the whole service; this bounds damage but does not remove the algorithmic cost. Also validate and re-encode untrusted inputs through a format allowlist to strip suspicious declared frame counts. Monitor for unusually long PDF-conversion jobs as a detection signal.
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
The flaw is an instance of CWE-407 (inefficient algorithmic complexity) inside Pillow's pure-Python PDF writer, src/PIL/PdfParser.py. PdfParser reserves PDF indirect object identifiers through next_object_id(), which previously derived the next identifier by taking max(self.xref_table.keys()) + 1 - a full rebuild-and-scan of every identifier already reserved. When Pillow writes a multipage PDF from a multi-frame image with save_all=True, one object identifier is reserved per frame/page, so the repeated scans make total work grow quadratically with frame count rather than linearly. Attacker control over the frame count is the lever: format parsers honour declared frame counts, so a physically tiny APNG (or GIF/TIFF) declaring a very large number of frames forces the writer into an arbitrarily long CPU loop while memory and bandwidth stay low. The upstream fix (commit f6a852555f1a1bdff7781abf25f1a3b8bd6ce6cb, shipped in release 13.0.0) adds a cached self._max_object_id to the xref table that is updated on insertion and reuses it in read_pdf_info() instead of recomputing max() over all keys, restoring roughly linear behaviour. Note that the vulnerable code path is only reached during multi-frame PDF serialization - normal image decoding, other save formats, and single-frame saves do not exercise it.
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
Network-reachable via uploaded image, no auth or privileges needed (PR:N) and low complexity; impact is CPU-exhaustion DoS only, so A:H with C:N/I:N and unchanged scope.
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 takes quadratic time to reserve PDF object identifiers when saving many frames with save_all enabled. PdfParser.next_object_id() repeatedly rebuilds and scans all previously reserved identifiers for every object. An attacker can supply a multi-frame image, including a small APNG with a large declared frame count, to an application that converts it to a multipage PDF. This can consume excessive CPU and deny 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-407 (Inefficient Algorithmic Complexity), triggered on the PDF writer path, not the reader.
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 5.1.0 through 12.x contain a high-severity denial-of-service flaw that can exhaust CPU in services converting multi-frame images such as APNG, GIF, and TIFF to PDF via Image.save with save_all=True. Any team operating image-to-PDF pipelines that accept untrusted uploads should treat this as an availability risk, because a tiny crafted image can consume disproportionate processing time and degrade or halt document conversion for legitimate users. Leadership should prioritize inventory and upgrade to Pillow 13.0.0.
Vendor-released patch: 13.0.0; apply vendor patch. Until deployment, restrict save_all=True PDF conversion to trusted images, enforce strict declared-frame-count limits before processing, cap CPU/memory/time per conversion, and isolate conversion workers behind rate limiting.
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
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-104656
GHSA-jg86-v3jv-hrpm
NVD
CVE.org
EPSS
Vulnrichment
Exploit-DB