CVE-2026-42440

CVE-2026-42440 is a high-severity security vulnerability in org.apache.opennlp:opennlp-tools (maven), affecting versions < 2.5.9. It is fixed in 2.5.9, 3.0.0-M3.

Summary

OOM Denial of Service via Unbounded Array Allocation in Apache OpenNLP AbstractModelReader 

Versions Affected:

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.

Impact

CVE-2026-42440 has a CVSS score of 7.5 (High). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (2.5.9, 3.0.0-M3); upgrading removes the vulnerable code path.

Affected versions

org.apache.opennlp:opennlp-tools (< 2.5.9) org.apache.opennlp:opennlp-tools (>= 3.0.0-M1, < 3.0.0-M3)

Security releases

org.apache.opennlp:opennlp-tools → 2.5.9 (maven) org.apache.opennlp:opennlp-tools → 3.0.0-M3 (maven)

Kodem intelligence

Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.

Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.

See it in your environment

Remediation advice

Upgrade the following packages to resolve this vulnerability:

org.apache.opennlp:opennlp-tools to 2.5.9 or later; org.apache.opennlp:opennlp-tools to 3.0.0-M3 or later

Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.

Frequently Asked Questions

  1. What is CVE-2026-42440? CVE-2026-42440 is a high-severity security vulnerability in org.apache.opennlp:opennlp-tools (maven), affecting versions < 2.5.9. It is fixed in 2.5.9, 3.0.0-M3.
  2. How severe is CVE-2026-42440? CVE-2026-42440 has a CVSS score of 7.5 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
  3. Which versions of org.apache.opennlp:opennlp-tools are affected by CVE-2026-42440? org.apache.opennlp:opennlp-tools (maven) versions < 2.5.9 is affected.
  4. Is there a fix for CVE-2026-42440? Yes. CVE-2026-42440 is fixed in 2.5.9, 3.0.0-M3. Upgrade to this version or later.
  5. Is CVE-2026-42440 exploitable, and should I be worried? Whether CVE-2026-42440 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
  6. What actually determines whether CVE-2026-42440 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
  7. How do I fix CVE-2026-42440?
    • Upgrade org.apache.opennlp:opennlp-tools to 2.5.9 or later
    • Upgrade org.apache.opennlp:opennlp-tools to 3.0.0-M3 or later

Other vulnerabilities in org.apache.opennlp:opennlp-tools

CVE-2026-42027CVE-2026-40682CVE-2017-12620

Stop the waste.
Protect your environment with Kodem.