{"id":"CVE-2026-42440","kind":"vulnerability","aliases":["CVE-2026-42440","GHSA-659w-93r5-9j6m"],"related":[],"title":"Apache OpenNLP AbstractModelReader has an OOM Denial of Service via Unbounded Array Allocation","description":"OOM Denial of Service via Unbounded Array Allocation in Apache OpenNLP AbstractModelReader \n\nVersions Affected: \n\nbefore 1.9.5\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.","summary":"Apache OpenNLP reads array sizes from a binary model file without bounds checks, so a crafted .bin model can trigger an OutOfMemoryError on load. An attacker who supplies a model file to a service that loads it can crash the JVM (denial of service).","severity":"high","cvss":7.5,"epss":0.00603,"exploited":false,"exploited_at":null,"products":[{"name":"org.apache.opennlp:opennlp-tools","fixed":["3.0.0-M3"],"affected":">= 3.0.0-M1, < 3.0.0-M3","ecosystem":"maven"},{"name":"org.apache.opennlp:opennlp-tools","fixed":["2.5.9"],"affected":">= 2.0.0, < 2.5.9","ecosystem":"maven"},{"name":"org.apache.opennlp:opennlp-tools","fixed":["1.9.5"],"affected":"< 1.9.5","ecosystem":"maven"},{"name":"apache opennlp","fixed":["2.5.9"],"affected":"< 2.5.9","ecosystem":"vendor"},{"name":"apache opennlp","fixed":[],"affected":"= 3.0.0","ecosystem":"vendor"}],"ecosystems":["maven","vendor"],"tags":["apache-opennlp","cwe-770","cwe-789","java","maven","package"],"not_affected_if":["models-from-trusted-source","no-model-loading-from-untrusted-input"],"how_to_check":"- Check the `opennlp-tools` version in your Maven or Gradle build, for example with `mvn dependency:tree | grep opennlp`\n- Look for code that loads `.bin` model files (GenericModelReader or components that call it) and check whether those files come from untrusted sources","fix":"- `opennlp-tools` 3.x: move to `3.0.0-M3`\n- `opennlp-tools` 2.x: move to `2.5.9`\n- `opennlp-tools` 1.x: move to `1.9.5`","status":"open","published_at":"2026-05-04T17:16:26+00:00","first_seen_at":"2026-11-04T02:29:58+00:00","triaged_at":"2026-11-04T02:30:28+00:00","updated_at":"2026-11-04T02:46:02+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-04T02:30:28Z","model":"claude-haiku-5-5","output":{"fix":"- `opennlp-tools` 3.x: move to `3.0.0-M3`\n- `opennlp-tools` 2.x: move to `2.5.9`\n- `opennlp-tools` 1.x: move to `1.9.5`","reach":"unknown","title":"Apache OpenNLP: crafted model file crashes Java process with memory exhaustion","impact":"low","summary":"Apache OpenNLP reads array sizes from a binary model file without bounds checks, so a crafted .bin model can trigger an OutOfMemoryError on load. An attacker who supplies a model file to a service that loads it can crash the JVM (denial of service).","audience":"developers","category":"package","nicknames":[],"who_cares":["java","apache-opennlp","maven"],"confidence":0.8,"fix_status":"available","needs_auth":"no","worst_case":"Crafted model file crashes the JVM process loading it","analyst_note":"","how_to_check":"- Check the `opennlp-tools` version in your Maven or Gradle build, for example with `mvn dependency:tree | grep opennlp`\n- Look for code that loads `.bin` model files (GenericModelReader or components that call it) and check whether those files come from untrusted sources","plain_action":"","needs_analyst":false,"not_affected_if":["models-from-trusted-source","no-model-loading-from-untrusted-input"],"who_is_affected":"Any application that loads OpenNLP binary model (.bin) files, directly or through a higher-level component, is exposed if those files come from untrusted or semi-trusted sources such as end users or third-party repositories. Applications that only load models they build or verify themselves are much less exposed. Until upgrading, the advisory suggests treating all model files as untrusted unless their provenance is verified.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"high"},"cost_usd":0.000834,"input_tokens":5139,"output_tokens":641,"severity_before":"high"},"analyst_status":null,"analyst_note":null,"search":"'-2026':15A,23A '-42440':16A,24A '-770':45B '-789':47B '000':401C,402C '1.9.5':110C '10':400C '2':339C '2.5.9':112C,345C '3':346C '3.0.0':114C,352C '32':127C '50000000':461C '659w':19A '93r5':20A '9j6m':21A 'abstractmodelread':3A,106C,118C 'affect':108C,299C 'alloc':13A,102C,146C,221C,371C,395C 'apach':1A,42B,51B,104C 'apache':37A,39A 'apache-opennlp':41B 'array':12A,54B,101C,145C,220C,370C 'attack':76B,177C,268C 'attacker-control':176C 'avail':213C 'avoid':494C 'back':469C 'bin':67B,190C,296C,481C 'binari':58B,135C 'bit':128C 'bound':62B,170C,360C,379C,398C 'cannot':475C 'caus':380C 'check':63B,368C,510C 'code':291C 'compon':310C 'constant':258C 'consum':231C 'control':178C 'correct':257C,261C 'correspond':225C 'cost':273C 'count':131C,172C,198C,366C,372C,409C 'craft':66B,189C 'crash':89B,284C 'cve':14A,22A 'cwe':44B,46B 'data':229C 'default':397C,436C,472C 'deleg':312C 'denial':7A,92B,96C,322C 'deploy':424C 'descript':116C 'deseri':241C,294C 'desir':454C 'direct':142C,301C 'dopennlp':458C 'e.g':457C 'earli':239C 'end':499C 'enough':209C 'entri':408C,433C,449C,460C 'error':236C 'exceed':377C 'exhaust':211C,423C 'fail':390C 'fall':468C 'far':415C 'fast':391C 'fetch':502C 'field':132C,199C,367C 'file':60B,81B,182C,192C,282C,330C,483C 'fix':356C 'fulli':175C 'genericmodelread':304C 'getoutcom':120C,246C 'getoutcomepattern':121C 'getpred':123C 'ghsa':18A 'ghsa-659w-93r5-9j6m':17A 'gis':244C 'heap':214C,422C 'higher':308C 'higher-level':307C 'illegalargumentexcept':382C 'immedi':477C 'impact':320C 'includ':300C 'input':486C 'int':151C 'integ':130C,456C 'integer.max':203C 'integr':509C 'introduc':357C 'invalid':462C 'java':48B 'jvm':91B,286C,442C 'label':226C 'larg':208C,394C 'legitim':411C,426C 'level':309C 'limit':440C 'load':74B,86B,288C,317C,328C,429C,495C 'm3':115C,353C 'maven':49B 'max':448C,459C 'meaning':271C 'method':119C 'mitig':338C 'model':59B,68B,80B,136C,181C,191C,245C,253C,297C,316C,329C,413C,430C,482C,496C 'model-typ':252C 'need':427C 'negat':165C,375C 'new':147C,150C,153C 'non':164C,465C 'non-neg':163C 'non-posit':464C 'note':354C 'num':155C 'numoctyp':152C 'numoutcom':149C 'occur':237C 'oom':6A,95C 'opennlp':2A,27A,31A,35A,38A,40A,43B,52B,105C,412C,447C 'opennlp-tools':26A,30A,34A 'org.apache.opennlp':25A,29A,33A 'origin':183C,337C 'outofmemoryerror':72B,217C 'packag':50B 'paramet':262C 'parti':506C 'pass':139C 'path':292C 'pattern':228C 'pay':269C 'payload':277C 'posit':455C,466C 'practic':319C 'pred':156C 'process':326C 'properti':451C 'proven':489C 'rais':438C 'reach':248C 'read':53B,125C,265C,388C 'reason':169C 'repositori':507C 'semi':335C 'semi-trust':334C 'servic':9A,84B,94B,98C,324C 'set':201C,445C 'sign':129C 'singl':280C 'size':55B,272C 'small':281C 'sourc':187C 'startup':443C 'stream':137C,234C 'string':148C,154C,255C 'suppli':78B,497C 'system':450C 'therefor':174C 'third':505C 'third-parti':504C 'threaten':421C 'three':365C 'thrown':385C 'tools':28A,32A,36A 'treat':479C 'trigger':70B,215C 'trust':336C 'type':254C 'unbound':11A,100C 'unless':487C 'untrust':186C,332C,485C 'upgrad':343C,350C,476C 'upper':359C 'use':302C 'user':341C,348C,473C,500C 'valid':158C 'valu':141C,161C,204C,207C,418C,467C 'verifi':491C 'version':107C 'via':10A,99C 'weapon':275C 'well':405C 'within':167C 'without':61B,157C,508C 'would':420C 'x':340C,347C","nicknames":[],"mitigations":[],"who_affected":"Any application that loads OpenNLP binary model (.bin) files, directly or through a higher-level component, is exposed if those files come from untrusted or semi-trusted sources such as end users or third-party repositories. Applications that only load models they build or verify themselves are much less exposed. Until upgrading, the advisory suggests treating all model files as untrusted unless their provenance is verified.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["apacheopennlp","opennlp","orgapacheopennlpopennlptools"],"ptokens":["apache","opennlp","org","tools"],"labels":["apacheopennlp","cwe770","cwe789","high","java","maven","package","vendor"],"campaign_type":null,"first_public_at":"2026-05-04T17:16:26+00:00","kev":null,"cvss_vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H","cvss_by":"GitHub","poc_count":0,"sources":[{"source":"ghsa","external_id":"GHSA-659w-93r5-9j6m","url":"https://github.com/advisories/GHSA-659w-93r5-9j6m","severity":"high","published_at":"2026-05-04T18:30:31+00:00","modified_at":"2026-11-04T02:29:31+00:00","first_seen_at":"2026-11-04T02:29:58+00:00","fetched_at":"2026-11-04T03:00:32+00:00","note":null},{"source":"nvd","external_id":"CVE-2026-42440","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42440","severity":null,"published_at":"2026-05-04T17:16:26+00:00","modified_at":"2026-10-26T19:10:00+00:00","first_seen_at":"2026-11-04T02:46:02+00:00","fetched_at":"2026-11-04T02:46:02+00:00","note":null}],"documents":[{"id":63156,"url":"https://github.com/apache/opennlp/pull/1198","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":63157,"url":"https://github.com/apache/opennlp/commit/96a073f693f3a0ded808a475f7d7773c072bb8a1","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":63158,"url":"https://github.com/apache/opennlp/commit/fc9824a97709470353add08e44cf15dc08677094","title":"Patch: github.com","kind":"other","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":63159,"url":"https://github.com/apache/opennlp/releases/tag/opennlp-1.9.5","title":"Release: github.com","kind":"release","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"},{"id":63160,"url":"https://github.com/apache/opennlp/releases/tag/opennlp-2.5.9","title":"Release: github.com","kind":"release","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"},{"id":63161,"url":"https://github.com/apache/opennlp/releases/tag/opennlp-3.0.0-M3","title":"Release: github.com","kind":"release","source":"ghsa","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release: github.com"},{"id":63229,"url":"https://lists.apache.org/thread/s8xlkx1gqbxfsq48py5h6jphjvgqp1jo","title":"Vendor advisory: lists.apache.org","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Vendor advisory: lists.apache.org"},{"id":63230,"url":"http://www.openwall.com/lists/oss-security/2026/05/01/21","title":"Third-party advisory: www.openwall.com","kind":"advisory","source":"nvd","publisher":"research","text":null,"published_at":null,"relation":"advisory","confidence":null,"note":"Third-party advisory: www.openwall.com"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}