Skip to main content
VulnerabilityPublished Updated

CVE-2024-24576: rust · OS Command Injection

Affects rustSource CVE Database V5

0

Not known to be exploited · 20% EPSS · CVSS 10.0 Critical : upgrade to 1.77.2 as a priority.

Data as of 26 Oct 2026, 10:12 UTC

CVSS 3.1 base score
10.0Critical
How severe the flaw is on the 0–10 CVSS scale.
EPSS
20.3% chance of exploitation in 30 days – higher than 97% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
Patch
Available – fixed in 1.77.2
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H

Exploitation evidence

  1. Disclosed: evidence found.

    CVE published 9 Apr 2024

  2. Detectable: no evidence on record.

    No public nuclei template indexed

  3. Weaponised: no evidence on record.

    No public exploit code indexed in Metasploit or Exploit-DB

  4. Exploited in the wild: no evidence on record.

    Not in CISA KEV and no source reports exploitation

  5. Observed by OffSeq Mirage: no evidence on record.

    No attack traffic recorded by OffSeq Mirage sensors

A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 26 Oct 2026.

What to do

Upgrade rust-lang/rust to 1.77.2.

Affected software

ProductAffectedFixed in
crates.iorust-lang/rustpkg:cargo/rust-lang/rustOther threatsAffected
  • <1.77.2
Fixed in
  • 1.77.2

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

European organizations should immediately upgrade Rust to version 1.77.2 or later to benefit from the patched escaping logic and error handling in the Command API. Developers should audit their codebases to identify any usage of the Command API invoking batch files with potentially untrusted input and refactor to ensure inputs are sanitized or controlled. Where possible, avoid invoking batch files with untrusted arguments or replace batch scripts with safer alternatives. For cases requiring custom argument handling, use the CommandExt::raw_arg method cautiously and only with trusted inputs. Implement runtime monitoring and logging for suspicious process spawning activities on Windows hosts. Security teams should also review build and deployment pipelines that use Rust on Windows to prevent injection via CI/CD processes. Finally, educate developers about the nuances of Windows command parsing and the importance of safe argument handling in Rust applications.

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.

References

Community reviews

Loading reviews…