aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2021-01-28 12:25:48 -0500
committerKevin Daudt <kdaudt@alpinelinux.org>2021-01-28 18:18:57 +0000
commit1c77f624d463b095411e4bf4f5af19e287779b45 (patch)
treef9bc6a689c7b02a22661364cfd0ef668582e8ff3
parentf97ce1b46be0dca96ed828f955da8ff8af41fcb0 (diff)
downloadaports-1c77f624d463b095411e4bf4f5af19e287779b45.tar.gz
aports-1c77f624d463b095411e4bf4f5af19e287779b45.tar.bz2
aports-1c77f624d463b095411e4bf4f5af19e287779b45.tar.xz
main/doas: patch out PATH reset vulnerability
-rw-r--r--main/doas/APKBUILD10
-rw-r--r--main/doas/reset-path.patch36
2 files changed, 43 insertions, 3 deletions
diff --git a/main/doas/APKBUILD b/main/doas/APKBUILD
index dee428a648..77cbedbd25 100644
--- a/main/doas/APKBUILD
+++ b/main/doas/APKBUILD
@@ -1,14 +1,17 @@
# Maintainer: Drew DeVault <sir@cmpwn.com>
pkgname=doas
pkgver=6.8
-pkgrel=0
+pkgrel=1
pkgdesc="OpenBSD's temporary privilege escalation tool"
url="https://github.com/Duncaen/OpenDoas"
arch="all"
license="BSD"
makedepends="bison"
subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://github.com/Duncaen/OpenDoas/archive/v$pkgver.tar.gz"
+source="
+ $pkgname-$pkgver.tar.gz::https://github.com/Duncaen/OpenDoas/archive/v$pkgver.tar.gz
+ reset-path.patch
+"
builddir="$srcdir/OpenDoas-$pkgver"
options="$options suid"
@@ -37,4 +40,5 @@ package() {
chmod 440 "$pkgdir"/etc/doas.conf
}
-sha512sums="4a57079bba353247e645bc07a5d4e78fd01471d193e83751fd87b72cffa4e152c0f7ea172563f767a7193b14489f57bc066b4fee50842d30b5b7f7ce918434bb doas-6.8.tar.gz"
+sha512sums="4a57079bba353247e645bc07a5d4e78fd01471d193e83751fd87b72cffa4e152c0f7ea172563f767a7193b14489f57bc066b4fee50842d30b5b7f7ce918434bb doas-6.8.tar.gz
+f261e954e7daf89bb7a8381a0be2942edebe4020b3b304ca1a71a5e5894482f1725e3dc75bc0da0603bde9cb729516010d1fdaeb7cd464b2ad03b131edc614a7 reset-path.patch"
diff --git a/main/doas/reset-path.patch b/main/doas/reset-path.patch
new file mode 100644
index 0000000000..0cf85f1e13
--- /dev/null
+++ b/main/doas/reset-path.patch
@@ -0,0 +1,36 @@
+From bf60b34f014432140b712395da9e792db3f55f06 Mon Sep 17 00:00:00 2001
+From: Duncan Overbruck <mail@duncano.de>
+Date: Thu, 28 Jan 2021 17:58:34 +0100
+Subject: [PATCH] correctly reset path for rules without specific command
+
+This is a fixup for commit 01c658f8c45cb92a343be5f32aa6da70b2032168
+where the behaviour was changed to not inherit the PATH variable
+by default.
+---
+ doas.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/doas.c b/doas.c
+index a184650..d312b24 100644
+--- a/doas.c
++++ b/doas.c
+@@ -386,6 +386,7 @@ main(int argc, char **argv)
+
+ #ifdef HAVE_LOGIN_CAP_H
+ if (setusercontext(NULL, targpw, target, LOGIN_SETGROUP |
++ LOGIN_SETPATH |
+ LOGIN_SETPRIORITY | LOGIN_SETRESOURCES | LOGIN_SETUMASK |
+ LOGIN_SETUSER) != 0)
+ errx(1, "failed to set user context for target");
+@@ -396,6 +397,8 @@ main(int argc, char **argv)
+ err(1, "initgroups");
+ if (setresuid(target, target, target) != 0)
+ err(1, "setresuid");
++ if (setenv("PATH", safepath, 1) == -1)
++ err(1, "failed to set PATH '%s'", safepath);
+ #endif
+
+ if (getcwd(cwdpath, sizeof(cwdpath)) == NULL)
+--
+2.30.0
+