summaryrefslogtreecommitdiffstats
path: root/CHANGELOG.md
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2021-01-11 13:44:07 -0500
committerAndrew Gallant <jamslam@gmail.com>2021-05-29 09:36:48 -0400
commit229d1a8d41b0023420e7815578fa0b39c0d5c2e4 (patch)
treeedfd1fc2d1225d71e125303d258ab27091f6afc3 /CHANGELOG.md
parent8ec6ef373f1845b5f9d9f341e8709cf86de057b8 (diff)
cli: fix arbitrary execution of program bug
This fixes a bug only present on Windows that would permit someone to execute an arbitrary program if they crafted an appropriate directory tree. Namely, if someone put an executable named 'xz.exe' in the root of a directory tree and one ran 'rg -z foo' from the root of that tree, then the 'xz.exe' executable in that tree would execute if there are any 'xz' files anywhere in the tree. The root cause of this problem is that 'CreateProcess' on Windows will implicitly look in the current working directory for an executable when it is given a relative path to a program. Rust's standard library allows this behavior to occur, so we work around it here. We work around it by explicitly resolving programs like 'xz' via 'PATH'. That way, we only ever pass an absolute path to 'CreateProcess', which avoids the implicit behavior of checking the current working directory. This fix doesn't apply to non-Windows systems as it is believed to only impact Windows. In theory, the bug could apply on Unix if '.' is in one's PATH, but at that point, you reap what you sow. While the extent to which this is a security problem isn't clear, I think users generally expect to be able to download or clone repositories from the Internet and run ripgrep on them without fear of anything too awful happening. Being able to execute an arbitrary program probably violates that expectation. Therefore, CVE-2021-3013[1] was created for this issue. We apply the same logic to the --pre command, since the --pre command is likely in a user's config file and it would be surprising for something that the user is searching to modify which preprocessor command is used. The --pre and -z/--search-zip flags are the only two ways that ripgrep will invoke external programs, so this should cover any possible exploitable cases of this bug. [1] - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013
Diffstat (limited to 'CHANGELOG.md')
-rw-r--r--CHANGELOG.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ebd8fa70..8aa0d3d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,13 @@ Now it looks like this:
FOO: binary file matches (found "\0" byte around offset XXX)
```
+Security fixes:
+
+* [CVE-2021-3013](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-3013):
+ Fixes a security hole on Windows where running ripgrep with either the
+ `-z/--search-zip` or `--pre` flags can result in running arbitrary
+ executables from the current directory.
+
Feature enhancements:
* Added or improved file type filtering for Bazel, dvc, FlatBuffers, Futhark,