Vulnerabilities in pkg:maven/org.apache.opennlp/opennlp-tools

PACKAGE
Advisory Identifier: GHSA-4v8g-86x5-3vrc
Advisory Summary

CVE-2026-40682 is a CRITICAL (CVSS 9.1) apache opennlp dictionaryentrypersistor vulnerable to vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Opennlp tools libraries in the Maven ecosystem. The issue involves apache opennlp dictionaryentrypersistor vulnerable to xml external entity (xxe) via unsanitized dictionary parsing. Remediation is available by upgrading affected packages to version 2.5.9, 3.0.0-M3, 1.9.5.

4 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:maven/org.apache.opennlp/opennlp-tools

4 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:maven/org.apache.opennlp/opennlp-tools. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-4v8g-86x5-3vrc CVE-2026-40682 CRITICAL Apache OpenNLP DictionaryEntryPersistor Vulnerable to XML External Entity (XXE) via Unsanitized Dictionary Parsing
GHSA-cx4m-2p55-rw7j CVE-2026-42027 CRITICAL Apache OpenNLP ExtensionLoader Vulnerable to Arbitrary Class Instantiation via Model Manifest
GHSA-659w-93r5-9j6m CVE-2026-42440 HIGH Apache OpenNLP AbstractModelReader has an OOM Denial of Service via Unbounded Array Allocation
GHSA-h22x-hm8g-rxpg CVE-2017-12620 CRITICAL Improper Restriction of XML External Entity Reference in Apache OpenNLP

CVE-2026-40682 at a Glance

CVE Identifier CVE-2026-40682
GHSA Identifier GHSA-4v8g-86x5-3vrc
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Opennlp tools
Package Ecosystem Maven
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

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

How to Fix CVE-2026-40682

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

org.apache.opennlp:opennlp-tools fixed: 2.5.9
<dependency>
    <groupId>org.apache.opennlp</groupId>
    <artifactId>opennlp-tools</artifactId>
    <version>2.5.9</version>
</dependency>
org.apache.opennlp:opennlp-tools fixed: 3.0.0-M3
<dependency>
    <groupId>org.apache.opennlp</groupId>
    <artifactId>opennlp-tools</artifactId>
    <version>3.0.0-M3</version>
</dependency>
org.apache.opennlp:opennlp-tools fixed: 1.9.5
<dependency>
    <groupId>org.apache.opennlp</groupId>
    <artifactId>opennlp-tools</artifactId>
    <version>1.9.5</version>
</dependency>
Verify Direct and Transitive Dependencies

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

mvn dependency:tree -Dincludes=org.apache.opennlp

How to Check if You Are Affected

To determine whether your Java application is affected by CVE-2026-40682, inspect your build dependencies using the Maven Dependency Plugin:

mvn dependency:tree -Dincludes=org.apache.opennlp

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

Note: The mvn dependency:tree -Dincludes=org.apache.opennlp command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Opennlp tools, 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

XML External Entity (XXE) via Unsanitized Dictionary Parsing in Apache OpenNLP DictionaryEntryPersistor Versions Affected: before 2.5.9, before 3.0.0-M3 Description: The DictionaryEntryPersistor class initializes a static SAXParserFactory at class-load time without enabling FEATURE_SECURE_PROCESSING or disabling DTD processing. When create(InputStream, EntryInserter) is invoked, the only feature set on the XMLReader is namespace support — external entity resolution and DOCTYPE declarations remain fully enabled. An attacker who can supply a crafted dictionary file (e.g., a stop-word list or domain dictionary) containing a malicious DOCTYPE declaration can trigger local file disclosure via file:// entity references or server-side request forgery via http:// entity references during SAX parsing, before the application processes a single dictionary entry. This is inconsistent with the project's own XmlUtil.createSaxParser() helper, which correctly sets FEATURE_SECURE_PROCESSING and disallow-doctype-decl and is used by all other XML parsing paths in the codebase. The public Dictionary(InputStream) constructor delegates directly to this method and is the documented API for loading user-supplied dictionaries, making untrusted input a realistic scenario. Mitigation: 2.x users should upgrade to 2.5.9. 3.x users should upgrade to 3.0.0-M3. Users who cannot upgrade immediately should ensure that all dictionary files are sourced from trusted origins and should consider wrapping the Dictionary(InputStream) constructor with input validation that rejects any XML containing a DOCTYPE declaration before it reaches the parser.

CVE-2026-40682 Affected Opennlp tools Versions

3 component(s)
Fixed Versions:
2.5.93.0.0-M31.9.5
Product / Package Ecosystem Affected Versions Fixed Version
org.apache.opennlp:opennlp-tools
Maven
≥ 2.0.0
< 2.5.9
2.5.9
org.apache.opennlp:opennlp-tools
Maven
≥ 3.0.0-M1
< 3.0.0-M3
3.0.0-M3
org.apache.opennlp:opennlp-tools
Maven
< 1.9.5
1.9.5

References

Frequently Asked Questions

What is CVE-2026-40682?
CVE-2026-40682 is a security vulnerability in Opennlp tools involving Apache OpenNLP DictionaryEntryPersistor Vulnerable to XML External Entity (XXE) via Unsanitized Dictionary Parsing under CWE-611: Improper Restriction of XML External Entity Reference.
Which Opennlp tools versions are affected?
Affected versions include releases prior to 2.5.9, 3.0.0-M3, 1.9.5 across affected packages: org.apache.opennlp:opennlp-tools.
What version fixes CVE-2026-40682?
Upgrading to 2.5.9, 3.0.0-M3, 1.9.5 (or the latest patched release for your respective branch) resolves the vulnerability.
Is opennlp-tools affected?
Yes, org.apache.opennlp:opennlp-tools is affected in releases prior to 2.5.9, 3.0.0-M3, 1.9.5. Upgrade your dependency to 2.5.9, 3.0.0-M3, 1.9.5 or later.
What is the CVSS score of CVE-2026-40682?
CVE-2026-40682 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2026-40682?
CVE-2026-40682 is classified under CWE-611: Improper Restriction of XML External Entity Reference (The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.).
How can I check Maven dependencies for CVE-2026-40682?
Run the dependency tree command: 'mvn dependency:tree -Dincludes=org.apache.opennlp'. 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-4v8g-86x5-3vrc",
  "modified" : "2026-10-02T22:41:33Z",
  "published" : "2026-05-04T18:30:30Z",
  "aliases" : [ "CVE-2026-40682" ],
  "summary" : "Apache OpenNLP DictionaryEntryPersistor Vulnerable to XML External Entity (XXE) via Unsanitized Dictionary Parsing",
  "details" : "XML External Entity (XXE) via Unsanitized Dictionary Parsing in Apache OpenNLP DictionaryEntryPersistor\n\n\nVersions Affected: before 2.5.9, before 3.0.0-M3\n\n\nDescription: The DictionaryEntryPersistor class initializes a static SAXParserFactory at class-load time without enabling FEATURE_SECURE_PROCESSING or disabling DTD processing. When create(InputStream, EntryInserter) is invoked, the only feature set on the XMLReader is namespace support — external entity resolution and DOCTYPE declarations remain fully enabled. An attacker who can supply a crafted dictionary file (e.g., a stop-word list or domain dictionary) containing a malicious DOCTYPE declaration can trigger local file disclosure via file:// entity references or server-side request forgery via http:// entity references during SAX parsing, before the application processes a single dictionary entry. This is inconsistent with the project's own XmlUtil.createSaxParser() helper, which correctly sets FEATURE_SECURE_PROCESSING and disallow-doctype-decl and is used by all other XML parsing paths in the codebase. The public Dictionary(InputStream) constructor delegates directly to this method and is the documented API for loading user-supplied dictionaries, making untrusted input a realistic scenario.\n\n\nMitigation: 2.x users should upgrade to 2.5.9. 3.x users should upgrade to 3.0.0-M3. Users who cannot upgrade immediately should ensure that all dictionary files are sourced from trusted origins and should consider wrapping the Dictionary(InputStream) constructor with input validation that rejects any XML containing a DOCTYPE declaration before it reaches the parser.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.opennlp:opennlp-tools"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.0.0"
      }, {
        "fixed" : "2.5.9"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.opennlp:opennlp-tools"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0-M1"
      }, {
        "fixed" : "3.0.0-M3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "Maven",
      "name" : "org.apache.opennlp:opennlp-tools"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.9.5"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-40682"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/security/cve/CVE-2026-40682"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=2466484"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/apache/opennlp"
  }, {
    "type" : "WEB",
    "url" : "https://lists.apache.org/thread/r6jpt0qr9nj67gqhppqg7jxf8vsbo0w6"
  }, {
    "type" : "WEB",
    "url" : "https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40682.json"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2026/05/01/19"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-05-08T17:51:59Z",
    "nvd_published_at" : "2026-05-04T17:16:23Z"
  }
}