# NLTK unsafe pickle deserialization in allowlisted loaders

Source: https://junglewise.ai/threats/nltk-unsafe-pickle-deserialization-in-allowlisted-loaders-eeef7a48  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-25. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: critical · CVSS 9.8 · Published 2026-08-25

NLTK is a widely-used natural language processing library that loads pre-trained models and tokenizers from pickle files. Versions before 3.10.3 contain a design flaw in their "safe" pickle loading mechanism that was meant to prevent code execution—but instead still allows attackers to run arbitrary commands by crafting malicious model or tokenizer artifacts. If an application loads untrusted models, attackers can achieve complete system compromise.

Technologies: [nltk (PyPI)](https://junglewise.ai/threats/technologies/nltk). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Critical severity, with a CVSS score of 9.8, published 25 August 2026.

**Which products and versions are affected?** nltk (PyPI) <= 3.10.2.

**Is there a fix for This vulnerability?** A patch was published on 2026-08-11: Patched version 3.10.3 released before disclosure; primary advisory GHSA-x99w-6fgc-pmfw published Aug 11, 2026 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network.

**Am I affected?** Check whether you run nltk (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is a deserialization flaw (CWE-502) in NLTK's allowlisted pickle loaders: nltk.picklesec.allowlisted_pickle_load(), nltk.tokenize.punkt.punkt_pickle_load(), and nltk.parse.transitionparser.TransitionParser.parse(). The root cause is that allowlists grant trust to entire module namespaces (e.g., nltk.tokenize, numpy) rather than specific safe callables. An attacker can craft a malicious pickle using pickle REDUCE to invoke dangerous in-namespace functions: ReppTokenizer._execute() calls subprocess.Popen(), and numpy.f2py.crackfortran.myeval() calls eval() with attacker-controlled input. Exploitation requires only that the victim application loads an attacker-supplied model or tokenizer artifact—no authentication or user interaction is needed. The attack is network-reachable if models are downloaded from untrusted sources. Patched versions 3.10.3+ replace broad namespace allowlists with exact (module, qualname) pairs and add post-load type validation and deny-list checks for dangerous modules.

## Affected products

- NLTK Project NLTK <= 3.10.2

## Timeline

- 2026-08-25: disclosed
- 2026-08-11: patched: Patched version 3.10.3 released before disclosure; primary advisory GHSA-x99w-6fgc-pmfw published Aug 11, 2026

## References

- [https://github.com/nltk/nltk/security/advisories/GHSA-x99w-6fgc-pmfw](https://github.com/nltk/nltk/security/advisories/GHSA-x99w-6fgc-pmfw)
- [https://www.vulncheck.com/advisories/nltk-before-3.10.3-remote-code-execution-via-unsafe-pickle-deserialization](https://www.vulncheck.com/advisories/nltk-before-3.10.3-remote-code-execution-via-unsafe-pickle-deserialization)

## Related threats

- [NLTK WekaClassifier path traversal in model validation](https://junglewise.ai/threats/cve-2026-109956-nltk-through-3-10-3-contains-a-path-traversal-vulnerability-in)
- [NLTK RecursiveDescentParser uncontrolled recursion denial of service](https://junglewise.ai/threats/cve-2026-12876-nltk-recursivedescentparser-uncontrolled-recursion-denial-of)
- [NLTK tgrep regular expression denial of service](https://junglewise.ai/threats/nltk-tgrep-regular-expression-denial-of-service-02fca1b2)
- [NLTK Downloader hardlink filesystem containment bypass](https://junglewise.ai/threats/nltk-downloader-hardlink-filesystem-containment-bypass-522cb97d)
- [NLTK Pl196xCorpusReader quadratic ReDoS on malformed TEI blocks](https://junglewise.ai/threats/nltk-pl196xcorpusreader-quadratic-redos-on-malformed-tei-blocks-8473e6ef)
