/

CVE-2026-76843

Severity:

HIGH RISK

(7.8)

Unsafe Deserialization (CWE-502) in Flair Clustering

CVE-2026-76843

Deferred

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

Severity:

HIGH RISK

(7.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

Flair's clustering model loader deserializes model data with Python pickle, allowing attacker-controlled model files to execute arbitrary code during loading. The risk arises when an untrusted or tampered model file is supplied to a process that imports and invokes the clustering loader.

Affected context

The vulnerable behavior is present in distributed Flair packages that contain

flair/models/clustering.py, including the affected 0.15.x wheels. The

ClusteringModel.load method remains reachable through a direct module

import even though clustering support was removed from the documented API.

Deployments are at risk when model files can be downloaded, uploaded, shared,

or otherwise modified by parties outside the application's trust boundary.

Exploit preconditions

  • Attack surface: Model-loading functionality exposed through the Flair Python package
  • Required access: Ability to provide, replace, or influence a model file loaded by the application
  • Trigger point: Invocation of ClusteringModel.load for the attacker-controlled file
  • Why exploitation is possible: The loader passes serialized model data to pickle.loads, which can execute code as part of object reconstruction
  • Execution context: The attacker's code runs with the privileges of the process performing the model load

Why this happens

The root cause is unsafe deserialization of untrusted model data. The

clustering loader obtains serialized content through Joblib and then passes

it to Python's pickle deserializer, which permits executable reconstruction

behavior rather than limiting input to inert data. This is CWE-502: Deserialization of Untrusted Data, because serialized input is treated as

trusted object state without adequately enforcing a safe format or trust

boundary.

Potential impact

  • An attacker could execute arbitrary Python code in the loading process
  • The application process may be compromised or used to access local data
  • Credentials, tokens, or other secrets available to the process could be exposed
  • The host or workload could be used for persistence, lateral movement, or further attacks
  • Model integrity and downstream machine-learning results may be affected

General mitigation guidance

Mitigation generally focuses on eliminating executable deserialization from

untrusted model-loading paths and reducing trust in model artifacts.

Common defensive patterns include:

  • Prefer non-executable, schema-constrained model formats for untrusted artifacts
  • Use restricted loaders that cannot instantiate arbitrary application objects
  • Treat downloaded and user-supplied models as untrusted until independently verified
  • Apply integrity and provenance checks before model loading
  • Isolate model-processing workloads with least privilege, restricted network access, and minimal filesystem permissions
  • Separate model validation from privileged application processes
  • Keep undocumented or legacy loading paths disabled where they are not required

How teams detect issues like this

Detection approaches can include:

  • Static analysis searches for pickle.loads, pickle.load, Joblib loading, and custom deserialization in model-ingestion code
  • Code review checks for executable serialization formats crossing trust boundaries
  • Dependency and artifact inspection to identify distributed modules that remain importable despite API removal
  • Runtime monitoring for unexpected child processes, filesystem changes, or network connections during model loading
  • Policy enforcement requiring model provenance, integrity verification, and approved serialization formats
  • Automated security review tools that flag unsafe deserialization sinks and untrusted data flows

Sources

SourceLink
github.comgithub.com/flairNLP/flair
github.comgithub.com/flairNLP/flair/blob/v0.14.0/flair/models/clustering.py
pypi.orgpypi.org/project/flair/0.15.1/
vulncheck.comvulncheck.com/advisories/flair-and-deserialization-of-untrusted-data-via-clusteringmodel-load

Frequently asked

questions

It can be exploitable remotely when an application accepts or retrieves

attacker-controlled model files through a network-facing upload, repository,

storage location, or model distribution workflow. The vulnerable loader itself

does not require a direct network connection.

The attacker generally needs a way to influence the model artifact that a

process loads, such as uploading a file, modifying shared storage, or

controlling a model source. The resulting code executes with the loader's

process privileges.

Avoid deserializing untrusted data with pickle or other executable formats.

Prefer a restricted, schema-based model representation and verify artifact

integrity and provenance before loading.

Treat model files as untrusted input, enforce approved serialization formats

through development and deployment policy, review deserialization sinks, and

isolate model-loading workloads with least privilege.

Find out what's already
exploitable in your codebase.