/

CVE-2026-31222

Severity:

HIGH RISK

(8.8)

Unsafe Deserialization in Snorkel Trainer.load()

CVE-2026-31222

Modified

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution via Malicious Model Checkpoints

Severity:

HIGH RISK

(8.8)

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

Snorkel up to version 0.10.0 contains an unsafe deserialization issue in the Trainer.load() method, which uses torch.load() without the security-restrictive weights_only=True parameter.

If an attacker can supply or influence a model checkpoint file, they can craft a malicious payload that leads to arbitrary code execution when the file is loaded through the vulnerable method.

Affected context

This vulnerability affects applications that:

  • Use the Snorkel library (through v0.10.0),
  • Rely on the Trainer class and its Trainer.load() method to restore models from checkpoints,
  • Load model artifacts from locations or channels that may be influenced by external parties (e.g., user uploads, shared storage, CI artifacts, third-party model repositories).

The risk is elevated when model checkpoint files are not strictly controlled, validated, or sourced from fully trusted origins.

Exploit preconditions

  • Attack surface: Model checkpoint loading via Trainer.load() in Snorkel-based applications.
  • Required access: Ability to provide or modify model checkpoint files that the application will load (e.g., upload, replace on disk, control network storage, or compromise a model repository).
  • Trigger point: Invocation of Trainer.load() on a malicious checkpoint file, either during training resumption, evaluation, or deployment startup.
  • Why exploitation is possible: Trainer.load() calls torch.load() without weights_only=True, causing PyTorch to deserialize arbitrary Pickle objects embedded in the checkpoint, which can execute attacker-controlled code during deserialization.

Why this happens

The underlying issue is the use of a general-purpose deserialization mechanism on data that may be attacker-controlled, without restricting what can be instantiated.

In this case, Trainer.load() relies on torch.load(), which uses Python's Pickle under the hood. Without the weights_only=True option or equivalent safeguards, the loader reconstructs arbitrary Python objects encoded in the checkpoint file, including those with side effects during unpickling. This maps directly to CWE-502: Deserialization of Untrusted Data, where serialized data is treated as trusted program state instead of opaque, data-only content.

Potential impact

  • Arbitrary code execution in the context of the process loading the model.
  • Compromise of the host system running the Snorkel-based application.
  • Theft or manipulation of sensitive data used during training or inference.
  • Installation of backdoors or persistence mechanisms in ML pipelines or deployment environments.
  • Lateral movement to other systems reachable from the compromised host.

General mitigation guidance

Effective mitigation focuses on treating model files as potentially hostile and constraining deserialization behavior:

  • Prefer loading data-only artifacts: use weights_only=True or equivalent options to limit loading to tensor weights and simple data structures rather than arbitrary objects.
  • Introduce a strict trust boundary around model checkpoints: only load models from vetted, authenticated sources (e.g., signed artifacts, controlled registries, or tightly permissioned storage).
  • Apply content validation and metadata checks before loading: verify expected file format, schema, and origin rather than blindly deserializing.
  • Run ML workloads under least privilege, using dedicated service accounts, restricted filesystem access, and isolation mechanisms (containers, sandboxes) to limit blast radius if deserialization is abused.
  • Reduce reliance on generic object serialization formats like Pickle for cross-boundary data exchange, favoring safer, data-only formats where feasible.

How teams detect issues like this

Detection should aim to identify unsafe deserialization patterns and untrusted model sources:

  • Configure static analysis or code scanning to flag calls to torch.load() (or similar APIs) that are invoked without weights_only=True or other restrictions, especially in code paths that handle external or user-influenced input.
  • During code review, scrutinize any logic that:
  • Loads models, checkpoints, or pipelines from file or network locations, and
  • Uses Pickle-based or equivalent deserialization mechanisms without explicit trust assumptions.
  • Implement security policies in CI/CD that:
  • Prevent merging changes introducing new unsafe deserialization calls,
  • Require explicit justification and documentation for any remaining uses of generic Pickle-based loading.
  • Use runtime monitoring or logging to track when and from where model checkpoints are loaded, correlating unusual sources or patterns with potential abuse.

Sources

SourceLink
github.comgithub.com/snorkel-team/snorkel
notion.sonotion.so/CVE-2026-31222-35d1e139318881db8398e0732af8df6d

Frequently asked

questions

It can be, if the application accepts model checkpoint files from remote users or remote storage under attacker control. In such setups, an attacker can deliver a malicious checkpoint that triggers code execution when loaded.

It depends on how the application is designed. If only authenticated users or internal services can influence checkpoint files, exploitation requires compromising those channels or accounts. If arbitrary users can upload or replace model files, then no additional authentication beyond that mechanism is needed.

Restrict deserialization to data-only content by using safer loading modes (such as weights_only=True where available) and avoid Pickle-backed deserialization for untrusted or semi-trusted inputs. Combine this with strict control over where model artifacts can come from.

Establish a policy that model and pipeline artifacts are treated like executable code: only load from trusted, verified sources; avoid generic object serialization for cross-boundary exchange; employ static analysis and code review checks for deserialization usage; and run ML components with minimal privileges and strong isolation to contain potential exploitation.

Find out what's already
exploitable in your codebase.