From: Paulo Alcantara <pc@manguebit.org>
To: Pavel Shilovsky <piastryyy@gmail.com>
Cc: Daniel Birtwhistle <daniel.birtwhistle@gehealthcare.com>,
"Paulo Alcantara (Red Hat)" <pc@manguebit.org>,
Steve French <smfrench@gmail.com>,
linux-cifs@vger.kernel.org
Subject: [PATCH] mount.cifs: prevent stolen creds through SUDO_UID
Date: Tue, 28 Jul 2026 20:35:32 -0300 [thread overview]
Message-ID: <20260728233532.3022799-1-pc@manguebit.org> (raw)
When mount.cifs is invoked with setuid, a non-root user may set
SUDO_UID to be used on the retry kerberos authentication path,
therefore allowing it to mount shares by using credential caches from
different users in the system.
Fix this by trusting the value of SUDO_UID only when mount.cifs is
being executed by sudo or root.
Fixes: 1a1507654c5f ("mount.cifs: use SUDO_UID env variable for cruid")
Reported-by: Daniel Birtwhistle <daniel.birtwhistle@gehealthcare.com>
Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
Cc: Steve French <smfrench@gmail.com>
Cc: linux-cifs@vger.kernel.org
---
mount.cifs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mount.cifs.c b/mount.cifs.c
index b57c7d346f42..f0e9bc7beae2 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -2145,7 +2145,7 @@ int main(int argc, char **argv)
int rc = 0;
int already_uppercased = 0;
int sloppy = 0;
- int fallback_sudo_uid = 0;
+ int fallback_sudo_uid = geteuid() || getuid();
size_t options_size = MAX_OPTIONS_LEN;
struct parsed_mount_info *parsed_info = NULL;
struct parsed_mount_info *reinit_parsed_info = NULL;
--
2.55.0
next reply other threads:[~2026-07-28 23:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 23:35 Paulo Alcantara [this message]
2026-07-29 19:31 ` [PATCH] mount.cifs: prevent stolen creds through SUDO_UID Birtwhistle, Daniel
2026-07-29 21:22 ` Steve French
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260728233532.3022799-1-pc@manguebit.org \
--to=pc@manguebit.org \
--cc=daniel.birtwhistle@gehealthcare.com \
--cc=linux-cifs@vger.kernel.org \
--cc=piastryyy@gmail.com \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox