aboutsummaryrefslogtreecommitdiff
path: root/debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
diff options
context:
space:
mode:
authorSteve Langasek <vorlon@debian.org>2021-12-06 11:11:31 -0800
committerSteve Langasek <vorlon@debian.org>2021-12-06 11:11:31 -0800
commita3d540fc9aab544f53eb4d2035454a12820bd02d (patch)
treec0ff911dfb5b5d5e719c747165c526681420cb79 /debian/patches-applied/pam_unix_dont_trust_chkpwd_caller.patch
parentea04efa24985743014da9dd22c0581cbaef82ede (diff)
parent17efd306e797a3fe46564896de31583c2c99f338 (diff)
downloadpam-a3d540fc9aab544f53eb4d2035454a12820bd02d.tar.gz
pam-a3d540fc9aab544f53eb4d2035454a12820bd02d.tar.bz2
pam-a3d540fc9aab544f53eb4d2035454a12820bd02d.zip
pam (1.4.0-11) unstable; urgency=medium
* Whitespace fixes in debconf templates. [ Sergio Durigan Junior ] * d/p/pam_env-allow-environment-files-without-EOL-at-EOF.patch: Allow /etc/environment files without EOL at EOF. In other words, allow files without a newline at the end. (LP: #1953201) [dgit import unpatched pam 1.4.0-11]
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 00000000..11d4ee31
--- /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;
+ }
+ }