CVE-2026-0848: Arbitrary Code Execution in NLTK StanfordSegmenter via Untrusted JAR Loading
Last updated 6 May 2026
Other sources
NLTK versions <=3.9.2 are vulnerable to arbitrary code execution due to improper input validation in the StanfordSegmenter module. The module dynamically loads external Java .jar files without verification or sandboxing. An attacker can supply or replace the JAR file, enabling the execution of arbitrary Java bytecode at import time. This vulnerability can be exploited through methods such as model poisoning, MITM attacks, or dependency poisoning, leading to remote code execution. The issue arises from the direct execution of the JAR file via subprocess with unvalidated classpath input, allowing malicious classes to execute when loaded by the JVM.
— MITRE
NLTK versions =3.9.2 are vulnerable to arbitrary code execution due to improper input validation in the StanfordSegmenter module. The module dynamically loads external Java .jar files without verification or sandboxing. An attacker can supply or replace the JAR file, enabling the execution of arbitrary Java bytecode at import time. This vulnerability can be exploited through methods such as model poisoning, MITM attacks, or dependency poisoning, leading to remote code execution. The issue arises from the direct execution of the JAR file via subprocess with unvalidated classpath input, allowing malicious classes to execute when loaded by the JVM.
— IBM
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/nltkto a version that resolves this vulnerability.Fixed in 3.9.3-1 - Upgrade
Upgrade
NLTK StanfordSegmenter (NLTK)to a version that resolves this vulnerability.Fixed in 3.9.2 - Compensating control
Do not allow untrusted parties to supply/replace the external StanfordSegmenter .jar file that the StanfordSegmenter module dynamically loads; only load the expected, verified jar (e.g., from a trusted, tamper-protected location) and avoid unvalidated classpath/subprocess inputs.
Event History
Frequently Asked Questions
What is the severity of CVE-2026-0848?
CVE-2026-0848 has a high severity rating due to the potential for arbitrary code execution.
How do I fix CVE-2026-0848?
To fix CVE-2026-0848, update NLTK to a version later than 3.9.2 that addresses the vulnerability.
Which versions of NLTK are affected by CVE-2026-0848?
NLTK versions 3.9.2 and prior are affected by CVE-2026-0848.
What type of vulnerability is CVE-2026-0848?
CVE-2026-0848 is an arbitrary code execution vulnerability caused by improper input validation in the StanfordSegmenter module.
What can happen if CVE-2026-0848 is exploited?
If exploited, CVE-2026-0848 could allow an attacker to execute arbitrary code on a vulnerable system.