Skip to content
CVE-2026-112393

CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save

Initial Access Impact Last updated:

Detects the presence, installation, or runtime use of Python Pillow (PIL) versions >= 2.0.0 and < 13.0.0, which are vulnerable to a heap buffer overflow (CWE-122) and stale-heap memory disclosure in the _tiffWriteProc function when saving compressed TIFF images to a target without a usable fileno(), such as io.BytesIO. The callback sizes its allocation from the prior buffer size instead of the current write position. An attacker who can supply crafted image data or an out-of-line TIFF tag processed by a vulnerable Pillow build can trigger out-of-bounds heap writes. This can crash the process, disclose stale heap contents, and may allow code execution (CVSS 9.2). A reproducer is published in the GHSA advisory. File paths and targets with real file descriptors are unaffected. The issue is fixed in Pillow 13.0.0. Because this is a library-level flaw, detection focuses on inventorying vulnerable Pillow installations, observing pip install and upgrade activity, and catching process crash signals from Python workers that produce TIFF output.

Vulnerability Intelligence

Public PoC

What is CVE-2026-112393 CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save?

CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save (CVE-2026-112393) maps to the Initial Access and Impact tactics — the adversary is trying to get into your network in MITRE ATT&CK.

This page provides production-ready detection logic for CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save, covering the data sources and telemetry it touches: Microsoft Defender for Endpoint, DeviceProcessEvents. The queries below are rated high severity at medium confidence, and ship for 7 SIEM platforms — KQL, SPL, Elastic, QRadar, Sumo, YARA-L, LogScale.

MITRE ATT&CK

Tactic
Initial Access Impact
Microsoft Sentinel / Defender
kusto
// df00tech DF00-5316b00ee3 · https://df00tech.com/detections/CVE-2026-112393 · licence: https://df00tech.com/detections/licence
// Detect vulnerable Pillow installation/usage via package manager and process telemetry
let VulnerablePillowRegex = @"(?i)pillow[-=]+(([2-9]|1[0-2])\.[0-9]+(\.[0-9]+)?)";
DeviceProcessEvents
| where Timestamp > ago(7d)
| where FileName in~ ("pip", "pip3", "python", "python3", "pip.exe", "python.exe") or ProcessCommandLine has_any ("pip install", "pip3 install", "pip download")
| where ProcessCommandLine has "pillow" or ProcessCommandLine has "Pillow"
| where ProcessCommandLine matches regex VulnerablePillowRegex
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName, ReportId
| order by Timestamp desc

Flags pip install/download or Python invocations referencing Pillow at a version within the vulnerable range (2.0.0 <= v < 13.0.0). Version regex deliberately excludes 13.x and above.

high severity medium confidence

Data Sources

Microsoft Defender for Endpoint DeviceProcessEvents

Required Tables

DeviceProcessEvents

False Positives

  • Developers intentionally pinning an older Pillow for compatibility testing in an isolated environment
  • Security researchers reproducing the CVE in a sandbox
  • CI pipelines installing a vulnerable version before an immediate upgrade step

Query fingerprint DF00-5316b00ee3 · licence

Sigma logsource & community rules

The detection logic for CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save (CVE-2026-112393) above is provided in a vendor-neutral form so you can deploy it on any SIEM. The same logic is shipped here as native KQL (Microsoft Sentinel / Defender), SPL (Splunk), Elastic (Elastic Security (EQL)), QRadar (IBM QRadar (AQL)), Sumo (Sumo Logic CSE), YARA-L (Google Chronicle / SecOps), LogScale (CrowdStrike LogScale (CQL)) queries. In Sigma terms, this detection targets the following logsource:

logsource:
  category: process_creation
  product: windows

Browse the community-maintained Sigma rules for this technique:


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Install vulnerable Pillow version in isolated virtualenv

    Expected signal: Process execution event for pip install referencing Pillow==10.4.0; package metadata written under the venv site-packages.

  2. Test 2 Report installed Pillow version

    Expected signal: Python process launch event with command line referencing PIL/Pillow version output.

  3. Test 3 Exercise compressed TIFF save path (benign)

    Expected signal: Python process launch event; the crafted-input crash path is not exercised here.


Response Playbook

Triage

  1. Confirm the exact installed Pillow version on the host: run `python -c "import PIL; print(PIL.__version__)"` and `pip show Pillow` in each virtualenv/interpreter. Any version >= 2.0.0 and < 13.0.0 is vulnerable.
  2. Determine whether the application saves compressed TIFF images to a non-file target such as io.BytesIO (for example `Image.save(buf, format='TIFF', compression='tiff_lzw'/'tiff_deflate'/'group4')`), which is the vulnerable code path in _tiffWriteProc. Saves to a file path or a real file descriptor are not affected.
  3. Assess exposure: identify whether any part of the TIFF save path (compression type, image dimensions, tag values such as ImageDescription/DocumentName/XMP, or an embedded ICC profile) can be influenced by untrusted input.
  4. Check for recent process crashes, segfaults, or abnormal Python worker restarts on hosts that process image output, which may indicate exploitation attempts.

Containment

  1. Upgrade Pillow to 13.0.0 or later across all affected environments: `pip install --upgrade 'Pillow>=13.0.0'` and rebuild or redeploy any container images that pin a vulnerable version.
  2. Where immediate upgrade is not possible, save TIFF output to a file path or real file descriptor instead of an in-memory target, or reject untrusted control over save parameters, image dimensions, and tag values.
  3. Isolate hosts showing crash signatures consistent with heap corruption pending investigation.

Evidence Collection

  1. Capture `pip freeze` / SBOM output and container image manifests recording the vulnerable Pillow version and its install timestamp.
  2. Collect core dumps, segfault logs (dmesg, journald), and application exception traces from Python workers that save TIFF images around the suspected exploitation window.
  3. Preserve any input images or TIFF save-parameter payloads submitted to the service for offline analysis.

Escalation Criteria

  • ! Escalate to IR if heap-corruption crash signatures coincide with externally-supplied image or save-parameter input, indicating active exploitation.
  • ! Escalate if a vulnerable Pillow is confirmed on an internet-facing service that accepts untrusted images or save parameters.
  • ! Escalate if stale-heap disclosure is suspected (unexpected bytes appearing in generated TIFF output) as this may leak sensitive memory.

Investigation Guide

Forensic Artifacts

  • > pip/package metadata (`pip show Pillow`, site-packages PIL/_version.py, dist-info RECORD) establishing the installed version
  • > OS crash telemetry: core dumps, dmesg/journald segfault entries, and Windows WER reports for the Python process
  • > Application logs and generated TIFF files that may contain stale heap bytes (disclosure evidence)

Tuning Guidance

This detection is inventory and exposure oriented and is expected to surface legitimate installs. Reduce noise by restricting the version regex to your actual deployed range, excluding known-remediated hosts, and whitelisting sandbox/CI build agents that intentionally install old versions for testing. After a fleet-wide upgrade to >=13.0.0, retune to alert only on new installs of vulnerable versions.


Hunting Queries

Inventory all hosts that have installed or referenced Pillow via pip so each can be version-checked against the vulnerable range.

Hunting — KQL
kql
// df00tech DF00-5316b00ee3 · https://df00tech.com/detections/CVE-2026-112393 · licence: https://df00tech.com/detections/licence
DeviceProcessEvents | where Timestamp > ago(30d) | where ProcessCommandLine has_any ("pillow","Pillow") and ProcessCommandLine has_any ("install","download") | project Timestamp, DeviceName, ProcessCommandLine | order by Timestamp desc
Hunting — SPL
spl
``` df00tech DF00-5316b00ee3 · https://df00tech.com/detections/CVE-2026-112393 · licence: https://df00tech.com/detections/licence ```
index=* (process="*pillow*" OR process="*Pillow*") (process="*install*" OR process="*download*") | stats count by host, process | sort - count

Atomic Red Team Tests

Test 1 Install vulnerable Pillow version in isolated virtualenv
linux

Creates a throwaway virtualenv and installs a Pillow version within the vulnerable range to validate package-manager detection.

Command

bash
python3 -m venv /tmp/pillow_vuln_test && /tmp/pillow_vuln_test/bin/pip install 'Pillow==10.4.0'

Cleanup

bash
rm -rf /tmp/pillow_vuln_test

Expected Telemetry

Process execution event for pip install referencing Pillow==10.4.0; package metadata written under the venv site-packages.

Expected Detection

KQL/SPL/EQL queries match the pip install of Pillow at a vulnerable version (10.4.0).

Test 2 Report installed Pillow version
linux

Invokes Python to print the installed Pillow version, simulating inventory discovery of a vulnerable build.

Command

bash
/tmp/pillow_vuln_test/bin/python -c "import PIL; print('Pillow', PIL.__version__)"

Cleanup

bash
rm -rf /tmp/pillow_vuln_test

Expected Telemetry

Python process launch event with command line referencing PIL/Pillow version output.

Expected Detection

Process telemetry showing python invocation referencing Pillow; correlatable to vulnerable version inventory.

Test 3 Exercise compressed TIFF save path (benign)
linux

Generates a benign image and saves it as a compressed TIFF to an in-memory buffer, exercising the vulnerable _tiffWriteProc code path in a lab for telemetry validation (no exploit).

Command

bash
/tmp/pillow_vuln_test/bin/python -c "import io; from PIL import Image; im=Image.new('RGB',(64,64),'red'); im.save(io.BytesIO(), format='TIFF', compression='tiff_lzw')"

Cleanup

bash
rm -rf /tmp/pillow_vuln_test

Expected Telemetry

Python process launch event; the crafted-input crash path is not exercised here.

Expected Detection

Process telemetry confirming the compressed-TIFF save path is in use on a host running a vulnerable Pillow version.

Related Detections

Blog posts about this detection

Browse by tactic

Full ATT&CK matrix Search all detections