PyPI: nltk

CVE-2026-12074

Safety vulnerability ID: SFTY-20260731-78787

Affected versions of the nltk package are vulnerable to Path Traversal due to unsanitized user input being used to construct a file path. The FramenetCorpusReader.frame() method (via internal frame_by_name logic) joins a caller-supplied frame name directly into an XML file path without any containment check, and because the resulting path is built as a plain string rather than a PathPointer, it is opened with the builtin open(), which bypasses the nltk.pathsec sandbox entirely, even when ENFORCE=True is set. An attacker who controls the frame name passed to frame() can insert ../ sequences to escape the intended corpus directory and read arbitrary XML files elsewhere on the filesystem, with parsed file content returned directly to the caller, resulting in Information Disclosure of sensitive files such as configuration data or on-disk credentials stored as XML.

Created at: Jul 31, 2026Updated at: Jul 31, 2026

Overview

Natural Language Toolkit (NLTK) has path traversal in FramenetCorpusReader.frame() that allows arbitrary XML file read, bypassing the nltk.pathsec sandbox (ENFORCE=True)

Advisory

nltk – Path Traversal

Affected Package

Affecting nltk package, versions
<= 3.9.4

Also affects

---

How to Fix

Upgrade
nltk
to
3.10.0
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