/

CVE-2026-71513

Severity:

HIGH RISK

(8.8)

Unsafe Deserialization (CWE-502) in NLTK Model Parser

CVE-2026-71513

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote 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

NLTK contains an unsafe pickle deserialization flaw in AllowlistUnpickler, where validation checks the pickle module but not the referenced global name. An attacker who can supply a crafted transition-parser model may execute arbitrary commands when TransitionParser.parse loads that model.

Affected context

The vulnerability occurs in NLTK deployments that use the transition-parser functionality to load models through allowlisted_pickle_load. It becomes risky when an untrusted or attacker-controlled model can reach the parser loading path, such as through model ingestion, shared storage, or an application endpoint that accepts externally supplied model artifacts.

Exploit preconditions

  • Attack surface: NLTK transition-parser model loading
  • Required access: Ability to provide, replace, or influence a model artifact
  • Trigger point: TransitionParser.parse loading a model through allowlisted_pickle_load
  • Why exploitation is possible: The allowlist validates the pickle module string but does not adequately constrain the global name, permitting attribute traversal to callables outside the intended namespace

Why this happens

The underlying bug is an incomplete allowlist applied during pickle deserialization. Allowing a module while failing to validate the complete global name permits references to be resolved through attributes beyond the approved namespace. Because pickle loading can reconstruct objects and invoke callable behavior, this trust-boundary failure maps to CWE-502, Unsafe Deserialization.

Potential impact

  • An attacker may execute arbitrary operating-system commands in the NLTK process
  • The affected application could be compromised
  • Credentials, model data, or other local resources could be exposed
  • The attacker could modify files or influence downstream processing
  • A compromised service could be used for lateral movement, depending on its privileges

General mitigation guidance

Mitigation generally focuses on avoiding executable serialization formats for

untrusted model artifacts and reducing trust in model sources.

Common defensive patterns include:

  • Prefer non-executable, schema-defined model formats where practical
  • Apply strict, full-name allowlists when object deserialization is unavoidable
  • Validate model structure and provenance before loading it
  • Keep model repositories and transfer channels access-controlled and integrity-protected
  • Load models in isolated, least-privileged processes with restricted filesystem and network access
  • Separate model ingestion from sensitive application workloads

How teams detect issues like this

Organizations can look for this class of issue through:

  • Static analysis rules identifying pickle loading and custom unpicklers
  • Code review checks for allowlists that validate only modules or prefixes
  • Tests using unexpected qualified names and attribute-resolution paths
  • Dependency and policy scans for executable deserialization in model pipelines
  • Runtime monitoring for unexpected child processes, command execution, or model-loading activity

Automated code review and software composition analysis tools may help identify

unsafe deserialization patterns before deployment.

Sources

SourceLink
github.comgithub.com/nltk/nltk
github.comgithub.com/nltk/nltk/blob/v3.10.2/nltk/picklesec.py#L119-L124
github.comgithub.com/nltk/nltk/commit/c3e37113742a1ebeeb4f2ca58941f320f98805ea
vulncheck.comvulncheck.com/advisories/nltk-through-remote-code-execution-via-allowlistunpickler-dotted-name-bypass

Frequently asked

questions

It can be exploitable remotely when an application accepts or retrieves

attacker-controlled transition-parser models through a network-accessible

workflow. In other deployments, exploitation may require local access to

model storage or a trusted model distribution path.

The attacker generally needs the ability to introduce, replace, or influence a

model that is later loaded by TransitionParser.parse. The exact access

requirement depends on how models are uploaded, stored, and distributed.

Avoid loading untrusted pickle data and use a non-executable, schema-validated

model representation where feasible. If deserialization is necessary, enforce

complete qualified-name restrictions rather than validating only a module

component.

Treat model artifacts as untrusted input, verify their provenance and

integrity, isolate model loading, apply least privilege, and include

deserialization-focused tests and static analysis in the development process.

Find out what's already
exploitable in your codebase.