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.
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.
How to Fix
Mitigation and Workarounds
---
Vulnerable Functions
Functions linked to known vulnerabilities.
References
- https://getsafety.com/vulnerabilities/SFTY-20260319-61439/CVE-2026-33236
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2026-33236
- https://data.safetycli.com/changelogs/nltk/
- https://github.com/advisories/GHSA-469j-vmhf-r6v7
- https://pypi.org/project/nltk
- https://github.com/nltk/nltk/security/advisories/GHSA-469j-vmhf-r6v7
- https://nvd.nist.gov/vuln/detail/CVE-2026-33236
- https://github.com/nltk/nltk/commit/89fe2ec2c6bae6e2e7a46dad65cc34231976ed8a
- https://github.com/advisories/GHSA-469j-vmhf-r6v7
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
