CVE-2022-29599: Command injection in Apache Maven maven-shared-utils

Summary

24/05/2022
Yes i
Critical
9.8

CVE-2022-29599: Command injection in Apache Maven maven-shared-utils. Affects org.apache.maven.shared:maven-shared-utils versions < 3.3.3. Fixed in 3.3.3. How to fix ↓

Also tracked for

The same CVE-2022-29599 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

Apache Maven maven-shared-utils is a utility library used by Maven to provide common functionality across different Maven plugins and components. It offers various features such as command line handling, file manipulation, and string utilities. However, prior to version 3.3.3, the library is vulnerable to command injection attacks.

Vulnerability Detail

The vulnerability (CVE-2022-29599) in Apache Maven maven-shared-utils arises from the Commandline class, which can emit double-quoted strings without proper escaping. This allows an attacker to inject malicious commands into the shell, potentially leading to unauthorized access, data leakage, or remote code execution. The severity of this vulnerability is rated as CRITICAL with a CVSS score of 9.8.

How To Fix

Minimum fixed version

3.3.3

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not immediately feasible, a possible workaround is to manually sanitize and escape any user-supplied input before using it in command-line operations. This can be achieved by carefully validating and sanitizing the input to remove any potentially harmful characters or sequences. Here is an example in Java:

String sanitizedInput = input.replaceAll("[\\"\\$\\`\\\\]", "\\\\$0");

Conclusion

In conclusion, Apache Maven maven-shared-utils prior to version 3.3.3 is vulnerable to command injection attacks due to improper escaping of double-quoted strings. It is crucial to upgrade to the latest version or apply the provided workaround to mitigate the risk. For further assistance on vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for org.apache.maven.shared:maven-shared-utils →

Share this vulnerability

FAQ

Apache Maven maven-shared-utils is a utility library used by Maven to provide common functionality across different Maven plugins and components. It offers various features such as command line handling, file manipulation, and string utilities.

Command injection is a type of vulnerability where an attacker can execute arbitrary commands on a target system by injecting malicious input into a command execution context. In this case, the vulnerability allows an attacker to inject commands into the shell via improperly escaped double-quoted strings.

Exploiting this vulnerability can lead to unauthorized access, data leakage, or remote code execution on systems using Apache Maven maven-shared-utils prior to version 3.3.3. An attacker could execute arbitrary commands with the privileges of the user running the vulnerable Maven plugin or component.

To fix this vulnerability, it is recommended to upgrade to Apache Maven maven-shared-utils version 3.3.3 or later. This version includes the necessary fixes to properly escape double-quoted strings and prevent command injection attacks.

If upgrading to the latest version is not immediately feasible, a possible workaround is to manually sanitize and escape any user-supplied input before using it in command-line operations. This involves carefully validating and sanitizing the input to remove any potentially harmful characters or sequences.

How To Fix

Minimum fixed version

3.3.3

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback