From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9343C71153 for ; Mon, 4 Sep 2023 18:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238534AbjIDSdt (ORCPT ); Mon, 4 Sep 2023 14:33:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232597AbjIDSdt (ORCPT ); Mon, 4 Sep 2023 14:33:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77311B2 for ; Mon, 4 Sep 2023 11:33:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0BC7B61998 for ; Mon, 4 Sep 2023 18:33:41 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 230F6C433C7; Mon, 4 Sep 2023 18:33:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693852420; bh=iBrA2blQRjI305oudANt+C5E7+FyEQSCBA01lwPAYoo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z/D6rmh8WSZyuFYzbq3EOyYUO4IQ9qYOiDgAN/N3CtcpEHau1o00sj/mxgys5YHay 5d5hCNOpovLeXu4KYxiS6DeFhCCpDoT6RUB+WlzCS3NIsYuN36DjzRwJsfIEyAtcMu Tz4h3MIDWWNxyjZ3VeQQ5eFvEvsEYAUIEwAYiCX4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Namjae Jeon , Steve French , zdi-disclosures@trendmicro.com Subject: [PATCH 6.4 03/32] ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob() Date: Mon, 4 Sep 2023 19:30:01 +0100 Message-ID: <20230904182948.059517709@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230904182947.899158313@linuxfoundation.org> References: <20230904182947.899158313@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 6.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Namjae Jeon 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 Signed-off-by: Steve French Signed-off-by: Greg Kroah-Hartman --- fs/smb/server/auth.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/smb/server/auth.c +++ b/fs/smb/server/auth.c @@ -355,6 +355,9 @@ int ksmbd_decode_ntlmssp_auth_blob(struc 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;