CVE-2026-112399: Pillow Memory Allocation Vulnerability Due to APNG Background Disposal
Summary
CVE-2026-112399: Pillow: APNG background disposal allocates full canvas before decompression bomb check. Affects pillow versions >= 8.1.0, < 13.0.0. Fixed in 13.0.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
Pillow is a widely-used Python Imaging Library that provides extensive capabilities for opening, manipulating, and saving various image file formats. It supports features such as image processing, drawing, and image file format conversions. However, a vulnerability has been identified in Pillow's handling of animated PNG (APNG) files, specifically related to background disposal operations, which can lead to excessive memory allocation and potential denial of service.
Vulnerability Detail
The vulnerability arises from the way Pillow allocates memory for APNG background disposal images before performing a decompression bomb check. When an APNG file with a large declared size is opened, Pillow allocates memory based on the image dimensions, which can lead to significant memory spikes. For instance, an APNG file claiming dimensions of 22000x22000 pixels can cause Pillow to allocate approximately 1.9 GB of memory. If the claimed size exceeds the available memory, the operating system may terminate the process, resulting in a denial of service. This issue is rooted in the _seek() method of the PngImageFile class, where the memory allocation occurs before the decompression bomb check is executed.
How To Fix
Latest published version: 13.0.0 as of 22 Oct 2026
pip install --upgrade "pillow==13.0.0"
The newest release already contains this fix.
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, avoid opening untrusted APNG files with Pillow until the library is updated. Additionally, consider implementing checks on the image dimensions before processing to prevent excessive memory allocation.
Conclusion
In summary, CVE-2026-112399 presents a significant risk to applications using the Pillow library for image processing, particularly when handling untrusted APNG files. Users are strongly advised to update to the latest version of Pillow to mitigate this vulnerability and ensure the stability and security of their applications.
See every vulnerability recorded for pillow →
FAQ
CVE-2026-112399 is a vulnerability in the Pillow library that allows for excessive memory allocation when opening certain animated PNG files, potentially leading to denial of service.
If your application uses Pillow to process images, it may be susceptible to memory spikes and crashes when handling untrusted APNG files, especially those with large dimensions.
The vulnerability affects Pillow versions from 8.1.0 up to, but not including, 13.0.0.
You can use Vulert, which monitors open-source vulnerabilities in your software. By utilizing the Vulert playground, you can check if your application is affected by this vulnerability without needing to sign up.
The CVSS score for this vulnerability is 8.7, indicating a high severity level.
References
Related vulnerabilities
Recent vulnerabilities recorded for pillow.