From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D69DAC142 for ; Mon, 4 Sep 2023 18:35:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5D5B0C433C7; Mon, 4 Sep 2023 18:35:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1693852516; bh=Yj5D4FRIPI1AFPnqux9n0Csz0bZRJBmRjyRYdG71KmE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bY/DAg8Nphcz39r60daQYO/GcMfRxCk/gJ9RESWvcv+K6P8GABRD/JZVJQTxmcpyS 3KuLxtXHkP7Mzv5qHSv+wlUjr783VLVlo+9pd7xPf6mQ3Mx3o1CFIdr2aL1r8V+a9X 1n2ZLoTTM8EQ7thJqhfShsQ8RWvJgkzZ5f+Ip7NI= 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.1 03/31] ksmbd: fix slub overflow in ksmbd_decode_ntlmssp_auth_blob() Date: Mon, 4 Sep 2023 19:30:11 +0100 Message-ID: <20230904182947.157770722@linuxfoundation.org> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230904182946.999390199@linuxfoundation.org> References: <20230904182946.999390199@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-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;