CVE-2026-42027 Details
Description
Arbitrary Class Instantiation via Model Manifest in Apache OpenNLP ExtensionLoader 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: * 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.
A vulnerability exists in the Apache OpenNLP ExtensionLoader component, specifically in versions prior to 2.5.9 and 3.0.0-M3. The issue arises in the 'instantiateExtension' method, which loads classes by their fully-qualified names from the 'manifest.properties' entry of model archives. Although the method includes a type check to ensure classes are subtypes of expected interfaces, this check occurs after the class has been loaded and initialized. As a result, an attacker can supply a manipulated model archive to execute the static initializer of any class on the classpath, potentially leading to exploitation if the class performs useful actions during initialization, such as JNDI lookups or network requests. This vulnerability is not a straightforward remote code execution but poses a risk as third-party model distribution becomes more prevalent. Additionally, deployments that include legitimate subclasses of 'BaseToolFactory' or 'ArtifactSerializer' with side-effecting constructors are also vulnerable, as a malicious manifest can be used to trigger the execution of such classes' constructors during model loading.
Users of Apache OpenNLP 2.x should upgrade to version 2.5.9, and users of Apache OpenNLP 3.x should upgrade to version 3.0.0-M3. After upgrading, deployments that load models referencing factories or serializers outside the 'opennlp.*' package must opt those packages in, either programmatically or by setting the 'OPENNLP_EXT_ALLOWED_PACKAGES' system property. For users unable to upgrade immediately, it is recommended to source model files from trusted origins and audit the classpath for classes with side-effecting static initializers or constructors.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed May 5, 2026References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://access.redhat.com/errata/RHSA-2026:65126 | redhat-SADP | |
| https://access.redhat.com/security/cve/CVE-2026-42027 | redhat-SADP | |
| https://bugzilla.redhat.com/show_bug.cgi?id=2466527 | redhat-SADP | |
| https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-42027.json | redhat-SADP | |
| http://www.openwall.com/lists/oss-security/2026/05/01/20 | CVE | Mailing ListThird Party Advisory |
| https://lists.apache.org/thread/ltlo4powjfc0w2w2yyl1o5tc7q1gcb2y | [email protected] | Mailing ListVendor Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-470 | Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') | [email protected] |
| CWE-502 | Deserialization of Untrusted Data | redhat-SADP |
Affected Products
| Product | Versions |
|---|---|
| apache opennlp | < 2.5.9 3.0.0 m1 3.0.0 m2 |
CPE
Remediation
| |
Change History
13 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Sep 9, 2026 | CVE Modified | redhat-SADP |
| Sep 9, 2026 | CVE Modified | CVE |
| Sep 9, 2026 | CVE Modified | [email protected] |
| Jul 15, 2026 | CVE Modified | redhat-SADP |
| Jun 30, 2026 | CVE Modified | [email protected] |
| Jun 30, 2026 | CVE Modified | redhat-SADP |
| Jun 29, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Jun 17, 2026 | CVE Modified | [email protected] |
| May 6, 2026 | Initial Analysis | [email protected] |
| May 5, 2026 | CVE Modified | CISA-ADP |
| May 4, 2026 | CVE Modified | CVE |
| May 4, 2026 | New CVE Received | [email protected] |