cifs: bound invalid NTLMSSP signature diagnostic
Subsystems (2)
PATCH RESEND 1/1 cifs: bound invalid NTLMSSP signature diagnostic
The NTLMSSP Signature field is an eight-byte binary value and need not be NUL-terminated. decode_ntlmssp_challenge() prints it with %s on the signature-mismatch path, so the diagnostic can continue beyond the received blob until it encounters a zero byte.
KASAN reports:
BUG: KASAN: slab-out-of-bounds in string Read of size 1 string vsnprintf _printk decode_ntlmssp_challenge
Print the fixed-width field with the bounded hexadecimal format.
The patched kernel reaches the invalid-signature path and returns -EINVAL without a KASAN report.
--- fs/smb/client/sess.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/smb/client/sess.c +1 -1
@@ -666,7 +666,7 @@ int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len, }if (memcmp (pblob->Signature,"NTLMSSP" ,8 )) { -cifs_dbg (VFS ,"blob signature incorrect %s\n" , +cifs_dbg (VFS ,"blob signature incorrect %8phN\n" , pblob->Signature);return -EINVAL ; }
Signature · 1 line
2.39.5 (Apple Git-154)
Quoted 14 lines · Yifan Zhang
The NTLMSSP Signature field is an eight-byte binary value and need not be NUL-terminated.
decode_ntlmssp_challenge()prints it with %s on the signature-mismatch path, so the diagnostic can continue beyond the received blob until it encounters a zero byte.KASAN reports:
BUG: KASAN: slab-out-of-bounds in string Read of size 1 string vsnprintf _printk decode_ntlmssp_challenge
Quoted 2 lines
Print the fixed-width field with the bounded hexadecimal format.
...
Applied.