PyPI: nltk

CVE-2026-33236

Safety vulnerability ID: SFTY-20260319-61439

Safety legacy ID: pyup.io-89827

Affected versions of the nltk package are vulnerable to Arbitrary File Overwrite due to improper validation of path components from remote XML index files. The vulnerability exists in nltk/downloader.py because Package.fromxml() builds self.filename with untrusted subdir and id values, _download_package() joins that filename with download_dir, calls os.makedirs() on the attacker-controlled info.subdir, and then writes the downloaded file with open(filepath, "wb") without blocking dot-dot-slash path traversal sequences.

Created at: Mar 25, 2026Updated at: Mar 25, 2026

Overview

NLTK has a Downloader Path Traversal Vulnerability (AFO) - Arbitrary File Overwrite

Advisory

Affected versions of the nltk package are vulnerable to Arbitrary File Overwrite due to improper validation of path components from remote XML index files. The vulnerability exists in nltk/downloader.py because Package.fromxml() builds self.filename with untrusted subdir and id values, _download_package() joins that filename with download_dir, calls os.makedirs() on the attacker-controlled info.subdir, and then writes the downloaded file with open(filepath, "wb") without blocking dot-dot-slash path traversal sequences.

Affected Package

Affecting nltk package, versions
<=3.9.2

Also affects

---

How to Fix

Upgrade
nltk
to
3.9.3
or higher.

Mitigation and Workarounds

---

Vulnerable Functions

Functions linked to known vulnerabilities.

Vulnerable function data is available for Enterprise customers

Book a call with us to see Safety in action.

Safety

Verified by Safety

Our Cybersecurity Intelligence Team reviewed this vulnerability. We combine public data with our own research to find issues not yet reported to public sources.

Learn more