CVE-2026-40682: CWE-611 Improper Restriction of XML External Entity Reference in Apache Software Foundation Apache OpenNLP
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.
AI Analysis
Technical Summary
Apache OpenNLP's DictionaryEntryPersistor class initializes a SAXParserFactory without enabling FEATURE_SECURE_PROCESSING or disabling DTD processing, leaving external entity resolution and DOCTYPE declarations enabled. When the create(InputStream, EntryInserter) method is called, this insecure parser configuration allows an attacker who can supply a crafted dictionary file (such as a stop-word list or domain dictionary) containing a malicious DOCTYPE declaration to exploit XML External Entity (XXE) injection. This can lead to local file disclosure via file:// entity references or server-side request forgery via http:// entity references during SAX parsing, before any dictionary entries are processed. This issue contrasts with other XML parsing paths in the codebase that correctly disable these features. The vulnerability affects Apache OpenNLP versions before 2.5.9 and before 3.0.0-M3. The recommended mitigation is to upgrade to version 2.5.9 or 3.0.0-M3. For users unable to upgrade immediately, it is advised to ensure dictionary files come from trusted sources and to implement input validation to reject XML containing DOCTYPE declarations before parsing.
Potential Impact
Successful exploitation allows an unauthenticated attacker who can supply a crafted dictionary XML file to cause local file disclosure or server-side request forgery via XXE during XML parsing. This can lead to confidentiality breaches of local files and potential interaction with internal systems through SSRF. The vulnerability has a CVSS score of 9.1 (critical), indicating high impact on confidentiality and integrity without requiring privileges or user interaction.
Mitigation Recommendations
A fix is available by upgrading Apache OpenNLP to version 2.5.9 for 2.x users or 3.0.0-M3 for 3.x users. Users who cannot upgrade immediately should ensure all dictionary files are sourced from trusted origins and implement input validation to reject any XML containing DOCTYPE declarations before parsing with the vulnerable Dictionary(InputStream) constructor.
CVE-2026-40682: CWE-611 Improper Restriction of XML External Entity Reference in Apache Software Foundation Apache OpenNLP
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.
CVSS v3.1
Score 9.1critical
Affected software
pkg:maven/org.apache.opennlp/opennlpRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Apache OpenNLP's DictionaryEntryPersistor class initializes a SAXParserFactory without enabling FEATURE_SECURE_PROCESSING or disabling DTD processing, leaving external entity resolution and DOCTYPE declarations enabled. When the create(InputStream, EntryInserter) method is called, this insecure parser configuration allows an attacker who can supply a crafted dictionary file (such as a stop-word list or domain dictionary) containing a malicious DOCTYPE declaration to exploit XML External Entity (XXE) injection. This can lead to local file disclosure via file:// entity references or server-side request forgery via http:// entity references during SAX parsing, before any dictionary entries are processed. This issue contrasts with other XML parsing paths in the codebase that correctly disable these features. The vulnerability affects Apache OpenNLP versions before 2.5.9 and before 3.0.0-M3. The recommended mitigation is to upgrade to version 2.5.9 or 3.0.0-M3. For users unable to upgrade immediately, it is advised to ensure dictionary files come from trusted sources and to implement input validation to reject XML containing DOCTYPE declarations before parsing.
Potential Impact
Successful exploitation allows an unauthenticated attacker who can supply a crafted dictionary XML file to cause local file disclosure or server-side request forgery via XXE during XML parsing. This can lead to confidentiality breaches of local files and potential interaction with internal systems through SSRF. The vulnerability has a CVSS score of 9.1 (critical), indicating high impact on confidentiality and integrity without requiring privileges or user interaction.
Mitigation Recommendations
A fix is available by upgrading Apache OpenNLP to version 2.5.9 for 2.x users or 3.0.0-M3 for 3.x users. Users who cannot upgrade immediately should ensure all dictionary files are sourced from trusted origins and implement input validation to reject any XML containing DOCTYPE declarations before parsing with the vulnerable Dictionary(InputStream) constructor.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- apache
- Date Reserved
- 2026-04-14T17:21:09.189Z
- Cvss Version
- null
- State
- PUBLISHED
- Remediation Level
- null
- Vendor Advisory Urls
- [{"url":"https://access.redhat.com/security/cve/CVE-2026-40682","vendor":"Red Hat"}]
Threat ID: 69f8d216cbff5d8610397041
Added to database: 05/04/2026, 17:06:30 UTC
Last enriched: 07/15/2026, 09:11:53 UTC
Last updated: 08/01/2026, 08:48:05 UTC
Views: 124
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.