Pillow: Infinite loop when counting frames of crafted MIC images
Summary
Pillow, the Python imaging library, can enter an infinite loop when an application reads the frame count (n_frames) or saves all frames of a crafted Microsoft Image Composer (MIC) file. The issue only occurs when the optional olefile package is installed and the embedded TIFF stream contains three or more image directories. An attacker who can supply such a file can keep one worker process at full CPU indefinitely, causing a denial of service, but cannot read data or execute code.
Affected
- Pillow 7.2.0 through 12.3.0 (Python package Pillow, pip)
- Only with the optional olefile package installed
Fixed in
- Pillow 13.0.0
- No patched 12.x release is known; a distribution backport has not been verified.
Workaround
- Without olefile installed, the MIC plugin is not registered and the vulnerable path is not reached (inference from the advisory, not vendor-tested).
- Reject MIC files before they reach Pillow in upload workflows and avoid reading n_frames on untrusted input.
- Use a process timeout or worker restart so a stuck worker cannot stay at full CPU.
Exploitation
- No evidence of exploitation in the wild found (not verified against the CISA KEV catalogue).
- CISA SSVC: exploitation PoC available, automatable: yes.
- A public description with trigger conditions exists in the GitHub advisory; a crafted file of about 5.6 KB is sufficient.
Our recommendation
- Check whether Pillow is used on untrusted uploads and whether olefile is installed, including transitive dependencies in lockfiles and requirements.
- Upgrade to Pillow 13.0.0 or later; check pins that may block the upgrade.
- Until patched, apply the workarounds and monitor for workers at sustained 100% CPU.
Public exploits
PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.
Research sources
- GitHub Security Advisory GHSA-22hg-r758-rrw9 github.com
- Pillow 13.0.0 release github.com
- Fix commit 26cb3ed github.com
- OSV BIT-pillow-2026-112390 osv.dev
- Pillow 13.0.0 release notes github.com
Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 1 Nov 2026, 15:41.
Original description (NVD)
Pillow is a Python imaging library. From 7.2.0 until 13.0.0, Pillow can enter an infinite loop while determining the frame count of a MIC image. MicImageFile inherits TIFF frame traversal, but MicImageFile.tell reports the OLE stream index and its seek() resets TIFF frame state, so an embedded TIFF with at least three IFDs never advances. When an application with olefile installed reads n_frames or saves all frames from a crafted MIC file, the non-advancing traversal can hold a worker at full CPU indefinitely. This issue is fixed in version 13.0.0.
NVD references (4)
- https://github.com/python-pillow/Pillow/commit/26cb3ed061173b817b9ee4b6f507cb0e1e293218
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-22hg-r758-rrw9
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-22hg-r758-rrw9
Sources
The tracker combines official, freely usable data sources – updated continuously:
- NVD (NIST) – CVEs, rating (CVSS), affected products
- CISA KEV – vulnerabilities confirmed by CISA as actively exploited
- CISA Vulnrichment – CISA assessment (SSVC) in the official CVE record
- FIRST EPSS – probability of exploitation
- Microsoft MSRC – Patch Tuesday: vulnerabilities, severity, updates
- PoC-in-GitHub – public proof-of-concept repositories
- Metasploit (Rapid7) – modules of the Metasploit Framework
- Exploit-DB (OffSec) – archive of public exploits (links only)
- Patch days: official vendor pages (linked per vendor) (Vendor patch days)
This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.
Affected? We can help.
We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.
