summary refs log tree commit diff
path: root/fs
diff options
context:
space:
mode:
authorNamjae Jeon <linkinjeon@kernel.org>2023-08-25 23:40:31 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-09-06 21:26:59 +0100
commit30fd6521b2fbd9b767e438e31945e5ea3e3a2fba (patch)
tree29edc45875155b361d05a783164e40230a6905d3 /fs
parent7d8855fd849d9c3186a9e1d3085ea4aedc6e019f (diff)
downloadlinux-30fd6521b2fbd9b767e438e31945e5ea3e3a2fba.tar.gz
ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob()
commit 4b081ce0d830b684fdf967abc3696d1261387254 upstream.

If authblob->SessionKey.Length is bigger than session key
size(CIFS_KEY_SIZE), slub overflow can happen in key exchange codes.
cifs_arc4_crypt copy to session key array from SessionKey from client.

Cc: stable@vger.kernel.org
Reported-by: zdi-disclosures@trendmicro.com # ZDI-CAN-21940
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/smb/server/auth.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/smb/server/auth.c b/fs/smb/server/auth.c
index 5e5e120edcc2..15e5684e328c 100644
--- a/fs/smb/server/auth.c
+++ b/fs/smb/server/auth.c
@@ -355,6 +355,9 @@ int ksmbd_decode_ntlmssp_auth_blob(struct authenticate_message *authblob,
 		if (blob_len < (u64)sess_key_off + sess_key_len)
 			return -EINVAL;
 
+		if (sess_key_len > CIFS_KEY_SIZE)
+			return -EINVAL;
+
 		ctx_arc4 = kmalloc(sizeof(*ctx_arc4), GFP_KERNEL);
 		if (!ctx_arc4)
 			return -ENOMEM;