Executive brief
NLTK is a popular Python library for natural language processing that includes a downloader for fetching language models and datasets. The downloader extracts packages to a configurable directory but fails to prevent overwriting files outside that directory via hardlinks. On systems where users share a common downloader cache directory, an attacker with write access can craft malicious hardlinks to overwrite sensitive files, potentially compromising system integrity or other users' data.
Technical details
This is a filesystem containment bypass vulnerability in the `nltk.downloader.Downloader.download()` and `nltk.downloader.Downloader.incr_download()` methods. The downloader validates and rejects symlinks at extraction targets but treats pre-existing hardlinks as ordinary in-root files, allowing writes through the hardlink to mutate inodes outside the install tree. The attack requires the attacker to plant files in a writable shared downloader root on the same filesystem as the target, then trigger extraction of a package whose member lands on the hardlink path. The vulnerability affects NLTK versions through 3.10.2 and is patched in 3.10.3. Successful exploitation results in arbitrary file overwrite with integrity and availability impact on the vulnerable system.
Affected products
- NLTK Project NLTK through 3.10.2
Timeline
- 2026-08-12: disclosed
- 2026-09-02: advisory
- 2026-08-28: patched: Patch released as v3.10.3
References
- https://github.com/nltk/nltk/security/advisories/GHSA-f794-5jv7-7672
- https://github.com/nltk/nltk/pull/3797
- https://github.com/nltk/nltk/commit/9e6d5f05902b9aaa1221a0a565448d17a9c9b3e8
- https://github.com/nltk/nltk/releases/tag/v3.10.3
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3741.yaml