CVE-2026-40682

NameCVE-2026-40682
DescriptionXML 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.
SourceCVE (at NVD; CERT, ENISA, LWN, oss-sec, fulldisc, Debian ELTS, Red Hat, Ubuntu, Gentoo, SUSE bugzilla/CVE, GitHub advisories/code/issues, web search, more)

Vulnerable and fixed packages

The table below lists information on source packages.

Source PackageReleaseVersionStatus
apache-opennlp (PTS)bullseye1.9.3-1vulnerable
bookworm2.1.0-1vulnerable
forky, sid, trixie2.5.3-1vulnerable

The information below is based on the following data on fixed versions.

PackageTypeReleaseFixed VersionUrgencyOriginDebian Bugs
apache-opennlpsource(unstable)(unfixed)

Notes

https://www.openwall.com/lists/oss-security/2026/05/01/19
https://issues.apache.org/jira/browse/OPENNLP-1819
https://github.com/apache/opennlp/pull/1019
Fixed by: https://github.com/apache/opennlp/commit/b85e45f064a9b9089b65ca73c75544092fec4eae (opennlp-3.0.0-M3)
https://github.com/apache/opennlp/pull/1020
Fixed by: https://github.com/apache/opennlp/commit/d9aaa472e0e6672d672bfc296a69ab68f8757959 (opennlp-2.5.9)

Search for package or bug name: Reporting problems