Know every vulnerabilitybefore it knows you.
DevGuard continuously monitors your dependencies and alerts you when CVEs like this one affect your stack — with real-time threat intelligence built for developers.
RUSTSEC-2021-0071
No affected components available
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:
- A
DecompressionReaderwill resolve decompression programs to absolute paths automatically using thePATHenvironment 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 new function,
resolve_binary, was added to help users of this crate mitigate this behavior when they need to create their ownstd::process::Command. For example, ripgrep usesgrep_cli::resolve_binaryon the argument given to its--preflag.
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.
The vulnerability can be exploited over the network without needing physical access. It is easy for an attacker to exploit this vulnerability. An attacker does not need any special privileges or access rights. No user interaction is needed for the attacker to exploit this vulnerability. The impact is confined to the system where the vulnerability exists. There is a high impact on the confidentiality of the information. There is a high impact on the integrity of the data. There is a high impact on the availability of the system.
Active exploitation in the wild has been confirmed. Immediate patching or mitigation is required.
The exploit probability is very low. The vulnerability is unlikely to be exploited in the next 30 days.
We did not find any exploit available. Neither in GitHub repositories nor in the Exploit-Database.
Browse More
Continuously monitor your dependencies and get alerted when vulnerabilities like this one affect your stack.
Checkout DevGuard