CVE-2026-12252: Nltk NLTK Stanford Wrapper Classes Execute Vulnerability

HIGH
Advisory Identifier: GHSA-9r6g-266r-89x4
CVSS 7.8
CWE-94
Published
Advisory Summary

CVE-2026-12252 is a HIGH (CVSS 7.8) nltk stanford wrapper classes execute vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Nltk libraries in the PyPI ecosystem. The issue involves nltk stanford wrapper classes execute untrusted jar files without verification. Remediation is available by upgrading affected packages to version 3.9.4.

CVE-2026-12252 at a Glance

CVE Identifier CVE-2026-12252
GHSA Identifier GHSA-9r6g-266r-89x4
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Nltk
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-12252

To remediate this vulnerability, upgrade all affected Nltk dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

nltk fixed: 3.9.4
pip install nltk>=3.9.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show nltk

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-12252, inspect your installed packages using pip:

pip show nltk

Analyze the terminal output to locate any version of Nltk in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.9.4), your application is affected.

Note: The pip show nltk command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Nltk, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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.

CVE-2026-12252 Affected Nltk Versions

1 component(s)
Fixed Versions:
3.9.4
Product / Package Ecosystem Affected Versions Fixed Version
nltk
PyPI
< 3.9.4
3.9.4

References

Frequently Asked Questions

What is CVE-2026-12252?
CVE-2026-12252 is a security vulnerability in Nltk involving NLTK Stanford wrapper classes execute untrusted JAR files without verification under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Nltk versions are affected?
Affected versions include releases prior to 3.9.4 across affected packages: nltk.
What version fixes CVE-2026-12252?
Upgrading to 3.9.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nltk affected?
Yes, nltk is affected in releases prior to 3.9.4. Upgrade your dependency to 3.9.4 or later.
What is the CVSS score of CVE-2026-12252?
CVE-2026-12252 has a CVSS v3.1 base score of 7.8 (HIGH) with vector string CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-12252?
CVE-2026-12252 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check PyPI dependencies for CVE-2026-12252?
Run the dependency tree command: 'pip show nltk'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-9r6g-266r-89x4",
  "modified" : "2026-10-02T18:30:17Z",
  "published" : "2026-07-04T03:31:03Z",
  "aliases" : [ "CVE-2026-12252" ],
  "summary" : "NLTK Stanford wrapper classes execute untrusted JAR files without verification",
  "details" : "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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "nltk"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.9.4"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-12252"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/pull/3743"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/commit/006f4b83d430147b067b81e2cddd226d6fa405c8"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/commit/24777f0cb8c33ed2839d16e0f8169a3c312a6806"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/nltk/nltk"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/nltk/nltk/releases/tag/v3.10.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/nltk/PYSEC-2026-2085.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://huntr.com/bounties/f5c93982-0cc9-4e2e-bb85-1b6ab29a2efb"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-10-02T18:30:17Z",
    "nvd_published_at" : "2026-07-04T02:16:23Z"
  }
}