High

PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files

  • Disclosed: 27.01.2026
  • Updated: 04.11.2026 05:17

Summary

A vulnerability in PyTorch's weights_only unpickler allows an attacker to craft a malicious checkpoint file (.pth) that, when loaded with torch.load(..., weights_only=True), can corrupt memory and potentially lead to arbitrary code execution.

Vulnerability Details

The weights_only=True unpickler failed to properly validate pickle opcodes and storage metadata, allowing:

  1. Heap memory corruption via SETITEM/SETITEMS opcodes applied to non-dictionary types
  2. Storage size mismatch between declared element count and actual data in the archive

Impact

An attacker who can convince a user to load a malicious checkpoint file may achieve arbitrary code execution in the context of the victim's process.

Credit

Ji'an Zhou

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Python (PyPI) pytorch < 2.10.0 2.10.0
Python (PyPI) torch < 2.10.0 2.10.0

References

CVSS score 8.8/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Weakness (CWE)
CWE-502, CWE-94
Platform
Python (PyPI)
Package
pytorch, torch
Disclosed
27.01.2026
Updated
04.11.2026 05:17

Sources and licenses

OSV / GitHub Advisory Database - PYSEC-2026-1856 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - PYSEC-2026-2286 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-63cw-57p8-fm3p - CC BY 4.0

Vulnerability history: torch

All published vulnerabilities of this package (Python (PyPI)), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (31) in the archive
Total entries
31
First → latest
11.2022 03.2026
Without a fix
9
Exploited in attacks
0

Severity breakdown

  • Critical 3
  • High 10
  • Medium 11
  • Low 5
  • Unrated 2

Disclosures per year

  1. 2022: 1
  2. 2023: 0
  3. 2024: 4
  4. 2025: 24
  5. 2026: 2
Severity:
  1. PyTorch Vulnerable to Remote Code Execution via Untrusted Checkpoint Files this entry
    High · 8.8 CVE-2026-24747 < 2.10.0 2.10.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.