CVE-2024-24576
Last modified
CVE-2024-24576 is a critical-severity vulnerability rated 10/10 on the CVSS scale. 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`. EPSS estimates a 20.34% chance of exploitation in the next 30 days.
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
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H
Weakness Enumeration
Affected Software
| Vendor | Product | Versions |
|---|---|---|
| Fedoraproject | Fedora | 38 |
| Fedoraproject | Fedora | 39 |
| Fedoraproject | Fedora | 40 |
| Rust-Lang | Rust | < 1.77.2 |
References
- http://www.openwall.com/lists/oss-security/2024/04/09/16Mailing List, Third Party Advisory
- https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInputTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.htmlTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argsTechnical Description
- https://github.com/rust-lang/rust/issuesIssue Tracking
- https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mhMitigation, Vendor Advisory
- https://www.rust-lang.org/policies/securityTechnical Description
- http://www.openwall.com/lists/oss-security/2024/04/09/16Mailing List, Third Party Advisory
- https://doc.rust-lang.org/std/io/enum.ErrorKind.html#variant.InvalidInputTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.htmlTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argTechnical Description
- https://doc.rust-lang.org/std/process/struct.Command.html#method.argsTechnical Description
- https://github.com/rust-lang/rust/issuesIssue Tracking
- https://github.com/rust-lang/rust/security/advisories/GHSA-q455-m56c-85mhMitigation, Vendor Advisory
- https://www.kb.cert.org/vuls/id/123335Third Party Advisory
- https://www.rust-lang.org/policies/securityTechnical Description
Timeline
- Published
- Last Modified
- Status
- Analyzed
Frequently Asked Questions
What is CVE-2024-24576?
How severe is CVE-2024-24576?
How do I fix CVE-2024-24576?
How Strix Helps
- How Strix found a critical auth bypass in etcdStrix autonomously discovered a critical authentication bypass in etcd, later designated CVE-2026-33413.
- Autonomous PentestingAI agents that find and validate exploitable vulnerabilities like this one across your applications.
- PR ReviewsPentest every pull request so vulnerable code is caught before it ships to production.
- AI Penetration TestingHow AI-driven penetration testing continuously covers your attack surface.
Related CVEs from 2024
- CVE-2024-24570Statamic is a Laravel and Git powered CMS. HTML files crafte…6.1
- CVE-2024-24571facileManager is a modular suite of web apps built with the …5.4
- CVE-2024-24572facileManager is a modular suite of web apps built with the …6.5
- CVE-2024-24573facileManager is a modular suite of web apps built with the …8.8
- CVE-2024-24574phpMyFAQ is an open source FAQ web application for PHP 8.1+ …6.1
- CVE-2024-24575libgit2 is a portable C implementation of the Git core metho…7.5
- CVE-2024-24577libgit2 is a portable C implementation of the Git core metho…9.8
- CVE-2024-24578RaspberryMatic is an open-source operating system for HomeMa…9.8
- CVE-2024-24579stereoscope is a go library for processing container images …9.8
- CVE-2024-2458The Powerkit – Supercharge your WordPress Site plugin for Wo…5.4
- CVE-2024-24580Improper conditions check in some Intel(R) Data Center GPU M…5.5
- CVE-2024-24581in OpenHarmony v4.0.0 and prior versions allow a local attac…7.8
Are you affected by CVE-2024-24576?
Run a free Strix scan to check your systems for this vulnerability.
Scan your code nowSource: NVD / NIST
