Detect Pillow JPEG Decoder Draft-Scale Heap Buffer Overflow (CVE-2026-112403) in CrowdStrike LogScale
Detects presence and exploitation risk of CVE-2026-112403, a heap-based buffer overflow (CWE-122) in the Python Pillow imaging library prior to 13.0.0 (<= 12.3.0 affected). Pillow's JPEG decoder can write a full-width scanline into a buffer sized for a requested draft scale, corrupting adjacent heap memory. An attacker who can supply a crafted JPEG to an application that uses Image.draft() or thumbnail-style decoding with scaling can trigger heap corruption, potentially leading to denial of service or remote code execution (CVSS 9.2). A public PoC exists via the GHSA advisory. This detection surfaces vulnerable Pillow installations, suspicious image-processing crashes, and anomalous JPEG ingestion against image-handling services.
Based on GHSA-8g5g-8vmr-9782, Pillow JPEG decoder draft-scale heap overflow
MITRE ATT&CK
- Tactic
- Initial Access Execution
LogScale Detection Query
// df00tech DF00-a48cd5e74a · https://df00tech.com/detections/CVE-2026-112403 · licence: https://df00tech.com/detections/licence
#event_simpleName=ProcessRollup2 (FileName=/python3?(\.exe)?/i) (CommandLine=/(PIL|Pillow|Image\.draft|thumbnail)/i)
| join({#event_simpleName=ProcessTerminate OR #event_simpleName=CrashNotification}, field=[aid, TargetProcessId], include=[#event_simpleName])
| groupBy([aid, ComputerName, FileName, CommandLine], function=collect([#event_simpleName])) CrowdStrike CQL correlating Python PIL/Pillow image-decode process executions with subsequent process-termination or crash events on the same host, indicative of CVE-2026-112403.
Data Sources
Required Tables
False Positives & Tuning
- Normal Python process lifecycle terminations
- Developer or QA image-processing crashes
- Out-of-memory conditions unrelated to the overflow
Other platforms for CVE-2026-112403
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 Enumerate installed Pillow version
Expected signal: Process execution of python3/pip with Pillow version string in output and software-inventory record.
- Test 2 Install vulnerable Pillow in isolated venv
Expected signal: pip install process events and a Pillow 12.3.0 package record on the host.
- Test 3 Decode a draft-scaled JPEG with Pillow (lab PoC harness)
Expected signal: python3 process with command line referencing PIL/Image.draft; on a crafted input, a SIGSEGV / core dump / abnormal termination.
References (5)
- https://github.com/python-pillow/Pillow/security/advisories/GHSA-8g5g-8vmr-9782
- https://github.com/python-pillow/Pillow/commit/242a059aedc1935097d9aa1dc3f099750467ba75
- https://github.com/python-pillow/Pillow/releases/tag/13.0.0
- https://nvd.nist.gov/vuln/detail/CVE-2026-112403
- https://github.com/advisories/GHSA-8g5g-8vmr-9782
Response Playbook
Triage
- Confirm the installed Pillow version on the affected host with `python3 -c "import PIL; print(PIL.__version__)"` or `pip show pillow`; versions <= 12.3.0 (anything < 13.0.0) are vulnerable.
- Determine whether the host runs an application that decodes untrusted/user-supplied JPEG images, especially using Image.draft() or thumbnail/scaled decoding, these code paths trigger the draft-scale overflow.
- Review surrounding logs for crash signatures (SIGSEGV, core dumped, malloc/heap errors) correlated with image uploads to establish whether exploitation was attempted.
- Identify the ingress point of any suspicious JPEG (upload endpoint, email attachment, message queue) and retain the sample for analysis.
Containment
- Upgrade Pillow to 13.0.0 or later across all affected hosts and rebuild/redeploy dependent application images.
- If immediate patching is not possible, disable or gate untrusted image ingestion, or reject JPEGs at the application edge until patched, and run the image-processing worker under a restricted, sandboxed, non-privileged account.
- Isolate any host showing confirmed heap-corruption/crash exploitation evidence pending forensic review.
Evidence Collection
- Preserve the crafted JPEG sample(s) and compute hashes for threat-intel correlation.
- Collect core dumps, application stack traces, and process crash logs from the time window of suspected exploitation.
- Export the software inventory record showing the vulnerable Pillow version and the full command line of the image-processing process.
Escalation Criteria
- !Escalate to incident response if a crash correlates with a crafted JPEG and is followed by anomalous child-process execution or outbound connections, suggesting code execution.
- !Escalate if the vulnerable, internet-facing service processes untrusted images and no compensating controls are in place.
- !Escalate if multiple hosts or a shared base container image are found vulnerable, indicating broad exposure.
Investigation Guide
Forensic Artifacts
- >
Core dump / crash log of the Python process at the moment of JPEG decode - >
The malicious JPEG file and its hash - >
pip/conda package metadata recording the installed Pillow version - >
Application upload logs tying a request to the decode crash
Tuning Guidance
To reduce noise, scope the process/crash correlation to hosts and services that actually decode untrusted images (upload handlers, thumbnailers, document pipelines). Exclude known CI/QA hosts that deliberately process malformed images, and OOM-driven crashes on memory-constrained hosts. The software-inventory arm of the KQL/SPL queries is high-precision for exposure assessment and can be run on its own as a vulnerability-management sweep; the crash-correlation arm is the exploitation signal and benefits from a short time window (<=30s) between decode and termination.
Hunting Queries
Enumerate all hosts running a Pillow version below the fixed 13.0.0 release to scope exposure.
// df00tech DF00-a48cd5e74a · https://df00tech.com/detections/CVE-2026-112403 · licence: https://df00tech.com/detections/licence
DeviceTvmSoftwareInventory | where SoftwareName in~ ("pillow","Pillow") | extend ver=parse_version(SoftwareVersion) | where ver < parse_version("13.0.0") | project DeviceName, SoftwareVersion ``` df00tech DF00-a48cd5e74a · https://df00tech.com/detections/CVE-2026-112403 · licence: https://df00tech.com/detections/licence ```
(index=inventory OR index=vuln) (product=pillow OR package=pillow) | eval major=tonumber(mvindex(split(replace(version,"[^0-9.]",""),"."),0)) | where major<13 | stats values(version) by host Atomic Red Team Tests
Checks whether the installed Pillow version is within the vulnerable range (< 13.0.0) to validate the inventory-based detection.
Command
python3 -c "import PIL, sys; print('Pillow', PIL.__version__); sys.exit(0)" || pip show pillow | grep -i version Cleanup
echo 'no cleanup required' Expected Telemetry
Process execution of python3/pip with Pillow version string in output and software-inventory record.
Expected Detection
Inventory arm of the detection flags the host if the reported version is < 13.0.0.
Creates a disposable virtualenv with a known-vulnerable Pillow release to generate inventory telemetry in a lab.
Command
python3 -m venv /tmp/pilvuln && /tmp/pilvuln/bin/pip install 'pillow==12.3.0' && /tmp/pilvuln/bin/python -c "import PIL; print(PIL.__version__)" Cleanup
rm -rf /tmp/pilvuln Expected Telemetry
pip install process events and a Pillow 12.3.0 package record on the host.
Expected Detection
Software-inventory detection flags Pillow 12.3.0 as < 13.0.0.
Exercises the vulnerable draft-scale decode path against a JPEG to reproduce the decode/crash telemetry the detection correlates on. Run only in an isolated lab VM.
Command
/tmp/pilvuln/bin/python -c "from PIL import Image; im=Image.open('/tmp/test.jpg'); im.draft('RGB',(32,32)); im.load(); print('decoded')" Cleanup
rm -f /tmp/test.jpg; rm -rf /tmp/pilvuln Expected Telemetry
python3 process with command line referencing PIL/Image.draft; on a crafted input, a SIGSEGV / core dump / abnormal termination.
Expected Detection
Crash-correlation arm fires when the PIL decode process terminates abnormally within the correlation window.