summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVijay Anusuri <vanusuri@mvista.com>2024-01-24 09:35:24 +0530
committerSteve Sakoman <steve@sakoman.com>2024-01-31 03:51:10 -1000
commit70de5ee7d1203779901b54d29fc7a1ee39a55ad3 (patch)
tree8291ee7cd8033b0d1a566ada79b3e274c0b35427
parent574b30350364287ca9c29f44174d8448f140b278 (diff)
downloadpoky-70de5ee7d1203779901b54d29fc7a1ee39a55ad3.tar.gz
pam: Fix for CVE-2024-22365
Upstream-Status: Backport from https://github.com/linux-pam/linux-pam/commit/031bb5a5d0d950253b68138b498dc93be69a64cb (From OE-Core rev: a3fbe1156fccb3e60a183263a3bde5a8ef6725a8) Signed-off-by: Vijay Anusuri <vanusuri@mvista.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-22365.patch59
-rw-r--r--meta/recipes-extended/pam/libpam_1.3.1.bb1
2 files changed, 60 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..33ac37b7f0
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch
@@ -0,0 +1,59 @@
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: Vijay Anusuri <vanusuri@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 2528cff86..f72d67189 100644
26--- a/modules/pam_namespace/pam_namespace.c
27+++ b/modules/pam_namespace/pam_namespace.c
28@@ -1201,7 +1201,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@@ -1255,22 +1255,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) {
diff --git a/meta/recipes-extended/pam/libpam_1.3.1.bb b/meta/recipes-extended/pam/libpam_1.3.1.bb
index bc72afe6ad..527a368e2d 100644
--- a/meta/recipes-extended/pam/libpam_1.3.1.bb
+++ b/meta/recipes-extended/pam/libpam_1.3.1.bb
@@ -24,6 +24,7 @@ SRC_URI = "https://github.com/linux-pam/linux-pam/releases/download/v${PV}/Linux
24 file://pam-security-abstract-securetty-handling.patch \ 24 file://pam-security-abstract-securetty-handling.patch \
25 file://pam-unix-nullok-secure.patch \ 25 file://pam-unix-nullok-secure.patch \
26 file://crypt_configure.patch \ 26 file://crypt_configure.patch \
27 file://CVE-2024-22365.patch \
27 " 28 "
28 29
29SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165" 30SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165"