Every CVE Search/ Get API key

CVE-2021-3013

OS command injection in ripgrep

9.8 CriticalFix available

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

1.93%Up 1.2 points since Jun 12, 2021
90%50%10%1%

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 CriticalCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.0
7.5 HighAV: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 CriticalCVSS: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 CriticalCVSS: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 CriticalCVSS: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 DecompressionReader will resolve decompression programs to absolute 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 new function, resolve_binary, was added to help users of this crate 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.

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 CriticalCVSS: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 CriticalCVSS: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

Affected packages
PackageAffectedFixed
ripgrep
crates.io
before 13.0.0
13.0.0
grep-cli
crates.io
before 0.1.6
0.1.6
grep-cli
crates.io
0.0.0-0 up to 0.1.6
0.1.6
rust-ripgrep
Ubuntu: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-ripgrep
Ubuntu:22.04:LTS
All versions, plus listed versions
12.1.1-113.0.0-213.0.0-2ubuntu0.1
None known
ripgrep
openSUSE:Tumbleweed
before 13.0.0-2.2
13.0.0-2.2

History

History
RecordedChangedSources
aliasesEUVD
first indexedCVE 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

Show 5 moreShow less
MoveEnter Open