Cyber Posture

CVE-2026-42027

Critical

Published: 04 May 2026

Published
04 May 2026
Modified
06 May 2026
KEV Added
Patch
CVSS Score 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
EPSS Score 0.0036 58.2th percentile
Risk Priority 20 60% EPSS · 20% KEV · 20% CVSS

Description

Arbitrary Class Instantiation via Model Manifest in Apache OpenNLP ExtensionLoader Versions Affected: 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…

more

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: * 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.

Mitigating Controls (NIST 800-53 r5)AI

prevent

Flaw remediation directly mitigates the vulnerability by upgrading Apache OpenNLP to patched versions 2.5.9 or 3.0.0-M3, which introduce a package-prefix allowlist before Class.forName execution.

prevent

Information input validation enforces checks on class names from manifest.properties files in model archives to prevent loading arbitrary classes with side-effecting static initializers.

prevent

Least functionality minimizes the attack surface by restricting the classpath to essential components, removing libraries with exploitable side-effecting static initializers.

Security SummaryAI

CVE-2026-42027 is an arbitrary class instantiation vulnerability in the ExtensionLoader component of Apache OpenNLP, stemming from the ExtensionLoader.instantiateExtension(Class, String) method. This method loads a class by its fully-qualified name using Class.forName() and invokes its no-arg constructor, with the class name sourced from the manifest.properties entry in a model archive. The subsequent isAssignableFrom check for subtypes of BaseToolFactory or ArtifactSerializer occurs after Class.forName() has already executed the target's static initializer. Versions affected include those before 2.5.9 in the 2.x series and before 3.0.0-M3 in the 3.x series.

An attacker can exploit this by supplying a crafted model archive containing a malicious class name in the manifest.properties file. During model loading, Class.forName() triggers the static initializer of any class on the classpath, enabling side effects such as JNDI lookups, outbound network I/O, or filesystem access if an exploitable class is present. This requires unauthenticated network access (AV:N/AC:L/PR:N) but is not a drop-in remote code execution, as it depends on the victim's classpath containing suitable classes; exploitation risk increases with third-party model distribution from untrusted sources like community repositories. A narrower vector allows forcing the no-arg constructor of legitimate BaseToolFactory or ArtifactSerializer subclasses with side-effecting behavior.

Apache advisories recommend upgrading to version 2.5.9 for 2.x users or 3.0.0-M3 for 3.x users, where the fix introduces a package-prefix allowlist checked before Class.forName() to prevent execution of disallowed classes' static initializers; opennlp.* packages are permitted by default, with opt-in for others via ExtensionLoader.registerAllowedPackage(String) or the OPENNLP_EXT_ALLOWED_PACKAGES system property. Users unable to upgrade should source model files only from trusted origins and audit the classpath for classes with side-effecting static initializers or constructors, especially those involving JNDI, network requests, or filesystem operations. The vulnerability carries a CVSS v3.1 score of 9.8 and is linked to CWE-470 (Unsafe Reflection). Additional details are available in the Apache announcement at https://lists.apache.org/thread/ltlo4powjfc0w2w2yyl1o5tc7q1gcb2y and oss-security mailing list at http://www.openwall.com/lists/oss-security/2026/05/01/20.

Details

CWE(s)

Affected Products

apache
opennlp
3.0.0 · ≤ 2.5.9

MITRE ATT&CK Enterprise TechniquesAI

T1190 Exploit Public-Facing Application Initial Access
Adversaries may attempt to exploit a weakness in an Internet-facing host or system to initially access a network.
T1620 Reflective Code Loading Stealth
Adversaries may reflectively load code into a process in order to conceal the execution of malicious payloads.
Why these techniques?

CVE enables remote exploitation of a public-facing app via crafted model input (T1190) and directly abuses Class.forName reflection to load/execute arbitrary attacker-supplied classes from the classpath (T1620).

Confidence: HIGH · MITRE ATT&CK Enterprise v18.1

References