Skip to content

Commit 326b055

Browse files
shreeya-patel98PlaidCat
authored andcommitted
smb: client: reject userspace cifs.spnego descriptions
cve CVE-2026-46243 commit-author Asim Viladi Oglu Manizada <manizada@pm.me> commit 3da1fdf cifs.spnego key descriptions contain authority-bearing fields such as pid, uid, creduid, and upcall_target that cifs.upcall treats as kernel-originating inputs. However, userspace can also create keys of this type through request_key(2) or add_key(2), allowing those fields to be supplied without CIFS origin. Only accept cifs.spnego descriptions while CIFS is using its private spnego_cred to request the key. Fixes: f1d662a ("[CIFS] Add upcall files for cifs to use spnego/kerberos") Assisted-by: avom-custom-harness:gpt-5.5-qwen3.6-mod-mix Reviewed-by: David Howells <dhowells@redhat.com> Signed-off-by: Asim Viladi Oglu Manizada <manizada@pm.me> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Shreeya Patel <spatel@ciq.com>
1 parent 0a85b25 commit 326b055

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

fs/smb/client/cifs_spnego.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
*/
99

1010
#include <linux/list.h>
11+
#include <linux/cred.h>
1112
#include <linux/slab.h>
1213
#include <linux/string.h>
1314
#include <keys/user-type.h>
@@ -40,12 +41,27 @@ cifs_spnego_key_destroy(struct key *key)
4041
kfree(key->payload.data[0]);
4142
}
4243

44+
static int
45+
cifs_spnego_key_vet_description(const char *description)
46+
{
47+
/*
48+
* cifs.spnego descriptions are authority-bearing inputs to cifs.upcall.
49+
* They are only valid when produced by CIFS while using the private
50+
* spnego_cred installed below. Do not let userspace create this type
51+
* of key through request_key(2)/add_key(2), since the helper treats
52+
* pid/uid/creduid/upcall_target as kernel-originating fields.
53+
*/
54+
if (current_cred() != spnego_cred)
55+
return -EPERM;
56+
return 0;
57+
}
4358

4459
/*
4560
* keytype for CIFS spnego keys
4661
*/
4762
struct key_type cifs_spnego_key_type = {
4863
.name = "cifs.spnego",
64+
.vet_description = cifs_spnego_key_vet_description,
4965
.instantiate = cifs_spnego_key_instantiate,
5066
.destroy = cifs_spnego_key_destroy,
5167
.describe = user_describe,

0 commit comments

Comments
 (0)