/

CVE-2026-109956

Severity:

HIGH RISK

(7.0)

Path Traversal (CWE-22) in NLTK Weka Classifier API

CVE-2026-109956

Awaiting Analysis

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Unauthorized File Access and File Write

Severity:

HIGH RISK

(7.0)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

NLTK's WekaClassifier may allow path traversal when attacker-controlled model paths are passed without adequate validation. An attacker who can control the model_filename or model argument could cause the Weka JVM to write files or probe files outside approved data directories.

NLTK's WekaClassifier may allow path traversal when attacker-controlled model paths are passed without adequate validation. An attacker who can control the model_filename or model argument could cause the Weka JVM to write files or probe files outside approved data directories.

Affected context

This issue may affect applications using NLTK's WekaClassifier when model path arguments can be influenced by untrusted users, external configuration, or other attacker-controlled data. The risk arises when path containment checks are bypassed or applied inconsistently before the Weka JVM processes the supplied path.

This issue may affect applications using NLTK's WekaClassifier when model path arguments can be influenced by untrusted users, external configuration, or other attacker-controlled data. The risk arises when path containment checks are bypassed or applied inconsistently before the Weka JVM processes the supplied path.

Exploit preconditions

  • Attack surface: NLTK WekaClassifier model-path handling
  • Required access: Ability to influence the model_filename or model argument, directly or indirectly
  • Trigger point: Weka model loading or classifier initialization
  • Why exploitation is possible: Unvalidated path values may escape intended NLTK data roots, allowing downstream file operations to target locations outside the permitted directory
  • Attack surface: NLTK WekaClassifier model-path handling
  • Required access: Ability to influence the model_filename or model argument, directly or indirectly
  • Trigger point: Weka model loading or classifier initialization
  • Why exploitation is possible: Unvalidated path values may escape intended NLTK data roots, allowing downstream file operations to target locations outside the permitted directory

Why this happens

The underlying flaw is insufficient validation and canonicalization of attacker-influenced filesystem paths. Although NLTK path security controls may be intended to constrain access to approved data roots, the WekaClassifier path-handling flow can accept values that bypass those containment assumptions. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

The underlying flaw is insufficient validation and canonicalization of attacker-influenced filesystem paths. Although NLTK path security controls may be intended to constrain access to approved data roots, the WekaClassifier path-handling flow can accept values that bypass those containment assumptions. This maps to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, commonly known as path traversal.

Potential impact

  • An attacker could cause files to be written outside approved application directories
  • Sensitive files or filesystem metadata could be probed
  • Existing files could be overwritten, depending on process permissions
  • Application integrity or availability could be affected
  • File writes could contribute to further compromise when writable locations are security-sensitive
  • An attacker could cause files to be written outside approved application directories
  • Sensitive files or filesystem metadata could be probed
  • Existing files could be overwritten, depending on process permissions
  • Application integrity or availability could be affected
  • File writes could contribute to further compromise when writable locations are security-sensitive

General mitigation guidance

Mitigation generally focuses on reducing trust in model-path inputs and enforcing containment at the point of use.

Common defensive patterns include:

  • Resolve and canonicalize paths before authorization checks
  • Permit only explicitly approved directories and expected model-file names
  • Reject absolute paths, traversal components, symbolic-link escapes, and unexpected path formats
  • Prefer controlled model identifiers or server-side mappings over user-supplied filesystem paths
  • Apply the same validation rules to every argument and code path that reaches the Weka JVM
  • Run the classifier with the least filesystem privileges necessary
  • Use isolated, non-sensitive working directories with restrictive permissions

Mitigation generally focuses on reducing trust in model-path inputs and enforcing containment at the point of use.

Common defensive patterns include:

  • Resolve and canonicalize paths before authorization checks
  • Permit only explicitly approved directories and expected model-file names
  • Reject absolute paths, traversal components, symbolic-link escapes, and unexpected path formats
  • Prefer controlled model identifiers or server-side mappings over user-supplied filesystem paths
  • Apply the same validation rules to every argument and code path that reaches the Weka JVM
  • Run the classifier with the least filesystem privileges necessary
  • Use isolated, non-sensitive working directories with restrictive permissions

How teams detect issues like this

Organizations can look for:

  • Static-analysis findings involving path construction from model_filename, model, or comparable external inputs
  • Code review signals such as string concatenation or filesystem access before canonicalization and containment checks
  • Tests covering absolute paths, traversal segments, symbolic links, alternate path formats, and paths outside approved roots
  • Runtime policy alerts for classifier processes accessing or writing outside designated model directories
  • File-integrity monitoring for unexpected changes made by Weka or NLTK worker processes

Automated code-review and software-composition tools may help identify unsafe path handling patterns, but should be supplemented with application-specific tests.

Organizations can look for:

  • Static-analysis findings involving path construction from model_filename, model, or comparable external inputs
  • Code review signals such as string concatenation or filesystem access before canonicalization and containment checks
  • Tests covering absolute paths, traversal segments, symbolic links, alternate path formats, and paths outside approved roots
  • Runtime policy alerts for classifier processes accessing or writing outside designated model directories
  • File-integrity monitoring for unexpected changes made by Weka or NLTK worker processes

Automated code-review and software-composition tools may help identify unsafe path handling patterns, but should be supplemented with application-specific tests.

Sources

SourceLink
github.comgithub.com/nltk/nltk/security/advisories/GHSA-j456-xh4h-cpf2
vulncheck.comvulncheck.com/advisories/nltk-through-3.10.3-path-traversal-via-wekaclassifier-model-path

Frequently asked

questions

It can be remotely exploitable in applications that expose model selection or classifier configuration to untrusted users or remote inputs. Otherwise, exploitation may require local or internal access to the calling application.

The attacker generally needs a way to influence the model_filename or model argument, either directly or through a configuration, API, or stored model reference.

Treat model paths as untrusted, canonicalize them before checking containment, and allow access only to explicitly approved directories and files.

Use identifier-to-path mappings, reject traversal and absolute-path forms, apply least filesystem privilege, and test path handling against escape and symlink scenarios.

It can be remotely exploitable in applications that expose model selection or classifier configuration to untrusted users or remote inputs. Otherwise, exploitation may require local or internal access to the calling application.

The attacker generally needs a way to influence the model_filename or model argument, either directly or through a configuration, API, or stored model reference.

Treat model paths as untrusted, canonicalize them before checking containment, and allow access only to explicitly approved directories and files.

Use identifier-to-path mappings, reject traversal and absolute-path forms, apply least filesystem privilege, and test path handling against escape and symlink scenarios.

Find out what's already
exploitable in your codebase.