# CVE-2022-41678: Apache ActiveMQ: Insufficient API restrictions on Jolokia allow authenticated users to perform RCE

> Authenticated users can achieve remote code execution via Jolokia API due to insufficient restrictions, requiring an upgrade to secure versions.

- **Severity:** High 8.8 (`CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Nov 2023
- **Updated:** 3 Nov 2025
- **Also known as:** BIT-activemq-2022-41678, DEBIAN-CVE-2022-41678, GHSA-53v4-42fg-g287, OESA-2023-1925, UBUNTU-CVE-2022-41678

## What is CVE-2022-41678?

CVE-2022-41678 is a high-severity code injection vulnerability in Apache Activemq, published on 28 Nov 2023. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Once an user is authenticated on Jolokia, he can potentially trigger arbitrary code execution. 

In details, in ActiveMQ configurations, jetty allows
org.jolokia.http.AgentServlet to handler request to /api/jolokia

org.jolokia.http.HttpRequestHandler#handlePostRequest is able to
create JmxRequest through JSONObject. And calls to
org.jolokia.http.HttpRequestHandler#executeRequest.

Into deeper calling stacks,
org.jolokia.handler.ExecHandler#doHandleRequest can be invoked
through refection. This could lead to RCE through via
various mbeans. One example is unrestricted deserialization in jdk.management.jfr.FlightRecorderMXBeanImpl which exists on Java version above 11.

1 Call newRecording.

2 Call setConfiguration. And a webshell data hides in it.

3 Call startRecording.

4 Call copyTo method. The webshell will be written to a .jsp file.

The mitigation is to restrict (by default) the actions authorized on Jolokia, or disable Jolokia.
A more restrictive Jolokia configuration has been defined in default ActiveMQ distribution. We encourage users to upgrade to ActiveMQ distributions version including updated Jolokia configuration: 5.16.6, 5.17.4, 5.18.0, 6.0.0.

Weakness: CWE-287 (Improper Authentication)

## Which versions are affected by CVE-2022-41678?

5 open source packages ship an affected version, including org.apache.activemq:apache-activemq and activemq. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.activemq:apache-activemq` | Maven | All versions | 5.16.6 |
| `org.apache.activemq:apache-activemq` | Maven | All versions | 5.16.6 |
| `org.apache.activemq:apache-activemq` | Maven | From 5.17.0 | 5.17.4 |
| `org.apache.activemq:apache-activemq` | Maven | From 5.17.0 | 5.17.4 |
| `activemq` | Bitnami | All versions | 5.16.6, 5.17.4 |

Products: Apache Activemq.

## How do I fix CVE-2022-41678?

Upgrade org.apache.activemq:apache-activemq to a fixed version for your release line: 5.16.6 or 5.17.4.

## Is CVE-2022-41678 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-41678 exists.

Public exploit code:

- Apache ActiveMQ漏洞综合利用工具(CVE-2015-5254，CVE-2016-3088，CVE-2022-41678，CVE-2023-46604，CVE-2024-32114，CVE-2026-34197，CVE-2026-40466， CVE-2026-42588) (github_poc): https://github.com/Catherines77/ActiveMQ-EXPtools
- CVE-2022-41678: Dangerous MBeans Accessible via Jolokia API in Apache ActiveMQ (github_poc): https://github.com/mbadanoiu/CVE-2022-41678
- CVE-2022-41678 是 Apache ActiveMQ 中的一个远程代码执行漏洞。该漏洞允许攻击者通过 JMX (Java Management Extensions) 接口修改 Log4j 配置或 JFR (Java Flight Recorder) 配置，从而写入恶意的 JSP webshell 到服务器的 web 目录中，最终实现远程代码执行。 (github_poc): https://github.com/URJACK2025/CVE-2022-41678
- Apache ActiveMQ < 5.16.5/5.17.3 - Remote Code Execution (nuclei): http/cves/2022/CVE-2022-41678.yaml

## Other vulnerabilities in Apache Activemq

- [CVE-2023-46604](https://insights.sbomify.com/CVE-2023-46604/): Apache ActiveMQ Deserialization of Untrusted Data (critical 10.0, exploited in the wild)
- [CVE-2016-3088](https://insights.sbomify.com/CVE-2016-3088/): Apache ActiveMQ Improper Input Validation (critical 9.8, exploited in the wild)
- [CVE-2026-34197](https://insights.sbomify.com/CVE-2026-34197/): Apache ActiveMQ Improper Input Validation (high 8.8, exploited in the wild)
- [CVE-2020-11998](https://insights.sbomify.com/CVE-2020-11998/): Remote code execution in Apache ActiveMQ (critical 9.8)
- [CVE-2013-7285](https://insights.sbomify.com/CVE-2013-7285/): Command Injection in Xstream (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2022-41678 and fix it if it is affected.

What it is: CVE-2022-41678 is a high-severity code injection vulnerability in Apache Activemq, published on 28 Nov 2023. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2022-41678 exists.

Affected packages and fixed versions:
- org.apache.activemq:apache-activemq (Maven): affected all versions; fixed in 5.16.6
- org.apache.activemq:apache-activemq (Maven): affected all versions; fixed in 5.16.6
- org.apache.activemq:apache-activemq (Maven): affected from 5.17.0; fixed in 5.17.4
- org.apache.activemq:apache-activemq (Maven): affected from 5.17.0; fixed in 5.17.4
- activemq (Bitnami): affected all versions; fixed in 5.16.6, 5.17.4

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-2022-41678/ (Markdown: https://insights.sbomify.com/CVE-2022-41678/index.md)
```

## Sources

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

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