# CVE-2021-41766: Insecure Java Deserialization in Apache Karaf

> Apache Karaf's JMX implementation allows insecure Java deserialization, potentially enabling remote code execution if vulnerable classes are present.

- **Severity:** High 8.1 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 26 Jan 2022
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-jh5g-9m4v-9vv9

## What is CVE-2021-41766?

CVE-2021-41766 is a high-severity unsafe deserialization vulnerability in Apache Karaf, published on 26 Jan 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Apache Karaf allows monitoring of applications and the Java runtime by using the Java Management Extensions (JMX). JMX is a Java RMI based technology that relies on Java serialized objects for client server communication. Whereas the default JMX implementation is hardened against unauthenticated deserialization attacks, the implementation used by Apache Karaf is not protected against this kind of attack. The impact of Java deserialization vulnerabilities strongly depends on the classes that are available within the targets class path. Generally speaking, deserialization of untrusted data does always represent a high security risk and should be prevented. The risk is low as, by default, Karaf uses a limited set of classes in the JMX server class path. It depends of system scoped classes (e.g. jar in the lib folder).

Weakness: CWE-502 (Deserialization of Untrusted Data)

## Which versions are affected by CVE-2021-41766?

2 open source packages ship an affected version, including org.apache.karaf.management:org.apache.karaf.management.server. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.karaf.management:org.apache.karaf.management.server` | Maven | All versions | 4.3.6 |
| `org.apache.karaf.management:org.apache.karaf.management.server` | Maven | All versions | 4.3.6 |

Products: Apache Karaf.

## How do I fix CVE-2021-41766?

Upgrade org.apache.karaf.management:org.apache.karaf.management.server to 4.3.6 or later.

## Is CVE-2021-41766 being exploited?

There is no known exploitation of CVE-2021-41766 in the wild and no public exploit code.

## Other vulnerabilities in Apache Karaf

- [CVE-2026-91012](https://insights.sbomify.com/CVE-2026-91012/): Apache Karaf: Path Traversal in Config Service Allows Manager-to-Admin Privilege Escalation (critical 9.8)
- [CVE-2026-91048](https://insights.sbomify.com/CVE-2026-91048/): Missing authorization in Apache Karaf (critical 9.8)
- [CVE-2022-40145](https://insights.sbomify.com/CVE-2022-40145/): Apache Karaf: JDBC JAAS LDAP injection (critical 9.8)
- [CVE-2018-11788](https://insights.sbomify.com/CVE-2018-11788/): XML External Entity Reference in Apache Karaf (critical 9.8)
- [CVE-2026-92142](https://insights.sbomify.com/CVE-2026-92142/): Apache Karaf: Authorization bypass in JMX MBean lifecycle operations (high 8.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41766 and fix it if it is affected.

What it is: CVE-2021-41766 is a high-severity unsafe deserialization vulnerability in Apache Karaf, published on 26 Jan 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-41766 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.karaf.management:org.apache.karaf.management.server (Maven): affected all versions; fixed in 4.3.6
- org.apache.karaf.management:org.apache.karaf.management.server (Maven): affected all versions; fixed in 4.3.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2021-41766/ (Markdown: https://insights.sbomify.com/CVE-2021-41766/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2021-41766
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2021-41766
- OSV: https://osv.dev/vulnerability/CVE-2021-41766

---
From sbomify Insights: https://insights.sbomify.com/CVE-2021-41766/
Summaries are generated and may contain mistakes; the official description above is the record.
