CVE-2024-24576
criticalpriority · attend · 57EPSS 0.203 · 97 %ileexploit · PoCEURUUSEPSS · scored 2026-10-27
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.
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode
ssvc
A stakeholder decision — act, attend, or track — from exploitation and impact.
weaknesses
The CWE weakness classes this flaw belongs to.
exploits (7)
Public proof-of-concept and weaponised exploit code.
- Gaurav1020/CVE-2024-24576-PoC-RustGaurav1020/CVE-2024-24576-PoC-RustPoC · poc_in_github
- aydinnyunus/CVE-2024-24576-ExploitCVE-2024-24576 Proof of ConceptPoC · poc_in_github
- brains93/CVE-2024-24576-PoC-Pythonbrains93/CVE-2024-24576-PoC-PythonPoC · poc_in_github
- foxoman/CVE-2024-24576-PoC---NimCVE-2024-24576 PoC for Nim LangPoC · poc_in_github
- frostb1ten/CVE-2024-24576-PoCExample of CVE-2024-24576 use case.PoC · poc_in_github
affected products (7)
Products and version ranges known to be affected.
also known as (3)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (40)
External citations — patches, advisories, analysis.
- http://www.openwall.com/lists/oss-security/2024/04/09/16cnnvd
- https://access.redhat.com/security/cve/cve-2024-24576cnnvd
- https://cxsecurity.com/cveshow/CVE-2024-24576/cnnvd
- https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInputcnnvd
- https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_argcnnvd
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argcnnvd
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argscnnvd
- https://github.com/rust-lang/rust/issuescnnvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan