Re:Arbitrary file write vulnerability in GNU gzip's zgrep ut...
by deathanatos on Monday April 18, 2022 @06:46PM
(#31077625)
… that is also shocking… it wouldn't just stream the decompression, perhaps piping the decompressed stream into grep itself?
[ Parent
| on HN ]
Re:Arbitrary file write vulnerability in GNU gzip's zgrep ut...
by TheDong on Monday April 18, 2022 @07:15PM
(#31077919)
zgrep does stream directly from gzip into grep.
You can see that here: https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=...
It's also mentioned in one of the few comments in zgrep: https://git.savannah.gnu.org/cgit/gzip.git/tree/zgrep.in?id=...
> we use stdin to pass the gzip output to grep
zgrep does create a temporary directory to store the grep search pattern, but only if the pattern is passed via `zgrep -f`, and only if the pattern passed in is not a regular file (i.e. `zgrep -f <(echo "foo") some_file.gz` would create a temporary file with the contents "foo", not with the contents of some_file.gz, and `zgrep -f pattern_file search_file.gz` would not create any temporary file)