CVE-2024-24576
Scores
EPSS
Percentile: 79.2%
CVSS
CVSS Score: 10.0/10
All CVSS Scores
Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Vector Breakdown
CVSS (Common Vulnerability Scoring System) vector provides detailed metrics about vulnerability characteristics
CVSS
Attack Vector
Network (N)
Describes how the vulnerability is exploited
Attack Complexity
Low (L)
Describes the conditions beyond the attacker's control
Privileges Required
None (N)
Describes the level of privileges an attacker must possess
User Interaction
None (N)
Captures the requirement for a human user participation
Scope
Changed (C)
Determines if a successful attack impacts components beyond the vulnerable component
Confidentiality Impact
High (H)
Measures the impact to the confidentiality of information
Integrity Impact
High (H)
Measures the impact to integrity of a successfully exploited vulnerability
Availability Impact
High (H)
Measures the impact to the availability of the impacted component
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.
Scaner-VS 7 — a modern vulnerability management solution
Sources
CWEs
Related Vulnerabilities
Exploits
Exploit ID: CVE-2024-24576
Source: github-poc
Vulnerable Software (17)
Type: Configuration
Operating System:
{ "children": [ { "cpe_match": [ { "cpe23uri": "cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.77.2" } ], "negate": fa...
{ "children": [ { "cpe_match": [ { "cpe23uri": "cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.77.2" } ], "negate": false, "operator": "OR" } ], "operator": "OR"}
Source: anchore_overrides
Type: Configuration
Product: cargo
Operating System: ubuntu focal 20.04
{ "unaffected": true}
Source: ubuntu
Type: Configuration
Product: cargo
Operating System: ubuntu jammy 22.04
{ "unaffected": true}
Source: ubuntu
Type: Configuration
Product: clippy
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust-analyzer
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust-cargo
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust-doc
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust-gdb
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rust-src
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Product: rustc
Operating System: ubuntu focal 20.04
{ "unaffected": true}
Source: ubuntu
Type: Configuration
Product: rustc
Operating System: ubuntu jammy 22.04
{ "unaffected": true}
Source: ubuntu
Type: Configuration
Product: rustc
Operating System: ubuntu mantic 23.10
{ "unaffected": true}
Source: ubuntu
Type: Configuration
Product: rustc
Operating System: debian
{ "unaffected": true}
Source: debian
Type: Configuration
Product: rustfmt
Operating System: altlinux
{ "fixed": "1:1.80.0-alt0.p10.1"}
Source: redhat
Type: Configuration
Vendor: *
Product: fedora
Operating System: * * *
{ "cpe_match": [ { "cpe23uri": "cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:*", "vulnerable": true }, { "cpe23uri": "cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:*",...
{ "cpe_match": [ { "cpe23uri": "cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:*", "vulnerable": true }, { "cpe23uri": "cpe:2.3:o:fedoraproject:fedora:39:*:*:*:*:*:*:*", "vulnerable": true }, { "cpe23uri": "cpe:2.3:o:fedoraproject:fedora:40:*:*:*:*:*:*:*", "vulnerable": true } ], "operator": "OR"}
Source: nvd
Type: Configuration
Vendor: *
Product: rust
Operating System: * * *
{ "children": [ { "cpe_match": [ { "cpe23uri": "cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.77.2", "vulnerable": true ...
{ "children": [ { "cpe_match": [ { "cpe23uri": "cpe:2.3:a:rust-lang:rust:*:*:*:*:*:*:*:*", "versionEndExcluding": "1.77.2", "vulnerable": true } ], "operator": "OR" }, { "cpe_match": [ { "cpe23uri": "cpe:2.3:o:microsoft:windows:-:*:*:*:*:*:*:*" } ], "operator": "OR" } ], "operator": "AND"}
Source: nvd