* [PATCH] net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length
@ 2026-08-03 4:36 Henry Martin
2026-08-06 0:30 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Henry Martin @ 2026-08-03 4:36 UTC (permalink / raw)
To: netdev; +Cc: sam, fercerpav, joel, Henry Martin
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 <bsdhenrymartin@gmail.com>
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
---
net/ncsi/ncsi-netlink.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/ncsi/ncsi-netlink.c b/net/ncsi/ncsi-netlink.c
index 2f872d064396d..29f9dd0b62dc2 100644
--- a/net/ncsi/ncsi-netlink.c
+++ b/net/ncsi/ncsi-netlink.c
@@ -461,6 +461,11 @@ 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)) {
+ /* The payload cannot extend past the data attribute */
+ ret = -EINVAL;
+ goto out_netlink;
+ }
nca.data = data + sizeof(*hdr);
ret = ncsi_xmit_cmd(&nca);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length
2026-08-03 4:36 [PATCH] net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length Henry Martin
@ 2026-08-06 0:30 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-06 0:30 UTC (permalink / raw)
To: Henry Martin; +Cc: netdev, sam, fercerpav, joel
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 3 Aug 2026 12:36:18 +0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length
https://git.kernel.org/netdev/net/c/afa58b738491
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-06 0:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 4:36 [PATCH] net/ncsi: fix heap OOB read in NCSI_CMD_SEND_CMD payload length Henry Martin
2026-08-06 0:30 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox