CVE-2026-40682: Opennlp tools Apache OpenNLP DictionaryEntryPersistor Vulnerable To Vulnerability
CRITICALCVE-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.
CVE-2026-40682 at a Glance
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).
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.
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>2.5.9</version>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>3.0.0-M3</version>
</dependency>
<dependency>
<groupId>org.apache.opennlp</groupId>
<artifactId>opennlp-tools</artifactId>
<version>1.9.5</version>
</dependency>
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
CVE-2026-40682 Affected Opennlp tools Versions
3 component(s)| 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?
Which Opennlp tools versions are affected?
What version fixes CVE-2026-40682?
Is opennlp-tools affected?
What is the CVSS score of CVE-2026-40682?
What CWE is associated with CVE-2026-40682?
How can I check Maven dependencies for CVE-2026-40682?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}