summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-extended/pam/libpam/CVE-2024-22365.patch')
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-22365.patch59
1 files changed, 59 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) {