aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2026-10-27 14:31:32 +0000
committerMark Johnston <markj@FreeBSD.org>2026-11-16 21:21:08 +0000
commit0ed72563c53b815b6633167c987c78425523ee61 (patch)
treeeca2b266176b41bceebadbc061ea886f81ebd506
parent59d88f534c804e277e9cd758fce8c535d644a926 (diff)
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
-rw-r--r--usr.sbin/gssd/gssd.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/usr.sbin/gssd/gssd.c b/usr.sbin/gssd/gssd.c
index 54d2062dd29a..a939312633c1 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>
@@ -951,7 +952,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"
@@ -1184,7 +1186,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"