Track vulnerabilities like this one.
Sign up free to get alerted when software you use is affected.
8.3
CVE-2026-81726: NLTK model functions can access files outside allowed folder
CVE-2026-81726 · published 2 months ago
Summary
The NLTK library’s model‑import and export functions can be tricked into reading from or writing to any location on the server, even when file‑access restrictions are turned on. This could let a malicious user place or retrieve data from restricted areas. Update NLTK to a version that fixes the issue as soon as a patch becomes available, or avoid letting untrusted users specify file paths.
What to do
The CVE record does not list a fixed version. Check the vendor's site or the advisory links below - a fix may already be released.
Affected software
| Ecosystem | Vendor | Product | Affected versions |
|---|---|---|---|
| – | nltk | nltk | <= 3.10.3 |
| Debian:11 | debian | nltk | All versions |
| Debian:12 | debian | nltk | All versions |
| Debian:13 | debian | nltk | All versions |
| Debian:14 | debian | nltk | All versions |
| PyPI | nltk team | nltk | <= 3.10.3 |
| pip | – | nltk | <= 3.10.3 |
| Ubuntu:Pro:14.04:LTS | canonical | nltk | All versions |
Original advisory text
NLTK: Model-artifact APIs bypass pathsec and touch files outside allowed roots
### Summary
Several model-artifact APIs still treat caller-controlled model paths as ordinary filenames even when NLTK path security is enforced. The same outside-root paths are rejected by guarded helpers, but these public read and write flows still use raw file APIs.
### Details
- **Vulnerability type:** File sandbox bypass
- **Affected component:** `TransitionParser.train`, `TransitionParser.parse`, `AveragedPerceptron.save`, `AveragedPerceptron.load`, `PerceptronTagger.save_to_json`, `save_maxent_params`
- **Affected versions:** Published `3.9.4` and current source `v3.10.0-rc2` both reproduced.
- **Patched versions:** Not yet patched
- **Root cause:** Model import and export helpers use built-in `open()` on caller-controlled paths instead of pathsec-aware helpers.
`TransitionParser.train()` writes outside allowed roots, `TransitionParser.parse()` reads outside allowed roots, `AveragedPerceptron` bypasses the sandbox in both directions, and adjacent read-side helpers in the same family already show the intended guarded behavior. I confirmed outside-root reads and writes while `pathsec.open()` or the guarded sibling helpers rejected the same paths.
### PoC
**Preconditions**
- The application enables `pathsec` enforcement and lets untrusted workflows choose model import or export paths.
**Steps**
1. Enable `pathsec.ENFORCE=True` and restrict allowed roots to a dedicated sandbox directory.
2. Use public model import or export APIs with paths that point outside that root.
3. Observe the same paths are rejected by negative-control guarded helpers such as `pathsec.open()`, `PerceptronTagger.load_from_json()`, or `load_maxent_params()`.
4. Observe the vulnerable APIs still read or write outside-root files successfully.
**Minimal reproducible excerpt**
```text
transition_train_exists True
transition_parse_loader_read_bytes 13
averaged_load_keys ['bias']
maxent_save wrote ['alwayson.tab', 'labels.txt']
```
### Impact
Consumers that rely on `pathsec` for local containment can be tricked into reading or overwriting files outside approved roots through normal model persistence and loading APIs.
### Remediation
Route all model-path file access through `nltk.pathsec.open()` or existing pathsec-aware helpers, and add regression tests that pair each vulnerable API with a negative control on the same path.
### References
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/parse/transitionparser.py#L551-L571
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L106-L113
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L262-L273
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/classify/maxent.py#L1583-L1602
Several model-artifact APIs still treat caller-controlled model paths as ordinary filenames even when NLTK path security is enforced. The same outside-root paths are rejected by guarded helpers, but these public read and write flows still use raw file APIs.
### Details
- **Vulnerability type:** File sandbox bypass
- **Affected component:** `TransitionParser.train`, `TransitionParser.parse`, `AveragedPerceptron.save`, `AveragedPerceptron.load`, `PerceptronTagger.save_to_json`, `save_maxent_params`
- **Affected versions:** Published `3.9.4` and current source `v3.10.0-rc2` both reproduced.
- **Patched versions:** Not yet patched
- **Root cause:** Model import and export helpers use built-in `open()` on caller-controlled paths instead of pathsec-aware helpers.
`TransitionParser.train()` writes outside allowed roots, `TransitionParser.parse()` reads outside allowed roots, `AveragedPerceptron` bypasses the sandbox in both directions, and adjacent read-side helpers in the same family already show the intended guarded behavior. I confirmed outside-root reads and writes while `pathsec.open()` or the guarded sibling helpers rejected the same paths.
### PoC
**Preconditions**
- The application enables `pathsec` enforcement and lets untrusted workflows choose model import or export paths.
**Steps**
1. Enable `pathsec.ENFORCE=True` and restrict allowed roots to a dedicated sandbox directory.
2. Use public model import or export APIs with paths that point outside that root.
3. Observe the same paths are rejected by negative-control guarded helpers such as `pathsec.open()`, `PerceptronTagger.load_from_json()`, or `load_maxent_params()`.
4. Observe the vulnerable APIs still read or write outside-root files successfully.
**Minimal reproducible excerpt**
```text
transition_train_exists True
transition_parse_loader_read_bytes 13
averaged_load_keys ['bias']
maxent_save wrote ['alwayson.tab', 'labels.txt']
```
### Impact
Consumers that rely on `pathsec` for local containment can be tricked into reading or overwriting files outside approved roots through normal model persistence and loading APIs.
### Remediation
Route all model-path file access through `nltk.pathsec.open()` or existing pathsec-aware helpers, and add regression tests that pair each vulnerable API with a negative control on the same path.
### References
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/parse/transitionparser.py#L551-L571
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L106-L113
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/tag/perceptron.py#L262-L273
- https://github.com/nltk/nltk/blob/v3.10.0-rc2/nltk/classify/maxent.py#L1583-L1602
References
- https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/81xxx/CVE-2026-81726... Vendor Advisory
- https://github.com/nltk/nltk Product
- https://github.com/nltk/nltk/pull/3759
- https://github.com/nltk/nltk/pull/3813
- https://ubuntu.com/security/CVE-2026-81726 Third Party Advisory
- https://www.cve.org/CVERecord?id=CVE-2026-81726 Third Party Advisory
- https://github.com/nltk/nltk/security/advisories/GHSA-8mgp-746c-j5xp
- https://security-tracker.debian.org/tracker/CVE-2026-81726 Vendor Advisory
- https://nvd.nist.gov/vuln/detail/CVE-2026-81726
- https://github.com/nltk/nltk/pull/3757
- https://github.com/advisories/GHSA-8mgp-746c-j5xp
- https://github.com/nltk/nltk/commit/2a92b71827d754ae8920261e7ed0c4bb283ab2d7
- https://github.com/nltk/nltk/commit/a44a7af69bca87e92d9c4a701fcbbe4512e8d450
- https://github.com/nltk/nltk/commit/cbc98458b43de5f792f0382583c16df39e5c5117
- https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-3740.y...
- https://www.vulncheck.com/advisories/nltk-through-3.10.3-path-traversal-via-mode...
Internet-facing
60 days
Internal
At next upgrade
- Not known to be exploited
- Needs hands-on effort to exploit
- Gives an attacker partial control
Severity
8.3
High
Type
CWE-73External Control of File Name or Path
CWE-22Path Traversal
CWE-59Link Following
Timeline
Published2 Sep 2026
Updated4 Nov 2026
First seen27 Aug 2026
Sources
DEBIAN-CVE-2026-81726 · OSV
CVE-2026-81726 · OSV
GHSA-8mgp-746c-j5xp · GHSA
CVE-2026-81726 · NVD
CVE-2026-81726 · MITRE
GHSA-8mgp-746c-j5xp · OSV
UBUNTU-CVE-2026-81726 · OSV
Track software like this
Free during beta