CVE-2026-96643: Pillow: PNG eXIf chunk makes EXIF parsing run in quadratic time
Pillow is a Python imaging library. From 11.0.0 until 13.0.0, Exif.load() in src/PIL/Image.py repeatedly slices the remaining EXIF data while it begins with the six-byte Exif header. src/PIL/PngImagePlugin.py accepts an uncapped PNG eXIf chunk, so a file filled with repeated headers causes a new shrinking copy on every iteration and quadratic CPU work. The condition is reachable through Image.getexif(), Image.getexif(), and ImageOps.exiftranspose(), including common photo-upload rotation workflows. This issue is fixed in version 13.0.0.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
Pillowto a version that resolves this vulnerability.Fixed in 13.0.0
Event History
Frequently Asked Questions
Which deployments are realistically exposed to this issue?
Deployments using Pillow versions 11.0.0 through versions before 13.0.0 are exposed when they process attacker-controlled PNG files and invoke EXIF handling. Common exposure includes photo-upload workflows that use ImageOps.exif_transpose() for automatic rotation.
What does an attacker need to provide to trigger the problem?
An attacker needs to supply a PNG containing an eXIf chunk filled with repeated six-byte Exif headers. The application must then reach EXIF parsing through Image.getexif(), Image._getexif(), or ImageOps.exif_transpose().
What should be done if an immediate upgrade is not possible?
Avoid invoking the affected EXIF-processing paths on untrusted PNG uploads, particularly automatic EXIF-based rotation via ImageOps.exif_transpose(). Restricting or rejecting PNG inputs with eXIf metadata can also prevent the described trigger condition.
How can I determine whether my application is affected?
Check whether Pillow is installed at version 11.0.0 or later but earlier than 13.0.0, and whether your code calls Image.getexif(), Image._getexif(), or ImageOps.exif_transpose() on PNG files from untrusted sources. Pillow 13.0.0 contains the fix.