git: 9bbbb1a74dc2 - stable/15 - gssd: Fix unix credential squashing when accepting a context

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 17 Nov 2026 17:05:52 UTC
The branch stable/15 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=9bbbb1a74dc2b47c0d6660c5c9f130e31643cfda

commit 9bbbb1a74dc2b47c0d6660c5c9f130e31643cfda
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2026-10-27 14:31:32 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2026-11-17 16:57:22 +0000

    gssd: Fix unix credential squashing when accepting a context
    
    gssd_accept_sec_context_lucid_v1_1_svc() handles context acceptance when
    MIT Kerberos is in use.  Its last operation is to map the Kerberos
    principal to a local credential subsequently used by the NFS server for
    the authenticated session.
    
    If it fails to resolve the principal to a local user, it is supposed to
    squash the client's credentials.  However, it failed to set the UID
    field, which will end up set to zero, corresponding to the root user on
    the server.  As a result, an authenticated principal that doesn't map to
    a local user ends up being treated as UID 0.
    
    Fix this.  Use names for the nobody user and group.
    
    Approved by:    so
    Security:       FreeBSD-SA-26:78.gssd
    Security:       CVE-2026-101315
    Reported by:    Erik Power
    Reported by:    SecBuddyF, Tencent KeenLab
    Reviewed by:    rmacklem, cy
    Fixes:          e3ac01e18eb3 ("kgssapi: Fix the kgssapi so that it can use MIT Kerberos")
    Sponsored by:   The FreeBSD Foundation
---
 usr.sbin/gssd/gssd.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c
index 5a00dbdd7c97..711e10624155 100644
--- a/usr.sbin/gssd/gssd.c
+++ b/usr.sbin/gssd/gssd.c
@@ -28,6 +28,7 @@
  */
 
 #include <sys/param.h>
+#include <sys/conf.h>
 #include <sys/stat.h>
 #include <sys/linker.h>
 #include <sys/module.h>
@@ -939,7 +940,8 @@ gssd_accept_sec_context_lucid_v1_1_svc(accept_sec_context_lucid_v1_args *argp,
 					result->gidlist.gidlist_val[i] =
 					    groups[i];
 			} else {
-				result->gid = 65534;
+				result->uid = UID_NOBODY;
+				result->gid = GID_NOBODY;
 				result->gidlist.gidlist_len = 0;
 				result->gidlist.gidlist_val = NULL;
 				gssd_verbose_out("gssd_pname_to_uid: mapped"
@@ -1172,7 +1174,7 @@ gssd_pname_to_uid_1_svc(pname_to_uid_args *argp, pname_to_uid_res *result, struc
 				    " to uid=%d, gid=%d\n", (int)result->uid,
 				    (int)result->gid);
 			} else {
-				result->gid = 65534;
+				result->gid = GID_NOBODY;
 				result->gidlist.gidlist_len = 0;
 				result->gidlist.gidlist_val = NULL;
 				gssd_verbose_out("gssd_pname_to_uid: mapped"