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 parse dictionary XML unsafely in affected versions. If an application accepts a malicious dictionary file, parsing may disclose local files or trigger server-side requests before normal dictionary processing begins.
Executive priority
Treat as urgent for systems that process external dictionary files. The issue is critical severity, but business urgency depends on whether untrusted parties can influence OpenNLP dictionary input.
Technical view
CVE-2026-40682 is an XXE flaw in DictionaryEntryPersistor. A SAXParserFactory is initialized without secure processing or DTD blocking, leaving external entity resolution enabled when Dictionary(InputStream) reaches the parser. Affects OpenNLP before 2.5.9 and before 3.0.0-M3.
Likely exposure
Exposure is most likely in Java applications using org.apache.opennlp:opennlp-tools that load stop-word, domain, or other dictionary files from users, tenants, partners, or external storage. Static, internally controlled dictionaries reduce practical exposure.
Exploitation context
The bundle does not cite active exploitation, and KEV is false. Practical exploitation requires influence over dictionary XML consumed by the documented Dictionary(InputStream) path or DictionaryEntryPersistor.create.
Researcher notes
The key differentiator is this parser path not using the project’s safer XmlUtil.createSaxParser helper. Focus validation on reachability of Dictionary(InputStream), trust boundaries around dictionary sources, and fixed-version confirmation. Evidence is incomplete on real-world exploitation.
Mitigation direction
Upgrade OpenNLP 2.x deployments to 2.5.9.
Upgrade OpenNLP 3.x deployments to 3.0.0-M3.
Accept dictionary files only from trusted, controlled sources.
Reject dictionary XML containing DOCTYPE before parser invocation.
Check Apache and distribution vendor guidance for packaged fixes.
Validation and detection
Inventory org.apache.opennlp:opennlp-tools versions, including transitive dependencies.
Identify code paths using Dictionary(InputStream) or DictionaryEntryPersistor.create.
Review whether dictionary files can be user, tenant, partner, or externally supplied.
Confirm mitigated code rejects DOCTYPE-bearing dictionary XML safely.
Verify production deployments run fixed OpenNLP versions.
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.