Skip to content

Commit

Permalink
ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob()
Browse files Browse the repository at this point in the history
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.

Reported-by: [email protected] # ZDI-CAN-21940
Signed-off-by: Namjae Jeon <[email protected]>
  • Loading branch information
namjaejeon committed Aug 25, 2023
1 parent 34af6fa commit 04216d3
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions auth.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,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;
Expand Down

0 comments on commit 04216d3

Please sign in to comment.