aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Daudt <kdaudt@alpinelinux.org>2022-01-25 21:33:44 +0000
committerKevin Daudt <kdaudt@alpinelinux.org>2022-01-25 21:50:15 +0000
commit8f89436f46604cd7b31c4d8778eddc07a498079c (patch)
tree52d27c14bee71f40a923e763a721aaf8fc2da6fb
parentcd6f370db5b7cf97463a7da4148014d53c78942c (diff)
community/polkit: mitigate CVE-2021-4034
https://www.openwall.com/lists/oss-security/2022/01/25/11
-rw-r--r--community/polkit/APKBUILD6
-rw-r--r--community/polkit/CVE-2021-4034.patch79
2 files changed, 84 insertions, 1 deletions
diff --git a/community/polkit/APKBUILD b/community/polkit/APKBUILD
index 908a5d5e582..f012a2051e2 100644
--- a/community/polkit/APKBUILD
+++ b/community/polkit/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=polkit
pkgver=0.119
-pkgrel=7
+pkgrel=8
pkgdesc="Application development toolkit for controlling system-wide privileges"
url="https://www.freedesktop.org/wiki/Software/polkit/"
arch="all !mips !mips64 !s390x !riscv64" # Rust
@@ -44,9 +44,12 @@ source="https://www.freedesktop.org/software/polkit/releases/polkit-$pkgver.tar.
make-innetgr-optional.patch
alpine-polkit.pam
polkit.initd
+ CVE-2021-4034.patch
"
# secfixes:
+# 0.119-r8:
+# - CVE-2021-4034
# 0.119-r0:
# - CVE-2021-3560
@@ -208,4 +211,5 @@ sha512sums="
0c47751e928a91ce3a477a330ef38b8f6f003b515c94e7fb9842e6f2043be43d749ab7390cc1dbcf1fa6128b62cf0eab353d4f8855d68e595bc53777512f4562 make-innetgr-optional.patch
f5102dc00d390b3a3c957b62e1712db778c7ffb7378f3d8e816c0757c11a308c5d5303e42595b0d6add9839247c773880cd34e56afacc89eb6efaadf9aae7826 alpine-polkit.pam
f6e5ac0ed41feb392dfd104979ec577c5936f3db2bd252b12b7b9b2609a0901dae38bebec1ea65ccf4f427860b520383ae4d2c66fb74ab986c715f6b0ad50473 polkit.initd
+462ca97dd15e1035c1df3b7fcaf8f803b3d9ddd3f9d0188889c1b1fc4c5290d717b684b2f355d0840c6f733d9bef906363a1242d6079478abb2aaaf15a357b45 CVE-2021-4034.patch
"
diff --git a/community/polkit/CVE-2021-4034.patch b/community/polkit/CVE-2021-4034.patch
new file mode 100644
index 00000000000..a06300a5307
--- /dev/null
+++ b/community/polkit/CVE-2021-4034.patch
@@ -0,0 +1,79 @@
+From a2bf5c9c83b6ae46cbd5c779d3055bff81ded683 Mon Sep 17 00:00:00 2001
+From: Jan Rybar <jrybar@redhat.com>
+Date: Tue, 25 Jan 2022 17:21:46 +0000
+Subject: [PATCH] pkexec: local privilege escalation (CVE-2021-4034)
+
+---
+ src/programs/pkcheck.c | 5 +++++
+ src/programs/pkexec.c | 23 ++++++++++++++++++++---
+ 2 files changed, 25 insertions(+), 3 deletions(-)
+
+diff --git a/src/programs/pkcheck.c b/src/programs/pkcheck.c
+index f1bb4e1..768525c 100644
+--- a/src/programs/pkcheck.c
++++ b/src/programs/pkcheck.c
+@@ -363,6 +363,11 @@ main (int argc, char *argv[])
+ local_agent_handle = NULL;
+ ret = 126;
+
++ if (argc < 1)
++ {
++ exit(126);
++ }
++
+ /* Disable remote file access from GIO. */
+ setenv ("GIO_USE_VFS", "local", 1);
+
+diff --git a/src/programs/pkexec.c b/src/programs/pkexec.c
+index 7698c5c..84e5ef6 100644
+--- a/src/programs/pkexec.c
++++ b/src/programs/pkexec.c
+@@ -488,6 +488,15 @@ main (int argc, char *argv[])
+ pid_t pid_of_caller;
+ gpointer local_agent_handle;
+
++
++ /*
++ * If 'pkexec' is called THIS wrong, someone's probably evil-doing. Don't be nice, just bail out.
++ */
++ if (argc<1)
++ {
++ exit(127);
++ }
++
+ ret = 127;
+ authority = NULL;
+ subject = NULL;
+@@ -614,10 +623,10 @@ main (int argc, char *argv[])
+
+ path = g_strdup (pwstruct.pw_shell);
+ if (!path)
+- {
++ {
+ g_printerr ("No shell configured or error retrieving pw_shell\n");
+ goto out;
+- }
++ }
+ /* If you change this, be sure to change the if (!command_line)
+ case below too */
+ command_line = g_strdup (path);
+@@ -636,7 +645,15 @@ main (int argc, char *argv[])
+ goto out;
+ }
+ g_free (path);
+- argv[n] = path = s;
++ path = s;
++
++ /* argc<2 and pkexec runs just shell, argv is guaranteed to be null-terminated.
++ * /-less shell shouldn't happen, but let's be defensive and don't write to null-termination
++ */
++ if (argv[n] != NULL)
++ {
++ argv[n] = path;
++ }
+ }
+ if (access (path, F_OK) != 0)
+ {
+--
+GitLab
+