]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob()
authorNamjae Jeon <linkinjeon@kernel.org>
Mon, 18 Dec 2023 15:34:24 +0000 (00:34 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Dec 2023 09:41:58 +0000 (10:41 +0100)
[ Upstream commit 4b081ce0d830b684fdf967abc3696d1261387254 ]

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>
fs/ksmbd/auth.c

index ee912d24ad94500005a5911e60fe93de7cf08220..9a08e6a90b94d0df821b870b3c3358714c0b6a5b 100644 (file)
@@ -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;