Back to Intelligence

CVE-2026-15679: Hugging Face PyTorch Image Models (timm) RCE — Detection and Remediation

SA
Security Arsenal Team
July 30, 2026
6 min read

A critical remote code execution (RCE) vulnerability has been identified in the Hugging Face PyTorch Image Models (timm) library, tracked as CVE-2026-15679 (ZDI-26-523). As AI workflows become increasingly integrated into core business logic, the supply chain integrity of model repositories is paramount. This vulnerability allows attackers to execute arbitrary code by deserializing maliciously crafted checkpoint files. While user interaction is required—typically opening a compromised model file or visiting a malicious page—the barrier to exploitation is dangerously low in environments where data scientists and engineers regularly pull models from community repositories.

With a CVSS score of 7.8 (High), this is not a theoretical risk. It represents a tangible pathway for initial access into sensitive research and development environments. Defenders must act immediately to identify vulnerable library versions and block the execution of untrusted model artifacts.

Technical Analysis

Vulnerability: Deserialization of Untrusted Data CVE ID: CVE-2026-15679 ZDI ID: ZDI-26-523 Affected Product: Hugging Face PyTorch Image Models (timm)

Mechanism of Attack: The vulnerability resides in the handling of model checkpoints (files typically ending in .bin or .pth). The timm library relies on PyTorch's serialization methods, which utilize Python's pickle module for object serialization. pickle is inherently unsafe for untrusted data because it allows the specification of arbitrary functions to execute during the deserialization process (via the __reduce__ method).

In this specific instance, the library fails to properly validate the data stream when loading a checkpoint. An attacker can create a malicious model file and distribute it via a compromised repository, a pull request, or a phishing lure. When a victim loads this model using vulnerable timm functions (such as create_model with pre-trained weights), the malicious payload within the file is deserialized, leading to immediate code execution in the context of the user running the Python process.

Exploitation Requirements:

  • User Interaction: The target must load the malicious checkpoint file.
  • Access: Unauthenticated (remote).
  • Scope: Once the Python interpreter executes the payload, the attacker inherits the permissions of the local user, potentially pivoting to cloud storage, code repositories, or internal networks.

Detection & Response

Detecting deserialization attacks requires a shift in mindset for SOC analysts. We are not looking for malware signatures on disk, but rather anomalous process behavior originating from usually benign machine learning utilities. Since torch.load is a CPU-bound function, the most reliable detection is the "breakout" behavior—when the Python interpreter spawns a shell or a network utility as a child process.

The following rules focus on high-fidelity indicators of compromise (IOCs) associated with successful deserialization exploits (reverse shells or data exfiltration tools spawned by Python).

SIGMA Rules

YAML
---
title: Potential Python Deserialization Exploit - Shell Spawning
id: 9a1b2c3d-4e5f-6789-0123-456789abcdef0
status: experimental
description: Detects Python or PyTorch processes spawning shell environments (bash/sh), a common post-exploitation step for pickle deserialization attacks.
references:\  - https://zerodayinitiative.com/advisories/ZDI-26-523/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1059.004
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    ParentImage|endswith:
      - '/python'
      - '/python3'
    Image|endswith:
      - '/bash'
      - '/sh'
      - '/zsh'
  filter_legit_dev:
    CommandLine|contains:
      - 'pytest'
      - 'virtualenv'
      - 'conda'
  condition: selection and not filter_legit_dev
falsepositives:
  - Legitimate developer testing scripts (rare in production nodes)
level: high
---
title: Python Spawning PowerShell or Cmd on Windows
id: b2c3d4e5-6789-0123-4567-89abcdef012
status: experimental
description: Detects Python processes spawning cmd.exe or powershell.exe, indicative of code execution exploits on Windows ML workstations.
references:
  - https://zerodayinitiative.com/advisories/ZDI-26-523/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.execution
  - attack.t1059.003
logsource:
  category: process_creation
  product: windows
detection:
  selection:
    ParentProcessName|endswith:
      - '\python.exe'
      - '\pythonw.exe'
    Image|endswith:
      - '\powershell.exe'
      - '\cmd.exe'
  condition: selection
falsepositives:
  - System administration scripts
level: high
---
title: Python Spawning Network Utility (Reverse Shell Pattern)
id: c3d4e5f6-7890-1234-5678-9abcdef01234
status: experimental
description: Detects Python spawning netcat, curl, or wget commonly used in reverse shells following a successful RCE.
references:
  - https://zerodayinitiative.com/advisories/ZDI-26-523/
author: Security Arsenal
date: 2026/04/06
tags:
  - attack.command_and_control
  - attack.t1071
logsource:
  category: process_creation
  product: linux
detection:
  selection:
    ParentImage|endswith:
      - '/python'
      - '/python3'
    Image|endswith:
      - '/nc'
      - '/netcat'
      - '/curl'
      - '/wget'
  condition: selection
falsepositives:
  - Legitimate data download scripts (verify command line)
level: critical


**KQL (Microsoft Sentinel / Defender)**
KQL — Microsoft Sentinel / Defender
// Hunt for Python processes spawning suspicious child processes (Linux/Windows)
DeviceProcessEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in ("python", "python3", "python.exe")
| where FileName in ("bash", "sh", "powershell.exe", "cmd.exe", "nc", "netcat", "curl", "wget")
| project Timestamp, DeviceName, InitiatingProcessCommandLine, FileName, ProcessCommandLine, AccountName
| order by Timestamp desc


**Velociraptor VQL**
VQL — Velociraptor
-- Hunt for Python processes spawning shells or network tools
SELECT Parent.Pid as ParentPid, Parent.Name as ParentName, Parent.Cmdline as ParentCmd,
       Pid, Name, Cmdline, Username
FROM pslist()
LEFT JOIN pslist() AS Parent ON Parent.Pid = Ppid
WHERE Parent.Name =~ "python"
  AND (Name =~ "(bash|sh|zsh|nc|curl|wget|powershell|cmd)$")


**Remediation Script (Bash)**
Bash / Shell
#!/bin/bash
# Remediation script for CVE-2026-15679
# Forces upgrade of timm and PyTorch to latest secure versions

echo "[+] Checking for vulnerable timm installation..."

# Check if timm is installed
if pip show timm > /dev/null 2>&1; then
    echo "[!] timm found. Upgrading to latest version to mitigate CVE-2026-15679..."
    pip install --upgrade timm
    if [ $? -eq 0 ]; then
        echo "[+] Upgrade successful."
    else
        echo "[-] Upgrade failed. Please run manually: pip install --upgrade timm"
        exit 1
    fi
else
    echo "[?] timm is not installed in this environment."
fi

# Ensure PyTorch is also up to date as it is the underlying serialization engine
echo "[+] Checking PyTorch version..."
pip install --upgrade torch

echo "[+] Remediation check complete."

Remediation

  1. Patch Immediately: Update the timm library to the latest version. The ZDI advisory confirms this issue is fixed in recent releases. Run pip install --upgrade timm in all affected environments.
  2. Update PyTorch: Ensure the underlying PyTorch framework is updated to the latest stable version, as hardening in torch.load may also be required.
  3. Validate Model Sources: Implement a strict policy prohibiting the loading of unserialized models from untrusted sources. Enforce the use of the safe_weights_only=True (or equivalent flag in your framework version) if available, although patching is the only definitive fix for this specific deserialization flaw.
  4. Sandboxing: Where possible, run model inference and loading inside isolated containers (e.g., Docker with restricted capabilities and no network access) to limit the blast radius of a deserialization attack.

Related Resources

Security Arsenal Penetration Testing Services AlertMonitor Platform Book a SOC Assessment vulnerability-management Intel Hub

criticalzero-daycvepatch-tuesdayexploitvulnerability-disclosurehugging-facecve-2026-15679pytorchrce

Is your security operations ready?

Get a free SOC assessment or see how AlertMonitor cuts through alert noise with automated triage.