CVE-2026-42027: Apache OpenNLP: Arbitrary Class Instantiation via Model Manifest in ExtensionLoader
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.
Security readout for executives and security teams
Plain-English summary
Apache OpenNLP can be tricked into loading a class named inside an untrusted model file. That class may run startup code before OpenNLP rejects it. This is serious for systems that load third-party or community models, but the sources do not show active exploitation.
Executive priority
Prioritize remediation for services that process untrusted or externally sourced NLP models. The CVSS is critical, but business urgency depends on model provenance controls and classpath risk. Treat internet-facing or automated model ingestion workflows as highest priority.
Technical view
ExtensionLoader.instantiateExtension uses Class.forName() on manifest-controlled factory or serializer class names before enforcing the expected subtype. Default class initialization can execute static initializers for any class on the application classpath. Exploitability depends on useful side effects in available classes or legitimate extension constructors.
Likely exposure
Exposure is most likely where Apache OpenNLP loads model archives from external, community, user-supplied, or weakly governed sources. Products embedding org.apache.opennlp:opennlp-tools may also be exposed if they accept or fetch models dynamically.
Exploitation context
The source describes a crafted model archive as the trigger. It is not described as drop-in remote code execution; impact depends on risky classes already present on the classpath. KEV is false and no cited source reports active exploitation.
Researcher notes
Key issue is initialization order: Class.forName() executes before assignability validation. The fix is a package-prefix allowlist checked before loading. Useful validation should focus on model provenance, extension configuration, classpath contents, and whether any side-effecting initializer or no-arg constructor is reachable.
Mitigation direction
Upgrade OpenNLP 2.x deployments to 2.5.9.
Upgrade OpenNLP 3.x deployments to 3.0.0-M3.
For affected 1.x deployments, follow Apache guidance for the fixed line.
Only load model files from trusted, governed sources.
Configure allowed extension package prefixes for required non-opennlp extensions.
Audit classpaths for side-effecting static initializers and constructors.
Validation and detection
Inventory uses of org.apache.opennlp:opennlp-tools and embedded OpenNLP copies.
Confirm deployed versions are not before 1.9.5, 2.5.9, or 3.0.0-M3.
Review model acquisition paths for third-party or user-supplied archives.
Inspect manifest.properties in accepted model archives for factory and serializer class references.
Verify OPENNLP_EXT_ALLOWED_PACKAGES or programmatic allowlists cover only required packages.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-470: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Code execution and unsafe deserialization weaknesses often justify reviewing execution behavior and process telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references code or command execution, so execution technique review may help defensive triage. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
2CVSS vectors
5Timeline events
3ADP providers
5Source links
SSVC decision data
CISA-ADPCISA Coordinator
Timestamp
Version
2.0.3
Exploitation: noneAutomatable: yesTechnical Impact: total
CVSS vector scores
2 official scores
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-470 · source CWE mapping
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Deserialization of Untrusted Data represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.