CVE-2026-112406 in Pillow
Summary
by MITRE • 10/20/2026
Pillow is a Python imaging library. From 5.1.0 until 13.0.0, Pillow can enter an infinite loop while rewriting PDF pages. PdfParser.rewrite_pages() follows Parent relationships without detecting a cycle in the page tree. An attacker can supply a cyclic PDF to an application that appends an image to that PDF. This can hold the worker at full CPU and deny service. This issue is fixed in version 13.0.0.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Analysis
by VulDB Data Team • 10/20/2026
The vulnerability identified within the Pillow Python imaging library, specifically affecting versions from 5.1.0 through 13.0.0, represents a significant availability risk due to an infinite loop condition triggered during PDF processing operations. This flaw is rooted in the internal implementation of the PdfParser.rewrite_pages() method, which is responsible for manipulating and reconstructing page structures within Portable Document Format files. The core technical deficiency lies in the traversal logic used to follow Parent relationships within the PDF object hierarchy. When parsing or rewriting pages, the library recursively navigates up the document tree structure without implementing any mechanism to detect cycles or visited nodes. In a well-formed PDF, this parent-child relationship forms a directed acyclic graph; however, when an attacker crafts a maliciously constructed cyclic PDF where page objects reference each other in a loop, the parser enters an infinite recursive cycle. This behavior effectively traps the processing thread, causing it to consume CPU resources continuously without making progress or returning control to the application logic.
From an operational perspective, this vulnerability poses a severe threat to services that utilize Pillow for image manipulation tasks involving PDF files, such as appending images to existing documents or converting formats. If an untrusted user can upload or supply a cyclic PDF file to an application leveraging these vulnerable versions of Pillow, they can trigger the infinite loop remotely. The immediate consequence is a denial of service condition where the affected worker process becomes unresponsive and consumes one hundred percent of its allocated CPU time slice. In environments utilizing multi-threaded web servers or asynchronous task queues, this single malicious request can exhaust available threads or processes, leading to broader system instability and preventing legitimate users from accessing services. The impact is particularly acute in cloud-native or serverless architectures where resource limits are enforced per instance, as the runaway process may trigger automatic scaling events or incur excessive costs due to prolonged execution times before being forcibly terminated by infrastructure-level timeouts.
This vulnerability aligns with Common Weakness Enumeration CWE-835, which describes a loop involving unnecessary repetition, and more specifically reflects issues related to improper input validation that fails to detect structural anomalies in file formats. In the context of the MITRE ATT&CK framework, this exploit technique corresponds to T1496 Resource Hijacking, where an adversary uses computing resources for their own benefit or causes disruption by exhausting system capacity. The attack vector is classified as remote with low complexity, requiring only a single crafted PDF file to be processed by the vulnerable application component. It does not require authentication if the service accepts untrusted uploads, making it a high-risk vulnerability in public-facing applications that handle document processing workflows.
The recommended mitigation strategy involves upgrading the Pillow library to version 13.0.0 or later, where this logic has been corrected to include cycle detection mechanisms during page tree traversal. For organizations unable to upgrade immediately due to dependency constraints, implementing input validation at the application layer is critical. This includes restricting file uploads to trusted sources only and employing sandboxing techniques such as running PDF processing tasks in isolated containers with strict CPU time limits or memory quotas. Additionally, integrating a separate PDF parsing library for initial structural analysis before passing data to Pillow can provide an additional layer of defense against malformed inputs. Security teams should also monitor application logs for signs of high CPU utilization associated with specific user sessions or upload endpoints to detect potential exploitation attempts in real-time.