Skip to content
AboutEditorial policyContactWednesday, October 21, 2026
BlueTeamInsider.Security news, verified and fast
Breaking alerts
Every story the minute it is published
Follow via RSS
Vulnerabilities

Pillow Heap Overflow in TIFF Handling Exposes Python Apps to Code Execution

A critical heap buffer overflow in the Pillow library allows attackers to execute code when saving compressed TIFF images to in-memory buffers.

Illustration: A small white pillow sits on a wooden table next to a stack of compressed image files.
AI-generated illustration: BlueTeam Insider

Key points

  • The flaw affects Pillow versions 2.0.0 through 12.x.
  • Attackers can trigger code execution via crafted TIFF tags.
  • Version 13.0.0 resolves the vulnerability.

The Pillow Python imaging library contains a critical heap buffer overflow in its TIFF handling code. This vulnerability, tracked as CVE-2026-112393, affects applications using Pillow versions 2.0.0 up to 13.0.0. The issue arises specifically when saving compressed TIFF data to targets without usable file descriptors, such as in-memory BytesIO objects. Environments processing user-uploaded images or generating reports in memory are exposed.

Root cause

According to the National Vulnerability Database, the flaw resides in the _tiffWriteProc function. When Pillow saves compressed TIFF data via libtiff to a target lacking a usable fileno(), the callback incorrectly sizes its allocation. It uses the prior buffer size rather than the current write position. This miscalculation allows data to be copied beyond the allocated memory boundary.

Attack path

An attacker can exploit this by providing an out-of-line TIFF tag or a retained ICC profile. As libtiff seeks forward during the write process, the oversized copy operation overflows the heap. This overflow can crash the application process. In many cases, it may also allow arbitrary code execution on the host system.

Affected versions

  • Pillow 2.0.0
  • Pillow 3.0.0 through 12.x
  • Any version prior to 13.0.0

Mitigation

  • Upgrade Pillow to version 13.0.0 immediately.
  • Avoid saving compressed TIFF data to BytesIO objects.
  • Use file paths with real file descriptors for TIFF output.
  • Validate image inputs before processing with Pillow.

Detection notes

Security teams should monitor for unexpected application crashes in image-processing services. Look for memory access violations or segmentation faults in system logs. Alert on processes attempting to write large amounts of data to temporary in-memory buffers. Check for anomalous CPU spikes during image conversion tasks. Isolate affected containers or virtual machines immediately upon detecting a crash. Review access logs for suspicious file uploads preceding the failure.

What to do and how to stay safe: Pillow

  • Scan your inventory for Python applications using Pillow.
  • Identify code paths that save TIFF files to memory buffers.
  • Prioritize patching systems that process untrusted image inputs.
  • Monitor for process terminations related to memory errors.

Step-by-step guide: Unpatched Software Myths: Why Common Beliefs Fail to Protect You

General security guidance from the BlueTeam Insider newsroom. It is not confirmed advice from the organisations named in this story.

Frequently asked questions

What is the CVSS score for CVE-2026-112393?

The National Vulnerability Database rates this vulnerability as 9.2, which is considered critical.

Does this affect saving TIFF files to disk?

No, file paths and targets with real file descriptors are unaffected by this specific overflow.

Is there a fix available?

Yes, the issue is fixed in Pillow version 13.0.0.

Sources

  1. CVE Program
PillowCVE-2026-112393Pythonheap overflowTIFF

Related Posts