summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch')
-rw-r--r--meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch49
1 files changed, 49 insertions, 0 deletions
diff --git a/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch b/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch
new file mode 100644
index 0000000000..9ca7c2f202
--- /dev/null
+++ b/meta/recipes-connectivity/openssh/openssh/CVE-2021-41617.patch
@@ -0,0 +1,49 @@
1From 1f0707e8e78ef290fd0f229df3fcd2236f29db89 Mon Sep 17 00:00:00 2001
2From: Changqing Li <changqing.li@windriver.com>
3Date: Thu, 28 Oct 2021 11:11:05 +0800
4Subject: [PATCH] upstream: need initgroups() before setresgid(); reported by
5 anton@,
6
7ok deraadt@
8
9OpenBSD-Commit-ID: 6aa003ee658b316960d94078f2a16edbc25087ce
10
11CVE: CVE-2021-41617
12Upstream-Status: [Backport]
13https://github.com/openssh/openssh-portable/commit/f3cbe43e28fe71427d41cfe3a17125b972710455
14https://github.com/openssh/openssh-portable/commit/bf944e3794eff5413f2df1ef37cddf96918c6bde
15
16Signed-off-by: Changqing Li <changqing.li@windriver.com>
17---
18 misc.c | 8 ++++++++
19 1 file changed, 8 insertions(+)
20
21diff --git a/misc.c b/misc.c
22index d988ce3..33eca1c 100644
23--- a/misc.c
24+++ b/misc.c
25@@ -56,6 +56,7 @@
26 #ifdef HAVE_PATHS_H
27 # include <paths.h>
28 #include <pwd.h>
29+#include <grp.h>
30 #endif
31 #ifdef SSH_TUN_OPENBSD
32 #include <net/if.h>
33@@ -2629,6 +2630,13 @@ subprocess(const char *tag, const char *command,
34 }
35 closefrom(STDERR_FILENO + 1);
36
37+ if (geteuid() == 0 &&
38+ initgroups(pw->pw_name, pw->pw_gid) == -1) {
39+ error("%s: initgroups(%s, %u): %s", tag,
40+ pw->pw_name, (u_int)pw->pw_gid, strerror(errno));
41+ _exit(1);
42+ }
43+
44 if (setresgid(pw->pw_gid, pw->pw_gid, pw->pw_gid) == -1) {
45 error("%s: setresgid %u: %s", tag, (u_int)pw->pw_gid,
46 strerror(errno));
47--
482.17.1
49