# CVE-2026-40682: Apache OpenNLP XXE in DictionaryEntryPersistor

Source: https://junglewise.ai/threats/cve-2026-40682-apache-opennlp-xxe-in-dictionaryentrypersistor  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-04. Updated: 2026-06-29  
License: CC BY 4.0 with a link back

CVE-2026-40682 · Severity: critical · CVSS 9.1 · Published 2026-05-04

Apache OpenNLP, a machine learning library used for processing natural language text, contains a security flaw in how it handles dictionary files. An attacker can provide a specially crafted dictionary file that, when loaded by the software, allows them to read sensitive files from the server or perform unauthorized network requests. This could lead to the exposure of private data or internal system information.

Technologies: [org.apache.opennlp:opennlp-tools (Maven)](https://junglewise.ai/threats/technologies/org-apache-opennlp-opennlp-tools). Vendors: [Maven](https://junglewise.ai/threats/vendors/maven).

## Quick answers

**Is CVE-2026-40682 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-40682 being exploited in the wild.

**How severe is CVE-2026-40682?** Critical severity, with a CVSS score of 9.1, published 4 May 2026.

**Which products and versions are affected?** org.apache.opennlp:opennlp-tools (Maven) ECOSYSTEM:introduced=2.0.0,fixed=2.5.9.

**Is there a fix for CVE-2026-40682?** Yes. org.apache.opennlp:opennlp-tools (Maven): upgrade to 2.5.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-40682 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-40682?** Check whether you run org.apache.opennlp:opennlp-tools (Maven) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- org.apache.opennlp:opennlp-tools (Maven): upgrade to 2.5.9 or later

  ```sh
  # set org.apache.opennlp:opennlp-tools to 2.5.9 in your pom.xml or build.gradle
  ```


## Technical details

The DictionaryEntryPersistor class in Apache OpenNLP initializes a static SAXParserFactory without enabling FEATURE_SECURE_PROCESSING or disabling DTD processing. When the create(InputStream, EntryInserter) method or the public Dictionary(InputStream) constructor is invoked, the underlying XMLReader remains configured to resolve external entities and DOCTYPE declarations. A remote attacker can exploit this by providing a malicious XML-based dictionary file (such as a stop-word list) containing crafted DOCTYPE declarations. Successful exploitation allows for local file disclosure via file:// protocols or Server-Side Request Forgery (SSRF) via http:// protocols. The issue has been addressed in versions 2.5.9 and 3.0.0-M3 by aligning the parser configuration with the project's secure XmlUtil helper.

## Affected products

- Apache OpenNLP < 2.5.9, 3.0.0-M1, 3.0.0-M2

## Identifiers

- CVE-2026-40682
- GHSA-4v8g-86x5-3vrc

## Timeline

- 2026-05-01: disclosed: Initial disclosure on oss-security mailing list
- 2026-05-04: advisory: NVD publication date

## References

- [https://repo.maven.apache.org/maven2/](https://repo.maven.apache.org/maven2/)
- [https://lists.apache.org/thread/r6jpt0qr9nj67gqhppqg7jxf8vsbo0w6](https://lists.apache.org/thread/r6jpt0qr9nj67gqhppqg7jxf8vsbo0w6)
- [http://www.openwall.com/lists/oss-security/2026/05/01/19](http://www.openwall.com/lists/oss-security/2026/05/01/19)

## Related threats

- [Apache OpenNLP denial of service in AbstractModelReader](https://junglewise.ai/threats/cve-2026-42440-apache-opennlp-denial-of-service-in-abstractmodelreader)
- [Apache OpenNLP arbitrary class instantiation in ExtensionLoader](https://junglewise.ai/threats/cve-2026-42027-apache-opennlp-arbitrary-class-instantiation-in-extensionloader)
- [Improper Restriction of XML External Entity Reference in Apache OpenNLP](https://junglewise.ai/threats/cve-2017-12620-improper-restriction-of-xml-external-entity-reference-in-apache)
