CVE-2026-40682
CriticalCVSS 9.1Exploitation Probability (EPSS)
Low risk41th percentile - higher than 41% of all known CVEs
Summary
An XML External Entity (XXE) vulnerability was found in Apache OpenNLP's DictionaryEntryPersistor class. The class initializes a SAX parser without enabling secure processing or disabling DTD handling, allowing an attacker to inject a malicious DOCTYPE declaration in a dictionary file. This can lead to local file disclosure via file:// entity references or server-side request forgery via http:// entity references during XML parsing.
Risk Assessment
The organization risks exposure of sensitive files from the server's filesystem and potential use of the server for attacks on other network resources (SSRF). The attack is feasible by supplying a crafted dictionary file, such as a stop-word list or domain dictionary.
Recommendation
Upgrade Apache OpenNLP to version 2.5.9 (for 2.x branch) or 3.0.0-M3 (for 3.x branch) immediately. If upgrading is not possible, ensure all dictionary files come from trusted sources and implement input validation that rejects any XML containing a DOCTYPE declaration before it reaches the parser.
Other vulnerabilities in Apache OpenNLP
See all- CVE-2026-82617Critical
The built-in name-finder patterns EMAIL and URL in Apache OpenNLP contain ambiguous nested quantifiers, enabling a ReDoS attack. A crafted input can trigger super-linear backtracking or unbounded matcher recursion, leading to CPU exhaustion or StackOverflowError. The issue affects versions 2.0.0 through 2.5.11 and 3.0.0-M1 through 3.0.0-M5.
- CVE-2026-43825High
In Apache OpenNLP, the libsvm document categorization module (3.x line) is vulnerable to untrusted Java deserialization. The SvmDoccatModel.deserialize(InputStream) method uses java.io.ObjectInputStream without a filter, allowing an attacker to execute arbitrary code via a crafted stream.
- CVE-2026-42027Critical
In Apache OpenNLP before versions 1.9.5, 2.5.9, and 3.0.0-M3, the ExtensionLoader.instantiateExtension() method loads a class by name from a model archive's manifest.properties using Class.forName() before checking type compatibility. This allows an attacker to execute the static initializer of any class on the classpath during model loading, potentially causing harmful side effects.
- CVE-2026-67211High
A vulnerability in Apache OpenNLP (opennlp-spellcheck extension, versions 3.0.0-M4 and 3.0.0-M5) allows an Out-of-Memory Denial of Service. The SymSpellModelSerializer.create() method reads unigram and bigram count fields from a model file and passes them directly to map pre-sizing without an upper bound, causing a crafted .bin file to attempt a 4–8 GB allocation and fail with OutOfMemoryError.
- CVE-2026-63317Medium
In Apache OpenNLP before versions 2.5.10 and 3.0.0-M5, a vulnerability allows arbitrary class instantiation. An attacker can supply a crafted model or format name, leading to loading and executing code from dangerous classes.
- CVE-2026-42440High
In Apache OpenNLP before versions 1.9.5, 2.5.9, and 3.0.0-M3, a denial-of-service vulnerability exists due to unbounded array allocation in AbstractModelReader. The methods getOutcomes(), getOutcomePatterns(), and getPredicates() allocate arrays based on a 32-bit integer from the model file without validation, allowing an attacker to set the value to Integer.MAX_VALUE and trigger an OutOfMemoryError.
Original NVD description (English source)
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.
Vulnerability data from NVD (NIST) · CISA KEV · EPSS

