CVE-2026-112391 in Pillowinfo

Summary

by MITRE • 10/20/2026

Pillow is a Python imaging library. From 5.1.0 until 13.0.0, Pillow's PdfParser.get_value() can recurse without a limit while reading nested PDF objects. The parser follows attacker-controlled arrays and dictionaries when an existing PDF is opened for append. An attacker can provide a deeply nested PDF to an application that saves an image with PDF append enabled. This can raise an uncaught RecursionError or terminate the worker, causing denial of 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 in Pillow versions ranging from 5.1.0 through 13.0.0 stems from a critical flaw within the PdfParser.get_value() method, which lacks adequate recursion depth limits when processing nested PDF objects. As a widely adopted Python imaging library used for opening, manipulating, and saving images across various formats including Portable Document Format, Pillow is frequently integrated into web applications and automated pipelines that handle user-uploaded content. The specific technical failure occurs during the parsing phase where the parser traverses arrays and dictionaries within a PDF structure. When an application utilizes the append mode to modify an existing PDF file rather than creating a new one from scratch, it invokes this vulnerable code path. An attacker can craft a maliciously constructed PDF document containing deeply nested structures that exploit this lack of boundary enforcement.

From a technical perspective, the core issue is an unbounded recursion mechanism inherent in how the parser resolves references to other objects within the file structure. Standard PDF parsing logic often requires following indirect object references, which may themselves point to arrays or dictionaries containing further references. Without a maximum depth counter or stack limit check, the Python interpreter will continue diving deeper into these nested structures until it exhausts available call stack memory. This behavior transforms what should be a simple data extraction process into an infinite loop of function calls that inevitably triggers a RecursionError exception in standard CPython environments or causes abrupt termination of worker processes in asynchronous frameworks like asyncio or threaded web servers.

The operational impact of this vulnerability is primarily centered on Denial of Service conditions within applications relying on Pillow for PDF processing tasks involving append operations. Because the error manifests as an uncaught exception, it can crash individual application threads or workers depending on how the underlying framework handles exceptions in image processing pipelines. In high-traffic environments such as content management systems, document conversion services, or email gateways that scan attachments, a single maliciously crafted PDF upload could destabilize the entire service by exhausting system resources through repeated crashes or memory consumption associated with stack overflow attempts. This represents a significant availability risk for any production environment where untrusted users can influence input data processed via Pillow's append functionality.

This vulnerability aligns closely with CWE-674, which describes Uncontrolled Recursion in non-recursive algorithms, as the code fails to limit the depth of recursive calls based on external input structure. Furthermore, it maps to MITRE ATT&CK technique T1499, Endpoint Denial of Service, specifically under the sub-category of Resource Exhaustion via Overflow or Loop, where an attacker leverages inefficient resource handling logic to degrade service availability rather than executing arbitrary code. The attack vector is classified as remote with low complexity since it requires only a single crafted file upload and does not necessitate authentication if append functionality is exposed publicly.

Mitigation strategies must prioritize immediate upgrading of the Pillow library to version 13.0.0 or later, where this recursion limit has been properly implemented by the maintainers. For organizations unable to upgrade immediately due to dependency constraints, defensive coding practices should be employed within application layers that interface with Pillow. This includes implementing strict file size limits and depth checks on uploaded PDFs before they are passed to any parsing functions. Additionally, wrapping image processing operations in try-except blocks capable of catching RecursionError can prevent worker crashes from propagating to the broader service infrastructure, although this serves only as a temporary compensatory control rather than a root cause fix. Security teams should also audit their use cases for PDF append functionality and consider whether alternative libraries with more robust parsing engines might be suitable for handling untrusted document inputs in high-risk environments.

Responsible

GitHub M

Reservation

10/19/2026

Disclosure

10/20/2026

Moderation

accepted

EPSS

0.00000

KEV

no

Activities

low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!