# CVE-2023-37582: Apache RocketMQ: Possible remote code execution when using the update configuration function

> Attackers can execute arbitrary commands on Apache RocketMQ NameServer if the address is exposed and lacks permission verification.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/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:** 12 Jul 2023
- **Updated:** 23 Apr 2025
- **Also known as:** GHSA-gpq8-963w-8qc9

## What is CVE-2023-37582?

CVE-2023-37582 is a critical command injection vulnerability in Apache RocketMQ, published on 12 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The RocketMQ NameServer component still has a remote command execution vulnerability as the CVE-2023-33246 issue was not completely fixed in version 5.1.1. 

When NameServer address are leaked on the extranet and lack permission verification, an attacker can exploit this vulnerability by using the update configuration function on the NameServer component to execute commands as the system users that RocketMQ is running as. 

It is recommended for users to upgrade their NameServer version to 5.1.2 or above for RocketMQ 5.x or 4.9.7 or above for RocketMQ 4.x to prevent these attacks.

Weakness: CWE-94 (Improper Control of Generation of Code)

## Which versions are affected by CVE-2023-37582?

4 open source packages ship an affected version, including org.apache.rocketmq:rocketmq-namesrv. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.rocketmq:rocketmq-namesrv` | Maven | All versions | 4.9.7 |
| `org.apache.rocketmq:rocketmq-namesrv` | Maven | All versions | 4.9.7 |
| `org.apache.rocketmq:rocketmq-namesrv` | Maven | From 5.0.0 | 5.1.2 |
| `org.apache.rocketmq:rocketmq-namesrv` | Maven | From 5.0.0 | 5.1.2 |

Products: Apache Rocketmq.

## How do I fix CVE-2023-37582?

Upgrade org.apache.rocketmq:rocketmq-namesrv to a fixed version for your release line: 4.9.7 or 5.1.2.

## Is CVE-2023-37582 being exploited?

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

Public exploit code:

- Apache RocketMQ Arbitrary File Write Vulnerability Exploit (github_poc): https://github.com/Malayke/CVE-2023-37582_EXPLOIT
- https://github.com/laishouchao/Apache-RocketMQ-RCE-CVE-2023-37582-poc (github_poc): https://github.com/laishouchao/Apache-RocketMQ-RCE-CVE-2023-37582-poc
- https://github.com/shoucheng3/apache__rocketmq_CVE-2023-37582_4-9-6 (github_poc): https://github.com/shoucheng3/apache__rocketmq_CVE-2023-37582_4-9-6
- Apache RocketMQ - Remote Command Execution (nuclei)

## Other vulnerabilities in Apache RocketMQ

- [CVE-2023-33246](https://insights.sbomify.com/CVE-2023-33246/): Apache RocketMQ Command Execution (critical 9.8, exploited in the wild)
- [CVE-2024-23321](https://insights.sbomify.com/CVE-2024-23321/): Apache RocketMQ: Unauthorized Exposure of Sensitive Data (high 7.5)
- [CVE-2019-17572](https://insights.sbomify.com/CVE-2019-17572/): Directory traversal in Apache RocketMQ (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2023-37582 and fix it if it is affected.

What it is: CVE-2023-37582 is a critical command injection vulnerability in Apache RocketMQ, published on 12 Jul 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2023-37582 exists.

Affected packages and fixed versions:
- org.apache.rocketmq:rocketmq-namesrv (Maven): affected all versions; fixed in 4.9.7
- org.apache.rocketmq:rocketmq-namesrv (Maven): affected all versions; fixed in 4.9.7
- org.apache.rocketmq:rocketmq-namesrv (Maven): affected from 5.0.0; fixed in 5.1.2
- org.apache.rocketmq:rocketmq-namesrv (Maven): affected from 5.0.0; fixed in 5.1.2

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

## Sources

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

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