Deserialization of Untrusted DataWeakness · CWE-502

CVE-2026-31232

HIGH · 8.8 CVSS v3.1 Published 2026-05-12
Mitigation only
No fix yet — a mitigation exists. There is no fixed release. A documented workaround reduces exposure in the meantime.
See remediation →
95/100
Remediation priority · Urgent
Remotely reachable No privileges

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
The CosyVoice project thru commit 6e01309e01bc93bbeb83bdd996b1182a81aaf11e (2025-30-21) contains an insecure deserialization vulnerability (CWE-502) in its model loading process. When loading model files (.pt) from a user-specified directory (via the --model_dir argument), the code uses torch.load() without the security-restrictive weights_only=True parameter. This allows the deserialization of arbitrary Python objects via the Pickle module. An attacker can exploit this by providing a maliciously crafted model directory containing .pt files with embedded pickle payloads. When a victim loads this directory using CosyVoice's web interface, the malicious payload is executed, leading to remote code execution on the victim's system.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

CosyVoice uses torch.load() without the weights_only=True parameter when loading model files (.pt) from user-specified directories via --model_dir. This allows arbitrary pickle deserialization, enabling remote code execution through maliciously crafted model files.

MitigationAdd weights_only=True to all torch.load() calls, or migrate to safer serialization formats like SafeTensors, and implement model file integrity validation.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Locate CosyVoice installation
    Find the CosyVoice source code directory. Common locations include: pip show cosyvoice and examine the Location path, or search for cosyvoice directories in Python site-packages or project folders.
    Affected if CosyVoice is not installed - not affected; if installed, continue checks.
  2. Find torch.load() calls in model loading code
    Search the CosyVoice codebase for patterns: grep -rn 'torch.load' or inspect files that handle model loading, typically in inference scripts, model loading utilities, or the main entry point.
    Affected if No torch.load() calls found - not affected; if found, continue.
  3. Verify --model_dir parameter exists
    Search for argument parsing: grep -rn 'model_dir' to find where the --model_dir CLI argument is defined and passed to model loading functions.
    Affected if --model_dir parameter not used - not affected; if used, continue.
  4. Check if weights_only=True is missing
    Examine each torch.load() call that loads .pt files. Look for the presence or absence of the weights_only parameter. The vulnerability exists when weights_only=True is NOT specified.
    Affected if torch.load() calls loading .pt files lack weights_only=True - vulnerable to RCE.
  5. Confirm model files are loaded from user-specified path
    Trace the code flow: verify that the path from --model_dir is passed directly to torch.load() without validation, signing, or integrity checks.
    Affected if Untrusted .pt files from --model_dir are loaded without validation - actively vulnerable.

If CosyVoice is installed and loads .pt model files from user-controlled directories via --model_dir without weights_only=True, the environment is affected and vulnerable to remote code execution.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Mitigation available No clean upgrade yet — mitigate in the meantime
Mitigation

Add weights_only=True to all torch.load() calls, or migrate to safer serialization formats like SafeTensors, and implement model file integrity validation.

Recommended fix Moderate confidence
  1. 1. Locate all instances of torch.load() in the CosyVoice codebase, particularly in model loading functions that handle the --model_dir argument
  2. 2. For each torch.load() call that loads .pt model files, add the weights_only=True parameter
  3. 3. Example fix: Change torch.load(model_path) to torch.load(model_path, weights_only=True)
  4. 4. If weights_only=True causes legitimate model loading failures (some models use custom classes), consider implementing a safe loading approach using torch.serialization.safe_load or validating model files before loading
  5. 5. After applying the patch, test model loading with the --model_dir argument to ensure functionality is preserved
  6. 6. Deploy the patched version to all systems using CosyVoice
Caveat Using weights_only=True may break loading of models that legitimately contain custom Python objects. If this occurs, a custom unpickler or model re-export may be required.

Generated from the published advisory — verify against the referenced sources before acting.

Have this fixed Scoped from the published advisory
  • Consultation2.0 h
  • Implementation2.0 h
  • Testing3.0 h
  • Review / QA2.0 h
9.0 hours of engineering $1,570
Get help mitigating

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,512.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-31232 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-31232 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data