Pillow 13.0.0 releases fix for CVE-2026-112393 heap overflow in TIFF handling
A critical vulnerability in the Python Pillow library allows code execution via malformed TIFF files. Version 13.0.0 resolves the issue for affected users.
Key points
- Pillow versions 2.0.0 through 12.x are affected by CVE-2026-112393.
- The flaw enables heap buffer overflow and stale-heap disclosure in TIFF handling.
- Version 13.0.0 is the first release to fix this critical security issue.
The Python Imaging Library Pillow has released version 13.0.0 to address a critical security flaw. This update resolves a heap buffer overflow that could allow remote code execution in applications using the library.
What happened
According to the National Vulnerability Database record for CVE-2026-112393, the vulnerability exists in Pillow versions from 2.0.0 up to, but not including, 13.0.0. The National Vulnerability Database rates the flaw as critical with a CVSS score of 9.2. The issue stems from weaknesses classified as CWE-122, which relates to buffer overflow errors.
The flaw occurs within the _tiffWriteProc function when saving compressed TIFF data. This process uses libtiff to write to targets that lack a usable file number, such as BytesIO objects. The callback mechanism incorrectly sizes its allocation based on the prior buffer size rather than the current write position. This discrepancy allows attacker-controlled data, such as an out-of-line TIFF tag or a retained ICC profile, to be copied beyond the allocated memory after libtiff seeks forward.
This heap buffer overflow can crash the affected process. It may also allow an attacker to execute arbitrary code. Independently, unwritten alignment gaps in compressed TIFF output larger than 64 KiB can disclose stale heap bytes. This disclosure occurs without requiring a crafted tag, according to the vulnerability description.
Why it matters
File paths and targets with real file descriptors are unaffected by this specific issue. The vulnerability specifically impacts in-memory operations where file numbers are not available. This distinction is crucial for organizations determining their exposure. Applications that save TIFFs to disk files are not vulnerable to this specific overflow vector.
However, many modern applications process images in memory for performance or privacy reasons. Systems using BytesIO or similar in-memory streams for TIFF compression are at risk. The ability to disclose stale heap bytes provides attackers with sensitive memory contents. This information can aid in further exploitation or bypass security mechanisms.
What to watch
- Monitor for any new advisories regarding Pillow or libtiff interactions.
- Check internal logs for unexpected process crashes during TIFF handling.
- Review code for uses of BytesIO with compressed TIFF output.
- Verify that all systems have upgraded to version 13.0.0 or later.
Who needs to act first
Teams should prioritize updating systems that process user-supplied TIFF images in memory. Identify applications using Pillow for image manipulation, especially those handling uploads. Roll out the update to public-facing services first to reduce attack surface. Test the new version in a staging environment to ensure compatibility. Back up configuration files before applying the update. If immediate patching is not possible, restrict TIFF uploads to trusted sources only. Monitor for unusual memory behavior or crashes in logging systems.
Background: CVSS score
The CVSS score explains vulnerability severity using a 0.0 to 10.0 scale. It measures attack vector, complexity, privileges required, and impact on confidentiality, integrity, and availability. You use this metric to prioritize patches, though you must adjust it for your specific environment to avoid wasting time on irrelevant threats.
Read the full guide: CVSS Score Explained: How to Read Risk Metrics and Prioritize Fixes
What to do and how to stay safe: Pillow
- Audit your inventory for Python applications using Pillow versions prior to 13.0.0.
- Check if these applications save compressed TIFF data to in-memory targets like BytesIO.
- Plan an upgrade to Pillow 13.0.0 to resolve the heap buffer overflow vulnerability.
- Monitor application logs for crashes or errors related to TIFF processing after the update.
Step-by-step guide: Virtual Patching Myths: What It Actually Fixes and Breaks
General security guidance from the Patch Gazette newsroom. It is not confirmed advice from the organisations named in this story.
Frequently asked questions
Which versions of Pillow are affected by CVE-2026-112393?
Versions from 2.0.0 up to, but not including, 13.0.0 are affected by this vulnerability.
Is there a fix available for this critical vulnerability?
Yes, the issue is fixed in version 13.0.0 of the Pillow library.
What kind of systems are vulnerable to this flaw?
Systems using Pillow to save compressed TIFF data to targets without a usable fileno, such as BytesIO, are vulnerable.




