VulnWatch by ve1ve2
medium 6.1 EPSS 0.24%

GHSA-c59x-vh6j-3w8v: NLTK: AllowlistUnpickler does not deny numpy submodule-local file-I/O sinks

Source:
OSV.dev
Published:
Fetched:
Updated:
Affects:
nltk

https://osv.dev/vulnerability/GHSA-c59x-vh6j-3w8v ↗

osvpypifix-available

NLTK: AllowlistUnpickler does not deny numpy submodule-local file-I/O sinks ### Summary `nltk.picklesec.allowlisted_pickle_load` keyed its denylist of dangerous globals by export name, so numpy's file-I/O callables that live in submodules and are not re-exported under `__module__ == "numpy"` were never matched. Under the broad `allowed_modules=("numpy", "scipy", "sklearn")` allowance that `TransitionParser.parse(depgraphs, modelFile)` granted for model files, a crafted protocol 4 pickle could name `numpy.lib._npyio_impl.recfromtxt` (arbitrary file read, result returned to the caller of `allowlisted_pickle_load`) or `numpy.lib.format.open_memmap` (attacker-chosen file create), and the REDUCE opcode invoked them during the load. ### Affected nltk >= 3.10.0 and <= 3.10.3 (the allowlisting unpickler and the `TransitionParser` model path); numpy must be installed. ### Reproduction A pickle whose REDUCE names `numpy.lib._npyio_impl.recfromtxt` with a target path, loaded through `allowlisted_pickle_load(data, allowed_modules=("numpy",))`, reads that file on v3.10.3; one naming `numpy.lib.format.open_memmap` with mode `w+` creates a file. Both are refused on develop with `UnpicklingError: global '...' is from a denied module`. The maintainer transcript below shows the before and after runs. ### Impact File read and file create on the host that loads an untrusted model through NLTK's allowlisting unpickler. No code execution: this sits below the `TransitionParser` code-execution sibling GHSA-m396-3h67-vpfv, which is why the severity was reassessed to Medium (see the reply below). _Editorial note (2026-10-10): the report body of this advisory had been overwritten with the text of GHSA-rv69-j573-cm47 (the nested gzip decompression bomb). The summary above was reconstructed by the maintainers from the title, the maintainer reply, the CVSS justification and PR #3757; the original reporter text is not recoverable from the record._ --- ## Fix status (2026-09-28) Status: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix). PR: #3778 "Bound decompression entry points in nltk (zip/gzip layers + pathsec.ZipFile + weka), CWE-409", merged 2026-08-25, merge commit 42d99b7a2 on develop. Fix commits: b6e0cedca (the nested gzip layer of a zip .gz member is bounded) and c6fe98211 (the decompression guards stream instead of buffering whole payloads). Probe: none. The advisory PoC re-run on develop 2fa3f48fe (256 MiB of zeros gzipped into a STORED zip member declared at about 256 KiB, read through nltk.data.find().open().read()): refused with ValueError "Refusing to decompress suspected gzip bomb 'corpus/bomb.gz': it expands beyond nltk.data.MAX_UNZIP_RATIO=1000". Release: none yet; no release tag contains b6e0cedca. --- ## Maintainer reply (2026-09-28) Status: fixed on develop, unreleased. ### Fix verified The numpy submodule file I/O sinks named in this report are denied on develop. This is fixed by PR #3757 ("Harden untrusted-model pickle allowlist (exact globals + numpy.lib denylist)"), merged into develop Affected: PyPI:nltk Fixed in: 3.10.4 References: https://github.com/nltk/nltk/security/advisories/GHSA-c59x-vh6j-3w8v https://nvd.nist.gov/vuln/detail/CVE-2026-128136 https://github.com/nltk/nltk/pull/3757 https://github.com/nltk/nltk/commit/a44a7af69bca87e92d9c4a701fcbbe4512e8d450 https://github.com/nltk/nltk https://github.com/nltk/nltk/releases/tag/v3.10.4

Linked vulnerabilities (4)

CVE-2026-128136 medium 6.1 EPSS 0.24% (p16) NVDCVE.orgGHSAGHSAGHSA
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N

nltk: nltk: Unauthorized file access via unsafe deserialization in model loading

CWE: CWE-502Aliases: GHSA-c59x-vh6j-3w8v, GHSA-m396-3h67-vpfv, GHSA-rv69-j573-cm47NVD: Awaiting Analysis
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:L/A:N

NLTK: AllowlistUnpickler does not deny numpy submodule-local file-I/O sinks

CWE: CWE-502Aliases: CVE-2026-128136, GHSA-m396-3h67-vpfv, GHSA-rv69-j573-cm47

Also reported by (1)