diff options
author | Vijay Anusuri <vanusuri@mvista.com> | 2024-01-24 09:35:24 +0530 |
---|---|---|
committer | Steve Sakoman <steve@sakoman.com> | 2024-01-31 03:51:10 -1000 |
commit | 70de5ee7d1203779901b54d29fc7a1ee39a55ad3 (patch) | |
tree | 8291ee7cd8033b0d1a566ada79b3e274c0b35427 /meta/recipes-extended/pam | |
parent | 574b30350364287ca9c29f44174d8448f140b278 (diff) | |
download | poky-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>
Diffstat (limited to 'meta/recipes-extended/pam')
-rw-r--r-- | meta/recipes-extended/pam/libpam/CVE-2024-22365.patch | 59 | ||||
-rw-r--r-- | meta/recipes-extended/pam/libpam_1.3.1.bb | 1 |
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 @@ | |||
1 | From 031bb5a5d0d950253b68138b498dc93be69a64cb Mon Sep 17 00:00:00 2001 | ||
2 | From: Matthias Gerstner <matthias.gerstner@suse.de> | ||
3 | Date: Wed, 27 Dec 2023 14:01:59 +0100 | ||
4 | Subject: [PATCH] pam_namespace: protect_dir(): use O_DIRECTORY to prevent | ||
5 | local DoS situations | ||
6 | |||
7 | Without O_DIRECTORY the path crawling logic is subject to e.g. FIFOs | ||
8 | being placed in user controlled directories, causing the PAM module to | ||
9 | block indefinitely during `openat()`. | ||
10 | |||
11 | Pass O_DIRECTORY to cause the `openat()` to fail if the path does not | ||
12 | refer to a directory. | ||
13 | |||
14 | With this the check whether the final path element is a directory | ||
15 | becomes unnecessary, drop it. | ||
16 | |||
17 | Upstream-Status: Backport [https://github.com/linux-pam/linux-pam/commit/031bb5a5d0d950253b68138b498dc93be69a64cb] | ||
18 | CVE: CVE-2024-22365 | ||
19 | Signed-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 | |||
24 | diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c | ||
25 | index 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 | ||
29 | SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165" | 30 | SRC_URI[md5sum] = "558ff53b0fc0563ca97f79e911822165" |