CVE-2026-63317: CWE-470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') in Apache Software Foundation Apache OpenNLP
Arbitrary Class Instantiation via XML Feature Generator Descriptor and Format Name in Apache OpenNLP Versions Affected: - before 2.5.10 - before 3.0.0-M5 Description: Three code paths in Apache OpenNLP load a class by its fully-qualified name via Class.forName() and invoke its no-arg constructor without any prior validation of the class name or its type. The affected paths are: (1) GeneratorFactory, which reads the class attribute of generator elements in an XML feature generator descriptor; such descriptors are embedded as artifacts in model archives (e.g. TokenNameFinder and POSTagger models) and are parsed during model loading, so an attacker who can supply a crafted model archive controls the class name directly. (2) StreamFactoryRegistry.getFactory(Class, String), which falls back to interpreting an unregistered format name as the fully-qualified class name of an ObjectStreamFactory; this is exploitable in applications that pass untrusted format names (e.g. exposing the -format parameter of the command-line tooling to external input). (3) StringInterners, which instantiates the interner implementation named by the opennlp.interner.class system property; this value is normally deployer-controlled, so it is hardened as defense in depth rather than being independently attacker-reachable. Exploitation requires a class with attacker-useful side effects in its static initializer or no-arg constructor (JNDI lookup, outbound network I/O, filesystem access) to be present on the classpath, so this is not drop-in remote code execution. T Mitigation: Upgrade to a fixed release. The fix routes all three paths through ExtensionLoader.instantiateExtension(...), which consults a package-prefix allowlist before Class.forName() is invoked, so a disallowed class is never loaded, initialized, or constructed. Classes under the opennlp. prefix remain permitted by default. Deployments that load models referencing feature generator factories, object stream factories, or string interners 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 all model files and format names are sourced from trusted origins and should audit their classpath for classes with side-effecting static initializers or constructors.
AI Analysis
Technical Summary
Apache OpenNLP versions before 2.5.10 and 3.0.0-M5 contain an unsafe reflection vulnerability (CWE-470) where three code paths instantiate classes by fully-qualified names without validation: (1) GeneratorFactory loading classes from XML feature generator descriptors embedded in model archives, (2) StreamFactoryRegistry interpreting unregistered format names as class names, and (3) StringInterners instantiating classes named by a system property. Exploitation requires attacker-controlled classes with side-effecting static initializers or constructors on the classpath, so this is not direct remote code execution. The vulnerability is mitigated in fixed releases by routing class loading through an ExtensionLoader that enforces a package-prefix allowlist, permitting only classes under the opennlp.* namespace by default. Deployments using external packages must explicitly allow those packages.
Potential Impact
An attacker who can supply crafted model archives or untrusted format names can cause the application to instantiate arbitrary classes on the classpath without validation. This could lead to execution of code with side effects such as network calls or filesystem access if such classes exist. However, exploitation requires the presence of attacker-useful classes on the classpath and is not direct remote code execution. The vulnerability could be leveraged in environments where untrusted inputs control model archives or format names.
Mitigation Recommendations
Upgrade to Apache OpenNLP version 2.5.10 or later, or 3.0.0-M5 or later, where the vulnerability is fixed by enforcing a package-prefix allowlist for class loading. If immediate upgrade is not possible, ensure that all model files and format names are sourced from trusted origins and audit the classpath for classes with side-effecting static initializers or constructors. For deployments using classes outside the opennlp.* namespace, explicitly register allowed packages via ExtensionLoader.registerAllowedPackage(String) or the OPENNLP_EXT_ALLOWED_PACKAGES system property.
CVE-2026-63317: CWE-470 Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection') in Apache Software Foundation Apache OpenNLP
Description
Arbitrary Class Instantiation via XML Feature Generator Descriptor and Format Name in Apache OpenNLP Versions Affected: - before 2.5.10 - before 3.0.0-M5 Description: Three code paths in Apache OpenNLP load a class by its fully-qualified name via Class.forName() and invoke its no-arg constructor without any prior validation of the class name or its type. The affected paths are: (1) GeneratorFactory, which reads the class attribute of generator elements in an XML feature generator descriptor; such descriptors are embedded as artifacts in model archives (e.g. TokenNameFinder and POSTagger models) and are parsed during model loading, so an attacker who can supply a crafted model archive controls the class name directly. (2) StreamFactoryRegistry.getFactory(Class, String), which falls back to interpreting an unregistered format name as the fully-qualified class name of an ObjectStreamFactory; this is exploitable in applications that pass untrusted format names (e.g. exposing the -format parameter of the command-line tooling to external input). (3) StringInterners, which instantiates the interner implementation named by the opennlp.interner.class system property; this value is normally deployer-controlled, so it is hardened as defense in depth rather than being independently attacker-reachable. Exploitation requires a class with attacker-useful side effects in its static initializer or no-arg constructor (JNDI lookup, outbound network I/O, filesystem access) to be present on the classpath, so this is not drop-in remote code execution. T Mitigation: Upgrade to a fixed release. The fix routes all three paths through ExtensionLoader.instantiateExtension(...), which consults a package-prefix allowlist before Class.forName() is invoked, so a disallowed class is never loaded, initialized, or constructed. Classes under the opennlp. prefix remain permitted by default. Deployments that load models referencing feature generator factories, object stream factories, or string interners 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 all model files and format names are sourced from trusted origins and should audit their classpath for classes with side-effecting static initializers or constructors.
CVSS v3.1
Score 5.6medium
Affected software
pkg:maven/Apache Software Foundation/org.apache.opennlp:opennlp-toolsRun on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
Apache OpenNLP versions before 2.5.10 and 3.0.0-M5 contain an unsafe reflection vulnerability (CWE-470) where three code paths instantiate classes by fully-qualified names without validation: (1) GeneratorFactory loading classes from XML feature generator descriptors embedded in model archives, (2) StreamFactoryRegistry interpreting unregistered format names as class names, and (3) StringInterners instantiating classes named by a system property. Exploitation requires attacker-controlled classes with side-effecting static initializers or constructors on the classpath, so this is not direct remote code execution. The vulnerability is mitigated in fixed releases by routing class loading through an ExtensionLoader that enforces a package-prefix allowlist, permitting only classes under the opennlp.* namespace by default. Deployments using external packages must explicitly allow those packages.
Potential Impact
An attacker who can supply crafted model archives or untrusted format names can cause the application to instantiate arbitrary classes on the classpath without validation. This could lead to execution of code with side effects such as network calls or filesystem access if such classes exist. However, exploitation requires the presence of attacker-useful classes on the classpath and is not direct remote code execution. The vulnerability could be leveraged in environments where untrusted inputs control model archives or format names.
Mitigation Recommendations
Upgrade to Apache OpenNLP version 2.5.10 or later, or 3.0.0-M5 or later, where the vulnerability is fixed by enforcing a package-prefix allowlist for class loading. If immediate upgrade is not possible, ensure that all model files and format names are sourced from trusted origins and audit the classpath for classes with side-effecting static initializers or constructors. For deployments using classes outside the opennlp.* namespace, explicitly register allowed packages via ExtensionLoader.registerAllowedPackage(String) or the OPENNLP_EXT_ALLOWED_PACKAGES system property.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- apache
- Date Reserved
- 2026-07-16T13:23:13.170Z
- Cvss Version
- null
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a6320db9c2644c7f8989bae
Added to database: 07/24/2026, 08:22:51 UTC
Last enriched: 07/24/2026, 08:37:11 UTC
Last updated: 07/24/2026, 21:21:47 UTC
Views: 31
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.