Email me

Rust advisories / grep-cli

Vulnerability CriticalRUSTSEC-2021-0071 · grep-cli

RUSTSEC-2021-0071: `grep-cli` may run arbitrary executables on Windows

Short answerA security vulnerability in the grep-cli crate: `grep-cli` may run arbitrary executables on Windows. Critical severity (CVSS 9.8). Fixed in 0.1.6: update to a fixed version.

Crategrep-cli
TypeVulnerability (code-execution)
Affected versionsBefore 0.1.6.
Fixed in0.1.6
SeverityCritical, CVSS 9.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Published2021-06-12
Last changed2023-11-08
Also known asCVE-2021-3013, GHSA-g4xg-fxmg-vcg5
Affected functionsgrep_cli::DecompressionReader::new

What to do

  1. See which version you have: cargo tree -i grep-cli (it also shows which of your dependencies pulls it in).
  2. Update within your version requirement: cargo update -p grep-cli. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for example grep-cli = "0.1.6") or update the dependency that pulls it in.
  3. Check again with cargo audit, or paste your Cargo.lock into our Cargo.toml checker.

Details from the advisory

On Windows in versions of grep-cli prior to 0.1.6, it's possible for some of the routines to execute arbitrary executables. In particular, a quirk of the Windows process execution API is that it will automatically consider the current directory before other directories when resolving relative binary names. Therefore, if you use grep-cli to read decompressed files in an untrusted directory with that directory as the CWD, a malicious actor to could put, e.g., a gz.exe binary in that directory and grep-cli will use the malicious actor's version of gz.exe instead of the system's.

This is also technically possible on Unix as well, but only if the PATH variable contains .. Conventionally, they do not.

A DecompressionReader has been fixed to automatically resolve binary names using PATH, instead of relying on the Windows API to do it.

If you use grep-cli's CommandReader with a std::process::Command value on Windows, then it is recommended to either construct the Command with an absolute binary name, or use grep-cli's new resolve_binary helper function.

To be clear, grep-cli 0.1.6 mitigates this issue in two ways:

paths automatically using the PATH environment variable, instead of relying on Windows APIs to do it (which would result in the undesirable behavior of checking the CWD for a program first).

  • A DecompressionReader will resolve decompression programs to absolute

mitigate this behavior when they need to create their own std::process::Command. For example, ripgrep uses grep_cli::resolve_binary on the argument given to its --pre flag.

  • A new function, resolve_binary, was added to help users of this crate

While the first mitigation fixes this issue for sensible values of PATH when doing decompression search, the second mitigation is imperfect. The more fundamental issue is that std::process::Command is itself vulnerable to this.

References

From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.

Up next

Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →

Did this answer your question?

Get the receipts by email.

What my AI agents tried this week, with the real numbers: what worked, what flopped, what made money. One email when there is something worth reading.

No spam, never sold. Every email has a one-click unsubscribe.

Popular in the shop

All 124 tools →

Browse: Bundles and kitsHome, family and schoolMoney and businessAI toolsSports and fitnessMaking and hobbiesFood and drinkIndie dev and launchTrading and quant

Free: Landing page teardown iPhone app cost calculator LLM API cost calculator Paid online: $49 Launch Check App builds Articles FAQ