CVE-2026-42440: Apache OpenNLP denial of service in AbstractModelReader

CVE-2026-42440 · Severity: high · CVSS 7.5 · Published 2026-05-04

Apache OpenNLP, a machine learning library used for natural language processing, is vulnerable to a denial-of-service attack. By providing a specially crafted model file, an attacker can force the application to exhaust its available memory, causing the system to crash. This impact is most significant for applications that allow users to upload their own models or that fetch models from unverified third-party sources.

Technologies: org.apache.opennlp:opennlp-tools (Maven). Vendors: Maven.

Quick answers

Is CVE-2026-42440 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-42440 being exploited in the wild.
How severe is CVE-2026-42440?
High severity, with a CVSS score of 7.5, published 4 May 2026.
Which products and versions are affected?
org.apache.opennlp:opennlp-tools (Maven) >= 3.0.0-M1, < 3.0.0-M3, ECOSYSTEM:introduced=0,fixed=2.5.9.
Is there a fix for CVE-2026-42440?
Yes. org.apache.opennlp:opennlp-tools (Maven): upgrade to 2.5.9 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-42440 attacked?
It is attacked over the network or with local access, in a software library.
Am I affected by CVE-2026-42440?
Check whether you run org.apache.opennlp:opennlp-tools (Maven) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • org.apache.opennlp:opennlp-tools (Maven): upgrade to 2.5.9 or later
    # set org.apache.opennlp:opennlp-tools to 2.5.9 in your pom.xml or build.gradle

Technical details

The vulnerability exists in the AbstractModelReader methods getOutcomes(), getOutcomePatterns(), and getPredicates(). These methods read a 32-bit signed integer from a binary model stream and use it directly for array allocation without validation. An attacker can set this value to Integer.MAX_VALUE in a crafted .bin file, triggering an OutOfMemoryError early in the deserialization process. The exploit requires the application to load a model from an untrusted source. Patches in versions 2.5.9 and 3.0.0-M3 introduce a default upper bound of 10,000,000 entries, configurable via the OPENNLP_MAX_ENTRIES system property.

Affected products

  • Apache OpenNLP before 1.9.5, before 2.5.9, before 3.0.0-M3

Identifiers

  • CVE-2026-42440
  • GHSA-659w-93r5-9j6m

Timeline

  • 2026-05-01: advisory: Developer advisory published to oss-security mailing list
  • 2026-05-04: disclosed: CVE published to NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.