# CVE-2026-40682: Apache OpenNLP: XXE via Dictionary Parsing in DictionaryEntryPersistor

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** CRITICAL 9.1
- **CVSS:** 9.1 (v3.1, CNA) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N`
- **CVSS metrics:** Attack vector: Network; Attack complexity: Low; Privileges required: None; User interaction: None; Scope: Unchanged; Confidentiality impact: High; Integrity impact: High; Availability impact: None
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Remote, no login needed
- **EPSS:** 0.84% (percentile 55, 2026-11-26)
- **CWE:** CWE-611
- **Aliases:** GHSA-4v8g-86x5-3vrc
- **Published:** 2026-05-04T16:55:55.834Z
- **Modified:** 2026-10-26T19:10:00.163Z

## Who should check

- Projects that depend on Maven package org.apache.opennlp:opennlp-tools (\>= 2.0.0, \< 2.5.9)
- Anyone running Apache Software Foundation Apache OpenNLP \>= 2.0, \< 2.5.9; \>= 3.0.0-M1, \< 3.0.0-M3; \< 1.9.5

## Description

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.

## Affected and fixed versions

- Maven `org.apache.opennlp:opennlp-tools`: affected \>= 2.0.0, \< 2.5.9; fixed 2.5.9, 3.0.0-M3, 1.9.5 (osv)
- Apache Software Foundation Apache OpenNLP: \>= 2.0, \< 2.5.9; \>= 3.0.0-M1, \< 3.0.0-M3; \< 1.9.5 (cvelist)

## Mitigation

- Upgrade org.apache.opennlp:opennlp-tools to one of 2.5.9, 3.0.0-M3, 1.9.5 (or later in the same release line).

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2026-40682. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2026-40682.md
Affected: org.apache.opennlp:opennlp-tools >= 2.0.0, < 2.5.9
Fixed in: 2.5.9, 3.0.0-M3, 1.9.5

Steps:
1. Search this machine and project for org.apache.opennlp:opennlp-tools (Maven), Apache Software Foundation Apache OpenNLP: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2026-40682 being exploited?

There is no confirmed exploitation: CVE-2026-40682 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.84% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2026-40682?

Critical: CVSS 9.1 (v3.1, scored by CNA). Remote, no login needed.

### Which versions are affected by CVE-2026-40682?

org.apache.opennlp:opennlp-tools \>= 2.0.0, \< 2.5.9.

### Is there a fix for CVE-2026-40682?

Yes. Fixed in 2.5.9, 3.0.0-M3, 1.9.5. Upgrade org.apache.opennlp:opennlp-tools to one of 2.5.9, 3.0.0-M3, 1.9.5 (or later in the same release line).

### How do I check if I'm affected by CVE-2026-40682?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- vendor: <https://lists.apache.org/thread/r6jpt0qr9nj67gqhppqg7jxf8vsbo0w6>
- vendor: <https://nvd.nist.gov/vuln/detail/CVE-2026-40682>
- other: <http://www.openwall.com/lists/oss-security/2026/05/01/19>
- other: <https://access.redhat.com/security/cve/CVE-2026-40682>
- other: <https://bugzilla.redhat.com/show_bug.cgi?id=2466484>
- other: <https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-40682.json>
- other: <https://github.com/apache/opennlp>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2026-40682>
- OSV: CC-BY 4.0 <https://osv.dev/vulnerability/GHSA-4v8g-86x5-3vrc> (license: <https://creativecommons.org/licenses/by/4.0/>)

HTML: <https://flawdb.com/CVE-2026-40682> · JSON: <https://flawdb.com/api/v1/entries/CVE-2026-40682>
