PyPI: pillow

CVE-2026-112891

Safety vulnerability ID: SFTY-20261021-20388

Affected versions of the Pillow package are vulnerable to Inefficient Algorithmic Complexity due to repeated copying of comment data when saving GIF images. The `_get_global_header()` function processes long GIF comment blocks in a manner that results in quadratic time complexity, as portions of the comment are repeatedly copied rather than handled in a single pass. An attacker can exploit this by supplying a crafted GIF containing an unusually long comment to a service that automatically processes and resaves untrusted images in GIF format, causing excessive CPU consumption and resulting in a Denial of Service condition.

Created at: Oct 22, 2026Updated at: Oct 22, 2026

Overview

Pillow: Quadratic GIF comment copying during save

Advisory

pillow – Inefficient Algorithmic Complexity

Affected Package

Affecting pillow package, versions>= 9.2.0, < 13.0.0

Also affects

---

How to Fix

Upgradepillowto13.0.0or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more