Skip to content
Medium 5.5

NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks

CVE-2026-128137 First seen on SecPulse

Affected packages

PackageAffected → Fixed
nltknltk —
PyPInltk
≥ 3.9.4, < 3.10.4→ 3.10.4
pipnltk
< 3.10.4→ 3.10.4

Fix status by distribution

Records published by each distribution for this CVE. Fixed versions differ by release; check each link.

Original description The description as published by the source.

affected: PyPI nltk >= 3.9.4 — CorpusReader.abspaths()/abspath() and the PlaintextCorpusReader / SyntaxCorpusReader view methods
dynamically reproduced: nltk 3.9.4 (8/9, scoped-escape checks), 3.10.3 (wheel, 9/9 checks) and master 6818767b9 (9/9 checks)


Source references (file:line) are to commit 303f6e2b (release tag v3.10.3). Line numbers in the released nltk wheel match this tag exactly; master 6818767b9 contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In 3.9.4 the same logic exists at earlier line numbers (api.py:222-236 for open(), api.py:161-203 for abspath()/abspaths(), data.py:382-388 for the pointer open, pathsec.py:105-114 for the scoped branch); the affected code is identical.

Summary

CorpusReader.open() (nltk/corpus/reader/api.py:235-257) is NLTK's hardened file-access entry point: after a lexical guard it calls validate_path(..., required_root=self._root) (api.py:246-249), and the scoped branch of pathsec.validate_path (nltk/pathsec.py:168-179) resolves symlinks and raises ValueError when the resolved target is not inside the corpus root. The view methods do not use this entry point: PlaintextCorpusReader.words/sents/paras (nltk/corpus/reader/plaintext.py:67-118) and SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words (api.py:473-519) build their streams from self.abspaths(fileids, ...) (`api.py:174-21…

Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory

References

We use cookies for analytics and ad measurement. This setting applies to all Game co., Ltd. sites. Details