From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 D3D9E54781; Mon, 17 Aug 2026 14:18:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976311; cv=none; b=DvhwbSGvkDi9Z56mB25RJu72NLz9QQXZ+o5PUJ2q+1PWN08kD82iwW8h5prHPNIIsYRIunipiv7SaNwuyqe3z/6hTVQUDFSyDgD8+To+XJVKb16u1KhA+bGGuZQrgEUnf9fKGTlkwjXtvkXy0g53RCJAyo2FdHu8/KaiBEHrvXQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786976311; c=relaxed/simple; bh=+4EQoFnnD+gtr4Qs/TNQ6d2V2vYo5LI1ceY4SIG87hw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sEMe99QDEf+GsWPibls7+gkzIJy+ly3mDO6DDLGLJo174DdWVkjhNSIBWJ17DJuXxn1Pi6m116Wm3JMb+olKi4iADIaj36twSBOb2uWwmj37TLvdFhEWE2NPJGq08s/hhbKuh1wvmBmaIVqYQ3ui5W2SSUCzhHBbTC9Ei0lajz4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=XRbC6JDY; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="XRbC6JDY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6203B1F000E9; Mon, 17 Aug 2026 14:18:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1786976310; bh=a0JXNmKQw/o3F8B76toauyj8oyI0nIb4LlNXGmcN8jQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=XRbC6JDYBwzTlJ41L7ZtwERL1SC0c5mHtkSXtIhbNlgbelFYmztFNRBz7QHmjsLr9 tqKJTiJxYn+zyfKtix7sv/07cvpNWoZFEwk6scRUZTPN6X3LIWJ5N9/x215vG/G1+q FYA3Kdi+ANKdDgFZw7gO0fQNzi+Ikwr4qm8bAynQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Henry Martin , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.10 330/389] net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length Date: Mon, 17 Aug 2026 15:32:49 +0200 Message-ID: <20260817132551.763098498@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260817132538.796021292@linuxfoundation.org> References: <20260817132538.796021292@linuxfoundation.org> User-Agent: quilt/0.69 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 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Henry Martin [ Upstream commit afa58b7384913c8773d837acdb07b035690ec5d2 ] ncsi_send_cmd_nl() takes the number of bytes to copy from the attacker-controlled ncsi_pkt_hdr.length field of the in-band packet header, while the source buffer is the NCSI_ATTR_DATA netlink attribute whose readable size is nla_len() - sizeof(ncsi_pkt_hdr). The two length sources are never cross-checked: only nla_len() >= sizeof(struct ncsi_pkt_hdr) is enforced. With hdr->length set larger than the attribute payload (up to 65535 against at most 2032 readable bytes), ncsi_cmd_handler_oem() copies past the end of the netlink attribute buffer with unsafe_memcpy(), leaking up to ~64KB of kernel heap memory into the transmitted NCSI command packet. The destination skb is sized by the declared payload, so the write side does not overflow - this is a pure OOB read / information leak, reachable with CAP_NET_ADMIN on systems with a registered NCSI device (e.g. OpenBMC on Aspeed BMC SoCs, where NET_NCSI=y is standard). Reject commands whose declared payload extends past the end of the data attribute. The issue was found by the autokbug dynamic kernel fuzzer at Tencent Yunding Lab. Fixes: 9771b8ccdfa6 ("net/ncsi: Extend NC-SI Netlink interface to allow user space to send NC-SI command") Reported-by: Henry Martin Signed-off-by: Henry Martin Link: https://patch.msgid.link/20260803043618.3210301-1-bsdhenrymartin@gmail.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ncsi/ncsi-netlink.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c index db350b8f5d88b..82b22368a540a 100644 --- a/net/ncsi/ncsi-netlink.c +++ b/net/ncsi/ncsi-netlink.c @@ -461,6 +461,10 @@ static int ncsi_send_cmd_nl(struct sk_buff *msg, struct genl_info *info) nca.req_flags = NCSI_REQ_FLAG_NETLINK_DRIVEN; nca.info = info; nca.payload = ntohs(hdr->length); + if (nca.payload > len - sizeof(*hdr)) { + ret = -EINVAL; + goto out_netlink; + } nca.data = data + sizeof(*hdr); ret = ncsi_xmit_cmd(&nca); -- 2.53.0