PyPI: nltk

CVE-2026-54293

Safety vulnerability ID: SFTY-20260616-58930

Affected versions of the Natural Language Toolkit (NLTK) package are vulnerable to Path Traversal due to improper handling of URL-encoded path separators and traversal segments. The `nltk.data.load()` function fails to properly sanitize path inputs before decoding them with `url2pathname()`, allowing encoded traversal patterns to bypass regex checks. An attacker can exploit this vulnerability by providing a specially crafted URL-encoded path, enabling arbitrary file read access on the system, potentially exposing sensitive files such as `/etc/passwd` or `/proc/self/environ`.

Created at: Jul 15, 2026Updated at: Jul 15, 2026

Overview

Natural Language Toolkit (NLTK): URL-Encoded Path Traversal in nltk.data.load() Allows Arbitrary Local File Read

Advisory

nltk – Path Traversal

Affected Package

Affecting nltk package, versions
<= 3.9.4

Also affects

---

How to Fix

We recommend updating nltk to the latest non-vulnerable version.

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