CVE-2026-31214

Published May 12, 2026 CVSS 3.1 · 9.8 Critical EPSS < 1% KEV · Not listed
Description
The torch-checkpoint-shrink.py script in the ml-engineering project in commit 0099885db36a8f06556efe1faf552518852cb1e0 (2025-20-27) contains an insecure deserialization vulnerability (CWE-502). The script uses torch.load() to process PyTorch checkpoint files (.pt) without enabling the security-restrictive weights_only=True parameter. This oversight allows the deserialization of arbitrary Python objects via the pickle module. A remote attacker can exploit this by providing a maliciously crafted checkpoint file, leading to arbitrary code execution in the context of the user running the script.

Analysis

AI-generated

Technical impact

The torch-checkpoint-shrink.py script fails to set the security‑restrictive weights_only=True parameter when calling torch.load(), allowing arbitrary Python objects to be deserialized via pickle. This flaw is classified as CWE‑502 (Insecure Deserialization). An attacker who can supply a maliciously crafted .pt checkpoint file can trigger the script to execute arbitrary code in the environment of the user running the script, leading to complete compromise of that system.

Affected Systems

The vulnerability exists in the open‑source ml‑engineering project, specifically the torch-checkpoint-shrink.py script. Any installation of this script that is capable of processing external checkpoint files is affected; there are no vendor or product version details provided beyond the open‑source repository identifier.

Risk and Exploitability

With an EPSS score of <1% and not listed in CISA KEV, the CVSS score of 9.8 confirms an extremely high severity for arbitrary code execution. The lack of the weights_only parameter makes the script vulnerable to pickle deserialization of malicious objects. Because the attacker must provide a crafted checkpoint file to the script, exploitation is limited to scenarios where the script processes untrusted data; nevertheless, once executed the attack achieves full control of the running process.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Modify the script to call torch.load(..., weights_only=True) before loading any checkpoint file.
  • Validate that any .pt file originates from a trusted source or use a safe deserialization method before passing it to torch.load().
  • Apply an updated version of the script when one becomes available, or replace the script with a hardened alternative that performs explicit type checking on loaded objects.

Generated by OpenCVE AI on May 13, 2026 at 15:35 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Stas00
Stas00 ml-engineering
Vendors & Products Stas00
Stas00 ml-engineering
Type Values Removed Values Added
Title Insecure deserialization in torch-checkpoint-shrink script leading to remote code execution
Type Values Removed Values Added
Weaknesses CWE-502
Metrics cvssV3_1

{'score': 9.8, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H'}

ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
Title Insecure deserialization in torch-checkpoint-shrink script leading to remote code execution
Type Values Removed Values Added
Description The torch-checkpoint-shrink.py script in the ml-engineering project in commit 0099885db36a8f06556efe1faf552518852cb1e0 (2025-20-27) contains an insecure deserialization vulnerability (CWE-502). The script uses torch.load() to process PyTorch checkpoint files (.pt) without enabling the security-restrictive weights_only=True parameter. This oversight allows the deserialization of arbitrary Python objects via the pickle module. A remote attacker can exploit this by providing a maliciously crafted checkpoint file, leading to arbitrary code execution in the context of the user running the script.
References
Weaknesses
  • CWE-502

    Deserialization of Untrusted Data

Sources

Status
PUBLISHED
Assigner
mitre
Published
Updated
May 13, 2026, 1:54 PM
Reserved
Mar 9, 2026, 12:00 AM
Status
Deferred
Published
May 12, 2026, 4:16 PM
Modified
Jun 17, 2026, 10:33 AM