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

Published May 1, 2026
·
Updated

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 FEATURESECUREPROCESSING 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 FEATURESECUREPROCESSING 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 Software

4 affected components
Apache OpenNLP<2.5.9, <3.0.0-M3
Apache OpenNLP<2.5.9
Apache OpenNLP=3.0.0-m1
Apache OpenNLP=3.0.0-m2

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Apache OpenNLP to a version that resolves this vulnerability.

    Fixed in 2.5.9Patch CVE-2026-40682
  2. Upgrade

    Upgrade Apache OpenNLP to a version that resolves this vulnerability.

    Fixed in 3.0.0-M3Patch CVE-2026-40682
  3. Configuration

    Wrap the Dictionary(InputStream) constructor usage with input validation that rejects any XML containing a DOCTYPE declaration, because XXE can be triggered during SAX parsing before any dictionary entry is processed.

    Apache OpenNLP Dictionary(InputStream) / dictionary XML parsing Reject DOCTYPE declarations = reject any XML containing a DOCTYPE declaration (disallow DOCTYPE) before it reaches the parser
  4. Compensating control

    If you cannot upgrade immediately, ensure all dictionary files loaded via Apache OpenNLP Dictionary(InputStream) are sourced from trusted origins, since the Dictionary(InputStream) constructor delegates directly to DictionaryEntryPersistor SAX parsing.

Event History

May 4, 2026
CVE Published
via MITRE·04:55 PM
Data Sourced
via MITRE·04:55 PM
DescriptionWeakness
Data Sourced
via NVD·05:16 PM
DescriptionSeverityWeaknessAffected Software
Data Sourced
via Red Hat·07:01 PM
DescriptionSeverityAffected Software

Frequently Asked Questions

1

Which applications are realistically exposed?

Applications that load stop-word lists, domain dictionaries, or other dictionary files from an attacker-controlled source through the public Dictionary(InputStream) constructor are exposed. That constructor delegates to the vulnerable dictionary parsing path.

2

What must an attacker be able to do?

An attacker must be able to supply a crafted dictionary XML file containing a malicious DOCTYPE declaration. No authentication, user interaction, or network access to the target service is required by the CVSS vector.

3

Is the vulnerable behavior present without a special parser configuration?

Yes. The DictionaryEntryPersistor parsing path does not enable secure processing or disable DTD declarations and external entity resolution; it only enables namespace support on the XMLReader.

4

How can I determine whether my application is affected?

Check whether it uses Apache OpenNLP versions before 2.5.9 or before 3.0.0-M3 and calls Dictionary(InputStream) or otherwise invokes DictionaryEntryPersistor.create(InputStream, EntryInserter). Review whether any dictionary input can be influenced by untrusted users or external sources.

5

What is the impact if exploitation succeeds?

A malicious file:// external entity can disclose local files, while an http:// external entity can cause server-side requests. Entity processing occurs during SAX parsing before any dictionary entry is processed.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203