CVE-2026-31250: CosyVoice: RCE via unsafe torch.load() in model averaging
UNKNOWNCosyVoice's model averaging utility loads PyTorch checkpoint files using torch.load() without the weights_only=True parameter, enabling arbitrary Python code execution via pickle deserialization when processing malicious .pt files. Any ML engineer or automated pipeline running average_model.py against attacker-controlled checkpoints will execute that payload under their own OS credentials — a targeted supply chain attack against fine-tuning and model averaging workflows. While no public exploit or active exploitation is confirmed and the CVE carries no CVSS score yet, crafting malicious pickle payloads is trivial and extensively documented, and ML teams routinely share checkpoint files from community or external sources. Audit all CosyVoice model averaging usage involving externally-sourced checkpoints and apply the fix by pinning past the vulnerable commit or adding weights_only=True to the torch.load() call in average_model.py.
What is the risk?
MEDIUM. The vulnerability is not remotely exploitable in the traditional sense — it requires an attacker to place malicious .pt checkpoint files in a directory the victim processes with average_model.py. However, the attack is trivially easy to execute once a malicious file is in position, and the ML ecosystem normalizes sharing and reusing checkpoints from Hugging Face, GitHub, and internal repositories without integrity verification. Organizations running automated fine-tuning or model averaging pipelines that pull checkpoints from external or shared sources are at elevated risk.
How does the attack unfold?
How severe is it?
What should I do?
4 steps-
Patch: Update CosyVoice past commit 6e01309e01bc93bbeb83bdd996b1182a81aaf11e, or manually change torch.load(path) to torch.load(path, weights_only=True) in average_model.py.
-
Source validation: Only process checkpoint files from trusted, internally-controlled sources; reject external .pt files for model averaging without cryptographic verification.
-
Sandbox: Run model averaging tools in isolated environments (containers or VMs) without access to sensitive credentials or downstream infrastructure.
-
Detection: Scan .pt/.pth files with fickling (Trail of Bits) or picklescan before loading. Monitor for unexpected process spawns or outbound network connections during torch.load() operations.
What does CISA's SSVC say?
Source: CISA Vulnrichment (SSVC v2.0). Decision based on the CISA Coordinator decision tree.
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is CVE-2026-31250?
CosyVoice's model averaging utility loads PyTorch checkpoint files using torch.load() without the weights_only=True parameter, enabling arbitrary Python code execution via pickle deserialization when processing malicious .pt files. Any ML engineer or automated pipeline running average_model.py against attacker-controlled checkpoints will execute that payload under their own OS credentials — a targeted supply chain attack against fine-tuning and model averaging workflows. While no public exploit or active exploitation is confirmed and the CVE carries no CVSS score yet, crafting malicious pickle payloads is trivial and extensively documented, and ML teams routinely share checkpoint files from community or external sources. Audit all CosyVoice model averaging usage involving externally-sourced checkpoints and apply the fix by pinning past the vulnerable commit or adding weights_only=True to the torch.load() call in average_model.py.
Is CVE-2026-31250 actively exploited?
No confirmed active exploitation of CVE-2026-31250 has been reported, but organizations should still patch proactively.
How to fix CVE-2026-31250?
1. Patch: Update CosyVoice past commit 6e01309e01bc93bbeb83bdd996b1182a81aaf11e, or manually change torch.load(path) to torch.load(path, weights_only=True) in average_model.py. 2. Source validation: Only process checkpoint files from trusted, internally-controlled sources; reject external .pt files for model averaging without cryptographic verification. 3. Sandbox: Run model averaging tools in isolated environments (containers or VMs) without access to sensitive credentials or downstream infrastructure. 4. Detection: Scan .pt/.pth files with fickling (Trail of Bits) or picklescan before loading. Monitor for unexpected process spawns or outbound network connections during torch.load() operations.
What systems are affected by CVE-2026-31250?
This vulnerability affects the following AI/ML architecture patterns: Model training pipelines, Model fine-tuning workflows, MLOps checkpoint management, Speech synthesis infrastructure.
What is the CVSS score for CVE-2026-31250?
No CVSS score has been assigned yet.
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0002.001 Models AML.T0010.003 Model AML.T0011.000 Unsafe AI Artifacts AML.T0018.002 Embed Malware Compliance Controls Affected
What are the technical details?
Original Advisory
CosyVoice thru commit 6e01309e01bc93bbeb83bdd996b1182a81aaf11e (2025-30-21) contains an insecure deserialization vulnerability (CWE-502) in its average_model.py model averaging tool. The script loads PyTorch checkpoint files (epoch_*.pt) for model averaging using torch.load() without enabling the weights_only=True security parameter. This allows the deserialization of arbitrary Python objects via the pickle module. An attacker can exploit this by providing malicious checkpoint files within a directory. When a victim uses the tool to average models from this directory, arbitrary code is executed on the victim's system.
Exploitation Scenario
An adversary targeting an ML team using CosyVoice uploads a malicious epoch_00.pt checkpoint to a shared model repository, Hugging Face model hub, or internal object storage. A researcher downloads the checkpoint directory and runs average_model.py to create an ensemble. torch.load() deserializes the embedded pickle payload, executing a reverse shell or credential harvester under the researcher's OS account. In automated pipelines that periodically pull and average community checkpoints, this triggers without any direct user interaction, giving the attacker persistent access to training infrastructure.
References
Timeline
Related Vulnerabilities
CVE-2025-59528 10.0 Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Supply Chain CVE-2024-2912 10.0 BentoML: RCE via insecure deserialization (CVSS 10)
Same attack type: Supply Chain CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Supply Chain CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Supply Chain CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same attack type: Code Execution