# CVE-2022-29599: Commandline class shell injection vulnerabilities

> Attackers can execute arbitrary commands via shell injection in Apache Maven's Commandline class due to improper escaping of double-quoted strings.

- **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:** 23 May 2022
- **Updated:** 3 Aug 2024
- **Also known as:** ALSA-2022:4797, ALSA-2022:4798, CLSA-2025-1766362094, DEBIAN-CVE-2022-29599, DLA-3059-1, DLA-3086-1, DSA-5242-1, GHSA-rhgr-952r-6p8q, OESA-2022-1684, RHSA-2022:1541, RHSA-2022:1662, RHSA-2022:4699, RHSA-2022:4797, RHSA-2022:4798, RHSA-2022:9098, RHSA-2023:0573, RLSA-2022:4797, RLSA-2022:4798, ROOT-APP-MAVEN-CVE-2022-29599, UBUNTU-CVE-2022-29599, USN-6730-1, openSUSE-SU-2024:12027-1

## What is CVE-2022-29599?

CVE-2022-29599 is a critical command injection vulnerability in Debian Debian Linux, published on 23 May 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

In Apache Maven maven-shared-utils prior to version 3.3.3, the Commandline class can emit double-quoted strings without proper escaping, allowing shell injection attacks.

Weakness: CWE-116 (Improper Encoding or Escaping of Output)

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

2 open source packages ship an affected version, including org.apache.maven.shared:maven-shared-utils. It affects 2 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `org.apache.maven.shared:maven-shared-utils` | Maven | All versions | 3.3.3 |
| `org.apache.maven.shared:maven-shared-utils` | Maven | All versions | 3.3.3 |
| `aopalliance` | AlmaLinux:8 | All versions | 1.0-17.module_el8.6.0+2752+f1f3449e |
| `aopalliance` | AlmaLinux:8 | All versions | 1.0-20.module_el8.6.0+2786+d7c38b21 |
| `apache-commons-cli` | AlmaLinux:8 | All versions | 1.4-4.module_el8.6.0+2752+f1f3449e |
| `apache-commons-cli` | AlmaLinux:8 | All versions | 1.4-7.module_el8.6.0+2786+d7c38b21 |
| `apache-commons-codec` | AlmaLinux:8 | All versions | 1.11-3.module_el8.6.0+2752+f1f3449e |
| `apache-commons-codec` | AlmaLinux:8 | All versions | 1.13-3.module_el8.6.0+2786+d7c38b21 |
| `apache-commons-io` | AlmaLinux:8 | All versions | 1:2.6-3.module_el8.6.0+2752+f1f3449e |
| `apache-commons-io` | AlmaLinux:8 | All versions | 1:2.6-6.module_el8.6.0+2786+d7c38b21 |
| `apache-commons-lang3` | AlmaLinux:8 | All versions | 3.7-3.module_el8.6.0+2752+f1f3449e |
| `apache-commons-lang3` | AlmaLinux:8 | All versions | 3.9-4.module_el8.6.0+2786+d7c38b21 |
| `apache-commons-logging` | AlmaLinux:8 | All versions | 1.2-13.module_el8.6.0+2752+f1f3449e |
| `atinject` | AlmaLinux:8 | All versions | 1-28.20100611svn86.module_el8.6.0+2752+f1f3449e |
| `atinject` | AlmaLinux:8 | All versions | 1-31.20100611svn86.module_el8.6.0+2786+d7c38b21 |
| `cdi-api` | AlmaLinux:8 | All versions | 1.2-8.module_el8.6.0+2752+f1f3449e |
| `cdi-api` | AlmaLinux:8 | All versions | 2.0.1-3.module_el8.6.0+2786+d7c38b21 |
| `geronimo-annotation` | AlmaLinux:8 | All versions | 1.0-23.module_el8.6.0+2752+f1f3449e |
| `geronimo-annotation` | AlmaLinux:8 | All versions | 1.0-26.module_el8.6.0+2786+d7c38b21 |
| `glassfish-el-api` | AlmaLinux:8 | All versions | 3.0.1-0.7.b08.module_el8.6.0+2752+f1f3449e |
| `google-guice` | AlmaLinux:8 | All versions | 4.1-11.module_el8.6.0+2752+f1f3449e |
| `google-guice` | AlmaLinux:8 | All versions | 4.2.2-4.module_el8.6.0+2786+d7c38b21 |
| `guava` | AlmaLinux:8 | All versions | 28.1-3.module_el8.6.0+2786+d7c38b21 |
| `guava20` | AlmaLinux:8 | All versions | 20.0-8.module_el8.6.0+2752+f1f3449e |
| `hawtjni-runtime` | AlmaLinux:8 | All versions | 1.16-2.module_el8.6.0+2752+f1f3449e |
| `httpcomponents-client` | AlmaLinux:8 | All versions | 4.5.10-4.module_el8.6.0+2786+d7c38b21 |
| `httpcomponents-client` | AlmaLinux:8 | All versions | 4.5.5-5.module_el8.6.0+2752+f1f3449e |
| `httpcomponents-core` | AlmaLinux:8 | All versions | 4.4.10-3.module_el8.6.0+2752+f1f3449e |
| `httpcomponents-core` | AlmaLinux:8 | All versions | 4.4.12-3.module_el8.6.0+2786+d7c38b21 |
| `jansi` | AlmaLinux:8 | All versions | 1.17.1-1.module_el8.0.0+6044+f3cbc35d |
| `jansi` | AlmaLinux:8 | All versions | 1.17.1-1.module_el8.6.0+2752+f1f3449e |
| `jansi` | AlmaLinux:8 | All versions | 1.18-4.module_el8.6.0+2786+d7c38b21 |
| `jansi-native` | AlmaLinux:8 | All versions | 1.7-7.module_el8.6.0+2752+f1f3449e |
| `jboss-interceptors-1.2-api` | AlmaLinux:8 | All versions | 1.0.0-8.module_el8.6.0+2752+f1f3449e |
| `jcl-over-slf4j` | AlmaLinux:8 | All versions | 1.7.25-4.module_el8.6.0+2752+f1f3449e |
| `jcl-over-slf4j` | AlmaLinux:8 | All versions | 1.7.28-3.module_el8.6.0+2786+d7c38b21 |
| `jsoup` | AlmaLinux:8 | All versions | 1.11.3-3.module_el8.6.0+2752+f1f3449e |
| `jsoup` | AlmaLinux:8 | All versions | 1.12.1-3.module_el8.6.0+2786+d7c38b21 |
| `jsr-305` | AlmaLinux:8 | All versions | 0-0.25.20130910svn.module_el8.6.0+2786+d7c38b21 |
| `maven` | AlmaLinux:8 | All versions | 1:3.5.4-5.module_el8.6.0+2752+f1f3449e |

Products: Apache Maven Shared Utils, Debian Debian Linux.

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

Upgrade org.apache.maven.shared:maven-shared-utils to 3.3.3 or later.

## Is CVE-2022-29599 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2022-29599 is a critical command injection vulnerability in Debian Debian Linux, published on 23 May 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-2022-29599 in the wild and no public exploit code.

Affected packages and fixed versions:
- org.apache.maven.shared:maven-shared-utils (Maven): affected all versions; fixed in 3.3.3
- org.apache.maven.shared:maven-shared-utils (Maven): affected all versions; fixed in 3.3.3

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

## Sources

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

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