Skip to content
Path traversal Disclosed report Beginner CVE-2026-0846

NLTK has Arbitrary File Read via Absolute Path Input in nltk.util.filestring()

The filestring() function in nltk.util opens files based on user-supplied paths without validation, allowing an attacker to read arbitrary files by providing absolute or traversal paths. This could expose sensitive system files when the function is used in web APIs or other interfaces that accept user input.

nltk/nltk

Originally disclosed on huntr

A vulnerability in the filestring() function of the nltk.util module in nltk version 3.9.2 allows arbitrary file read due to improper validation of input paths. The function directly opens files specified by user input without sanitization, enabling attackers to access sensitive system files by providing absolute paths or traversal paths. This vulnerability can be exploited locally or remotely, particularly in scenarios where the function is used in web APIs or other interfaces that accept user-supplied input.

From the GitHub Advisory Database (GHSA-h8wq-7xc4-p3qx, CC BY 4.0).

The original report as published on the GitHub Advisory Database. Images and videos are our own copies; raw HTML is shown as text. View it on GitHub Advisory Database.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the filestring() function directly opens the user-supplied path without validating or restricting it to a safe directory.

Impact

An attacker could read sensitive system files, potentially leading to information disclosure, especially if the function is exposed through a web API.

What the attacker needed

User input reaches filestring(); function used in an accessible interface

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

A function in a Python library takes a file path from the user and opens it without checking whether the path is safe. An attacker can give a path to a sensitive file on the server, such as a password file, and the function will read it. This is dangerous when the function is used in a web service that accepts input from users.

What is Path traversal?

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.

More from nltk/nltk

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Path traversal and file inclusion

The lesson behind this report.

Input that builds a file path escapes the intended folder, reading or writing files the application should never touch.