CVE-2021-3013
OS command injection in ripgrep
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
9.8
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
CVE-2021-3013- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - CVSS 2.0
- 7.5 High
AV:N/AC:L/Au:N/C:P/I:P/A:P - Updated
- 2026-11-02
CVE List No score
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
CVE-2021-3013- Updated
- 2026-11-02
EUVDEUVD-2021-1713 No score
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
EUVD-2021-1713- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-g4xg-fxmg-vcg5
9.8
OS command injection in ripgrep
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
GHSA-g4xg-fxmg-vcg5- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-78
- Updated
- 2026-11-02
OSV
9.8
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
CVE-2021-3013- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVGHSA-g4xg-fxmg-vcg5
9.8
OS command injection in ripgrep
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
GHSA-g4xg-fxmg-vcg5- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-78
- Updated
- 2026-11-02
OSVRUSTSEC-2021-0071
9.8
`grep-cli` may run arbitrary executables on Windows
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.
- Record
RUSTSEC-2021-0071- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2021-3013
9.8
ripgrep before 13 on Windows allows attackers to trigger execution of arbitrary programs from the current working directory via the -z/--search-zip or --pre flag.
- Record
UBUNTU-CVE-2021-3013- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVopenSUSE-SU-2024:11300-1 No score
ripgrep-13.0.0-2.2 on GA media
These are all security issues fixed in the ripgrep-13.0.0-2.2 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:11300-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
ripgrepcrates.io |
before 13.0.0 | 13.0.0 |
grep-clicrates.io |
before 0.1.6 | 0.1.6 |
grep-clicrates.io |
0.0.0-0 up to 0.1.6 | 0.1.6 |
rust-ripgrepUbuntu:20.04:LTS |
All versions, plus listed versions 0.10.0-2build111.0.2-111.0.2-1build111.0.2-1ubuntu0.1 |
None known |
rust-ripgrepUbuntu:22.04:LTS |
All versions, plus listed versions 12.1.1-113.0.0-213.0.0-2ubuntu0.1 |
None known |
ripgrepopenSUSE:Tumbleweed |
before 13.0.0-2.2 | 13.0.0-2.2 |
History
| Recorded | Changed | Sources |
|---|---|---|
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-3013 is a critical vulnerability (CVSS 9.8) in Ripgrep Project Ripgrep, published June 11, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.93%, the 80th percentile. Fixed in ripgrep 13.0.0.
References
github.com/BurntSushi/ripgrep/blob/master/CHANGELOG.md
github.com/BurntSushi/ripgrep/blob/e48a17e1891e1ea9dd06ba0e48d5fb140ca7c0c4/CHANGELOG.md
nvd.nist.gov/vuln/detail/CVE-2021-3013
rustsec.org/advisories/RUSTSEC-2021-0071.html
github.com/BurntSushi/ripgrep/issues/1773
github.com/advisories/GHSA-g4xg-fxmg-vcg5