CRITICAL🇵🇱 Wersja polska

CVE-2024-24576

CVSS 10.0v3.1pub. 2024-04-09upd. 2026-01-05

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.

🤖 AI Analysis
How it works

The Windows API passes all arguments to the executed process as a single string, and their splitting is the responsibility of the executed program. The `cmd.exe` command, used among other things to run batch files (.bat, .cmd), applies its own argument splitting logic, different from the standard C runtime. The Rust standard library implemented its own escaping for this case, however it turned out to be insufficient — specially crafted arguments allowed bypassing the escaping and executing arbitrary shell commands. According to the documentation of the `Command::arg` and `Command::args` API, arguments were supposed to be passed without interpretation by the shell, which constitutes a violation of the security guarantees of these interfaces.

Impact

An attacker who can control the arguments passed to a batch file executed by a Rust application on Windows can execute arbitrary shell commands with the process's privileges — which can lead to system compromise, data disclosure, or data modification.

Mitigation & patch

Rust should be updated to version 1.77.2 or later, which contains the fix. After updating, the library returns an `InvalidInput` error for arguments that it cannot safely escape. Developers implementing their own escaping or processing only trusted input data can alternatively use the `CommandExt::raw_arg` method to bypass the standard library's escaping logic.

Who is affected

Rust standard library in versions before 1.77.2, only on the Windows platform, in cases where an application runs batch files (.bat, .cmd) with untrusted arguments using the `Command` API.

Analysis generated by Claude AI (Anthropic) based on NVD data. Always verify with vendor.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
  • Fedora Project Fedora

    OS
    Fedoraproject
    383940
  • Microsoft Windows

    OS
    Microsoft
    wszystkie wersje
  • Rust Lang Rust

    APP
    Rust-Lang
    < 1.77.2
🔵
CHECK WITH VENDOR
No clear patch data available. Check vendor references.
Tags
Command Injection
CWE
References

Related vulnerabilities

CVE-2026-8398CRITICAL9.3⚠ KEVPL ✓ten sam produkt

Atak na łańcuch dostaw DAEMON Tools Lite — trojanizacja instalatorów

CVE-2025-10585CRITICAL9.8⚠ KEVPL ✓ten sam produkt

Type confusion w V8 (Google Chrome) — zdalne uszkodzenie sterty

CVE-2025-34028CRITICAL9.3⚠ KEVPL ✓ten sam produkt

Commvault Command Center – nieuwierzytelniony RCE przez path traversal w ZIP

CVE-2024-7262CRITICAL9.3⚠ KEVPL ✓ten sam produkt

Path Traversal w Kingsoft WPS Office — ładowanie dowolnej biblioteki Windows

CVE-2024-4577CRITICAL9.8⚠ KEVPL ✓ten sam produkt

PHP CGI argument injection – RCE na Windows przez mechanizm Best-Fit