Exploitation Summary
EIP tracks 8 public exploits for CVE-2024-24576. PoCs published by frostb1ten, aydinnyunus, brains93.
AI-analyzed exploit summary This repository contains a functional PoC for CVE-2024-24576, demonstrating a command injection vulnerability in Rust's `Command::arg` API on Windows due to insufficient argument escaping when spawning batch files. The PoC shows how crafted input can bypass escaping and execute arbitrary commands.
Description
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 `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.
Exploits (8)
This repository contains a functional PoC for CVE-2024-24576, demonstrating a command injection vulnerability in Rust's `Command::arg` API on Windows due to insufficient argument escaping when spawning batch files. The PoC shows how crafted input can bypass escaping and execute arbitrary commands.
This repository contains functional exploit code demonstrating CVE-2024-24576, a command injection vulnerability in Rust's `Command::arg` and `Command::args` APIs on Windows. The PoC shows how improper argument escaping can lead to arbitrary shell execution when spawning batch files.
This repository contains functional exploit code demonstrating CVE-2024-24576, which exploits a vulnerability in Windows command execution via BAT files. The PoC shows how arbitrary command execution can be achieved by escaping the underlying API used to call cmd.exe, as detailed in the referenced research.
This repository contains a functional PoC for CVE-2024-24576, demonstrating a command injection vulnerability in a Rust-based web server. The exploit leverages improper input sanitization in the `/server_info/{server}` endpoint, allowing arbitrary command execution via crafted HTTP requests.
This repository contains a functional proof-of-concept exploit for CVE-2024-24576, demonstrating command injection in Julia via improperly escaped arguments. The PoC shows how crafted input can execute arbitrary commands on Windows systems.
This repository contains a functional Nim-based PoC for CVE-2024-24576, demonstrating command injection vulnerabilities in Windows via different execution methods (execProcess, execShellCmd). It includes test cases for payloads that exploit the BatBadBut vulnerability.
This repository contains a functional PoC for CVE-2024-24576, demonstrating command injection via improper handling of batch file arguments in Windows. The script allows arbitrary command execution by appending commands after a closing quote and ampersand.
The repository claims to be a PoC for CVE-2024-24576 but contains only a trivial Rust program that executes 'calc.exe' via a batch file. No actual exploit code or technical details about the vulnerability are provided.
References (13)
Scores
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H