linux/net/ncsi
Henry Martin 67c72b8ef6 net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length
[ Upstream commit afa58b7384 ]

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: 9771b8ccdf ("net/ncsi: Extend NC-SI Netlink interface to allow user space to send NC-SI command")
Reported-by: Henry Martin <bsdhenrymartin@gmail.com>
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Link: https://patch.msgid.link/20260803043618.3210301-1-bsdhenrymartin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-08-19 17:14:14 +02:00
..
internal.h net: ncsi: Fix buffer overflow in fetching version id 2025-08-28 16:24:22 +02:00
Kconfig net/ncsi: add NCSI Intel OEM command to keep PHY up 2021-07-08 14:16:39 -07:00
Makefile treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ncsi-aen.c net: ncsi: fix skb leak in error paths 2026-04-18 10:33:15 +02:00
ncsi-cmd.c net/ncsi: Add NC-SI 1.2 Get MC MAC Address command 2025-03-13 12:50:20 +01:00
ncsi-manage.c net/ncsi: wait for the last response to Deselect Package before configuring channel 2025-03-13 12:50:33 +01:00
ncsi-netlink.c net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length 2026-08-19 17:14:14 +02:00
ncsi-netlink.h net/ncsi: Fix netlink registration 2020-11-12 17:00:13 -08:00
ncsi-pkt.h net: ncsi: Fix GCPS 64-bit member variables 2025-06-27 11:05:12 +01:00
ncsi-rsp.c net: ncsi: fix skb leak in error paths 2026-04-18 10:33:15 +02:00