Skip to main content

Pillow CVE-2026-112894

| EUVDEUVD-2026-104656 HIGH
Inefficient Algorithmic Complexity (CWE-407)
2026-10-19 GitHub_M GHSA-jg86-v3jv-hrpm
8.7
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Upload crafted multi-frame APNG
  2. Delivery
    Application calls Pillow save_all to PDF
  3. Exploit
    Quadratic object-ID reservation loop triggered
  4. Execution
    CPU exhaustion stalls worker
  5. Impact
    Denial 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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.3% exploitation probability (EPSS)

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

Alert me

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

Pillow 5.1.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

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

Vendor (GitHub_M) PRIMARY 8.7 HIGH
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
vuln.today AI 7.5 HIGH

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.

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

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

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

Lifecycle Timeline

2
Patch available
Oct 19, 2026 - 23:18 EUVD
CVE Published
Oct 19, 2026 - 21:55 cve.org
HIGH 8.7

DescriptionCVE.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
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 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

Why It Matters

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.

Business Impact: High
Compensating Controls

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

EPSS Score
0.3%
Top 80% exploitable
Prevalence
High
Pillow is among the most widely deployed Python imaging libraries
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 HIGH
CISA KEV No
Public POC No
EPSS 0.3%
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
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

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