Files
buildroot/package/linux-pam/0006-cve-2025-6020-02.patch
Thomas Perale c5a8cfd581 package/linux-pam: patch CVE-2025-6020
- CVE-2025-6020:
    A flaw was found in linux-pam. The module pam_namespace may use access
    user-controlled paths without proper protection, allowing local users
    to elevate their privileges to root via multiple symlink attacks and
    race conditions.

For more information, see:
  - https://www.cve.org/CVERecord?id=CVE-2025-6020

This fix was backported based on the work of the OpenEmbedded
community. See the link to the original patches in the patch header.

(cherry picked from 30e38505e4)
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
2026-05-28 11:56:50 +02:00

38 lines
1.6 KiB
Diff

From 976c20079358d133514568fc7fd95c02df8b5773 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@strace.io>
Date: Tue, 27 May 2025 08:00:00 +0000
Subject: [PATCH] pam_namespace: secure_opendir: do not look at the group
ownership
When the directory is not group-writable, the group ownership does
not matter, and when it is group-writable, there should not be any
exceptions for the root group as there is no guarantee that the root
group does not include non-root users.
Upstream: https://github.com/linux-pam/linux-pam/commit/976c20079358d133514568fc7fd95c02df8b5773
Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
Upstream: https://github.com/openembedded/openembedded-core/blob/scarthgap/meta/recipes-extended/pam/libpam/CVE-2025-6020-02.patch
CVE: CVE-2025-6020
[thomas: backport from OpenEmbedded patch to 1.6.1]
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
modules/pam_namespace/pam_namespace.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/modules/pam_namespace/pam_namespace.c b/modules/pam_namespace/pam_namespace.c
index 4c8153b..791dd07 100644
--- a/modules/pam_namespace/pam_namespace.c
+++ b/modules/pam_namespace/pam_namespace.c
@@ -215,8 +215,7 @@ static int secure_opendir(const char *path, int opm, mode_t mode,
if (dfd_next == -1)
goto error;
} else if (st.st_uid != 0
- || (st.st_gid != 0 && (st.st_mode & S_IWGRP))
- || (st.st_mode & S_IWOTH)) {
+ || (st.st_mode & (S_IWGRP|S_IWOTH))) {
/* do not follow symlinks on subdirectories */
flags |= O_NOFOLLOW;
}
--
2.49.0