NLTK WekaClassifier can read and write files outside allowed locations
What this means
An attacker who can control the model file path in WekaClassifier can read any file on the system and write trained models to any location. This breaks NLTK's security boundary that is supposed to prevent access to files outside designated data directories. An attacker could steal sensitive files, corrupt system files, or plant malicious model files.
SecurityElites Manager Brief: the decision in one minute
NLTK's WekaClassifier tool does not check file paths before passing them to Java, allowing attackers to read or write files anywhere on the system instead of only in allowed NLTK data directories. This needs to be fixed immediately in any workflow that accepts user-controlled model paths.
| SecurityElites Fix-First Score | 43 of 100 Our own ranking of what to fix first. Real attacks count most, then the chance of attack, then severity. |
|---|---|
| SecurityElites fix window | Within 30 days High severity. This is our suggestion from common practice; your own policy comes first. |
| Who should own the fix | Platform or ML infrastructure team (whoever manages NLTK and machine learning libraries). |
| Likely effort | About 30 minutes per service: update NLTK to version 3.10.4 and restart any services using WekaClassifier. Longer if the service needs extensive testing before restart. |
Questions to ask your team or supplier
- Does our codebase use WekaClassifier, and if so, do any of the model file paths come from user input, API calls, or external configuration?
- What file system permissions does the NLTK process or service have, and are there sensitive files or directories it should not be able to read or write to?
- Have we checked file access logs or file integrity monitoring for signs that this vulnerability may have been exploited in the past 90 days?
Message you can forward to the owning team
Security notice: NLTK WekaClassifier can read and write files outside allowed locations (CVE-2026-109956)
Severity: High
SecurityElites Fix-First Score: 43 of 100
SecurityElites fix window: Within 30 days
Action: upgrade to nltk 3.10.4 or later.
What we need from you: confirm whether we run this software, who owns it, and the date it will be fixed.
Full guide: https://securityelites.com/ai-vulnerabilities/cve-2026-109956-nltk-wekaclassifier-can-read-and-write-files-outside-allowed/
Source: SecurityElites AI Vulnerabilities Database, record SE-AIV-01466What is at stake in your AI setup
- Model files: An attacker can read trained model files from any location on the system, potentially exfiltrating proprietary ML models or stealing training data encoded in model weights.
- Training data: If model training data or datasets are stored on the same system, they can be read by crafting a malicious model path pointing to data files.
- System files and secrets: An attacker can read sensitive files (config files with API keys, secrets, source code) if the NLTK process has file access, potentially compromising connected AI services or APIs.
- Compute cost: An attacker could write malicious or large model files to any location, consuming disk space or causing resource exhaustion.
Who is exposed
- Teams running NLTK with untrusted input (user-uploaded model paths, API parameters, configuration files).
- Services that accept model file paths from end users or external systems.
- Deployments where the NLTK process runs with file access to sensitive directories.
- Teams using WekaClassifier for training or classification are most at risk; other NLTK classifiers are not affected.
Upgrades you need
| Software | Affected versions | Move to |
|---|---|---|
| nltk PyPI | Every version before 3.10.4 | 3.10.4 or later |
Am I affected?
Enter the version you run. Nothing you type is stored.
SecurityElites Developer Brief: the technical picture
| Is it being attacked | Working attack code is public, so expect attacks to follow |
|---|---|
| Where the attacker must be | Anywhere that can reach it over a network, including the internet if it is exposed |
| Account needed | None. No login is needed |
| Does a person have to do something | No. It works without anyone clicking or opening anything |
| How hard it is to do | Easy. It works reliably once the attacker can reach it |
| Risk of: data being read | Limited |
| Risk of: data or settings being changed | High |
| Risk of: the service being taken down | Limited |
| Can attackers automate it at scale | No, according to CISA. Each target needs manual work |
| How much control an attacker gains | Partial control, according to CISA |
Read from the official severity rating: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L
Kind of coding mistake
- CWE-22: file paths can escape the allowed folder
- CWE-73
Where it sits in the standards
OWASP Top 10 for LLM Applications 2025: LLM03 Supply Chain (unsafe model and data files)
If you cannot upgrade today
- Restrict the NLTK process file system permissions to only the NLTK data directory, disable WekaClassifier if unused, or add application-level path whitelisting before calling WekaClassifier with any user-controlled input.
Signs it may already have been used against you
- File access logs: Look for unexpected file reads or writes initiated by the NLTK process outside the normal NLTK data directory (e.g., /home, /etc, /tmp).
- File integrity monitoring: Check for unexpected changes to system files, configuration files, or sensitive application files that coincide with WekaClassifier calls.
- Application logs: Search for errors from NLTK pathsec validation (look for 'pathsec' or 'validate' errors) in the past 90 days; absence suggests the library is still vulnerable.
- Audit logs: Look for attempts to access model files in unusual paths via the Java weka process (may appear in process execution audit logs).
Log searches to start from
File access outside NLTK data directory by Java/weka process (adapt process_name and home_dir to match your environment)Splunk
process_name="java" OR process_name="weka" (file_path!="/opt/nltk_data/*" AND file_path!="/usr/share/nltk_data/*") file_action="open" OR file_action="write" | stats count by file_path, file_actionNLTK pathsec validation errors or rejections in application logs (adapt field_names to your log format)Elastic
process.name:java AND (message:*pathsec* OR message:*validate_tool_path* OR message:*validate_model_resource*) | stats count by messageWritten with AI as a starting point. Review them and change the index and field names to match your own logs before you rely on the result.
SecurityElites Fix Guide: step by step
- Find where NLTK is installedList all Python environments (virtual envs, containers, system Python) where NLTK is used. Check requirements.txt, setup.py, or pyproject.toml files in each service. Run pip show nltk to see which version is currently installed in each environment.
- Check if WekaClassifier is actually usedSearch your codebase for imports of WekaClassifier, calls to weka, or use of any weka-based models. If WekaClassifier is never used, the risk is low but the library should still be updated. Run: grep -r 'WekaClassifier\|from nltk.classify import weka' your_code/
- Review model file path sourcesList all places where model_filename or model paths are set for WekaClassifier. Identify whether these paths come from user input, API parameters, config files, or only from hardcoded internal values. If paths are always hardcoded and local, risk is lower than if they come from users or external systems.
- Check for signs of prior exploitationReview file system access logs, file integrity monitoring, and application logs from the past 90 days. Look for unexpected file writes outside the normal NLTK data directory, or unexpected file reads of sensitive files by the NLTK process. Check if model files appear in unusual locations.
- Update NLTK to version 3.10.4 or laterIn each Python environment that uses NLTK, run: pip install --upgrade 'nltk>=3.10.4'. Update the pinned version in requirements.txt or pyproject.toml to 3.10.4 or later. Rebuild any containers or virtual environments that include NLTK.
- Restart affected servicesRestart all services or processes that import or use NLTK, so they load the updated version. This includes web servers, batch jobs, and scheduled tasks that use NLTK.
- Verify the fix is in placeIn a test environment or on one production instance, run: python -c 'import nltk; print(nltk.__version__)' and confirm it shows 3.10.4 or later. If you use WekaClassifier, attempt to pass an out-of-bounds path and confirm it is rejected (you should see an error from pathsec validation).
- Harden model path handling going forwardIf WekaClassifier receives model paths from users or external systems, add application-level validation to restrict paths to expected directories before passing them to NLTK. Document which model paths are user-controlled and treat them as untrusted input.
How to confirm it is fixed: Run python -c "import nltk; print(nltk.__version__)" and confirm it shows 3.10.4 or later, then test that WekaClassifier rejects a model path outside the NLTK data directory with a pathsec validation error.
SecurityElites Quick Fixes: copy and paste
Upgrade nltk with pipupgrade
pip install --upgrade "nltk>=3.10.4"
pip show nltk | grep VersionPin it in requirements.txtupgrade
nltk>=3.10.4Check installed NLTK version in Pythonfor this issue
import nltk
print(f"NLTK version: {nltk.__version__}")
if tuple(map(int, nltk.__version__.split('.')[:3])) < (3, 10, 4):
print("WARNING: NLTK version is older than 3.10.4 and needs to be updated")Search for WekaClassifier usage in codefor this issue
grep -r "WekaClassifier" --include="*.py" .
grep -r "nltk.classify.weka" --include="*.py" .
grep -r "from nltk.classify import weka" --include="*.py" .Load PyTorch weights without running codegeneral hardening
import torch
state = torch.load("model.pt", weights_only=True)Load safetensors weightsgeneral hardening
from safetensors.torch import load_file
state = load_file("model.safetensors")Test in a non-production environment first. General hardening examples use placeholder names and ports; change them to match your setup.
Let your AI coding assistant do the upgrade
Paste this into the coding assistant you already use, inside the project. It checks first and asks before it changes anything.
Instruction for your coding assistant
You are helping me fix a security vulnerability (CVE-2026-109956) in this project.\n\n1. Search the whole repository, including lock files, container files and CI configuration, for these packages and list every place they are pinned or installed:\n - nltk (PyPI): must be 3.10.4 or later
2. Tell me which version we use now and whether it is affected. Stop and ask me before changing anything.
3. After I agree, raise each one to the safe version, update the lock files, and keep every other dependency as it is.
4. Run the tests and tell me what failed.
5. Give me a short summary of the files you changed that I can put in the pull request.SecurityElites Incident Drill: could your team handle this?
Four questions to ask in your next team meeting. If any has no clear answer, that is the gap to close.
Ticket for your backlog
Paste into Jira, GitHub Issues or any tracker that reads Markdown.
Ready-made ticket
## NLTK WekaClassifier can read and write files outside allowed locations (CVE-2026-109956)
**Severity:** High | **SE Fix-First Score:** 43/100 | **Fix window:** Within 30 days
**Record:** SE-AIV-01466 https://securityelites.com/ai-vulnerabilities/cve-2026-109956-nltk-wekaclassifier-can-read-and-write-files-outside-allowed/
### Why this matters
An attacker who can control the model file path in WekaClassifier can read any file on the system and write trained models to any location. This breaks NLTK's security boundary that is supposed to prevent access to files outside designated data directories. An attacker could steal sensitive files, corrupt system files, or plant malicious model files.
### What to do
1. Find where NLTK is installed
2. Check if WekaClassifier is actually used
3. Review model file path sources
4. Check for signs of prior exploitation
5. Update NLTK to version 3.10.4 or later
6. Restart affected services
7. Verify the fix is in place
8. Harden model path handling going forward
Full steps: https://securityelites.com/ai-vulnerabilities/cve-2026-109956-nltk-wekaclassifier-can-read-and-write-files-outside-allowed/
### Done when
- [ ] nltk is at 3.10.4 or later everywhere it is installed
- [ ] Lock files, container images and CI configuration are updated
- [ ] Run python -c "import nltk; print(nltk.__version__)" and confirm it shows 3.10.4 or later, then test that WekaClassifier rejects a model path outside the NLTK data directory with a pathsec validation error.
- [ ] Logs were checked for signs of earlier use
SecurityElites Fix Tracker
Record who owns this fix, the date it is due and when it is done, and see everything still open in one list. Free with a SecurityElites account.
Related vulnerabilities
In the same software
- NLTK can overwrite files outside its data folder via hardlinks during package extraction High · CVE-2026-128135
- NLTK can run untrusted Java code even after security fix in 3.10.3 Critical · CVE-2026-128138
- NLTK XML parser can be made to freeze by reading a crafted corpus file High · CVE-2026-128139
- NLTK dependency parser crashes on long sentences High · CVE-2026-129222
- NLTK WordNet tree methods can run out of memory with deep relation chains High · CVE-2026-129223
- NLTK regex compilation denial of service via many groups High · CVE-2026-129229
The same kind of mistake in other AI tools
- Listdom WordPress plugin allows anyone to run code on the server Critical · CVE-2026-126756
- DLOmix can run attacker code when loading PyTorch model files High · CVE-2026-141343
- HoloViz Lumen lets dashboard viewers run Python code on the server High · CVE-2026-141342
- RVC-Boss GPT-SoVITS can be made to run code when loading model files Critical · CVE-2026-140281
- MLflow can run attacker code during scorer deserialization Critical · CVE-2026-116692
Change history
- 27 Oct 2026: Made public
- 1 Dec 2026: Published
Official record
## Summary `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 ```python 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
Weakness type: CWE-22, CWE-73
Use this record in your own tools
Get this record as JSON
curl https://securityelites.com/wp-json/se-aivd/v1/vulns/CVE-2026-109956For scanners and pipelines: OSV format · CycloneDX format · API guide · Email alerts · Fix tracker
The plain-language sections were written with AI from the official record, and the upgrade versions come directly from the official data. Last updated 2 Dec 2026. Read the vendor advisory before changing a production system.