NLTK: Downloader.download follows hardlinks and overwrites outside-root files
Medium7.1CVE-2026-81727 · Published Sep 2, 2026 · updated Sep 10, 2026
Affected versions
| Package | Affected | Fixed in |
|---|---|---|
| nltk PyPI | < 3.10.3 | 3.10.3 |
Details and references
### Summary NLTK's downloader now blocks symlink escapes during ZIP extraction, but it still treats pre-existing hardlinks inside the install tree as ordinary in-root files. A normal package install can therefore overwrite an outside-root inode through that hardlink. ### Details - **Vulnerability type:** Filesystem containment bypass - **Affected component:** `nltk.downloader.Downloader.download`, `nltk.downloader.Downloader.incr_download` - **Affected versions:** Published `3.9.4` and current source `v3.10.0-rc2` both reproduced for the extraction-stage overwrite. - **Patched versions:** 3.10.3 - **Root cause:** The downloader validates traversal and symlink conditions but does not reject pre-existing hardlink aliases inside the install tree. The install flow correctly rejects a pre-existing symlink at an extraction target, yet it accepts a pre-existing hardlink at the same path. When the package is installed, extracted member data is written through the hardlink and mutates the outside inode. ### PoC **Preconditions** - The attacker can plant files inside a writable shared downloader root on the same filesystem as the target file. **Steps** 1. Prepare a downloader root and create a hardlink inside it that points to an outside target file. 2. Confirm a symlink at the same path is rejected as a negative control. 3. Run a normal `Downloader.download()` package install whose extracted member lands on the hardlink path. 4. Observe the outside target file is overwritten while the downloader still reports the package as installed. **Minimal reproducible excerpt** ```text extract_hardlink_before ORIGINAL extract_hardlink_after PWNED extract_hardlink_status installed ``` ### Impact A shared or attacker-influenced downloader directory can be turned into an overwrite primitive against same-filesystem files outside the intended install root. ### Remediation Treat pre-existing hardlinks as unsafe in extraction targets, verify that each write path stays within the intended install tree at the inode level, and add regression tests that pair hardlinks with existing symlink controls.
- CVSS 3.1
- CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H
- Severity from
- GitHub (reviewed advisory)
- Weakness
- CWE-59, CWE-61, CWE-73
- Also known as
- CVE-2026-81727, PYSEC-2026-3741
- github.com/nltk/nltk/security/advisories/GHSA-f794-5jv7-7672
- nvd.nist.gov/vuln/detail/CVE-2026-81727
- github.com/nltk/nltk/pull/3797
- github.com/nltk/nltk/commit/9e6d5f05902b9aaa1221a0a565448d17a9c9b3e8
- github.com/nltk/nltk
- github.com/nltk/nltk/releases/tag/v3.10.3
- github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3741.yaml
- www.vulncheck.com/advisories/nltk-before-3.10.3-hardlink-file-overwrite-via-downloader
More NLTK advisories
All NLTK| Date | Advisory | Severity | Fixed in |
|---|---|---|---|
| Sep 1 | NLTK: JVM argument injection bypass via per-call options in the NLTK Stanford wrappers (incomplete fix of CVE-2026-12841) CVE-2026-79675Critical9.8fixed in 3.10.3 | Critical9.8 | 3.10.3 |
| Sep 1 | NLTK: Uncontrolled search path when invoking the Graphviz 'dot' binary CVE-2026-78680High7.8fixed in 3.10.3 | High7.8 | 3.10.3 |
| Sep 2 | NLTK: Uncontrolled recursion in nltk.featstruct.FeatStructReader causes unhandled RecursionError (DoS) via deeply nested feature-structure input CVE-2026-81724Medium5.3fixed in 3.10.3 | Medium5.3 | 3.10.3 |
| Sep 2 | NLTK: Uncontrolled resource consumption in RecursiveDescentParser via ambiguous or left-recursive grammars CVE-2026-12876Mediumfixed in 3.10.3 | Medium | 3.10.3 |
| Sep 2 | NLTK: Quadratic CPU Exhaustion in `XMLCorpusView._read_xml_fragment()` CVE-2026-81723Medium3.7fixed in 3.10.3 | Medium3.7 | 3.10.3 |
| Sep 2 | NLTK: Model-artifact APIs bypass pathsec and touch files outside allowed roots CVE-2026-81726High7.0no fix yet | High7.0 | No fix yet |