CVE-2026-112396: Pillow Heap Use-After-Free Vulnerability in TIFF Encoding

pillow Updated 22 Oct 2026

Summary

21/10/2026
Yes i
Moderate
5.9

CVE-2026-112396: Pillow: Heap use-after-free when encoding TIFF to an in-memory buffer. Affects pillow versions >= 11.3.0, < 13.0.0. Fixed in 13.0.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

Pillow is a widely used Python Imaging Library that provides extensive capabilities for opening, manipulating, and saving various image file formats. It is particularly known for its ease of use and integration with Python applications. However, it is susceptible to vulnerabilities, particularly when handling untrusted image data, which can lead to severe security issues such as memory corruption and potential remote code execution.

Vulnerability Detail

The vulnerability arises when saving an image as TIFF to an in-memory buffer. If libtiff rejects a tag during encoding, the encoder frees its output buffer but does not close the libtiff handle. This oversight leads to a heap use-after-free condition, where subsequent operations may write to the freed memory, resulting in application crashes or potential remote code execution. The issue is triggered specifically when the Predictor tag is set incorrectly, causing the TIFFWriteScanline function to fail.

How To Fix

Latest published version: 13.0.0 as of 22 Oct 2026

pip install --upgrade "pillow==13.0.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid using the TIFF format for untrusted images or ensure that any image data being processed does not contain invalid tags that could trigger the vulnerability. Here is an example of code that could potentially trigger the vulnerability:

import io
from PIL import Image

# In-memory TIFF re-encode. Avoid using invalid tags.
im = Image.new("L", (64, 64))
buf = io.BytesIO()
im.save(buf, format="TIFF", compression="tiff_lzw", tiffinfo={317: 3})  # 317 = Predictor

Conclusion

The CVE-2026-112396 vulnerability in Pillow highlights a critical issue with heap use-after-free during TIFF encoding. Users are strongly advised to update to the latest version to mitigate risks associated with this vulnerability. Utilizing tools like Vulert can help monitor and manage open-source vulnerabilities effectively.

See every vulnerability recorded for pillow →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 5.9, indicating a moderate severity level.

You can use Vulert, which monitors and alerts for open-source vulnerabilities in real-time. Visit Vulert Scanner to check if your application is affected without requiring any signup.

The potential consequences include application crashes and memory corruption, which could lead to remote code execution if exploited by an attacker.

Yes, version 13.0.0 and later of Pillow contains the necessary fixes for this vulnerability.

If you cannot update immediately, avoid processing untrusted images in TIFF format or ensure that the image data does not contain invalid tags that could trigger the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for pillow.

How To Fix

Latest published version: 13.0.0 as of 22 Oct 2026

pip install --upgrade "pillow==13.0.0"

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback