CVE-2026-40682: Apache OpenNLP: XXE via Dictionary Parsing in DictionaryEntryPersistor
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.
Security readout for executives and security teams
Plain-English summary
Apache OpenNLP can process a malicious dictionary file in a way that lets an attacker read local files or make the server contact other systems. Risk depends on whether an application accepts attacker-controlled dictionaries. The issue is rated critical, with a CVSS 3.1 score of 9.1.
Executive priority
Treat as an urgent remediation item for services that accept externally supplied dictionaries, especially network-accessible systems with sensitive files or internal network access. Prioritize exposure discovery and supported upgrades. Where dictionary input is strictly trusted, schedule prompt remediation while preserving input controls.
Technical view
DictionaryEntryPersistor creates a SAX parser without secure processing or DTD restrictions. External entities and DOCTYPE declarations therefore remain enabled when Dictionary(InputStream) parses XML. A crafted dictionary can trigger file-based entity resolution or HTTP requests before dictionary entries are processed. This is CWE-611.
Likely exposure
Exposure is likely where applications use org.apache.opennlp:opennlp-tools versions before 2.5.9 or 3.x versions before 3.0.0-M3 and pass untrusted dictionary streams to the public Dictionary(InputStream) constructor. Systems using only trusted, controlled dictionary files have lower practical exposure.
Exploitation context
The supplied sources describe low-complexity, unauthenticated exploitation when an attacker can supply a crafted dictionary. Potential effects include local file disclosure and server-side request forgery. The CVE is not listed as KEV, and the supplied evidence does not establish active exploitation.
Researcher notes
The vulnerable parser configuration differs from the project’s XmlUtil.createSaxParser helper, which enables secure processing and rejects DOCTYPE declarations. The flaw occurs before entry handling, so downstream dictionary validation may not prevent entity resolution. Confirm exploitability through code and data-flow review without testing against production systems.
Mitigation direction
Upgrade OpenNLP 2.x deployments to version 2.5.9 or later.
Upgrade OpenNLP 3.x deployments to version 3.0.0-M3 or later.
Until upgraded, accept dictionary files only from trusted, controlled origins.
Reject dictionary XML containing DOCTYPE declarations before parser processing.
Validation and detection
Inventory applications containing the org.apache.opennlp:opennlp-tools package and record resolved versions.
Identify code paths invoking Dictionary(InputStream) or DictionaryEntryPersistor.create with externally influenced input.
Trace dictionary sources, including uploads, remote retrieval, shared storage, and administrative imports.
Confirm upgraded deployments resolve to 2.5.9 or 3.0.0-M3 and later applicable versions.
Verify temporary validation blocks DOCTYPE-bearing dictionary XML before parsing.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-611: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references SSRF or metadata access, so cloud discovery and credential material review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
3ADP providers
5Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: yesTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-611 · source CWE mapping
Improper Restriction of XML External Entity Reference
Improper Restriction of XML External Entity Reference represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.