AI and data stack advisories

Severe, 6 weeks2431Projects328

2431 severe, 6 weeks · 328 projects

NLTKGHSA-59f9-gqg8-mqpj

NLTK: Path Traversal in save_maxent_params / load_maxent_params Allow Arbitrary File READ/WRITE

NLTK

CVE-2026-126296 · Published Nov 16, 2026

Medium
Fix: upgrade to 3.10.4 or later
GitHub advisory

Summary

Path traversal in NLTK's save_maxent_params() and load_maxent_params() allows arbitrary file write and arbitrary file read outside the directories permitted by NLTK's pathsec security mechanism.

This vulnerability was previously reported through Huntr, accepted by the NLTK project, and assigned CVE-2026-15367. A $750 bounty was paid through Huntr (i didnt get the fix bounty). Huntr subsequently shut down its OSS vulnerability program, so I am submitting this report through GitHub to continue the existing disclosure process and preserve the original CVE assignment and researcher credit.

Details

The affected functions are:

  • nltk.classify.maxent.load_maxent_params()
  • nltk.classify.maxent.save_maxent_params()

Both functions construct filesystem paths from the caller-controlled tab_dir argument and access them using Python's built-in open() without passing the paths through NLTK's pathsec validation.

For example, load_maxent_params() constructs and opens:

  • <tab_dir>/weights.txt
  • <tab_dir>/mapping.tab
  • <tab_dir>/labels.txt
  • <tab_dir>/alwayson.tab

Similarly, save_maxent_params() creates/writes files under the supplied tab_dir.

This bypasses the security boundary provided by nltk.pathsec. NLTK documents pathsec as the mechanism for restricting filesystem access to permitted roots, with strict enforcement intended to prevent unauthorized filesystem access....

Affected versions

PackageAffectedFixed in
nltk
PyPI
< 3.10.43.10.4
Details and references

### Summary Path traversal in NLTK's save_maxent_params() and load_maxent_params() allows arbitrary file write and arbitrary file read outside the directories permitted by NLTK's pathsec security mechanism. This vulnerability was previously reported through Huntr, accepted by the NLTK project, and assigned CVE-2026-15367. A $750 bounty was paid through Huntr (i didnt get the fix bounty). Huntr subsequently shut down its OSS vulnerability program, so I am submitting this report through GitHub to continue the existing disclosure process and preserve the original CVE assignment and researcher credit. ### Details The affected functions are: - nltk.classify.maxent.load_maxent_params() - nltk.classify.maxent.save_maxent_params() Both functions construct filesystem paths from the caller-controlled tab_dir argument and access them using Python's built-in open() without passing the paths through NLTK's pathsec validation. For example, load_maxent_params() constructs and opens: - <tab_dir>/weights.txt - <tab_dir>/mapping.tab - <tab_dir>/labels.txt - <tab_dir>/alwayson.tab Similarly, save_maxent_params() creates/writes files under the supplied tab_dir. This bypasses the security boundary provided by nltk.pathsec. NLTK documents pathsec as the mechanism for restricting filesystem access to permitted roots, with strict enforcement intended to prevent unauthorized filesystem access. The relevant implementation is in: nltk/classify/maxent.py The affected functions can be found in the model parameter loading/saving section of that file. This issue was previously disclosed through Huntr and accepted before the Huntr OSS program was shut down. The original Huntr report was assigned CVE-2026-15367 and received a $750 bounty. I am therefore submitting this GitHub Security Advisory primarily as a continuation/transfer of the existing disclosure rather than as a new vulnerability report. ### PoC The issue can be reproduced by enabling NLTK's path security enforcement and supplying a tab_dir outside the permitted root. For example, with a controlled test environment: ```py import os import tempfile import nltk.pathsec as pathsec from nltk.classify.maxent import load_maxent_params, save_maxent_params pathsec.ENFORCE = True allowed_dir = tempfile.mkdtemp() outside_dir = tempfile.mkdtemp() # The same outside-root path is rejected when accessed through pathsec. try: with pathsec.open(os.path.join(outside_dir, "test.txt"), "w") as f: f.write("test") except Exception as e: print("pathsec.open rejected outside-root access:", type(e).__name__) # The vulnerable model-parameter APIs directly use open() # on paths derived from tab_dir. # # Supplying outside_dir as tab_dir causes the functions to access # files under outside_dir rather than enforcing the pathsec boundary. ``` For save_maxent_params(), the attacker-controlled tab_dir determines where the model parameter files are written. For load_maxent_params(), the attacker-controlled tab_dir determines which files are read. The important security property being bypassed is that pathsec.ENFORCE = True does not protect these file operations because the affected functions call the built-in open() directly rather than the pathsec-aware file-opening mechanism. ### Impact This is a path traversal / filesystem sandbox bypass resulting in arbitrary local file read and arbitrary local file write. Applications that use NLTK's pathsec mechanism as a filesystem security boundary may incorrectly assume that model parameter loading and saving are restricted to approved directories. An attacker who can influence the tab_dir argument may therefore: - read files outside the permitted NLTK data directories through load_maxent_params(); - create or overwrite files outside the permitted directories through save_maxent_params(); - bypass the filesystem containment provided by nltk.pathsec. The practical impact depends on how an application exposes these APIs and what filesystem permis

CVSS 4.0
CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N
Severity from
GitHub (reviewed advisory)
Weakness
CWE-22
Also known as
CVE-2026-126296

More NLTK advisories

All NLTK