/

CVE-2026-33236

Severity:

HIGH RISK

(8.1)

Path Traversal in NLTK Downloader XML Index Handling

CVE-2026-33236

Modified

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22

Impact:

Arbitrary File Creation and Overwrite

Severity:

HIGH RISK

(8.1)

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

A path traversal flaw in the NLTK downloader allows remote XML index servers to inject directory traversal sequences into the subdir and id attributes without validation.

When a client uses a malicious or compromised XML index, the downloader may create or overwrite arbitrary files and directories on the system, enabling data loss, configuration tampering, or limited code execution depending on what paths are targeted.

Affected context

This vulnerability affects applications and users that invoke the NLTK downloader to fetch corpora, models, or other resources from XML-based indexes.

It is relevant when:

  • The downloader is configured to use remote or custom XML index servers, or
  • An attacker can influence which XML index URL is loaded.

The flaw occurs in the client-side processing of subdir and id attributes from the XML index, which are used to determine local filesystem paths without sufficient normalization or validation.

Exploit preconditions

  • Attack surface: NLTK downloader client running on a user or application machine.
  • Required access: Ability to control, spoof, or redirect the downloader to a malicious XML index server (e.g., via configuration, environment, DNS, or MITM in some scenarios).
  • Trigger point: Execution of nltk.download() or any workflow that consumes the remote XML index and processes subdir/id attributes.
  • Why exploitation is possible: The downloader trusts path fragments from the XML index and concatenates them directly into local filesystem paths, allowing ../ sequences or absolute path-like values to break out of the intended download directory.

Why this happens

The core issue is unvalidated use of attacker-controlled path components from an XML index to construct local file system paths.

The downloader logic interprets subdir and id values as relative directory/file names and uses them directly, failing to normalize, canonicalize, or constrain them to an expected base directory.

This aligns with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, where path traversal sequences enable access to or modification of files outside the intended download root.

Potential impact

  • Arbitrary directory creation anywhere the downloader process has write permission.
  • Arbitrary file creation with attacker-controlled contents.
  • Overwrite of existing files, potentially including configuration files, logs, or application resources.
  • Disruption or corruption of NLTK data packages and NLP models, affecting application behavior or research results.
  • Under certain configurations, potential facilitation of limited code execution by overwriting scripts, configuration, or data that is later executed or interpreted.

General mitigation guidance

Mitigation focuses on strictly constraining how remote-controlled paths are interpreted and reducing trust in external indexes.

Pattern-oriented defensive measures include:

  • Normalizing and canonicalizing paths before use, rejecting any that escape the intended download root or contain traversal sequences (.., drive changes, absolute paths).
  • Enforcing a fixed, application-controlled base directory for downloads and ensuring all resolved paths remain inside that directory.
  • Treating all index-derived path fragments as untrusted input and applying allowlists for allowed characters and directory structures.
  • Running downloader processes with least-privilege accounts and limited filesystem permissions, so even if a path issue exists, the blast radius is reduced.
  • Favoring official, authenticated index sources and avoiding dynamically configured or user-supplied index URLs in production workflows.

How teams detect issues like this

Detection can combine code-focused and operational techniques:

  • Static analysis: Rules that flag concatenation of untrusted data (from XML attributes or network sources) into filesystem paths without validation or canonicalization.
  • Code review: Look for path-building logic that uses remote index attributes (subdir, id, or similar) directly in directory or filename construction; verify that checks enforce containment within a designated base directory.
  • Runtime monitoring: File integrity monitoring or audit logging to detect unexpected writes outside the normal NLTK data directories during downloader runs.
  • Configuration review: Inventory and review custom index URLs or mirrors used by NLTK in CI, training pipelines, or production systems to ensure they are trusted and well-controlled.

Sources

SourceLink
github.comgithub.com/nltk/nltk/commit/89fe2ec2c6bae6e2e7a46dad65cc34231976ed8a
github.comgithub.com/nltk/nltk/security/advisories/GHSA-469j-vmhf-r6v7
access.redhat.comaccess.redhat.com/errata/RHSA-2026:10184
access.redhat.comaccess.redhat.com/errata/RHSA-2026:19712
access.redhat.comaccess.redhat.com/errata/RHSA-2026:37275
access.redhat.comaccess.redhat.com/errata/RHSA-2026:42644
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-33236
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2449824
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-33236.json

Frequently asked

questions

It can be, if an attacker can cause the NLTK downloader to use a malicious or compromised XML index server. This might occur via explicit configuration, poisoned mirrors, or certain redirection scenarios. However, the attacker does not typically gain direct interactive access; they influence filesystem writes through crafted index data.

The attacker needs control over the XML index content the downloader consumes, or the ability to redirect the downloader to such an index. The resulting file operations execute with the same privileges as the user or application running the downloader.

Ensure all paths derived from remote metadata are normalized, validated, and constrained to a predefined base directory. Reject any path that resolves outside the allowed tree or contains suspicious elements, and treat remote index data as untrusted input at all times.

Design downloaders to operate within a sandboxed directory, use strict path canonicalization, and apply allowlists for resource names. Combine this with least-privilege execution, secure defaults for update sources, and automated checks (static analysis and code review rules) that flag untrusted data being used in path construction without proper validation.

Find out what's already
exploitable in your codebase.