Repository navigation
chore(deps): update dependency nltk to v3.10.4 [security] - #383
Merged
dreadnode-renovate-bot[bot] merged 1 commit intoNov 1, 2026
Merged
Conversation
| datasource | package | from | to | | ---------- | ------- | ------ | ------ | | pypi | nltk | 3.10.3 | 3.10.4 |
dreadnode-renovate-bot
Bot
deleted the
renovate/pypi-nltk-vulnerability
branch
November 1, 2026 00:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Note
This PR body was truncated due to platform limits.
This PR contains the following updates:
| Package | Change | Age | Confidence |
|
Generated Summary:
No relevant changes.
This summary was generated with ❤️ by rigging
| nltk (source) |
|
|
3.10.3→3.10.4|NLTK: WekaClassifier passes an unvalidated caller-controlled model path to the weka JVM, bypassing nltk.pathsec containment
GHSA-j456-xh4h-cpf2
More information
Details
Summary
WekaClassifierin NLTK passes a caller-controlled model file path to the weka Java VM without anynltk.pathsecvalidation.WekaClassifier.trainputs the caller'smodel_filenameverbatim into the weka argv["-d", model_filename, ...](weka writes the trained model there), andWekaClassifier._classify_manyputsself._modelinto["-l", self._model, ...](weka reads it). Undernltk.pathsec.ENFORCE=True(the default on current HEAD), NLTK's stated invariant — established by advisory CVE-2026-81726 / GHSA-8mgp-746c-j5xp — is that caller-controlled model-artifact paths must be bounded to the allowed NLTK data roots before any native tool opens them.WekaClassifieris the onejava()-based tool wrapper that skips this entirely, giving an untrusted workflow arbitrary-location file write (-d) and an arbitrary file read/parse oracle (-l), defeating pathsec containment.This is a standalone, unfixed variant of the same class as CVE-2026-81726, on a code path the CVE-2026-81726 fix never touched. That advisory enumerates 6 functions (
TransitionParser.train,TransitionParser.parse,AveragedPerceptron.save,AveragedPerceptron.load,PerceptronTagger.save_to_json,save_maxent_params) —WekaClassifieris not among them, and weka.py contains novalidate_tool_path/validate_model_resourceat all.Root Cause
WekaClassifier.train(cls, model_filename, ...)buildscmd = [javaclass, "-d", model_filename, "-t", train_filename](nltk/classify/weka.py:256) andWekaClassifier._classify_manybuilds[..., "-l", self._model, "-T", <staged>, ...](weka.py:131-133);self._modelis stored unvalidated in__init__(weka.py:108-110). Only the internally-generatedtrain.arff/test.arffare staged viamake_staging_dir; the model path is passed as-is.nltk.internals.java()(internals.py:388-431) validates the classpath (_verify_jar_sandbox), the JVM launcher options (_validate_java_options, the CVE-2026-12841 fix), the main-class tokencmd[0], and rejects@argfiletokens in any position — but it explicitly permits program arguments starting with-and never inspects the interior of a program-arg path value. So-d <path>/-l <path>flow unchecked tosubprocess.Popen(final_cmd, shell=False)and the weka JVM performs an unbounded native open/write on the caller-chosen path.Sibling wrappers prove the intended pattern:
CRFTagger.train/set_model_filecallvalidate_tool_path(crf.py:134,300);MaltParser.generate_malt_commandvalidates-i/-oviavalidate_tool_path(malt.py:340,344), its model viavalidate_model_resource(malt.py:326) andworking_dirviavalidate_path(malt.py:206). weka.py already uses pathsec elsewhere (validate_pathfor WEKAHOME,pathsec_openfor ARFF writes) but never for the model path.Impact
Under
pathsec.ENFORCE=True(default on HEAD), an untrusted workflow that chooses the weka model save/load path obtains:-d— overwrite or create a file at an attacker-chosen absolute or..-traversal path outside the allowed NLTK data roots (content constrained to weka's serialized-model format; the target choice is the integrity impact). This corrupts/clobbers arbitrary chosen files.-l— weka loads an out-of-root path as a model, yielding an existence/parse differential (file content is not echoed back → confidentiality impact is limited).This defeats the pathsec containment advisory CVE-2026-81726 promises, at the same privilege level / threat model that advisory was accepted under.
Proof of Concept
The argv construction — the vulnerable step — is confirmed without weka installed (see Bypass Evidence); a configured weka.jar is needed only to observe the JVM's actual file I/O.
Attack Chain
pathsec.ENFORCE=Truelets an untrusted workflow choose the weka model path and callsWekaClassifier.train("../../../home/victim/x", featuresets)(write) orWekaClassifier(fmt, "/home/victim/secret.model").classify_many(...)(read). Guard: none — plain classmethod/constructor parameter (weka.py:230,108-110). Bypass proof: grep shows weka.py uses novalidate_tool_path/validate_model_resource/validate_tool_dir(NONE).cmd = [javaclass, "-d", model_filename, "-t", train_filename](weka.py:256) /["-l", self._model, ...]. Guard: only the internally-generatedtrain.arffis staged viamake_staging_dir; the model path is passed as-is. Bypass proof: runtime capture yielded['weka.classifiers.bayes.NaiveBayes', '-d', '/tmp/outside_sandbox_weka.model', '-t', '<staged>/train.arff']— the raw out-of-root path iscmd[2].java(cmd, classpath=_weka_classpath, ...)→subprocess.Popen(final_cmd)(internals.py:431). Guard:java()validates classpath, JVMoptions,cmd[0], and rejects@argfiletokens. Bypass proof: none of these inspect the-d/-lprogram-arg value; internals.py explicitly documents that program args after the main class may start with-, and the path is neithercmd[0]nor an@-token, so everyjava()gate passes. Negative control: the same path throughvalidate_tool_path(..., for_write=True, must_exist=False)raisesPermissionError.-d) / parse-existence oracle (-l). Guard: pathsec is never consulted (novalidate_tool_path, nopathsec_open). Bypass proof: the directly-analogous siblingCRFTagger.traincallsvalidate_tool_path(model_file, must_exist=False)(crf.py:300); weka does not, and commitee6d6138hardened weka's other sinks (scratch files, WEKAHOME jar) while leaving the model path unvalidated.Bypass Evidence
validate_tool_path("/tmp/outside_sandbox_weka.model", for_write=True, must_exist=False)→PermissionError;validate_tool_path("../../../home/victim/.ssh/authorized_keys", ...)→PermissionError.['weka.classifiers.bayes.NaiveBayes', '-d', '/tmp/outside_sandbox_weka.model', '-t', '<staged>/train.arff']and read-side[..., '-l', '/home/victim/secret.model', '-T', '<staged>/test.arff', '-p', '0'].git show v3.10.3:nltk/classify/weka.pycontains both the-dmodel-path build (line 235) and the-lread, and NOvalidate_tool_path.Affected Versions
<= 3.10.3(present on the latest release tag v3.10.3 and on HEADc06cd264). No published fix has ever targeted the weka-d/-lmodel path; commits after v3.10.3 (ee6d6138,92aeada6,a9752559) touched weka.py for other sinks but did not add model-path validation.Suggested Fix
Before building the
-d/-l/-Tcommand, validate the model path with pathsec, mirroringCRFTagger/MaltParser:Reported by zx (Jace) — GitHub: @manus-use
Fix status (2026-09-28)
Status: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).
PR: #3863 "Bound the WekaClassifier model path to the pathsec data roots", merged 2026-09-06, merge commit bc2878725 on develop. Fix commit: 6a1760629.
Probe: nltk/test/unit/security_probes/ghsa_j456_xh4h_cpf2.py, added by PR #3905 "Add GHSA-j456 live probe; expand the GHSA-8mgp probe attack set" (commit a96715264, merged 2026-09-20, merge commit 84d987bf8); verdict on develop 2fa3f48fe: FIXED (WekaClassifier -l and -d refuse out-of-root model paths).
Release: none yet; no release tag contains 6a1760629.
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
nltk/nltk (nltk)
v3.10.4Compare Source
Version 3.10.4 2026-10-20
This release routes every file path, archive, download, URL fetch and external program through one sandbox that keeps reads and writes inside the trusted data directories, refuses path traversal, symlink escapes and decompression bombs, blocks requests to internal network addresses, and runs Java and other third-party tools only from trusted absolute locations with validated options and input. Pickled models now load through a restricted unpickler, XML and JSON parsing are hardened, and regular expressions, recursion and slow algorithms in the tokenizers, parsers, stemmers and corpus readers are bounded against denial-of-service input. Text that NLTK writes to the terminal, to CSV files, to the WordNet browser and to third-party tool input is sanitized against injection.
Security changes you may notice
Every refusal below raises with a message that starts with "Security Violation" and names the check, so a failure is easy to search for (PR #3877).
Security test and CI infrastructure
Other changes
Thanks to the following contributors to 3.10.4: Zhewen Tan, Yanhaoxi, Yazan Balawneh (Cystack.ps),
Abdulmoyn Sommakieh, Golitsin Vyacheslav, Mingzhe Yu, 宁岑, Tai An, 区梓灏, Tom Aarsen, Raffi Enficiaud,
JJ, Artemiy, Cherno.x, 0xEaS, sarvesh patil, Isaac David, Arthur Gervais, leduckhuong, Ibrahim zain,
Athul Jayaram, Chiencp, Ziyu Lin, Michael Lip, GOLDBERG8, Litesh Ghute, Kartik G, Thai Son Dinh,
infy, 0xRenSec, Joshgun Abdullayev, Arpit Jain, Mohammad Favas S, Jace, nguyencanhthuong,
kokomaru167, jankesec, Daniel Coles, Fodhil Benhiba, Ubaid Ur Rehman, Maciej Zmitrukiewicz,
Gecko Security, Bugbunny, Liling Tan, Huanyi Xie, ahcrm-core, Eric Kafe, Steven Bird.
What's Changed
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR has been generated by Mend Renovate CLI.