CVE-2026-42440 Details
Description
OOM Denial of Service via Unbounded Array Allocation in Apache OpenNLP AbstractModelReader Versions Affected: before 1.9.5 before 2.5.9 before 3.0.0-M3 Description: The AbstractModelReader methods getOutcomes(), getOutcomePatterns(), and getPredicates() each read a 32-bit signed integer count field from a binary model stream and pass that value directly to an array allocation (new String[numOutcomes], new int[numOCTypes][], new String[NUM_PREDS]) without validating that the value is non-negative or within a reasonable bound. The count is therefore fully attacker-controlled when the model file originates from an untrusted source. A crafted .bin model file in which any of these count fields is set to Integer.MAX_VALUE (or any value large enough to exhaust the available heap) triggers an OutOfMemoryError at the array allocation itself, before the corresponding label or pattern data is consumed from the stream. The error occurs very early in deserialization: for a GIS model, getOutcomes() is reached after only the model-type string, the correction constant, and the correction parameter have been read; so the attacker pays no meaningful size cost to weaponize a payload, and a single small file can crash a JVM that loads it. Any code path that deserializes a .bin model is affected, including direct use of GenericModelReader and any higher-level component that delegates to it during model load. The practical impact is denial of service against processes that load model files from untrusted or semi-trusted origins. Mitigation: * 2.x users should upgrade to 2.5.9. * 3.x users should upgrade to 3.0.0-M3. Note: The fix introduces an upper bound on each of the three count fields, checked before array allocation; counts that are negative or exceed the bound cause an IllegalArgumentException to be thrown and the read to fail fast with no large allocation. The default bound is 10,000,000, which is well above the entry counts of legitimate OpenNLP models but far below any value that would threaten heap exhaustion. Deployments that legitimately need to load models with more entries than the default can raise the limit at JVM startup by setting the OPENNLP_MAX_ENTRIES system property to the desired positive integer (e.g. -DOPENNLP_MAX_ENTRIES=50000000); invalid or non-positive values fall back to the default. Users who cannot upgrade immediately should treat all .bin model files as untrusted input unless their provenance is verified, and should avoid loading models supplied by end users or fetched from third-party repositories without integrity checks.
A denial-of-service vulnerability has been identified in Apache OpenNLP's AbstractModelReader. Affected versions include those prior to 2.5.9 and 3.0.0-M3. The issue arises because the AbstractModelReader methods getOutcomes(), getOutcomePatterns(), and getPredicates() read a 32-bit signed integer count from a binary model stream and directly use that value to allocate arrays. This allocation process does not validate whether the count is non-negative or within a reasonable limit. As a result, when the model file comes from an untrusted source, the count can be manipulated by an attacker. Exploitation of this vulnerability involves crafting a .bin model file with a count field set to Integer.MAX_VALUE or any value large enough to deplete the available heap memory. This triggers an OutOfMemoryError during the array allocation, before the model data is fully processed. The error occurs early in the deserialization process, allowing a small file to effectively crash a Java Virtual Machine (JVM) that loads it. This vulnerability affects any code path that deserializes a .bin model, including the direct use of GenericModelReader and higher-level components that rely on it.
Users of Apache OpenNLP 2.x should upgrade to version 2.5.9, and users of Apache OpenNLP 3.x should upgrade to version 3.0.0-M3. The fix includes a validation step that imposes an upper limit on the count fields before array allocation, preventing large allocations that could cause heap exhaustion. Users who cannot upgrade immediately should treat all .bin model files as untrusted unless their source can be verified, and avoid loading models from end users or third-party repositories without integrity checks.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed May 5, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://access.redhat.com/security/cve/CVE-2026-42440 | redhat-SADP | |
| https://bugzilla.redhat.com/show_bug.cgi?id=2466494 | redhat-SADP | |
| https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42440.json | redhat-SADP | |
| http://www.openwall.com/lists/oss-security/2026/05/01/21 | CVE | Mailing ListThird Party Advisory |
| https://lists.apache.org/thread/s8xlkx1gqbxfsq48py5h6jphjvgqp1jo | [email protected] | Mailing ListVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-770 | Allocation of Resources Without Limits or Throttling | redhat-SADP |
| CWE-789 | Memory Allocation with Excessive Size Value | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| apache opennlp | < 2.5.9 3.0.0 m1 3.0.0 m2 |
CPE
Remediation
| |
Change History
12 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jul 30, 2026 | CVE Modified | redhat-SADP |
| Jul 15, 2026 | CVE Modified | redhat-SADP |
| Jul 3, 2026 | CVE Modified | redhat-SADP |
| Jun 30, 2026 | CVE Modified | [email protected] |
| Jun 30, 2026 | CVE Modified | redhat-SADP |
| Jun 29, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 17, 2026 | CVE Modified | [email protected] |
| May 6, 2026 | Initial Analysis | [email protected] |
| May 5, 2026 | CVE Modified | CISA-ADP |
| May 4, 2026 | CVE Modified | CVE |
| May 4, 2026 | New CVE Received | [email protected] |