CVE-2024-24576

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.
References
Link Resource
http://www.openwall.com/lists/oss-security/2024/04/09/16 Mailing List Third Party Advisory
https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput Technical Description
https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html#method.arg Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html#method.args Technical Description
https://github.com/rust-lang/rust/issues Issue Tracking
https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh Vendor Advisory Mitigation
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ Mailing List Vendor Advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ Mailing List Vendor Advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ Mailing List Vendor Advisory
https://www.rust-lang.org/policies/security Technical Description
http://www.openwall.com/lists/oss-security/2024/04/09/16 Mailing List Third Party Advisory
https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput Technical Description
https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html#method.arg Technical Description
https://doc.rust-lang.org/std/process/struct.Command.html#method.args Technical Description
https://github.com/rust-lang/rust/issues Issue Tracking
https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh Vendor Advisory Mitigation
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ Mailing List Vendor Advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ Mailing List Vendor Advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ Mailing List Vendor Advisory
https://www.kb.cert.org/vuls/id/123335 Third Party Advisory
https://www.rust-lang.org/policies/security Technical Description
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:*

Configuration 2 (hide)

AND
cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*
cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:*

History

05 Jan 2026, 16:18

Type Values Removed Values Added
First Time Rust-lang
Fedoraproject fedora
Rust-lang rust
Microsoft
Microsoft windows
Fedoraproject
References () http://www.openwall.com/lists/oss-security/2024/04/09/16 - () http://www.openwall.com/lists/oss-security/2024/04/09/16 - Mailing List, Third Party Advisory
References () https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput - () https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput - Technical Description
References () https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg - () https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg - Technical Description
References () https://doc.rust-lang.org/std/process/struct.Command.html - () https://doc.rust-lang.org/std/process/struct.Command.html - Technical Description
References () https://doc.rust-lang.org/std/process/struct.Command.html#method.arg - () https://doc.rust-lang.org/std/process/struct.Command.html#method.arg - Technical Description
References () https://doc.rust-lang.org/std/process/struct.Command.html#method.args - () https://doc.rust-lang.org/std/process/struct.Command.html#method.args - Technical Description
References () https://github.com/rust-lang/rust/issues - () https://github.com/rust-lang/rust/issues - Issue Tracking
References () https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh - () https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh - Vendor Advisory, Mitigation
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ - Mailing List, Vendor Advisory
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ - Mailing List, Vendor Advisory
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ - Mailing List, Vendor Advisory
References () https://www.rust-lang.org/policies/security - () https://www.rust-lang.org/policies/security - Technical Description
References () https://www.kb.cert.org/vuls/id/123335 - () https://www.kb.cert.org/vuls/id/123335 - Third Party Advisory
CPE cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:*
cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:*
cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*
cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:*

04 Nov 2025, 19:16

Type Values Removed Values Added
References
  • () https://www.kb.cert.org/vuls/id/123335 -
Summary (en) 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. (en) 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.

21 Nov 2024, 08:59

Type Values Removed Values Added
References () http://www.openwall.com/lists/oss-security/2024/04/09/16 - () http://www.openwall.com/lists/oss-security/2024/04/09/16 -
References () https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput - () https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInput -
References () https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg - () https://doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tymethod.raw_arg -
References () https://doc.rust-lang.org/std/process/struct.Command.html - () https://doc.rust-lang.org/std/process/struct.Command.html -
References () https://doc.rust-lang.org/std/process/struct.Command.html#method.arg - () https://doc.rust-lang.org/std/process/struct.Command.html#method.arg -
References () https://doc.rust-lang.org/std/process/struct.Command.html#method.args - () https://doc.rust-lang.org/std/process/struct.Command.html#method.args -
References () https://github.com/rust-lang/rust/issues - () https://github.com/rust-lang/rust/issues -
References () https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh - () https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mh -
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ -
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ -
References () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ - () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ -
References () https://www.rust-lang.org/policies/security - () https://www.rust-lang.org/policies/security -

01 May 2024, 18:15

Type Values Removed Values Added
References
  • () http://www.openwall.com/lists/oss-security/2024/04/09/16 -

19 Apr 2024, 23:15

Type Values Removed Values Added
References
  • () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/N323QAEEUVTJ354BTVQ7UB6LYXUX2BCL/ -

19 Apr 2024, 04:15

Type Values Removed Values Added
References
  • () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/RPH3PF7DVSS2LVIRLW254VWUPVKJN46P/ -

12 Apr 2024, 02:15

Type Values Removed Values Added
References
  • () https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/W7WRFOIAZXYUPGXGR5UEEW7VTTOD4SZ3/ -

11 Apr 2024, 21:15

Type Values Removed Values Added
References
  • {'url': 'https://www.kb.cert.org/vuls/id/123335', 'name': 'https://www.kb.cert.org/vuls/id/123335', 'tags': [], 'refsource': ''}
Summary 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`][4] 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. 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.

10 Apr 2024, 16:15

Type Values Removed Values Added
References
  • () https://www.kb.cert.org/vuls/id/123335 -

09 Apr 2024, 18:15

Type Values Removed Values Added
New CVE

Information

Published : 2024-04-09 18:15

Updated : 2026-01-05 16:18


NVD link : CVE-2024-24576

Mitre link : CVE-2024-24576

CVE.ORG link : CVE-2024-24576


JSON object : View

Products Affected

fedoraproject

  • fedora

rust-lang

  • rust

microsoft

  • windows
CWE
CWE-78

Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

CWE-88

Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')