CVE-2026-112894 in Pillowinfo

Summary

by MITRE • 10/20/2026

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.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 10/20/2026

The vulnerability identified within the Pillow Python imaging library represents a significant algorithmic inefficiency classified as a ReDoS-like resource exhaustion flaw, specifically falling under CWE-400: Uncontrolled Resource Consumption. The core technical defect resides in the PdfParser.next_object_id() function, which is responsible for managing and assigning unique identifiers to objects when saving PDF files. In versions ranging from 5.1.0 through 13.0.0, this function employs a naive approach where it repeatedly rebuilds and scans all previously reserved object identifiers every time a new identifier is required. This results in quadratic time complexity relative to the number of frames being processed. Consequently, as the volume of data increases, the computational cost does not grow linearly but rather exponentially, creating a severe performance bottleneck that can be exploited by malicious actors.

From an operational perspective, this vulnerability poses a direct risk to availability through Denial of Service attacks. An attacker can craft a multi-frame image file, such as an APNG with a deceptively large declared frame count but minimal actual data payload, and submit it to any application that utilizes Pillow for conversion into multipage PDFs. When the library processes this input, the PdfParser must iterate through an increasingly large list of existing identifiers for every single new object created. This excessive CPU consumption can rapidly exhaust system resources, causing the hosting service or application to become unresponsive or crash entirely. The impact is particularly acute in environments where image processing is performed on demand by multiple users, as a few malicious requests can degrade performance for all other legitimate traffic.

This behavior aligns with ATT&CK technique T1496: Resource Hijacking, specifically the sub-technique of using computational resources to disrupt service availability. The vulnerability highlights the importance of efficient data structure selection in security-critical libraries. By failing to use a more appropriate data structure such as a hash map or an incrementing counter with collision resolution, Pillow inadvertently created a vector for algorithmic complexity attacks. Such vulnerabilities are often overlooked because they do not involve memory corruption or code execution but rather degrade service quality through inefficient processing logic.

The issue has been addressed in version 13.0.0 of the library by optimizing the object identifier reservation process to eliminate the quadratic scanning behavior. To mitigate this risk, organizations relying on Pillow for image processing workflows must ensure that their dependencies are updated to version 13.0.0 or later immediately. For systems where an immediate upgrade is not feasible due to compatibility constraints, implementing strict input validation and rate limiting can provide a temporary layer of defense. This includes enforcing maximum limits on the number of frames allowed in uploaded images and monitoring CPU usage patterns for anomalies indicative of resource exhaustion attacks. Regular security audits of third-party dependencies are essential to identify similar algorithmic vulnerabilities before they can be exploited in production environments.

Responsible

GitHub M

Reservation

10/19/2026

Disclosure

10/20/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!