/

CVE-2026-79657

Severity:

CRITICAL RISK

(9.8)

Unsafe Pickle Loading (CWE-502) in NLTK Model Artifacts

CVE-2026-79657

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution

Severity:

CRITICAL RISK

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

NLTK versions before 3.10.3 contain an unsafe deserialization vulnerability in allowlisted pickle loaders that trust whole module namespaces rather than specific safe callables. An attacker who can cause a malicious model or tokenizer artifact to be loaded may achieve arbitrary command execution in the affected process.

Affected context

The vulnerability occurs in NLTK deployments that load model or tokenizer artifacts through the affected pickle-based loaders. It becomes risky when an attacker can supply, replace, or otherwise influence an artifact before it is loaded, and when the loading process has meaningful operating-system or application permissions.

Exploit preconditions

  • Attack surface: Model or tokenizer artifact loading within an NLTK-enabled application
  • Required access: Ability to influence, replace, upload, or otherwise cause a malicious artifact to be selected
  • Trigger point: Deserialization during artifact loading
  • Why exploitation is possible: Namespace-level allowlisting permits dangerous functions within trusted modules to be invoked during pickle reconstruction

Why this happens

The underlying bug is unsafe deserialization of attacker-influenced pickle data. Rather than restricting reconstruction to an explicit set of inert, approved callables, the loader trusts broader module namespaces, allowing pickle reduction behavior to reach functions with command-execution capabilities. This maps to CWE-502: Deserialization of Untrusted Data, because serialized input is treated as trusted executable object-construction logic.

Potential impact

  • An attacker may execute arbitrary operating-system commands
  • The affected application process could be compromised
  • Credentials, tokens, or locally accessible data could be exposed
  • Attackers could modify application data or model artifacts
  • A compromised process could be used for further access depending on its privileges

General mitigation guidance

Mitigation generally focuses on eliminating implicit code execution during artifact loading and reducing trust in serialized inputs.

Common defensive patterns include:

  • Prefer data-only formats with explicit schemas over general-purpose pickle artifacts
  • Use deserializers that permit only narrowly defined, inert types and exact approved callables
  • Treat model and tokenizer artifacts as untrusted until verified through an independent trust process
  • Enforce integrity and provenance checks for artifacts before loading
  • Store artifacts in locations with controlled write permissions and restricted publication access
  • Run artifact-loading processes with least privilege, limited filesystem access, and constrained network permissions
  • Separate artifact validation from production loading where practical

How teams detect issues like this

Organizations can identify similar risks through:

  • Static analysis rules for pickle loading, generic object reconstruction, and broad namespace allowlists
  • Code review checks for deserializers that validate module membership instead of exact callable identity
  • Inventory and policy controls for model, tokenizer, and other serialized artifacts
  • Runtime monitoring for unexpected child processes, command interpreters, or unusual outbound connections during artifact loading
  • CI checks that reject untrusted serialization formats or require artifact integrity metadata
  • Automated security review tools that flag unsafe deserialization APIs and overly broad allowlisting

Sources

SourceLink
github.comgithub.com/nltk/nltk/security/advisories/GHSA-x99w-6fgc-pmfw
vulncheck.comvulncheck.com/advisories/nltk-before-3.10.3-remote-code-execution-via-unsafe-pickle-deserialization

Frequently asked

questions

It can be exploitable remotely when an application accepts attacker-controlled artifacts, retrieves them from an untrusted source, or exposes an artifact-upload or replacement workflow. Otherwise, exploitation may require local or supply-chain access to the artifact location.

The attacker needs a way to influence which model or tokenizer artifact is loaded, or to modify an artifact that a vulnerable process will subsequently read. The resulting impact also depends on the permissions of that process.

Avoid general-purpose pickle deserialization for untrusted artifacts. Use data-only, schema-constrained formats or a deserializer that permits only precisely defined safe types and callables.

Establish artifact provenance and integrity controls, restrict artifact write access, review deserialization logic for exact allowlists, and run loading components with minimal privileges and limited connectivity.

Find out what's already
exploitable in your codebase.