/

CVE-2026-31249

Severity:

HIGH RISK

(7.3)

Unsafe Deserialization in CosyVoice make_parquet_list.py

CVE-2026-31249

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Code Execution

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

CosyVoice's make_parquet_list.py data processing tool unsafely deserializes PyTorch .pt files using torch.load() without the weights_only=True security parameter, allowing arbitrary object loading through pickle.

If an attacker can introduce malicious .pt files into a processed data directory, running the tool can execute attacker-controlled code on the victim's machine.

Affected context

This vulnerability appears in environments where CosyVoice's make_parquet_list.py script is used to process directories of PyTorch .pt files containing utterance embeddings, speaker embeddings, or speech tokens.

The risk materializes when .pt files come from partially or fully untrusted sources (e.g., shared datasets, external contributors, or automated ingestion pipelines) and are processed without prior validation or isolation.

Systems such as experiment pipelines, training workflows, or batch preprocessing jobs that routinely run this script over large, mixed-trust datasets are particularly exposed.

Exploit preconditions

  • Attack surface: Local execution of the make_parquet_list.py tool on a system where CosyVoice is installed.
  • Required access: Ability to place or modify .pt files inside a directory that will be processed by the script (e.g., write access to a dataset folder).
  • Trigger point: Invocation of make_parquet_list.py on the attacker-controlled directory, causing torch.load() to deserialize the malicious .pt files.
  • Why exploitation is possible: torch.load() uses Python's pickle under the hood and, without weights_only=True or a restricted deserialization policy, it will reconstruct arbitrary Python objects that can execute code during unpickling.

Why this happens

The core issue is the use of a general-purpose deserialization mechanism for data that may not be fully trusted, a classic unsafe deserialization pattern described by CWE-502.

In this case, make_parquet_list.py calls torch.load() on .pt files without enabling protections like weights_only=True or enforcing a constrained format, effectively delegating trust to the pickle protocol.

Pickle is capable of reconstructing arbitrary Python objects, some of which can trigger code execution when they are deserialized.

This design treats external model/data artifacts as inherently trusted executable state instead of plain, inert data structures, allowing attacker-supplied .pt files to carry and execute malicious payloads during processing.

Potential impact

  • Execution of arbitrary Python or OS-level commands under the privileges of the user running the script
  • Compromise of developer or researcher workstations used for data preprocessing and experimentation
  • Theft or modification of sensitive data accessible to the compromised environment (e.g., training data, credentials, SSH keys)
  • Tampering with ML pipelines, including poisoning datasets or altering downstream training artifacts
  • Use of compromised systems as a foothold for lateral movement within internal networks

General mitigation guidance

Effective mitigation focuses on reducing trust in serialized artifacts and constraining deserialization behavior:

  • Prefer safe loading modes for PyTorch artifacts, such as using torch.load() with weights_only=True when only tensor weights or embeddings are needed.
  • Design serialization formats around simple, structured data (e.g., tensors, arrays, JSON-compatible objects) rather than arbitrary Python objects.
  • Introduce a clear trust boundary for dataset and model files, treating external or shared .pt files as untrusted by default.
  • Run preprocessing and data ingestion scripts under least-privilege user accounts, ideally inside containers or isolated environments to minimize blast radius.
  • Add validation steps that enforce expected shapes, dtypes, and keys for deserialized structures before they are used in the pipeline.
  • Document secure usage patterns for contributors and users, emphasizing that serialized binaries should not be treated as safe just because they are "model" or "embedding" files.

How teams detect issues like this

Detection generally combines code-centric review with pipeline-level monitoring:

  • Static analysis and code review:
  • Search for torch.load() and similar APIs (e.g., pickle.load, joblib.load) and flag call sites that deserialize externally supplied files.
  • Verify whether security-focused parameters (such as weights_only=True) or equivalent guards are in place when loading .pt files.
  • Look for data-processing scripts that automatically traverse directories and load files without validating origin or content type.
  • Policy and tooling:
  • Enforce secure deserialization guidelines through coding standards and pre-merge checks in CI pipelines.
  • Use automated review tools or linters configured to highlight unsafe deserialization patterns.
  • Maintain an inventory of scripts and services that ingest model or embedding artifacts, prioritizing them for manual security review.
  • Runtime monitoring:
  • In sensitive environments, consider running data-processing jobs in monitored sandboxes where unexpected system calls or network activity from such tools are flagged.

Sources

SourceLink
github.comgithub.com/FunAudioLLM/CosyVoice
notion.sonotion.so/CVE-2026-31249-35d1e13931888112af48f0bddf18f0b9

Frequently asked

questions

Not directly in the traditional network sense. Exploitation typically occurs when a user or automated pipeline locally runs make_parquet_list.py on attacker-controlled .pt files. However, if data directories are populated from remote or shared sources (e.g., downloaded datasets, shared network drives, or CI pipelines), an attacker can deliver malicious files remotely that are later processed locally.

The attacker needs the ability to place or modify .pt files in a directory that will be processed by the vulnerable script. This could be through compromised datasets, malicious contributions, misconfigured file shares, or other mechanisms that let them influence the input files consumed by make_parquet_list.py.

The safest pattern is to avoid deserializing arbitrary Python objects from untrusted sources. In practice, this means using safer deserialization modes (e.g., torch.load(..., weights_only=True) where applicable), restricting the file format to simple tensors or structured data, and validating the structure of loaded content. Refactoring tooling to rely on non-executable serialization formats wherever possible further reduces risk.

Establish a secure serialization policy for the project: treat all serialized binaries as untrusted by default, forbid generic pickle-based deserialization for external inputs, and require explicit safe-loading patterns. Complement this with code review checklists, automated static checks for dangerous deserialization calls, and guidance for contributors on how to safely share and consume model or embedding files.

Find out what's already
exploitable in your codebase.