Unsafe Reflection Affecting org.apache.opennlp:opennlp-api package, versions [3.0.0-M1,3.0.0-M3)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.67% (49th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JAVA-ORGAPACHEOPENNLP-16419374
  • published5 May 2026
  • disclosed4 May 2026
  • creditSubramanian S

Introduced: 4 May 2026

CVE-2026-42027  (opens in a new tab)
CWE-470  (opens in a new tab)

How to fix?

Upgrade org.apache.opennlp:opennlp-api to version 3.0.0-M3 or higher.

Overview

Affected versions of this package are vulnerable to Unsafe Reflection that leads to arbitrary class instantiation, via the instantiateExtension() method in the ExtensionLoader class. An attacker can trigger the static initializer of any class present on the classpath by supplying a model archive with a malicious manifest, leading to the execution of unintended code with potential side effects such as JNDI lookups, outbound network requests, or filesystem access. The isAssignableFrom() check that is intended to block the loading of classes from outside the extension's namespace succeeds, but runs after the class has already been loaded and initialized.

This is only exploitable if a class with attacker-controlled side effects in its static initializer or no-argument constructor is present on the classpath, and the attacker is able to supply a model archive from an untrusted source, such as a shared Hugging Face model.

Note: The fix for this vulnerability involves an allowlist approach, a consequence of which is that classes under the opennlp.* prefix are permitted by default. Other classes must be explicitly allowed via registerAllowedPackage() or configured with OPENNLP_EXT_ALLOWED_PACKAGES

CVSS Base Scores

version 4.0
version 3.1