CVE-2026-112891: Pillow: Quadratic GIF comment copying during save
On Pillow 12.3.0 and upstream main (ad277e2761b489681e71b51e91367d46b0ceabb9), a GIF with a long comment makes getglobalheader() copy portions of the comment repeatedly when saving, including comments carried over from untrusted images. I suggest provisional Moderate severity for crafted-image CPU denial of service, with CVSS-B 6.9 assuming a network service automatically opens unauthenticated uploads and they are resaved as GIFs; impact depends on input-size, concurrency, and worker CPU limits.
Other sources
Pillow is a Python imaging library. From 9.2.0 until 13.0.0, Pillow performs quadratic copying when saving a GIF with a long comment. getglobalheader() repeatedly copies portions of comment data while assembling the global header, including comments retained from an untrusted input image. An attacker can supply an image with a large GIF comment to an application that saves it as GIF. This can consume excessive CPU and delay or deny service. This issue is fixed in version 13.0.0.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/pillowto a version that resolves this vulnerability.Fixed in 13.0.0 - Upgrade
Upgrade
bitnami/pillowto a version that resolves this vulnerability.Fixed in 13.0.0 - Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which applications are exposed to this issue?
Applications using Pillow versions 9.2.0 through versions before 13.0.0 are exposed if they accept GIF images from untrusted sources and save or re-save them as GIF files. The risk is tied to processing images that contain large GIF comments.
What must an attacker do to trigger the denial of service?
An attacker must provide a GIF containing a large comment to an application that later saves the image as a GIF. During GIF header construction, Pillow repeatedly copies comment data, causing excessive CPU consumption.
Is authentication or user interaction required?
No. The supplied CVSS vector indicates network reachability with low attack complexity, no privileges required, and no user interaction required; however, the application must process and save the attacker-controlled GIF as GIF.
What is the remediation?
Upgrade Pillow to version 13.0.0, which fixes the issue. If upgrading is not immediately possible, avoid saving untrusted GIF inputs as GIF files, particularly inputs that may retain embedded comments.