OpennlpApplication · Apache

CVE-2026-42440

HIGH · 7.5 CVSS v3.1 Published 2026-05-04
Fix available
A fix is available. Upgrade to 2.5.9 or later.
See remediation →
84/100
Remediation priority · High
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
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.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

Apache OpenNLP AbstractModelReader contains an OOM vulnerability where getOutcomes(), getOutcomePatterns(), and getPredicates() methods read a 32-bit count from binary model files and pass it directly to array allocation without bounds validation. An attacker can craft a .bin model file with Integer.MAX_VALUE as the count, causing heap exhaustion and JVM crash.

MitigationUpgrade to OpenNLP 2.5.9, 3.0.0-M3, or later which implements the OPENNLP_MAX_ENTRIES bounds check (default 10M). If immediate upgrade is impossible, treat all .bin model files from untrusted sources as malicious and verify integrity before loading.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
OpennlpApplication
Affected:< 2.5.9= 3.0.0

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Identify Apache OpenNLP version
    Locate the opennlp JAR file or check your project's dependency management (Maven pom.xml, Gradle build file, or JAR manifest) for the Apache OpenNLP version
    Affected if Version is less than 2.5.9 or equals 3.0.0 (versions 1.x below 1.9.5 are also affected)
  2. Determine if .bin model files are loaded
    Search your codebase for calls to AbstractModelReader subclasses or model loading methods (e.g., opennlp.model.GenericModelReader, POSModel.loadFromFile, TokenizerModel.load) that load .bin files
    Affected if Your application loads binary .bin model files at runtime
  3. Check source of loaded models
    Inspect the file paths or URLs passed to model loading functions to see if they can accept input from untrusted sources (user uploads, network requests, external APIs)
    Affected if Models are loaded from untrusted or external sources without validation
  4. Verify -DOPENNLP_MAX_ENTRIES mitigation
    Check JVM startup arguments or system properties for -DOPENNLP_MAX_ENTRIES being set
    Affected if The mitigation is NOT present and you meet conditions in steps 1-3

You are affected if you run Apache OpenNLP version < 2.5.9 or = 3.0.0 AND load .bin model files from any source without the -DOPENNLP_MAX_ENTRIES system property set.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 2.5.9 or later
Fixed in 2.5.9
Interim mitigation

Upgrade to OpenNLP 2.5.9, 3.0.0-M3, or later which implements the OPENNLP_MAX_ENTRIES bounds check (default 10M). If immediate upgrade is impossible, treat all .bin model files from untrusted sources as malicious and verify integrity before loading.

Recommended fix High confidence

2.5.9 for 2.x branches; 3.0.0-M3 for 3.x branch

  1. Identify the current Apache OpenNLP version in use (check pom.xml, build.gradle, or Maven dependencies).
  2. For OpenNLP 2.x versions: upgrade the dependency to version 2.5.9 or later (e.g., change org.apache.opennlp:opennlp version to 2.5.9 in your build configuration).
  3. For OpenNLP 3.x versions: upgrade to version 3.0.0-M3 or later.
  4. After upgrading, rebuild and redeploy the application to ensure the new library version is loaded.
  5. If immediate upgrade is not possible and untrusted .bin model files must be handled, add a JVM startup parameter to limit array allocations: -DOPENNLP_MAX_ENTRIES=10000000 (or a suitable positive integer).
  6. Verify the fix by attempting to load a model file with an oversized count field and confirming the application throws IllegalArgumentException rather than crashing with OutOfMemoryError.

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in Opennlp Scoped from the published advisory
  • Consultation2.0 h
  • Implementation3.0 h
  • Testing3.0 h
  • Review / QA2.0 h
10.0 hours of engineering $1,750
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,800.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2026-42440 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2026-42440 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data