ksmbd: avoid out of bounds access in decode_preauth_ctxt()
authorDavid Disseldorp <ddiss@suse.de>
Thu, 13 Apr 2023 14:49:57 +0000 (23:49 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 20 Apr 2023 10:35:12 +0000 (12:35 +0200)
commita2f6ded41bec1d3be643c80a5eb97f1680309001
treed7b52dc28397cba659e0ed3c06b4e1b4d155f58b
parent2128f7c00fa5d5bca1186588f4f197faad2b4460
ksmbd: avoid out of bounds access in decode_preauth_ctxt()

commit e7067a446264a7514fa1cfaa4052cdb6803bc6a2 upstream.

Confirm that the accessed pneg_ctxt->HashAlgorithms address sits within
the SMB request boundary; deassemble_neg_contexts() only checks that the
eight byte smb2_neg_context header + (client controlled) DataLength are
within the packet boundary, which is insufficient.

Checking for sizeof(struct smb2_preauth_neg_context) is overkill given
that the type currently assumes SMB311_SALT_SIZE bytes of trailing Salt.

Signed-off-by: David Disseldorp <ddiss@suse.de>
Acked-by: Namjae Jeon <linkinjeon@kernel.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ksmbd/smb2pdu.c