-
Notifications
You must be signed in to change notification settings - Fork 551
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[XZ] Add v5.2.5 with security patch and no backdoor author commits (#…
…8396) * [XZ] Add v5.2.5 with security patch and no backdoor author commits * [XZ] Add patch for CVE-2022-1271, ZDI-22-619, ZDI-CAN-16587 * Add gpg verification and Lasse Collin's public key
- Loading branch information
Showing
4 changed files
with
182 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
-----BEGIN PGP PUBLIC KEY BLOCK----- | ||
|
||
mQINBEzEOZIBEACxg/IuXERlDB48JBWmF4NxNUuuup1IhJAJyFGFSKh3OGAO2Ard | ||
sNuRLjANsFXA7m7P5eTFcG+BoHHuAVYmKnI3PPZtHVLnUt4pGItPczQZ2BE1WpcI | ||
ayjGTBJeKItX3Npqg9D/odO9WWS1i3FQPVdrLn0YH37/BA66jeMQCRo7g7GLpaNf | ||
IrvYGsqTbxCwsmA37rpE7oyU4Yrf74HT091WBsRIoq/MelhbxTDMR8eu/dUGZQVc | ||
Kj3lN55RepwWwUUKyqarY0zMt4HkFJ7v7yRL+Cvzy92Ouv4Wf2FlhNtEs5LE4Tax | ||
W0PO5AEmUoKjX87SezQK0f652018b4u6Ex52cY7p+n5TII/UyoowH6+tY8UHo9yb | ||
fStrqgNE/mY2bhA6+AwCaOUGsFzVVPTbjtxL3HacUP/jlA1h78V8VTvTs5d55iG7 | ||
jSqR9o05wje8rwNiXXK0xtiJahyNzL97Kn/DgPSqPIi45G+8nxWSPFM5eunBKRl9 | ||
vAnsvwrdPRsR6YR3uMHTuVhQX9/CY891MHkaZJ6wydWtKt3yQ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C10KwpO+DNX1bZPNR8rZH08FqeZdNcrYzvJTciq4e3cl7hpI/t | ||
dhvkP5qOVsU2+dc5hxqLxavJ8LmcsB9Xgxs9f5SVFpgKqodWG62Ar3et7UvmYwjf | ||
OMblGLmMulQD22hIkIgkhjnPCv/wsv9kvhOLFeWi4DXvKOSlj94GOzxw2PU7dozi | ||
NjYUoJLxRt/E6IBGT/mQExE8Rn+aqkxC23MTwpWM6/p9HHL95UTzzz+BOh7mRvyp | ||
jDI= | ||
=PHuF | ||
-----END PGP PUBLIC KEY BLOCK----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
From 69d1b3fc29677af8ade8dc15dba83f0589cb63d6 Mon Sep 17 00:00:00 2001 | ||
From: Lasse Collin <[email protected]> | ||
Date: Tue, 29 Mar 2022 19:19:12 +0300 | ||
Subject: [PATCH] xzgrep: Fix escaping of malicious filenames (ZDI-CAN-16587). | ||
|
||
Malicious filenames can make xzgrep to write to arbitrary files | ||
or (with a GNU sed extension) lead to arbitrary code execution. | ||
|
||
xzgrep from XZ Utils versions up to and including 5.2.5 are | ||
affected. 5.3.1alpha and 5.3.2alpha are affected as well. | ||
This patch works for all of them. | ||
|
||
This bug was inherited from gzip's zgrep. gzip 1.12 includes | ||
a fix for zgrep. | ||
|
||
The issue with the old sed script is that with multiple newlines, | ||
the N-command will read the second line of input, then the | ||
s-commands will be skipped because it's not the end of the | ||
file yet, then a new sed cycle starts and the pattern space | ||
is printed and emptied. So only the last line or two get escaped. | ||
|
||
One way to fix this would be to read all lines into the pattern | ||
space first. However, the included fix is even simpler: All lines | ||
except the last line get a backslash appended at the end. To ensure | ||
that shell command substitution doesn't eat a possible trailing | ||
newline, a colon is appended to the filename before escaping. | ||
The colon is later used to separate the filename from the grep | ||
output so it is fine to add it here instead of a few lines later. | ||
|
||
The old code also wasn't POSIX compliant as it used \n in the | ||
replacement section of the s-command. Using \<newline> is the | ||
POSIX compatible method. | ||
|
||
LC_ALL=C was added to the two critical sed commands. POSIX sed | ||
manual recommends it when using sed to manipulate pathnames | ||
because in other locales invalid multibyte sequences might | ||
cause issues with some sed implementations. In case of GNU sed, | ||
these particular sed scripts wouldn't have such problems but some | ||
other scripts could have, see: | ||
|
||
info '(sed)Locale Considerations' | ||
|
||
This vulnerability was discovered by: | ||
cleemy desu wayo working with Trend Micro Zero Day Initiative | ||
|
||
Thanks to Jim Meyering and Paul Eggert discussing the different | ||
ways to fix this and for coordinating the patch release schedule | ||
with gzip. | ||
--- | ||
src/scripts/xzgrep.in | 20 ++++++++++++-------- | ||
1 file changed, 12 insertions(+), 8 deletions(-) | ||
|
||
diff --git a/src/scripts/xzgrep.in b/src/scripts/xzgrep.in | ||
index b180936..e5186ba 100644 | ||
--- a/src/scripts/xzgrep.in | ||
+++ b/src/scripts/xzgrep.in | ||
@@ -180,22 +180,26 @@ for i; do | ||
{ test $# -eq 1 || test $no_filename -eq 1; }; then | ||
eval "$grep" | ||
else | ||
+ # Append a colon so that the last character will never be a newline | ||
+ # which would otherwise get lost in shell command substitution. | ||
+ i="$i:" | ||
+ | ||
+ # Escape & \ | and newlines only if such characters are present | ||
+ # (speed optimization). | ||
case $i in | ||
(*' | ||
'* | *'&'* | *'\'* | *'|'*) | ||
- i=$(printf '%s\n' "$i" | | ||
- sed ' | ||
- $!N | ||
- $s/[&\|]/\\&/g | ||
- $s/\n/\\n/g | ||
- ');; | ||
+ i=$(printf '%s\n' "$i" | LC_ALL=C sed 's/[&\|]/\\&/g; $!s/$/\\/');; | ||
esac | ||
- sed_script="s|^|$i:|" | ||
+ | ||
+ # $i already ends with a colon so don't add it here. | ||
+ sed_script="s|^|$i|" | ||
|
||
# Fail if grep or sed fails. | ||
r=$( | ||
exec 4>&1 | ||
- (eval "$grep" 4>&-; echo $? >&4) 3>&- | sed "$sed_script" >&3 4>&- | ||
+ (eval "$grep" 4>&-; echo $? >&4) 3>&- | | ||
+ LC_ALL=C sed "$sed_script" >&3 4>&- | ||
) || r=2 | ||
exit $r | ||
fi >&3 5>&- | ||
-- | ||
2.35.1 | ||
|
Binary file not shown.