You are viewing this page in an unauthorized frame window.
This is a potential security issue, you are being redirected to
https://nvd.nist.gov
An official website of the United States government
Official websites use .gov
A .gov website belongs to an official government organization in the United States.
Secure .gov websites use HTTPS
A lock () or https:// means you've safely connected to the .gov website. Share sensitive information only on official, secure websites.
This vulnerability is currently awaiting analysis.
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.
Metrics
NVD enrichment efforts reference publicly available information to associate
vector strings. CVSS information contributed by other sources is also
displayed.
By selecting these links, you will be leaving NIST webspace.
We have provided these links to other web sites because they
may have information that would be of interest to you. No
inferences should be drawn on account of other sites being
referenced, or not, from this page. There may be other web
sites that are more appropriate for your purpose. NIST does
not necessarily endorse the views expressed, or concur with
the facts presented on these sites. Further, NIST does not
endorse any commercial products that may be mentioned on
these sites. Please address comments about this page to nvd@nist.gov.
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 untrus
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 untrus
Removed
Reference
GitHub, Inc. https://www.kb.cert.org/vuls/id/123335
CVE Modified by GitHub, Inc.4/10/2024 12:15:10 PM
Action
Type
Old Value
New Value
Added
Reference
GitHub, Inc. https://www.kb.cert.org/vuls/id/123335 [No types assigned]
New CVE Received from GitHub, Inc.4/09/2024 2:15:08 PM
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 untrus
Added
CVSS V3.1
GitHub, Inc. AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Added
CWE
GitHub, Inc. CWE-78
Added
CWE
GitHub, Inc. CWE-88
Added
Reference
GitHub, Inc. https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput [No types assigned]
Added
Reference
GitHub, Inc. https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg [No types assigned]
Added
Reference
GitHub, Inc. https://doc.rust-lang.org/std/process/struct.Command.html [No types assigned]
Added
Reference
GitHub, Inc. https://doc.rust-lang.org/std/process/struct.Command.html#method.arg [No types assigned]
Added
Reference
GitHub, Inc. https://doc.rust-lang.org/std/process/struct.Command.html#method.args [No types assigned]
Added
Reference
GitHub, Inc. https://github.com/rust-lang/rust/issues [No types assigned]
Added
Reference
GitHub, Inc. https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh [No types assigned]
Added
Reference
GitHub, Inc. https://www.rust-lang.org/policies/security [No types assigned]
Quick Info
CVE Dictionary Entry: CVE-2024-24576 NVD
Published Date: 04/09/2024 NVD
Last Modified: 11/21/2024
Source: GitHub, Inc.