|
|
9ba2f6 |
From 02e0f94fff27cad2ba4e65bdc4b21146b3bd9a97 Mon Sep 17 00:00:00 2001
|
|
|
9ba2f6 |
From: Oliver Kiddle <opk@zsh.org>
|
|
|
9ba2f6 |
Date: Wed, 15 Dec 2021 01:56:40 +0100
|
|
|
9ba2f6 |
Subject: [PATCH 1/2] security/41: Don't perform PROMPT_SUBST evaluation on
|
|
|
9ba2f6 |
%F/%K arguments
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
Mitigates CVE-2021-45444
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
Upstream-commit: c187154f47697cdbf822c2f9d714d570ed4a0fd1
|
|
|
9ba2f6 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
9ba2f6 |
---
|
|
|
9ba2f6 |
Src/prompt.c | 10 ++++++++++
|
|
|
9ba2f6 |
1 file changed, 10 insertions(+)
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
diff --git a/Src/prompt.c b/Src/prompt.c
|
|
|
9ba2f6 |
index b65bfb8..91e21c8 100644
|
|
|
9ba2f6 |
--- a/Src/prompt.c
|
|
|
9ba2f6 |
+++ b/Src/prompt.c
|
|
|
9ba2f6 |
@@ -244,6 +244,12 @@ parsecolorchar(zattr arg, int is_fg)
|
|
|
9ba2f6 |
bv->fm += 2; /* skip over F{ */
|
|
|
9ba2f6 |
if ((ep = strchr(bv->fm, '}'))) {
|
|
|
9ba2f6 |
char oc = *ep, *col, *coll;
|
|
|
9ba2f6 |
+ int ops = opts[PROMPTSUBST], opb = opts[PROMPTBANG];
|
|
|
9ba2f6 |
+ int opp = opts[PROMPTPERCENT];
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+ opts[PROMPTPERCENT] = 1;
|
|
|
9ba2f6 |
+ opts[PROMPTSUBST] = opts[PROMPTBANG] = 0;
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
*ep = '\0';
|
|
|
9ba2f6 |
/* expand the contents of the argument so you can use
|
|
|
9ba2f6 |
* %v for example */
|
|
|
9ba2f6 |
@@ -252,6 +258,10 @@ parsecolorchar(zattr arg, int is_fg)
|
|
|
9ba2f6 |
arg = match_colour((const char **)&coll, is_fg, 0);
|
|
|
9ba2f6 |
free(col);
|
|
|
9ba2f6 |
bv->fm = ep;
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+ opts[PROMPTSUBST] = ops;
|
|
|
9ba2f6 |
+ opts[PROMPTBANG] = opb;
|
|
|
9ba2f6 |
+ opts[PROMPTPERCENT] = opp;
|
|
|
9ba2f6 |
} else {
|
|
|
9ba2f6 |
arg = match_colour((const char **)&bv->fm, is_fg, 0);
|
|
|
9ba2f6 |
if (*bv->fm != '}')
|
|
|
9ba2f6 |
--
|
|
|
9ba2f6 |
2.34.1
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
From 6102afb5dfd7c704f9cf99bedb9c3ec3c7dbe8e3 Mon Sep 17 00:00:00 2001
|
|
|
9ba2f6 |
From: dana <dana@dana.is>
|
|
|
9ba2f6 |
Date: Tue, 21 Dec 2021 13:13:33 -0600
|
|
|
9ba2f6 |
Subject: [PATCH 2/2] CVE-2021-45444: Update NEWS/README
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
Upstream-commit: bdc4d70a7e033b754e68a8659a037ea0fc5f38de
|
|
|
9ba2f6 |
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
|
9ba2f6 |
---
|
|
|
9ba2f6 |
NEWS | 20 ++++++++++++++++++++
|
|
|
9ba2f6 |
README | 6 ++++++
|
|
|
9ba2f6 |
2 files changed, 26 insertions(+)
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
diff --git a/NEWS b/NEWS
|
|
|
9ba2f6 |
index 964e163..327b449 100644
|
|
|
9ba2f6 |
--- a/NEWS
|
|
|
9ba2f6 |
+++ b/NEWS
|
|
|
9ba2f6 |
@@ -4,6 +4,26 @@ CHANGES FROM PREVIOUS VERSIONS OF ZSH
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
Note also the list of incompatibilities in the README file.
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
+Changes since 5.8
|
|
|
9ba2f6 |
+-----------------
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+CVE-2021-45444: Some prompt expansion sequences, such as %F, support
|
|
|
9ba2f6 |
+'arguments' which are themselves expanded in case they contain colour
|
|
|
9ba2f6 |
+values, etc. This additional expansion would trigger PROMPT_SUBST
|
|
|
9ba2f6 |
+evaluation, if enabled. This could be abused to execute code the user
|
|
|
9ba2f6 |
+didn't expect. e.g., given a certain prompt configuration, an attacker
|
|
|
9ba2f6 |
+could trick a user into executing arbitrary code by having them check
|
|
|
9ba2f6 |
+out a Git branch with a specially crafted name.
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+This is fixed in the shell itself by no longer performing PROMPT_SUBST
|
|
|
9ba2f6 |
+evaluation on these prompt-expansion arguments.
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+Users who are concerned about an exploit but unable to update their
|
|
|
9ba2f6 |
+binaries may apply the partial work-around described in the file
|
|
|
9ba2f6 |
+Etc/CVE-2021-45444-VCS_Info-workaround.patch included with the shell
|
|
|
9ba2f6 |
+source. [ Reported by RyotaK <security@ryotak.me>. Additional thanks to
|
|
|
9ba2f6 |
+Marc Cornellà <hello@mcornella.com>. ]
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
Changes since 5.7.1-test-3
|
|
|
9ba2f6 |
--------------------------
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
diff --git a/README b/README
|
|
|
9ba2f6 |
index 7f1dd5f..c9e994a 100644
|
|
|
9ba2f6 |
--- a/README
|
|
|
9ba2f6 |
+++ b/README
|
|
|
9ba2f6 |
@@ -31,6 +31,12 @@ Zsh is a shell with lots of features. For a list of some of these, see the
|
|
|
9ba2f6 |
file FEATURES, and for the latest changes see NEWS. For more
|
|
|
9ba2f6 |
details, see the documentation.
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
+Incompatibilities since 5.8
|
|
|
9ba2f6 |
+---------------------------
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
+PROMPT_SUBST expansion is no longer performed on arguments to prompt-
|
|
|
9ba2f6 |
+expansion sequences such as %F.
|
|
|
9ba2f6 |
+
|
|
|
9ba2f6 |
Incompatibilities since 5.7.1
|
|
|
9ba2f6 |
-----------------------------
|
|
|
9ba2f6 |
|
|
|
9ba2f6 |
--
|
|
|
9ba2f6 |
2.34.1
|
|
|
9ba2f6 |
|