CVE-2026-33236
Python vulnerability analysis and mitigation

Overview

CVE-2026-33236 is a path traversal vulnerability in the NLTK (Natural Language Toolkit) downloader that allows an attacker controlling a remote XML index server to cause arbitrary directory creation, arbitrary file creation, and arbitrary file overwrite on a victim's system. It affects NLTK versions 3.9.3 and prior. The vulnerability was published on March 18, 2026, and patched via commit 89fe2ec2c6bae6e2e7a46dad65cc34231976ed8a. It carries a CVSS v3.1 base score of 8.1 (High) (GitHub Advisory, Red Hat Bugzilla).

Technical details

The root cause is CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), arising from the failure to validate the subdir and id attributes parsed from remote XML index files in nltk/downloader.py. Specifically, at line 253, self.filename = os.path.join(subdir, id + ext) constructs a file path directly from unvalidated XML attributes; at line 679, this filename is joined with the download directory without sanitization; at line 687, os.makedirs() can create directories outside the intended download path; and at line 695, open(filepath, 'wb') writes to the resulting arbitrary location. An attacker must control the XML index server that the victim's NLTK downloader contacts — either by operating a malicious server or via a man-in-the-middle attack — and the victim must trigger a download operation. Full proof-of-concept exploit code (two Python scripts: malicious_server.py and exploit_vulnerability.py) is publicly available in the security advisory (GitHub Advisory, Patch Commit).

Impact

Successful exploitation allows an unauthenticated remote attacker to overwrite critical system files (e.g., /etc/passwd, ~/.ssh/authorized_keys), create arbitrary files, and create arbitrary directories anywhere the running process has write access. Overwriting SSH authorized keys or other authentication artifacts can lead to full system compromise and persistent unauthorized access. Availability is also impacted if critical system files are corrupted or overwritten with attacker-controlled content, potentially rendering the system inoperable (GitHub Advisory, Red Hat Bugzilla).

Exploitability

Public proof-of-concept exploit code is available in the NLTK security advisory, consisting of two complete, runnable Python scripts that set up a malicious HTTP server and trigger arbitrary file overwrite on a victim system (GitHub Advisory). There is no confirmed evidence of in-the-wild exploitation at this time, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 0.043% (0.000430), indicating a low current probability of exploitation in the wild. No specific threat actor attribution has been reported.

Exploitation steps

  1. Set up malicious XML index server: Deploy a Python HTTP server (malicious_server.py) that serves a crafted XML index file containing path traversal sequences in the subdir and id attributes, e.g., <package subdir='../../tmp' id='test_file' .../>, along with a corresponding ZIP payload.
  2. Position for interception: Either operate a server that the victim is configured to use as their NLTK index URL, or perform a man-in-the-middle attack to redirect the victim's NLTK downloader requests to the malicious server.
  3. Trigger victim download: Wait for or socially engineer the victim to execute an NLTK download operation, e.g., nltk.download('test_file') or via the Downloader class pointed at the malicious index URL.
  4. Path traversal execution: NLTK's Package.fromxml() parses the malicious XML, constructing filename = '../../tmp/test_file.zip'. The _download_package() method joins this with the download directory without validation, and os.makedirs() creates the traversed directory path.
  5. Arbitrary file write: open(filepath, 'wb') writes the attacker-controlled ZIP content to the resolved path (e.g., /tmp/test_file.zip or /etc/passwd), completing the file overwrite.
  6. Achieve persistence or code execution: By overwriting files such as ~/.ssh/authorized_keys with attacker-controlled SSH public keys, or replacing executable scripts/cron jobs, the attacker can achieve persistent access or code execution (GitHub Advisory).

Indicators of compromise

  • Network: Outbound HTTP requests from a host running NLTK to an unexpected or untrusted XML index server URL (non-default NLTK index); unusual HTTP GET requests for XML files from Python processes.
  • File System: Unexpected files written outside the NLTK data directory (default: ~/nltk_data), particularly ZIP files in /tmp/, /etc/, or home directories; modification timestamps on sensitive files such as /etc/passwd, ~/.ssh/authorized_keys, or cron files coinciding with NLTK downloader activity.
  • Logs: Python process logs or application logs showing NLTK downloader activity with a non-standard server_index_url parameter; OS audit logs (e.g., auditd) recording file writes to sensitive paths by a Python process.
  • Process: Python processes spawning with arguments referencing nltk.downloader or Downloader with a custom server_index_url pointing to an external or internal non-standard host (GitHub Advisory).

Mitigation and workarounds

Update NLTK to a version beyond 3.9.3 that includes the fix from commit 89fe2ec2c6bae6e2e7a46dad65cc34231976ed8a, which adds validation of subdir and id attributes to reject path traversal sequences and adds a defense-in-depth check using os.path.realpath() to ensure file writes remain within the download directory. As a workaround, ensure NLTK downloaders only connect to trusted, authenticated XML index servers and restrict outbound network access from systems running NLTK to known-good index URLs. IBM has also released patches for affected products including IBM API Connect and IBM watsonx Orchestrate with watsonx Assistant Cartridge (GitHub Advisory, IBM Advisory, Patch Commit).

Community reactions

The vulnerability was noted on Mastodon via @thehackerwire and picked up by several CVE tracking and security news aggregators shortly after disclosure. OpenSUSE and Ubuntu issued security advisories for their packaged versions of NLTK, and Linux security news outlets covered the update. Red Hat tracked the issue via Bugzilla with high priority, and IBM issued advisories for affected downstream products. No major independent researcher commentary or significant social media debate has been identified beyond standard CVE tracking coverage (Red Hat Bugzilla, IBM Advisory).

Additional resources


SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-84366HIGH7.4
  • Python logoPython
  • python3.7
NoYesSep 01, 2026
GHSA-8423-8fgw-73vqMEDIUM6.9
  • Python logoPython
  • tornado
NoYesSep 01, 2026
CVE-2026-84311MEDIUM4.8
  • Python logoPython
  • pypdf2
NoYesSep 01, 2026
CVE-2026-84310MEDIUM4.8
  • Python logoPython
  • pypdf
NoYesSep 01, 2026
GHSA-wwv5-g3v4-889xLOW2.3
  • Python logoPython
  • tornado
NoYesSep 01, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management