CVE-2024-24576: Rusts's `std::process::Command` did not properly escape arguments of batch files on Windows
rust-lang · rust
Affected: rust-lang · Exploitation: likely to be exploited (10% or more)
Not in CyberSIXT coverage yet: no article names this CVE. This page shows the public record.
Higher than 97% of scored CVEs
DescriptionCVE.org
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.
Affected products1
From the CVE record. A product or version that is not listed is unknown, not unaffected.
- rust-lang · rust< 1.77.2
On the Atlas
Every published CVE is on the CyberSIXT Atlas, grouped by weakness, vendor and month.
- Exploitation
- Likely to be exploited (10% or more). EPSS gives it a 10% or higher chance of exploitation in the next 30 days.
- CISA KEV
- Not listed
- Public check
- No public nuclei template
- Vendor
- rust-lang
- Published
- April 2024
- Bounty reports
- 1 disclosed on HackerOne
Disclosed bug bounty reports about CVE-2024-24576
The reports on HackerOne that name this CVE, with HackerOne's own outcome. Titles and metadata only.
- `std::process::Command` batch files argument escaping could be bypassed with trailing whitespace or periodsInternet Bug Bounty · 2024 · low severityValid
CoverageNo articles yet
No CyberSIXT article names CVE-2024-24576 yet, so there is no coverage timeline, action brief or change log for it. Everything on this page comes from the public CVE record, CISA KEV, EPSS and the nuclei template index. Search the archive or see the CVEs in the news.
References
- NVD entrynvd.nist.gov
- CVE recordcve.org
- Weakness CWE-78cwe.mitre.org
- github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mgithub.com
- doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInpudoc.rust-lang.org
- doc.rust-lang.org/std/os/windows/process/trait.CommandExt.html#tdoc.rust-lang.org
- doc.rust-lang.org/std/process/struct.Command.htmldoc.rust-lang.org
- doc.rust-lang.org/std/process/struct.Command.html#method.argdoc.rust-lang.org
- doc.rust-lang.org/std/process/struct.Command.html#method.argsdoc.rust-lang.org
- github.com/rust-lang/rust/issuesgithub.com
- rust-lang.org/policies/securityrust-lang.org
- lists.fedoraproject.org/archives/list/package-announce@lists.fedlists.fedoraproject.org
- lists.fedoraproject.org/archives/list/package-announce@lists.fedlists.fedoraproject.org
- lists.fedoraproject.org/archives/list/package-announce@lists.fedlists.fedoraproject.org
- openwall.com/lists/oss-security/2024/04/09/16openwall.com
1 more reference is in the CVE record.