/

CVE-2026-31223

Severity:

HIGH RISK

(8.8)

Unsafe Deserialization in Snorkel BaseLabeler.load()

CVE-2026-31223

Modified

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Arbitrary Code Execution

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's BaseLabeler.load() method uses Python's unsafe pickle.load() API on user-supplied file paths without validation, enabling arbitrary object deserialization.

If an attacker can influence or supply the serialized labeler file, they can craft a malicious pickle payload that executes arbitrary code when loaded, resulting in full compromise of the victim's Python environment.

Affected context

This vulnerability affects applications that integrate Snorkel's BaseLabeler class and use BaseLabeler.load() to restore labeler models from pickle files.

It is most relevant when:

  • Model or labeler artifacts are loaded from paths influenced by user input or external sources (e.g., uploads, shared storage, APIs).
  • There is no integrity or authenticity verification of the model files.
  • The loading process runs with significant privileges or access to sensitive data or systems.

The risk is lower when all model files are locally generated, tightly controlled, and never overwritten or supplied by untrusted parties.

Exploit preconditions

  • Attack surface: The labeler model loading functionality exposed via APIs, web interfaces, CLI tools, or batch jobs that call BaseLabeler.load().
  • Required access: Ability to provide or tamper with the file path or underlying pickle file (e.g., via file upload, network share, compromised storage, or path injection).
  • Trigger point: Invocation of BaseLabeler.load() on a malicious pickle file containing crafted object constructors.
  • Why exploitation is possible: Python's pickle format supports arbitrary object instantiation and can execute code during deserialization. BaseLabeler.load() calls pickle.load() directly on untrusted file content without any format restriction, sandboxing, or trust validation.

Why this happens

The core issue is reliance on Python's pickle module to deserialize data that may be influenced by untrusted sources.

pickle is designed for serializing and deserializing Python objects, not for handling untrusted data; during unpickling, it can execute arbitrary code as part of rebuilding objects.

By calling pickle.load() on files referenced by user-controllable paths, the BaseLabeler.load() method creates a direct unsafe deserialization sink.

This maps to CWE-502 (Deserialization of Untrusted Data), where attacker-controlled serialized data is treated as trusted object graphs, enabling malicious behavior during reconstruction.

Potential impact

  • Execution of arbitrary Python or OS-level commands under the privileges of the application process.
  • Full compromise of the host environment running Snorkel-based workloads.
  • Theft or modification of training data, feature sets, and model artifacts.
  • Tampering with labeling logic to skew downstream models and analytics.
  • Use of the compromised system as a pivot point for lateral movement within the network.

General mitigation guidance

Effective mitigation focuses on eliminating unsafe deserialization and tightening trust boundaries around model artifacts:

  • Avoid using pickle for any data that could originate from, or be modified by, untrusted sources; prefer safer, data-only formats (e.g., JSON, YAML with safe loaders, or framework-specific safe serializers).
  • Introduce explicit model formats and schemas that treat labeler configuration and parameters as structured data rather than arbitrary Python objects.
  • Restrict where model and labeler files can be loaded from, using fixed, non-user-controlled directories and disallowing arbitrary file paths.
  • Apply strong integrity and authenticity checks (e.g., cryptographic signatures, checksums, or trusted artifact registries) before loading model files.
  • Run labeling and model-loading code with least privilege, in isolated environments or containers, to limit blast radius if a deserialization issue is triggered.

How teams detect issues like this

Detection typically combines code-level inspection with runtime monitoring:

  • Use static analysis or code search to locate uses of pickle.load(), pickle.loads(), or similar deserialization APIs and flag any paths influenced by external input.
  • During code review, treat any deserialization of complex objects as a high-risk pattern, especially where file paths are user-supplied or reside on shared or networked storage.
  • Enforce development policies that prohibit unsafe deserialization of untrusted data and require approved serialization formats for model artifacts.
  • Employ application security testing and dynamic analysis focused on endpoints or jobs that load user-provided files, attempting to supply non-conforming or instrumented payloads to observe behavior.
  • Monitor for unexpected process creation, network calls, or file system activity occurring immediately after model loading operations as possible indicators of exploitation.

Sources

SourceLink
github.comgithub.com/snorkel-team/snorkel
notion.sonotion.so/CVE-2026-31223-35d1e1393188811ab1d0e4a8a2e67992

Frequently asked

questions

It can be, depending on how Snorkel is integrated. If labeler models can be uploaded, selected from user-controlled locations, or otherwise influenced over the network, a remote attacker can provide a malicious pickle file and trigger code execution when BaseLabeler.load() is called.

An attacker needs control over the serialized model file or the path used by BaseLabeler.load(). This might be through a direct file upload feature, access to shared storage or object stores used for models, or an injection point that lets them redirect the loader to an attacker-controlled file.

The safest approach is to stop using pickle for any untrusted or semi-trusted model inputs and replace BaseLabeler loading with a data-only, schema-driven format. Where deserialization is still required, ensure only strictly validated, trusted artifacts from controlled locations are accepted, ideally with integrity checks.

Design ML pipelines and libraries so that models and labelers are expressed as configuration plus numeric parameters, not arbitrary executable objects. Standardize on safe serialization formats, introduce clear trust boundaries around artifact storage, and require security review for any feature that deserializes complex objects or loads executable code.

Find out what's already
exploitable in your codebase.