CVE-2024-24576
Published: 09 April 2024
Summary
CVE-2024-24576 is a critical-severity OS Command Injection (CWE-78) vulnerability in Fedoraproject Fedora. Its CVSS base score is 10.0 (Critical).
Operationally, ranked in the top 0.8% of CVEs by exploit likelihood; it is not currently listed in the CISA KEV catalog.
Deeper analysis
The vulnerability is an OS command injection flaw (CWE-78, CWE-88) in the Rust standard library prior to version 1.77.2. When the Command API is used on Windows to spawn processes with .bat or .cmd extensions, argument escaping is insufficient to prevent cmd.exe from interpreting attacker-controlled input as additional shell commands. The issue is specific to Windows batch-file invocation; other platforms and non-batch targets are unaffected. CVSS 3.1 scoring rates the flaw 10.0.
An attacker who can supply arguments to Command::arg or Command::args when a batch file is executed can bypass the library’s escaping logic and achieve arbitrary command execution in the context of the spawned process. The documented contract that arguments are passed verbatim without shell evaluation is violated only for cmd.exe targets, so any application that forwards untrusted data into batch-file invocations on Windows is exposed.
The Rust Security Response WG and subsequent advisories recommend upgrading to Rust 1.77.2, which strengthens escaping and causes Command to return an InvalidInput error when an argument cannot be safely escaped. Applications that already perform their own escaping or that operate only on trusted arguments may opt into CommandExt::raw_arg to bypass the new checks. The listed references (Rust documentation for Command, CommandExt::raw_arg, and ErrorKind::InvalidInput, plus the oss-security posting) contain the patch details and migration guidance.
EPSS scores have remained elevated (peak 0.8388, current 0.8054), indicating sustained exploitation interest after disclosure.
EU & UK References
- 🇪🇺 ENISA EUVD: EUVD-2024-21981
Vulnerability details
Rust is a programming language. The Rust Security Response WG was notified that the Rust standard library prior to version 1.77.2 did not properly escape arguments when invoking batch files (with the `bat` and `cmd` extensions) on Windows using the…
more
`Command`. An attacker able to control the arguments passed to the spawned process could execute arbitrary shell commands by bypassing the escaping. The severity of this vulnerability is critical for those who invoke batch files on Windows with untrusted arguments. No other platform or use is affected. The `Command::arg` and `Command::args` APIs state in their documentation that the arguments will be passed to the spawned process as-is, regardless of the content of the arguments, and will not be evaluated by a shell. This means it should be safe to pass untrusted input as an argument. On Windows, the implementation of this is more complex than other platforms, because the Windows API only provides a single string containing all the arguments to the spawned process, and it's up to the spawned process to split them. Most programs use the standard C run-time argv, which in practice results in a mostly consistent way arguments are splitted. One exception though is `cmd.exe` (used among other things to execute batch files), which has its own argument splitting logic. That forces the standard library to implement custom escaping for arguments passed to batch files. Unfortunately it was reported that our escaping logic was not thorough enough, and it was possible to pass malicious arguments that would result in arbitrary shell execution. Due to the complexity of `cmd.exe`, we didn't identify a solution that would correctly escape arguments in all cases. To maintain our API guarantees, we improved the robustness of the escaping code, and changed the `Command` API to return an `InvalidInput` error when it cannot safely escape an argument. This error will be emitted when spawning the process. The fix is included in Rust 1.77.2. Note that the new escaping logic for batch files errs on the conservative side, and could reject valid arguments. Those who implement the escaping themselves or only handle trusted inputs on Windows can also use the `CommandExt::raw_arg` method to bypass the standard library's escaping logic.
- CWE(s)
Related Threats
No named actor attribution yet. ATT&CK technique mapping in progress for this CVE.
Affected Assets
Mitigating Controls
Likely Mitigating Controls AI
Per-CVE control mapping for this CVE has not run yet; the list below is derived from the weakness types (CWEs) cited in the NVD entry.