Skip to main content
CVE-2026-128137VulnerabilityPublished

Gptline: NLTK corpus-reader view methods bypass the scoped root sandbox via intermediate-directory symlinks

Affects gptlineSource GCVE Database

0
Compare
Authoritative record:CVE-2026-128137· Medium 5.5

Not known to be exploited · CVSS 5.5 Medium : upgrade to 1.0.8_25 when convenient.

Data as of 24 Nov 2026, 21:27 UTC

CVSS 3.1 base score
5.5Medium
How severe the flaw is on the 0–10 CVSS scale.

Thin evidence

One scorer or none
CVSS scores by source
CNA (GitHub_M)CVSS 3.15.5
Patch
Available – fixed in 1.0.8_25
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 19 Nov 2026

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponized: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 24 Nov 2026.

What to do

Upgrade gptline to 1.0.8_25.

Affected software

ProductAffectedFixed in
Homebrewgptlinepkg:brew/gptlineOther threatsAffected
  • >=1.0.8_16 <1.0.8_25
Fixed in
  • 1.0.8_25

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

Description

> **affected**: PyPI `nltk` `>= 3.9.4` — `CorpusReader.abspaths()`/`abspath()` and the `PlaintextCorpusReader` / `SyntaxCorpusReader` view methods > **dynamically reproduced**: `nltk` `3.9.4` (8/9, scoped-escape checks), `3.10.3` (wheel, 9/9 checks) and `master` `6818767b9` (9/9 checks) --- _Source references (`file:line`) are to commit `303f6e2b` (release tag `v3.10.3`). Line numbers in the released `nltk` wheel match this tag exactly; `master` `6818767b9` contains the same code (pathsec.py renumbered by +44 lines from added hardening comments). In `3.9.4` the same logic exists at earlier line numbers (`api.py:222-236` for `open()`, `api.py:161-203` for `abspath()`/`abspaths()`, `data.py:382-388` for the pointer open, `pathsec.py:105-114` for the scoped branch); the affected code is identical._ ### Summary `CorpusReader.open()` (`nltk/corpus/reader/api.py:235-257`) is NLTK's hardened file-access entry point: after a lexical guard it calls `validate_path(..., required_root=self._root)` (`api.py:246-249`), and the scoped branch of `pathsec.validate_path` (`nltk/pathsec.py:168-179`) resolves symlinks and raises `ValueError` when the resolved target is not inside the corpus root. The view methods do **not** use this entry point: `PlaintextCorpusReader.words/sents/paras` (`nltk/corpus/reader/plaintext.py:67-118`) and `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`) build their streams from `self.abspaths(fileids, ...)` (`api.py:174-217`), which only does a lexical `self._root.join(fileid)` (`nltk/data.py:452-469`) and returns a `FileSystemPathPointer`. That pointer is opened via `FileSystemPathPointer.open()` → `pathsec.open(raw_path, "rb")` with `required_root` left at its default `None` (`data.py:438-447`, `nltk/pathsec.py:752,783`), so only the **global** allowed-roots check runs. The `O_NOFOLLOW` in `_hardened_open` (`pathsec.py:676-731`) protects only the final path component, so an **intermediate-directory symlink inside the corpus root** pointing at a sibling allowed root is followed by the kernel. **A caller who places such a symlink (or loads an untrusted corpus containing one) can read any file that `open()` would refuse — files outside the corpus root yet inside the global NLTK data sandbox — via `PlaintextCorpusReader.words([...])` / `SyntaxCorpusReader.words([...])` (and the `abspaths()`-returned pointer), defeating the scoped escape protection that GHSA-p4rw-class fixes and `test_required_root_blocks_symlink_escape` were added for.** ### Details Root cause: two sibling file-access channels on the same `CorpusReader` disagree about the scoped sandbox. 1. `CorpusReader.open()` (`api.py:235-257`) — the guarded channel: - Layer 1 lexical guard (`api.py:240-242`) rejects absolute paths and `..`. - Layer 2 scoped guard (`api.py:246-249`) calls `pathsec.validate_path(path, context="CorpusReader", required_root=self._root)`. - The `required_root` branch (`pathsec.py:168-179`) resolves the target with `Path(raw).resolve()` and raises `ValueError` when `target.is_relative_to(scoped_root)` is false. 2. The view-method channel — `abspaths()` → `FileSystemPathPointer` → `pathsec.open(required_root=None)`: - `CorpusReader.abspath()` (`api.py:174-183`) and `abspaths()` (`api.py:185-217`) return `self._root.join(f)` with **no** `validate_path` call. - `FileSystemPathPointer.join()` (`data.py:452-469`) only normalizes lexically (`normpath` + root-prefix `startswith`); it never calls `os.path.realpath`/`Path.resolve`, so the intermediate symlink is preserved verbatim. - `FileSystemPathPointer.open()` (`data.py:438-447`) calls `_secure_open(self._path, "rb")` (aliased from `pathsec.open`) with no `required_root`, so `pathsec.open` (`pathsec.py:752`) uses its default `required_root=None` and `validate_path` (`pathsec.py:783`) runs only the global allowed-roots check (`pathsec.py:181-207`). - Under `ENFORCE=True` + POSIX, `_hardened_open` (`pathsec.py:676-731`) opens with `O_NOFOLLOW` (`pathsec.py:705`) — but that flag only refuses a symlink in the **final** component; an intermediate directory symlink (`corpus/sub -> <other allowed root>`) is followed by the kernel. The post-open fd realpath re-validation (`pathsec.py:728-731`) again uses `required_root=None`, and since the target is inside an allowed root it passes. 3. The view methods hand the unguarded pointers straight to the stream views: - `PlaintextCorpusReader.words/sents/paras` (`plaintext.py:67-118`, abspaths at `76/96/116`) and `chapters` (`plaintext.py:230`). - `SyntaxCorpusReader.parsed_sents/tagged_sents/sents/tagged_words/words` (`api.py:473-519`, abspaths at `478/489/498/509/517`). - `StreamBackedCorpusView._open()` (`nltk/corpus/reader/util.py:203-216`) calls `self._fileid.open(self._encoding)` on the `PathPointer` (`util.py:210`), landing in the `required_root=None` path above. Net effect (observed): the identical fileid `"sub/secret.txt"` is rejected by `reader.open()

References

Community reviews

Loading reviews…