CVE-2026-12252: NLTK Stanford JAR Code Execution Flaw
NLTK, a widely-used natural language processing library for Python, contains a critical flaw in how it handles Stanford NLP tool integrations. Five specific classes that interface with Stanford tools (POS tagger, NER tagger, parser, and dependency parser variants) will execute Java code from JAR files without checking whether those files are legitimate. If an attacker can control the path to a JAR file loaded by an application using these classes—through a local directory listing, a misconfigured shared drive, or another vector—they can inject malicious Java code that runs with the privileges of the Python process. This is particularly dangerous in multi-tenant environments or applications that process untrusted linguistic input sources.
Source data · NVD / CISA · public domain
- CVSS
- 3.0 · 7.8 HIGH · CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- Weaknesses (CWE)
- CWE-94
- Affected products
- 1 configuration(s)
- Published / Modified
- 2026-07-04 / 2026-07-08
NVD description (verbatim)
In nltk/nltk versions 3.9.3 and earlier, five Stanford interface classes (StanfordPOSTagger, StanfordNERTagger, StanfordParser, StanfordDependencyParser, and StanfordNeuralDependencyParser) are vulnerable to untrusted JAR code execution. These classes accept user-controllable JAR paths and execute them via the `java()` function, which invokes `subprocess.Popen()` without integrity verification. This vulnerability is identical to CVE-2026-0848, which was fixed for StanfordSegmenter by adding SHA256 verification. However, the fix was not applied to these additional classes, leaving them susceptible to arbitrary code execution when loading untrusted JAR files.
2 reference(s) · View on NVD →
SEC.co analysis · AI-assisted, reviewed against source
Technical summary
The vulnerability stems from insufficient input validation in five StanfordPOSTagger, StanfordNERTagger, StanfordParser, StanfordDependencyParser, and StanfordNeuralDependencyParser classes within NLTK. These classes accept user-supplied JAR file paths and pass them to a `java()` function that invokes `subprocess.Popen()` to launch the Stanford tools. No cryptographic integrity verification (such as SHA256 hashing) is performed on the JAR before execution. This is a variant of CVE-2026-0848, which was patched in StanfordSegmenter by adding mandatory SHA256 verification; however, the remediation was not backported to the five affected classes listed above. An attacker with local file system access or the ability to influence JAR path resolution can replace a legitimate Stanford JAR with a malicious one, achieving arbitrary code execution in the context of the NLTK application.
Business impact
Organizations deploying NLTK for text analysis, named entity recognition, or linguistic processing face a direct threat to application integrity and data confidentiality. In scenarios where NLTK runs as a backend service—such as document processing pipelines, chatbot engines, or automated content analysis systems—a compromise could lead to unauthorized data exfiltration, process manipulation, or lateral movement within the network. The risk is amplified if the NLTK application runs with elevated privileges or in shared environments where file system write access is not tightly controlled. Supply chain concerns also arise: if attackers can poison JAR artifacts in shared repositories or cached dependency folders, many downstream applications could be compromised simultaneously.
Affected systems
NLTK versions 3.9.3 and earlier are affected. The vulnerability is limited to applications explicitly using the five Stanford interface classes mentioned: StanfordPOSTagger, StanfordNERTagger, StanfordParser, StanfordDependencyParser, and StanfordNeuralDependencyParser. Applications using other NLTK components or different NLP backends are not affected. The exposure depends on how the application obtains JAR paths—hardcoded paths are lower risk than paths derived from user input, environment variables, or dynamic discovery mechanisms.
Exploitability
Exploitation requires local file system access or the ability to influence how JAR paths are resolved within the application's runtime environment. The attack vector is local; remote exploitation is not directly possible. However, the barrier to exploitation is low once file system access is achieved: no special privileges are required, and user interaction is limited to typical application usage (e.g., submitting text for NLP processing). The CVSS 3.0 score of 7.8 (HIGH) reflects this combination: local attack vector, no privilege requirement, user interaction needed only for application-normal workflows, and high impact on confidentiality, integrity, and availability. The absence of KEV (Known Exploited Vulnerability) status indicates no public exploit toolkit has been observed in the wild as of the publication date, but the relative simplicity of the attack should not be discounted.
Remediation
Upgrade NLTK to a version released after July 8, 2026 that includes SHA256 verification for all five Stanford interface classes. Verify against the official NLTK GitHub repository and release notes for the exact patched version. As an interim control, restrict write access to directories containing JAR files, use read-only mounts where feasible, and validate JAR integrity through external mechanisms if patching is delayed. Monitor JAR file paths and execution logs for unexpected modifications or out-of-band JAR loads.
Patch guidance
Consult the NLTK project's official advisory and release notes to identify the first version that patches all five Stanford interface classes with SHA256 verification. Update NLTK through your package manager (pip, conda, or equivalent) and test the updated version in a staging environment to ensure compatibility with dependent code. If your organization uses pinned dependency versions, remove the pin and adopt the patched release. If you maintain a private mirror or offline cache of NLTK, refresh it with the patched version before allowing downstream consumers to update.
Detection guidance
Monitor execution of Java processes spawned by Python/NLTK applications, particularly those loading JAR files from unexpected or user-writable directories. Log all JAR file access within directories referenced by NLTK configuration or code. Implement file integrity monitoring (FIM) on directories containing Stanford JAR files to detect unauthorized modifications. Review application logs for `subprocess.Popen()` or `java()` calls with unusual arguments or paths. In containerized environments, use image scanning to detect vulnerable NLTK versions at build time. Network-level detection is difficult because the exploit is local; focus on endpoint and application logging.
Why prioritize this
This vulnerability merits immediate attention despite the absence of KEV status and local-only attack vector. The HIGH CVSS score, straightforward exploitation path, and widespread deployment of NLTK in data processing and AI pipelines create substantial risk. The fact that a similar vulnerability was previously patched in one class but not others suggests a maintenance gap that attackers may specifically exploit. Organizations should prioritize patching in the next maintenance window, particularly for systems that process untrusted input or run in multi-tenant environments.
Risk score, explained
The CVSS 3.0 score of 7.8 (HIGH) is driven by the combination of no privilege requirement (PR:N), low attack complexity (AC:L), and complete impact on confidentiality (C:H), integrity (I:H), and availability (A:H). The local attack vector (AV:L) prevents a critical score, and the requirement for user interaction (UI:R)—in the form of normal application usage—further moderates the score. However, in practice, the impact can be severe because arbitrary code execution allows an attacker to assume full control of the compromised process.
Frequently asked questions
Does this affect all NLTK users, or only those using Stanford tools?
Only users of the five specific Stanford interface classes are affected: StanfordPOSTagger, StanfordNERTagger, StanfordParser, StanfordDependencyParser, and StanfordNeuralDependencyParser. If your application uses NLTK's native tokenizers, taggers, or parsers (e.g., punkt, averaged_perceptron_tagger, or recursive descent parser), you are not vulnerable.
Can this be exploited remotely over the network?
No, the attack vector is local. An attacker must have access to the file system where JAR files are stored or be able to influence how the application resolves JAR paths. However, in cloud or containerized environments with shared storage, lateral movement from one compromised container or VM could lead to exploitation of others.
Is there a workaround if I cannot patch immediately?
Yes. Disable the Stanford interface classes if not essential, use environment isolation (containers, VMs) to limit blast radius, implement strict file access controls on JAR directories, and consider using alternative NLP libraries for the same functionality. Additionally, monitor JAR files and Java process invocation closely until patching is complete.
Why wasn't this fixed at the same time as CVE-2026-0848 in StanfordSegmenter?
The CVE indicates the fix was applied only to StanfordSegmenter, suggesting the other five classes were either overlooked or addressed separately. The root cause—unsafe JAR execution without integrity verification—affects multiple classes, and the patch should be uniform. Verify the patched NLTK version confirms all five classes include SHA256 verification.
This analysis is provided for informational purposes and is based on the CVE record and NLTK advisory as of July 8, 2026. Organizations should verify all patch versions, affected product ranges, and remediation steps against official vendor sources before implementing changes. The absence of KEV status does not indicate the vulnerability is unexploited in private campaigns. Security teams should adapt recommendations to their specific environment, threat model, and risk tolerance. No liability is assumed for actions taken or not taken based on this analysis. Source: NVD (public-domain), retrieved 2026-08-12. Analysis generated by SEC.co (claude-haiku-4-5).
Related vulnerabilities
- CVE-2026-10904HIGHChrome V8 Sandbox Escape Remote Code Execution
- CVE-2026-10928HIGHScript Injection in Google Chrome Headless – CVSS 8.8 High Severity
- CVE-2026-11231HIGHChrome Safe Browsing Code Execution on macOS – Patch Now
- CVE-2026-11688HIGHChrome SVG Sandbox Escape RCE Vulnerability – Patch Urgently
- CVE-2026-12242HIGHAdRotate Banner Manager PHP Code Injection Vulnerability
- CVE-2026-13500HIGHANTLR4 Code Injection Vulnerability (Grammar Action Block Handler)
- CVE-2026-13749HIGHSnowflake CLI Code Injection Vulnerability in Snowpark Annotation Processor
- CVE-2026-14383HIGHChrome V8 Sandbox Escape – CVSS 8.8 Critical Vulnerability