Executive brief
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.
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
Timeline
- 2026-05-01: advisory: Developer advisory published to oss-security mailing list
- 2026-05-04: disclosed: CVE published to NVD