Skip to main content
Vulnerability Database/CVE-2026-109956

CVE-2026-109956: NLTK WekaClassifier Path Traversal Flaw

CVE-2026-109956 is a path traversal vulnerability in NLTK WekaClassifier that lets attackers bypass security containment and access unauthorized files. This article covers the technical details, affected versions, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-109956 Overview

CVE-2026-109956 is a path traversal vulnerability in the Natural Language Toolkit (NLTK) through version 3.10.3. The flaw resides in the WekaClassifier component, which fails to properly validate model path arguments against the nltk.pathsec containment controls. Attackers who control the model_filename or model argument can direct the Weka Java Virtual Machine (JVM) to write files via the -d flag or probe files via the -l flag outside of allowed data roots. The vulnerability is tracked under CWE-22: Improper Limitation of a Pathname to a Restricted Directory.

Critical Impact

Attackers can write arbitrary files or enumerate sensitive files on the host filesystem by abusing unvalidated model paths passed to the Weka JVM.

Affected Products

  • NLTK (Natural Language Toolkit) versions through 3.10.3
  • Python applications using nltk.classify.weka.WekaClassifier
  • Deployments relying on nltk.pathsec for path containment

Discovery Timeline

  • 2026-10-13 - CVE-2026-109956 published to NVD
  • 2026-10-13 - Last updated in NVD database

Technical Details for CVE-2026-109956

Vulnerability Analysis

The vulnerability exists in the WekaClassifier wrapper that NLTK provides for interacting with the Weka machine learning toolkit. NLTK ships nltk.pathsec to constrain filesystem operations to designated data roots. The WekaClassifier constructor and training routines accept a model_filename or model argument that is passed directly as a command-line parameter to the Weka JVM subprocess.

Because the model path is not validated through nltk.pathsec before being handed to Weka, an attacker can supply an absolute path or a .. sequence that escapes the sandbox. Weka then honors the attacker-controlled path when executing -d (dump model) or -l (load model) operations.

Root Cause

The root cause is missing input validation on model path arguments inside WekaClassifier. The classifier assumes callers supply trusted paths and bypasses the nltk.pathsec containment layer that other NLTK components rely on. This breaks the trust boundary when model names originate from untrusted inputs such as user uploads, API parameters, or configuration files.

Attack Vector

Exploitation requires the attacker to influence the model_filename or model argument passed to WekaClassifier. In applications that build model paths from user-supplied data, an attacker can submit a crafted string pointing to a sensitive location. When Weka runs with -d, the JVM writes serialized model data to the attacker-chosen path, enabling arbitrary file write. When Weka runs with -l, the JVM attempts to load the file, allowing attackers to probe file existence outside the data root. See the GitHub Security Advisory GHSA-j456-xh4h-cpf2 and the VulnCheck Advisory for additional technical context.

Detection Methods for CVE-2026-109956

Indicators of Compromise

  • Weka JVM subprocess invocations containing absolute paths or .. sequences in the -d or -l arguments.
  • Unexpected files written outside the configured NLTK data directory with .model or Weka serialized formats.
  • Python process logs showing WekaClassifier invocations with model paths sourced from HTTP request parameters or user uploads.

Detection Strategies

  • Inspect application code paths that pass untrusted input into nltk.classify.weka.WekaClassifier constructors or train methods.
  • Enable auditd or equivalent filesystem auditing on sensitive directories to flag writes originating from Python or Java processes.
  • Review web application and API logs for parameters that resolve to filesystem paths, particularly those containing traversal characters.

Monitoring Recommendations

  • Monitor child-process execution of java spawned by Python interpreters, logging full command lines for later review.
  • Alert on NLTK applications performing file operations outside the designated NLTK_DATA directory.
  • Centralize application logs for machine learning workloads and correlate anomalous file write patterns with authentication context.

How to Mitigate CVE-2026-109956

Immediate Actions Required

  • Inventory applications and pipelines that import nltk.classify.weka and determine whether model paths derive from untrusted input.
  • Restrict WekaClassifier usage to trusted operators and remove any paths that accept user-controlled model filenames.
  • Run NLTK workloads under a least-privilege service account that cannot write to sensitive directories.

Patch Information

Upstream patch details are tracked in the NLTK Security Advisory GHSA-j456-xh4h-cpf2. Upgrade NLTK to a fixed release once published and rebuild dependent container images. Pin the fixed version in requirements.txt or equivalent dependency manifests to prevent regression.

Workarounds

  • Validate all model path arguments against an allowlist of absolute paths inside the approved NLTK data root before invoking WekaClassifier.
  • Normalize paths with os.path.realpath and reject any result that falls outside the expected directory tree.
  • Run the Weka JVM inside a filesystem sandbox such as a container with a read-only root or a chroot restricted to the data directory.
  • Disable WekaClassifier entirely in deployments that do not require Weka integration.
bash
# Configuration example: pin a patched NLTK release and enforce data root
pip install 'nltk>3.10.3'
export NLTK_DATA=/opt/nltk_data
chmod 750 /opt/nltk_data

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.