summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHitendra Prajapati <hprajapati@mvista.com>2024-01-19 11:19:54 +0530
committerSteve Sakoman <steve@sakoman.com>2024-01-24 04:04:55 -1000
commitb3e1dabe66cf0cb488649d20331efd65b0717426 (patch)
tree2aedb8c03ec4e645ff29658b1e2a82d1c17bd94b
parent80b4e5f953511191049f5240fb582a574165853a (diff)
downloadpoky-b3e1dabe66cf0cb488649d20331efd65b0717426.tar.gz
pam: fix CVE-2024-22365 pam_namespace misses
Upstream-Status: Backport from https://github.com/linux-pam/linux-pam/commit/031bb5a5d0d950253b68138b498dc93be69a64cb (From OE-Core rev: 9af2e012ee4483541559788dfb9510e0223daefe) Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-22365.patch62
-rw-r--r--meta/recipes-extended/pam/libpam_1.5.2.bb1
2 files changed, 63 insertions, 0 deletions
diff --git a/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch b/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch
new file mode 100644
index 0000000000..e9e3a078e0
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch
@@ -0,0 +1,62 @@
1From 031bb5a5d0d950253b68138b498dc93be69a64cb Mon Sep 17 00:00:00 2001
2From: Matthias Gerstner <matthias.gerstner@suse.de>
3Date: Wed, 27 Dec 2023 14:01:59 +0100
4Subject: [PATCH] pam_namespace: protect_dir(): use O_DIRECTORY to prevent
5 local DoS situations
6
7Without O_DIRECTORY the path crawling logic is subject to e.g. FIFOs
8being placed in user controlled directories, causing the PAM module to
9block indefinitely during `openat()`.
10
11Pass O_DIRECTORY to cause the `openat()` to fail if the path does not
12refer to a directory.
13
14With this the check whether the final path element is a directory
15becomes unnecessary, drop it.
16
17Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/031bb5a5d0d950253b68138b498dc93be69a64cb]
18CVE: CVE-2024-22365
19Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
20---
21 modules/pam_namespace/pam_namespace.c | 18 +-----------------
22 1 file changed, 1 insertion(+), 17 deletions(-)
23
24diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
25index 4d4188d..d6b1d3c 100644
26--- a/modules/pam_namespace/pam_namespace.c
27+++ b/modules/pam_namespace/pam_namespace.c
28@@ -1103,7 +1103,7 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir,
29 int dfd = AT_FDCWD;
30 int dfd_next;
31 int save_errno;
32- int flags = O_RDONLY;
33+ int flags = O_RDONLY | O_DIRECTORY;
34 int rv = -1;
35 struct stat st;
36
37@@ -1157,22 +1157,6 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir,
38 rv = openat(dfd, dir, flags);
39 }
40
41- if (rv != -1) {
42- if (fstat(rv, &st) != 0) {
43- save_errno = errno;
44- close(rv);
45- rv = -1;
46- errno = save_errno;
47- goto error;
48- }
49- if (!S_ISDIR(st.st_mode)) {
50- close(rv);
51- errno = ENOTDIR;
52- rv = -1;
53- goto error;
54- }
55- }
56-
57 if (flags & O_NOFOLLOW) {
58 /* we are inside user-owned dir - protect */
59 if (protect_mount(rv, p, idata) == -1) {
60--
612.25.1
62
diff --git a/meta/recipes-extended/pam/libpam_1.5.2.bb b/meta/recipes-extended/pam/libpam_1.5.2.bb
index 0799102f8e..20745aa837 100644
--- a/meta/recipes-extended/pam/libpam_1.5.2.bb
+++ b/meta/recipes-extended/pam/libpam_1.5.2.bb
@@ -26,6 +26,7 @@ SRC_URI = "https://github.com/linux-pam/linux-pam/releases/download/v${PV}/Linux
26 file://pam-volatiles.conf \ 26 file://pam-volatiles.conf \
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 " 30 "
30 31
31SRC_URI[sha256sum] = "e4ec7131a91da44512574268f493c6d8ca105c87091691b8e9b56ca685d4f94d" 32SRC_URI[sha256sum] = "e4ec7131a91da44512574268f493c6d8ca105c87091691b8e9b56ca685d4f94d"