summaryrefslogtreecommitdiffstats
path: root/meta/recipes-extended
diff options
context:
space:
mode:
authorGuðni Már Gilbert <gudni.m.g@gmail.com>2024-07-24 10:11:35 +0000
committerSteve Sakoman <steve@sakoman.com>2024-08-01 06:08:09 -0700
commitf999c32c8b18c1e1b5573fe79cb4b5a729c2d1a4 (patch)
treeab2030fc9fa0e2253985864d17128d14824dc7a2 /meta/recipes-extended
parent89107e01fb1a930df701cffadc8546b2b110a00d (diff)
downloadpoky-f999c32c8b18c1e1b5573fe79cb4b5a729c2d1a4.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: 6d4c14e1053089a67a38a8de95625e4ba3fbc32a) Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
Diffstat (limited to 'meta/recipes-extended')
-rw-r--r--meta/recipes-extended/pam/libpam/CVE-2024-22365.patch65
-rw-r--r--meta/recipes-extended/pam/libpam_1.5.3.bb1
2 files changed, 66 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..e4ec862dc5
--- /dev/null
+++ b/meta/recipes-extended/pam/libpam/CVE-2024-22365.patch
@@ -0,0 +1,65 @@
1From 84f378d3b8573828e7ccc54b54b5e128aa993748 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
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10Without O_DIRECTORY the path crawling logic is subject to e.g. FIFOs
11being placed in user controlled directories, causing the PAM module to
12block indefinitely during `openat()`.
13
14Pass O_DIRECTORY to cause the `openat()` to fail if the path does not
15refer to a directory.
16
17With this the check whether the final path element is a directory
18becomes unnecessary, drop it.
19
20Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/031bb5a5d0d950253b68138b498dc93be69a64cb]
21CVE: CVE-2024-22365
22Signed-off-by: Guðni Már Gilbert <gudni.m.g@gmail.com>
23---
24 modules/pam_namespace/pam_namespace.c | 18 +-----------------
25 1 file changed, 1 insertion(+), 17 deletions(-)
26
27diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
28index f34ce934..ef856443 100644
29--- a/modules/pam_namespace/pam_namespace.c
30+++ b/modules/pam_namespace/pam_namespace.c
31@@ -1194,7 +1194,7 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir,
32 int dfd = AT_FDCWD;
33 int dfd_next;
34 int save_errno;
35- int flags = O_RDONLY;
36+ int flags = O_RDONLY | O_DIRECTORY;
37 int rv = -1;
38 struct stat st;
39
40@@ -1248,22 +1248,6 @@ static int protect_dir(const char *path, mode_t mode, int do_mkdir,
41 rv = openat(dfd, dir, flags);
42 }
43
44- if (rv != -1) {
45- if (fstat(rv, &st) != 0) {
46- save_errno = errno;
47- close(rv);
48- rv = -1;
49- errno = save_errno;
50- goto error;
51- }
52- if (!S_ISDIR(st.st_mode)) {
53- close(rv);
54- errno = ENOTDIR;
55- rv = -1;
56- goto error;
57- }
58- }
59-
60 if (flags & O_NOFOLLOW) {
61 /* we are inside user-owned dir - protect */
62 if (protect_mount(rv, p, idata) == -1) {
63--
642.43.0
65
diff --git a/meta/recipes-extended/pam/libpam_1.5.3.bb b/meta/recipes-extended/pam/libpam_1.5.3.bb
index ef32d19f3d..bcaa84c9a5 100644
--- a/meta/recipes-extended/pam/libpam_1.5.3.bb
+++ b/meta/recipes-extended/pam/libpam_1.5.3.bb
@@ -26,6 +26,7 @@ SRC_URI = "${GITHUB_BASE_URI}/download/v${PV}/Linux-PAM-${PV}.tar.xz \
26 file://pam-volatiles.conf \ 26 file://pam-volatiles.conf \
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 " 30 "
30 31
31SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283" 32SRC_URI[sha256sum] = "7ac4b50feee004a9fa88f1dfd2d2fa738a82896763050cd773b3c54b0a818283"