Detect CVE-2026-112393: Pillow Heap Buffer Overflow in _tiffWriteProc on Compressed TIFF Save in Sumo Logic CSE
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.
MITRE ATT&CK
- Tactic
- Initial Access Impact
Sumo Detection Query
// df00tech DF00-5316b00ee3 · https://df00tech.com/detections/CVE-2026-112393 · licence: https://df00tech.com/detections/licence
_sourceCategory=*os* OR _sourceCategory=*endpoint*
| where (_raw matches "*pip install*" or _raw matches "*pip3 install*" or _raw matches "*pip download*")
| where (_raw matches "*pillow*" or _raw matches "*Pillow*")
| parse regex "(?i)[Pp]illow[-=]+(?<pillow_version>([2-9]|1[0-2])\.\d+(\.\d+)?)"
| where !isNull(pillow_version)
| fields _messageTime, _sourceHost, pillow_version, _raw
| sort by _messageTime desc Parses endpoint/OS logs for pip install operations referencing Pillow at a vulnerable version via regex capture.
Data Sources
Required Tables
False Positives & Tuning
- Deliberate pin to an older Pillow for testing
- Sandbox reproduction of the advisory
- Dependency resolver transiently installing an old version
Other platforms for CVE-2026-112393
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.
- 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.
- Test 2 Report installed Pillow version
Expected signal: Python process launch event with command line referencing PIL/Pillow version output.
- Test 3 Exercise compressed TIFF save path (benign)
Expected signal: Python process launch event; the crafted-input crash path is not exercised here.
References (5)
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-332p-7hrc-92wf
- https://github.com/python-pillow/Pillow/commit/11582e5ffbdceb973d5ee593f3105af5a9852b40
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-112393
- https://github.com/advisories/GHSA-332p-7hrc-92wf
Response Playbook
Triage
- 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.
- 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.
- 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.
- Check for recent process crashes, segfaults, or abnormal Python worker restarts on hosts that process image output, which may indicate exploitation attempts.
Containment
- 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.
- 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.
- Isolate hosts showing crash signatures consistent with heap corruption pending investigation.
Evidence Collection
- Capture `pip freeze` / SBOM output and container image manifests recording the vulnerable Pillow version and its install timestamp.
- Collect core dumps, segfault logs (dmesg, journald), and application exception traces from Python workers that save TIFF images around the suspected exploitation window.
- 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.
// 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 ``` 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
Creates a throwaway virtualenv and installs a Pillow version within the vulnerable range to validate package-manager detection.
Command
python3 -m venv /tmp/pillow_vuln_test && /tmp/pillow_vuln_test/bin/pip install 'Pillow==10.4.0' Cleanup
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).
Invokes Python to print the installed Pillow version, simulating inventory discovery of a vulnerable build.
Command
/tmp/pillow_vuln_test/bin/python -c "import PIL; print('Pillow', PIL.__version__)" Cleanup
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.
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
/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
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.