Critical

Apache OpenNLP ExtensionLoader Vulnerable to Arbitrary Class Instantiation via Model Manifest

  • Disclosed: 04.05.2026
  • Updated: 11.10.2026 13:19

Versions Affected: before 1.9.5, before 2.5.9, before 3.0.0-M3

Description: 

The ExtensionLoader.instantiateExtension(Class, String) method loads a class by its fully-qualified name via Class.forName() and invokes its no-arg constructor, with the class name sourced from the manifest.properties entry of a model archive. The existing isAssignableFrom check correctly rejects classes that are not subtypes of the expected extension interface (BaseToolFactory for factory=, ArtifactSerializer for serializer-class-*), but the check runs after Class.forName() has already loaded and initialized the named class.

Class.forName() with default initialization semantics executes the target class's static initializer before returning, so an attacker who can supply a crafted model archive can cause the static initializer of any class on the classpath to run during model loading, regardless of whether that class passes the subsequent type check.

Exploitation requires a class with attacker-useful side effects in its static initializer (for example, JNDI lookup, outbound network I/O, or filesystem access) to be present on the classpath, so this is not a drop-in remote code execution; however, the attack surface grows as third-party model distribution becomes more common (community model repositories, Hugging Face-style sharing), where users routinely load model files from origins they do not control. A secondary, narrower vector affects deployments that ship legitimate BaseToolFactory or ArtifactSerializer subclasses with side-effecting no-arg constructors: a malicious manifest can name such a class and force its constructor to run during model load.

Mitigation: 

  • 1.x users should upgrade to 1.9.5.
  • 2.x users should upgrade to 2.5.9.
  • 3.x users should upgrade to 3.0.0-M3.

Note: The fix introduces a package-prefix allowlist that is consulted before Class.forName() is invoked, so the static initializer of a disallowed class is never executed. Classes under the opennlp. prefix remain permitted by default. Deployments that load models referencing factories or serializers outside opennlp.* must opt those packages in, either programmatically via ExtensionLoader.registerAllowedPackage(String) before the first model load, or by setting the OPENNLP_EXT_ALLOWED_PACKAGES system property to a comma-separated list of allowed package prefixes.

Users who cannot upgrade immediately should ensure that all model files are sourced from trusted origins and should audit their classpath for classes with side-effecting static initializers or constructors, particularly any that perform JNDI lookups, network requests, or filesystem operations during class initialization.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Java / Kotlin (Maven) org.apache.opennlp:opennlp-tools >= 2.0.0, < 2.5.9, >= 3.0.0-M1, < 3.0.0-M3, < 1.9.5 2.5.9, 3.0.0-M3, 1.9.5

References

CVSS score 9.8/10
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Weakness (CWE)
CWE-470, CWE-502
Platform
Java / Kotlin (Maven)
Package
org.apache.opennlp:opennlp-tools
Disclosed
04.05.2026
Updated
11.10.2026 13:19

Sources and licenses

OSV / GitHub Advisory Database - GHSA-cx4m-2p55-rw7j - CC BY 4.0

Vulnerability history: org.apache.opennlp:opennlp-tools

All published vulnerabilities of this package (Java / Kotlin (Maven)), newest first. Shows whether this is a one-off slip or a package that needs watching.

Total entries
4
First → latest
05.2022 05.2026
Without a fix
0
Exploited in attacks
0

Severity breakdown

  • Critical 3
  • High 1

Disclosures per year

  1. 2022: 1
  2. 2023: 0
  3. 2024: 0
  4. 2025: 0
  5. 2026: 3
  1. High · 7.5 CVE-2026-42440 < 2.5.9, >= 3.0.0-M1, < 3.0.0-M3 2.5.9, 3.0.0-M3
  2. Apache OpenNLP ExtensionLoader Vulnerable to Arbitrary Class Instantiation via Model Manifest this entry
    Critical · 9.8 CVE-2026-42027 >= 2.0.0, < 2.5.9, >= 3.0.0-M1, < 3.0.0-M3, < 1.9.5 2.5.9, 3.0.0-M3, 1.9.5
  3. Critical · 9.1 CVE-2026-40682 >= 2.0.0, < 2.5.9, >= 3.0.0-M1, < 3.0.0-M3, < 1.9.5 2.5.9, 3.0.0-M3, 1.9.5
  4. Critical · 9.8 CVE-2017-12620 >= 1.5.0, < 1.8.2 1.8.2

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.