summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDivya Chellam <divya.chellam@windriver.com>2024-12-09 13:26:07 +0000
committerSteve Sakoman <steve@sakoman.com>2024-12-16 05:58:03 -0800
commit2a6fc7fbf2a772464dbf55dc3a645a042e93d866 (patch)
treec0437f15bd68c2ab86fc02a158ab10e7930531a4
parentc6bb0ec77c745e060ef938e7f13d2e6a76774d98 (diff)
downloadpoky-2a6fc7fbf2a772464dbf55dc3a645a042e93d866.tar.gz
libpam: fix CVE-2024-10041
A vulnerability was found in PAM. The secret information is stored in memory, where the attacker can trigger the victim program to execute by sending characters to its standard input (stdin). As this occurs, the attacker can train the branch predictor to execute an ROP chain speculatively. This flaw could result in leaked passwords, such as those found in /etc/shadow while performing authentications. References: https://security-tracker.debian.org/tracker/CVE-2024-10041 Upstream patches: https://github.com/linux-pam/linux-pam/commit/b3020da7da384d769f27a8713257fbe1001878be (From OE-Core rev: 3422c2533caaa2664944315580c52a2272815305) Signed-off-by: Divya Chellam <divya.chellam@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-10041.patch98
-rw-r--r--meta/recipes-extended/pam/libpam_1.5.2.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..cb0490299b
--- /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 f2474a5..b300522 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.2.bb b/meta/recipes-extended/pam/libpam_1.5.2.bb
index 20745aa837..05fe232f6a 100644
--- a/meta/recipes-extended/pam/libpam_1.5.2.bb
+++ b/meta/recipes-extended/pam/libpam_1.5.2.bb
@@ -27,6 +27,7 @@ SRC_URI = "https://github.com/linux-pam/linux-pam/releases/download/v${PV}/Linux
27 file://CVE-2022-28321-0002.patch \ 27 file://CVE-2022-28321-0002.patch \
28 file://0001-pam_motd-do-not-rely-on-all-filesystems-providing-a-.patch \ 28 file://0001-pam_motd-do-not-rely-on-all-filesystems-providing-a-.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] = "e4ec7131a91da44512574268f493c6d8ca105c87091691b8e9b56ca685d4f94d" 33SRC_URI[sha256sum] = "e4ec7131a91da44512574268f493c6d8ca105c87091691b8e9b56ca685d4f94d"