BREW-ACRONYM-CVE-2026-109956 (GHSA-J456-XH4H-CPF2)
Vulnerability from osv_homebrew – Published: 2026-10-29 21:52 – Updated: 2026-10-29 21:52 – Source websiteSummary
WekaClassifier in NLTK passes a caller-controlled model file path to the weka Java VM without any nltk.pathsec validation. WekaClassifier.train puts the caller's model_filename verbatim into the weka argv ["-d", model_filename, ...] (weka writes the trained model there), and WekaClassifier._classify_many puts self._model into ["-l", self._model, ...] (weka reads it). Under nltk.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. WekaClassifier is the one java()-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) — WekaClassifier is not among them, and weka.py contains no validate_tool_path/validate_model_resource at all.
Root Cause
WekaClassifier.train(cls, model_filename, ...) builds cmd = [javaclass, "-d", model_filename, "-t", train_filename] (nltk/classify/weka.py:256) and WekaClassifier._classify_many builds [..., "-l", self._model, "-T", <staged>, ...] (weka.py:131-133); self._model is stored unvalidated in __init__ (weka.py:108-110). Only the internally-generated train.arff/test.arff are staged via make_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 token cmd[0], and rejects @argfile tokens 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 to subprocess.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_file call validate_tool_path (crf.py:134,300); MaltParser.generate_malt_command validates -i/-o via validate_tool_path (malt.py:340,344), its model via validate_model_resource (malt.py:326) and working_dir via validate_path (malt.py:206). weka.py already uses pathsec elsewhere (validate_path for WEKAHOME, pathsec_open for 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:
- Arbitrary-location file write via -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.
- Arbitrary file read/parse oracle via -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
import nltk.pathsec as ps; ps.ENFORCE = True
from nltk.classify.weka import WekaClassifier
# write-side: model written OUTSIDE any allowed NLTK data root (refused for CRFTagger, allowed here)
WekaClassifier.train("/tmp/outside_sandbox/evil.model",
[({"a": 1}, "pos"), ({"a": 0}, "neg")])
# read-side: -l opens an arbitrary path
clf = WekaClassifier(fmt, "/home/victim/secret.model")
clf.classify_many([{"a": 1}])
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
- Entry. Action: an app running with
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). - Command build. Action: the path is placed into
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() sink. Action:
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. - Impact. Action: the weka JVM opens the path outside the allowed roots → arbitrary-location write (
-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
- Negative control (guard is real):
validate_tool_path("/tmp/outside_sandbox_weka.model", for_write=True, must_exist=False)→PermissionError;validate_tool_path("../../../home/victim/.ssh/authorized_keys", ...)→PermissionError. - Sink reached unvalidated (guard absent): captured write-side argv
['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']. - Version:
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 HEAD c06cd264). No published fix has ever targeted the weka -d/-l model 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/-T command, validate the model path with pathsec, mirroring CRFTagger/MaltParser:
validate_tool_path(model_filename, context="WekaClassifier.train", for_write=True, must_exist=False)
validate_tool_path(self._model, context="WekaClassifier._classify_many")
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.
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "nltk",
"resource_purl": "pkg:pypi/nltk@3.10.4",
"upstream_fixed_in": "3.10.4"
},
"package": {
"ecosystem": "Homebrew",
"name": "acronym",
"purl": "pkg:brew/acronym"
},
"ranges": [
{
"events": [
{
"introduced": "2.0.0"
},
{
"fixed": "2.0.0_6"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/nltk@3.10.4",
"name": "nltk",
"resource": "nltk",
"strategy": "registry",
"subject_version": "3.10.4"
}
]
},
"details": "## Summary\n`WekaClassifier` in NLTK passes a caller-controlled model file path to the weka Java VM without any `nltk.pathsec` validation. `WekaClassifier.train` puts the caller\u0027s `model_filename` verbatim into the weka argv `[\"-d\", model_filename, ...]` (weka *writes* the trained model there), and `WekaClassifier._classify_many` puts `self._model` into `[\"-l\", self._model, ...]` (weka *reads* it). Under `nltk.pathsec.ENFORCE=True` (the default on current HEAD), NLTK\u0027s stated invariant \u2014 established by advisory CVE-2026-81726 / GHSA-8mgp-746c-j5xp \u2014 is that caller-controlled model-artifact paths must be bounded to the allowed NLTK data roots before any native tool opens them. `WekaClassifier` is the one `java()`-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.\n\nThis 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`) \u2014 `WekaClassifier` is not among them, and weka.py contains no `validate_tool_path`/`validate_model_resource` at all.\n\n## Root Cause\n`WekaClassifier.train(cls, model_filename, ...)` builds `cmd = [javaclass, \"-d\", model_filename, \"-t\", train_filename]` (nltk/classify/weka.py:256) and `WekaClassifier._classify_many` builds `[..., \"-l\", self._model, \"-T\", \u003cstaged\u003e, ...]` (weka.py:131-133); `self._model` is stored unvalidated in `__init__` (weka.py:108-110). Only the internally-generated `train.arff`/`test.arff` are staged via `make_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 token `cmd[0]`, and rejects `@argfile` tokens in any position \u2014 but it explicitly permits program arguments starting with `-` and never inspects the interior of a program-arg path value. So `-d \u003cpath\u003e` / `-l \u003cpath\u003e` flow unchecked to `subprocess.Popen(final_cmd, shell=False)` and the weka JVM performs an unbounded native open/write on the caller-chosen path.\n\nSibling wrappers prove the intended pattern: `CRFTagger.train`/`set_model_file` call `validate_tool_path` (crf.py:134,300); `MaltParser.generate_malt_command` validates `-i`/`-o` via `validate_tool_path` (malt.py:340,344), its model via `validate_model_resource` (malt.py:326) and `working_dir` via `validate_path` (malt.py:206). weka.py already uses pathsec elsewhere (`validate_path` for WEKAHOME, `pathsec_open` for ARFF writes) but never for the model path.\n\n## Impact\nUnder `pathsec.ENFORCE=True` (default on HEAD), an untrusted workflow that chooses the weka model save/load path obtains:\n- Arbitrary-location file **write** via `-d` \u2014 overwrite or create a file at an attacker-chosen absolute or `..`-traversal path outside the allowed NLTK data roots (content constrained to weka\u0027s serialized-model format; the target choice is the integrity impact). This corrupts/clobbers arbitrary chosen files.\n- Arbitrary file **read/parse oracle** via `-l` \u2014 weka loads an out-of-root path as a model, yielding an existence/parse differential (file content is not echoed back \u2192 confidentiality impact is limited).\n\nThis defeats the pathsec containment advisory CVE-2026-81726 promises, at the same privilege level / threat model that advisory was accepted under.\n\n## Proof of Concept\n```python\nimport nltk.pathsec as ps; ps.ENFORCE = True\nfrom nltk.classify.weka import WekaClassifier\n# write-side: model written OUTSIDE any allowed NLTK data root (refused for CRFTagger, allowed here)\nWekaClassifier.train(\"/tmp/outside_sandbox/evil.model\",\n [({\"a\": 1}, \"pos\"), ({\"a\": 0}, \"neg\")])\n# read-side: -l opens an arbitrary path\nclf = WekaClassifier(fmt, \"/home/victim/secret.model\")\nclf.classify_many([{\"a\": 1}])\n```\nThe argv construction \u2014 the vulnerable step \u2014 is confirmed without weka installed (see Bypass Evidence); a configured weka.jar is needed only to observe the JVM\u0027s actual file I/O.\n\n## Attack Chain\n1. **Entry.** Action: an app running with `pathsec.ENFORCE=True` lets an untrusted workflow choose the weka model path and calls `WekaClassifier.train(\"../../../home/victim/x\", featuresets)` (write) or `WekaClassifier(fmt, \"/home/victim/secret.model\").classify_many(...)` (read). Guard: none \u2014 plain classmethod/constructor parameter (weka.py:230,108-110). Bypass proof: grep shows weka.py uses no `validate_tool_path`/`validate_model_resource`/`validate_tool_dir` (NONE).\n2. **Command build.** Action: the path is placed into `cmd = [javaclass, \"-d\", model_filename, \"-t\", train_filename]` (weka.py:256) / `[\"-l\", self._model, ...]`. Guard: only the internally-generated `train.arff` is staged via `make_staging_dir`; the model path is passed as-is. Bypass proof: runtime capture yielded `[\u0027weka.classifiers.bayes.NaiveBayes\u0027, \u0027-d\u0027, \u0027/tmp/outside_sandbox_weka.model\u0027, \u0027-t\u0027, \u0027\u003cstaged\u003e/train.arff\u0027]` \u2014 the raw out-of-root path is `cmd[2]`.\n3. **java() sink.** Action: `java(cmd, classpath=_weka_classpath, ...)` \u2192 `subprocess.Popen(final_cmd)` (internals.py:431). Guard: `java()` validates classpath, JVM `options`, `cmd[0]`, and rejects `@argfile` tokens. Bypass proof: none of these inspect the `-d`/`-l` program-arg value; internals.py explicitly documents that program args after the main class may start with `-`, and the path is neither `cmd[0]` nor an `@`-token, so every `java()` gate passes. Negative control: the same path through `validate_tool_path(..., for_write=True, must_exist=False)` raises `PermissionError`.\n4. **Impact.** Action: the weka JVM opens the path outside the allowed roots \u2192 arbitrary-location write (`-d`) / parse-existence oracle (`-l`). Guard: pathsec is never consulted (no `validate_tool_path`, no `pathsec_open`). Bypass proof: the directly-analogous sibling `CRFTagger.train` calls `validate_tool_path(model_file, must_exist=False)` (crf.py:300); weka does not, and commit `ee6d6138` hardened weka\u0027s other sinks (scratch files, WEKAHOME jar) while leaving the model path unvalidated.\n\n## Bypass Evidence\n- Negative control (guard is real): `validate_tool_path(\"/tmp/outside_sandbox_weka.model\", for_write=True, must_exist=False)` \u2192 `PermissionError`; `validate_tool_path(\"../../../home/victim/.ssh/authorized_keys\", ...)` \u2192 `PermissionError`.\n- Sink reached unvalidated (guard absent): captured write-side argv `[\u0027weka.classifiers.bayes.NaiveBayes\u0027, \u0027-d\u0027, \u0027/tmp/outside_sandbox_weka.model\u0027, \u0027-t\u0027, \u0027\u003cstaged\u003e/train.arff\u0027]` and read-side `[..., \u0027-l\u0027, \u0027/home/victim/secret.model\u0027, \u0027-T\u0027, \u0027\u003cstaged\u003e/test.arff\u0027, \u0027-p\u0027, \u00270\u0027]`.\n- Version: `git show v3.10.3:nltk/classify/weka.py` contains both the `-d` model-path build (line 235) and the `-l` read, and NO `validate_tool_path`.\n\n## Affected Versions\n`\u003c= 3.10.3` (present on the latest release tag v3.10.3 and on HEAD `c06cd264`). No published fix has ever targeted the weka `-d`/`-l` model path; commits after v3.10.3 (`ee6d6138`, `92aeada6`, `a9752559`) touched weka.py for other sinks but did not add model-path validation.\n\n## Suggested Fix\nBefore building the `-d`/`-l`/`-T` command, validate the model path with pathsec, mirroring `CRFTagger`/`MaltParser`:\n```python\nvalidate_tool_path(model_filename, context=\"WekaClassifier.train\", for_write=True, must_exist=False)\nvalidate_tool_path(self._model, context=\"WekaClassifier._classify_many\")\n```\n\n\n---\nReported by **zx (Jace)** \u2014 GitHub: @manus-use\n\n## Fix status (2026-09-28)\n\nStatus: MERGED on develop (unreleased; v3.10.3 of 2026-08-12 predates the fix).\n\nPR: #3863 \"Bound the WekaClassifier model path to the pathsec data roots\", merged 2026-09-06, merge commit bc2878725 on develop. Fix commit: 6a1760629.\n\nProbe: 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).\n\nRelease: none yet; no release tag contains 6a1760629.",
"id": "BREW-acronym-CVE-2026-109956",
"modified": "2026-10-29T21:52:04Z",
"published": "2026-10-29T21:52:04Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/security/advisories/GHSA-j456-xh4h-cpf2"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/pull/3863"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/commit/6a17606293fe9d3ea1006f99dd3fed2e2b25d519"
},
{
"type": "PACKAGE",
"url": "https://github.com/nltk/nltk"
},
{
"type": "WEB",
"url": "https://github.com/nltk/nltk/releases/tag/v3.10.4"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L",
"type": "CVSS_V3"
}
],
"summary": "NLTK: WekaClassifier passes an unvalidated caller-controlled model path to the weka JVM, bypassing nltk.pathsec containment",
"upstream": [
"GHSA-j456-xh4h-cpf2",
"CVE-2026-109956"
]
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.