summaryrefslogtreecommitdiffstats
path: root/debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:38:36 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 01:38:36 +0000
commitf03a6cee3de793ea6afa30b147e947b215d00011 (patch)
treec207fc88f43b0a66b17464d447cae7c98d9d41af /debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
parentAdding upstream version 1.3.1. (diff)
downloadpam-f03a6cee3de793ea6afa30b147e947b215d00011.tar.xz
pam-f03a6cee3de793ea6afa30b147e947b215d00011.zip
Adding debian version 1.3.1-5.debian/1.3.1-5debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch')
-rw-r--r--debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch b/debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
new file mode 100644
index 0000000..11d4ee3
--- /dev/null
+++ b/debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
@@ -0,0 +1,25 @@
+Dropping suid bits is not enough to let us trust the caller; the unix_chkpwd
+helper could be sgid shadow instead of suid root, as it is in Debian and
+Ubuntu by default. Drop any sgid bits as well.
+
+Authors: Steve Langasek <vorlon@debian.org>,
+ Michael Spang <mspang@csclub.uwaterloo.ca>
+
+Upstream status: to be submitted
+
+Index: pam/modules/pam_unix/unix_chkpwd.c
+===================================================================
+--- pam.orig/modules/pam_unix/unix_chkpwd.c
++++ pam/modules/pam_unix/unix_chkpwd.c
+@@ -137,9 +137,10 @@
+ /* if the caller specifies the username, verify that user
+ matches it */
+ if (strcmp(user, argv[1])) {
++ gid_t gid = getgid();
+ user = argv[1];
+ /* no match -> permanently change to the real user and proceed */
+- if (setuid(getuid()) != 0)
++ if (setresgid(gid, gid, gid) != 0 || setuid(getuid()) != 0)
+ return PAM_AUTH_ERR;
+ }
+ }