Skip to content
CVE-2026-112902 Elastic Security · Elastic

Detect Pillow libtiff TIFF Encoder TIFFSetField Argument Type Mismatch (CVE-2026-112902) in Elastic Security

Detects the presence, deployment, and exploitation exposure of CVE-2026-112902, a CWE-686 (Function Call With Incorrect Argument Type) vulnerability in the Pillow Python imaging library through version 12.3.0. When saving/encoding TIFF images via the libtiff encoder, Pillow passes arguments to libtiff's TIFFSetField() whose C types do not match libtiff's variadic definitions for certain tags, leading to memory corruption / undefined behavior that can be triggered by crafting a malicious TIFF file or by supplying crafted TIFF tag metadata to an application that re-encodes images with Pillow. A public PoC/advisory exists (GHSA-xvh5-g6gv-559v). The issue is fixed in Pillow 13.0.0. This detection surfaces vulnerable Pillow installations and runtime behaviors (Python processes importing PIL and encoding TIFFs, crashes/SIGSEGV in Python workers handling image uploads) so responders can inventory and remediate.

Based on GHSA-xvh5-g6gv-559v, Pillow libtiff TIFFSetField argument type advisory

MITRE ATT&CK

Tactic
Impact Initial Access

Elastic Detection Query

Elastic Security (Elastic)
eql
// df00tech DF00-eafc571bfe · https://df00tech.com/detections/CVE-2026-112902 · licence: https://df00tech.com/detections/licence
sequence by host.id with maxspan=5m
  [ process where process.name in ("python","python3","python.exe","python3.exe") and
      process.command_line : ("*PIL*","*Pillow*","*TiffImagePlugin*","*.tiff*","*.tif*") ]
  [ process where event.type == "end" and process.name in ("python","python3") and
      process.exit_code != 0 ]
medium severity low confidence

Correlates a Python process handling TIFF via Pillow with an abnormal (non-zero / crash) process exit within 5 minutes, a signature of encoder memory corruption being triggered.

Data Sources

Elastic DefendProcess Events

Required Tables

logs-endpoint.events.process-*

False Positives & Tuning

  • Python scripts that legitimately exit non-zero after valid Pillow TIFF errors (unsupported mode, disk full).
  • Automated test suites intentionally raising exceptions during image handling.
  • Resource-limited containers where Python workers are OOM-killed independent of this CVE.

Other platforms for CVE-2026-112902


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 Report installed Pillow version

    Expected signal: Process creation event for python3 with command line referencing PIL.

  2. Test 2 Encode a TIFF with the libtiff backend

    Expected signal: python3 process writing a .tiff file with PIL/TiffImagePlugin on the command line.

  3. Test 3 Save TIFF with custom tags to stress TIFFSetField path (Windows)

    Expected signal: python.exe process creation with .tiff and PIL on the command line.


Response Playbook

Triage

  1. Confirm the Pillow version on the alerting host: run `python -c "import PIL; print(PIL.__version__)"` for each interpreter/virtualenv; any version < 13.0.0 is vulnerable to CVE-2026-112902.
  2. Determine whether the application actually encodes/saves TIFF images with Pillow (Image.save(..., format='TIFF') or libtiff backend) versus only decoding/other formats, encoding is the trigger path.
  3. Identify whether TIFF input or tag metadata is attacker-influenced (file uploads, email attachments, user-supplied images) to assess real exploitability versus latent exposure.
  4. Check for crash evidence: Python worker SIGSEGV, core dumps, or abnormal non-zero exits correlated with TIFF handling around the alert time.

Containment

  1. Patch Pillow to 13.0.0 or later (`pip install --upgrade 'Pillow>=13.0.0'`) in every affected environment/virtualenv and redeploy the application.
  2. As an interim mitigation, disable TIFF encoding/save paths or reject TIFF uploads at the application edge until the upgrade is deployed.
  3. Isolate or rate-limit internet-facing services that re-encode untrusted TIFFs if crash/exploitation activity is observed.

Evidence Collection

  1. Capture the exact Pillow version, Python interpreter path, and installed libtiff version from the affected host.
  2. Preserve any core dumps, crash logs, and the triggering TIFF file(s) or request payloads for forensic analysis.
  3. Record process-creation and process-exit telemetry for the Python workers around the event window.

Escalation Criteria

  • !Escalate to IR if a repeatable Python crash/SIGSEGV is tied to attacker-supplied TIFF content, indicating active exploitation attempts.
  • !Escalate if the vulnerable service is internet-facing and processes untrusted image uploads, given the 8.3 CVSS and public PoC.
  • !Escalate if evidence of memory-corruption follow-on activity (unexpected child processes, outbound connections) is seen from the image-processing worker.

Investigation Guide

Forensic Artifacts

  • >Core dumps / crash reports from Python worker processes
  • >The triggering TIFF file and its tag metadata
  • >Installed Pillow and libtiff version records (pip metadata, package manager logs)

Tuning Guidance

Begin with software-inventory signals (installed Pillow major < 13) which are high-fidelity for exposure; treat runtime command-line and crash-correlation signals as lower-confidence enrichment. Suppress known, patched batch-processing hosts and allowlist internal image pipelines that cannot accept untrusted input. Promote severity where the service is internet-facing and accepts untrusted TIFF uploads.


Hunting Queries

Inventory sweep for Pillow installations older than 13.0.0 across the estate.

Hunting — KQL
kql
// df00tech DF00-eafc571bfe · https://df00tech.com/detections/CVE-2026-112902 · licence: https://df00tech.com/detections/licence
DeviceTvmSoftwareInventory | where SoftwareName has "pillow" | extend major=toint(split(SoftwareVersion,".")[0]) | where major < 13 | project DeviceName, SoftwareVersion
Hunting — SPL
spl
``` df00tech DF00-eafc571bfe · https://df00tech.com/detections/CVE-2026-112902 · licence: https://df00tech.com/detections/licence ```
index=inventory sourcetype="software:inventory" product=pillow | rex field=version "^(?<major>\d+)" | where major < 13 | table host version

Atomic Red Team Tests

Test 1 Report installed Pillow version
linux

Inventory check that prints the active Pillow version to confirm vulnerable (< 13.0.0) exposure.

Command

bash
python3 -c "import PIL; print('Pillow', PIL.__version__)"

Cleanup

bash
echo 'no cleanup required'

Expected Telemetry

Process creation event for python3 with command line referencing PIL.

Expected Detection

Runtime Pillow import signal / inventory version match fires when version major < 13.

Test 2 Encode a TIFF with the libtiff backend
linux

Exercises the vulnerable TIFF encoder code path by saving an image as TIFF using Pillow's libtiff backend in a lab environment.

Command

bash
python3 -c "from PIL import Image, TiffImagePlugin; TiffImagePlugin.WRITE_LIBTIFF=True; Image.new('RGB',(64,64)).save('/tmp/atomic_cve_112902.tiff', format='TIFF')"

Cleanup

bash
rm -f /tmp/atomic_cve_112902.tiff

Expected Telemetry

python3 process writing a .tiff file with PIL/TiffImagePlugin on the command line.

Expected Detection

Runtime Pillow-TIFF encoding signal (kql/spl/eql) matches the python TIFF-save process.

Test 3 Save TIFF with custom tags to stress TIFFSetField path (Windows)
windows

Encodes a TIFF with custom tiffinfo tags via the libtiff backend, exercising the TIFFSetField argument-type path on Windows for detection validation.

Command

powershell
python -c "from PIL import Image, TiffImagePlugin; TiffImagePlugin.WRITE_LIBTIFF=True; im=Image.new('RGB',(32,32)); im.save(r'C:\\Windows\\Temp\\atomic_112902.tiff', format='TIFF', tiffinfo={317:2, 278:16})"

Cleanup

powershell
del C:\Windows\Temp\atomic_112902.tiff

Expected Telemetry

python.exe process creation with .tiff and PIL on the command line.

Expected Detection

CrowdStrike/KQL runtime Pillow-TIFF signal matches the python.exe TIFF-encode process.

Related Detections