summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-10041.patch98
-rw-r--r--meta/recipes-extended/pam/libpam_1.5.3.bb1
2 files changed, 99 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/CVE-2024-10041.patch b/meta/recipes-extended/pam/libpam/CVE-2024-10041.patch
new file mode 100644
index 0000000000..41949cbf2a
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/CVE-2024-10041.patch
@@ -0,0 +1,98 @@
1From b3020da7da384d769f27a8713257fbe1001878be Mon Sep 17 00:00:00 2001
2From: "Dmitry V. Levin" <ldv@strace.io>
3Date: Mon, 1 Jan 2024 12:00:00 +0000
4Subject: [PATCH] pam_unix/passverify: always run the helper to obtain shadow
5 password file entries
6
7Initially, when pam_unix.so verified the password, it used to try to
8obtain the shadow password file entry for the given user by invoking
9getspnam(3), and only when that didn't work and the effective uid
10was nonzero, pam_unix.so used to invoke the helper as a fallback.
11
12When SELinux support was introduced by commit
1367aab1ff5515054341a438cf9804e9c9b3a88033, the fallback was extended
14also for the case when SELinux was enabled.
15
16Later, commit f220cace205332a3dc34e7b37a85e7627e097e7d extended the
17fallback conditions for the case when pam_modutil_getspnam() failed
18with EACCES.
19
20Since commit 470823c4aacef5cb3b1180be6ed70846b61a3752, the helper is
21invoked as a fallback when pam_modutil_getspnam() fails for any reason.
22
23The ultimate solution for the case when pam_unix.so does not have
24permissions to obtain the shadow password file entry is to stop trying
25to use pam_modutil_getspnam() and to invoke the helper instead.
26Here are two recent examples.
27
28https://github.com/linux-pam/linux-pam/pull/484 describes a system
29configuration where libnss_systemd is enabled along with libnss_files
30in the shadow entry of nsswitch.conf, so when libnss_files is unable
31to obtain the shadow password file entry for the root user, e.g. when
32SELinux is enabled, NSS falls back to libnss_systemd which returns
33a synthesized shadow password file entry for the root user, which
34in turn locks the root user out.
35
36https://bugzilla.redhat.com/show_bug.cgi?id=2150155 describes
37essentially the same problem in a similar system configuration.
38
39This commit is the final step in the direction of addressing the issue:
40for password verification pam_unix.so now invokes the helper instead of
41making the pam_modutil_getspnam() call.
42
43* modules/pam_unix/passverify.c (get_account_info) [!HELPER_COMPILE]:
44Always return PAM_UNIX_RUN_HELPER instead of trying to obtain
45the shadow password file entry.
46
47Complements: https://github.com/linux-pam/linux-pam/pull/386
48Resolves: https://github.com/linux-pam/linux-pam/pull/484
49Link: https://github.com/authselect/authselect/commit/1e78f7e048747024a846fd22d68afc6993734e92
50
51CVE: CVE-2024-10041
52
53Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/b3020da7da384d769f27a8713257fbe1001878be]
54
55Signed-off-by: Divya Chellam <divya.chellam@windriver.com>
56---
57 modules/pam_unix/passverify.c | 21 +++++++++++----------
58 1 file changed, 11 insertions(+), 10 deletions(-)
59
60diff --git a/modules/pam_unix/passverify.c b/modules/pam_unix/passverify.c
61index 81b10d8..97a81d6 100644
62--- a/modules/pam_unix/passverify.c
63+++ b/modules/pam_unix/passverify.c
64@@ -237,20 +237,21 @@ PAMH_ARG_DECL(int get_account_info,
65 return PAM_UNIX_RUN_HELPER;
66 #endif
67 } else if (is_pwd_shadowed(*pwd)) {
68+#ifdef HELPER_COMPILE
69 /*
70- * ...and shadow password file entry for this user,
71+ * shadow password file entry for this user,
72 * if shadowing is enabled
73 */
74- *spwdent = pam_modutil_getspnam(pamh, name);
75- if (*spwdent == NULL) {
76-#ifndef HELPER_COMPILE
77- /* still a chance the user can authenticate */
78- return PAM_UNIX_RUN_HELPER;
79-#endif
80- return PAM_AUTHINFO_UNAVAIL;
81- }
82- if ((*spwdent)->sp_pwdp == NULL)
83+ *spwdent = getspnam(name);
84+ if (*spwdent == NULL || (*spwdent)->sp_pwdp == NULL)
85 return PAM_AUTHINFO_UNAVAIL;
86+#else
87+ /*
88+ * The helper has to be invoked to deal with
89+ * the shadow password file entry.
90+ */
91+ return PAM_UNIX_RUN_HELPER;
92+#endif
93 }
94 } else {
95 return PAM_USER_UNKNOWN;
96--
972.40.0
98
diff --git a/meta/recipes-extended/pam/libpam_1.5.3.bb b/meta/recipes-extended/pam/libpam_1.5.3.bb
index f05272652d..55b4dd7ee1 100644
--- a/meta/recipes-extended/pam/libpam_1.5.3.bb
+++ b/meta/recipes-extended/pam/libpam_1.5.3.bb
@@ -27,6 +27,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/Linux-PAM-${PV}.tar.xz \
27 file://0001-pam_namespace-include-stdint-h.patch \ 27 file://0001-pam_namespace-include-stdint-h.patch \
28 file://0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch \ 28 file://0001-pam_pwhistory-fix-passing-NULL-filename-argument-to-.patch \
29 file://CVE-2024-22365.patch \ 29 file://CVE-2024-22365.patch \
30 file://CVE-2024-10041.patch \
30 " 31 "
31 32
32SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283" 33SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283"