Executive brief
NLTK is a natural language processing library used by developers to build text analysis applications. A vulnerability in its downloader component allows attackers with write access to a shared downloader directory to overwrite arbitrary files outside the intended installation directory by creating hardlinks. This could lead to unauthorized modification of system files or application data, compromising system integrity and availability.
Technical details
The vulnerability is a link-following / filesystem containment bypass (CWE-59) in NLTK's package downloader. The Downloader.download and Downloader.incr_download methods properly validate symlinks and traversal conditions during ZIP extraction but fail to validate pre-existing hardlinks within the install tree. An attacker with write access to a shared downloader root on the same filesystem can create a hardlink pointing to an outside-root target file, and when a legitimate package is extracted, the data is written through the hardlink alias, overwriting the external file. The attack requires local filesystem access and low privileges. Patched versions (3.10.3+) address this by treating pre-existing hardlinks as unsafe extraction targets and validating inode-level containment.
Affected products
- NLTK Project NLTK <=3.10.2
Timeline
- 2026-08-12: disclosed
- 2026-08-27: advisory
- 2026-08-12: patched: Fix included in version 3.10.3 or later