public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH net 0/6] net/ncsi: harden packet parsing against malformed BMC replies
@ 2026-04-22 16:03 Michael Bommarito
  2026-04-22 16:03 ` [PATCH net 1/6] net/ncsi: validate response packet lengths against the skb Michael Bommarito
                   ` (6 more replies)
  0 siblings, 7 replies; 9+ messages in thread
From: Michael Bommarito @ 2026-04-22 16:03 UTC (permalink / raw)
  To: Samuel Mendoza-Jonas, Paul Fertser, netdev
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, linux-kernel, Michael Bommarito

NC-SI treats the management controller as privileged, but the Linux
packet parser still needs to reject malformed or truncated replies
instead of walking past the skb or past its software filter tables.

This series closes six linked parser issues in net/ncsi:

  - short replies accepted before response header/checksum reads
  - GC/GP count fields exceeding software filter limits
  - GMCMA address counts exceeding payload-backed addresses
  - OEM response parsing that trusts vendor-specific payload offsets
  - short AEN packets accepted before AEN header/payload reads
  - GP payloads not checked against the consumed MAC/VLAN table bytes

The threat model here is a compromised BMC or management-channel MITM
on the NC-SI link. This is not internet-reachable remote input, so I am
sending it as a public [PATCH net] series with Cc: stable rather than
through security@.

Testing:

  - x86_64 defconfig with CONFIG_NET_NCSI=y and
    CONFIG_NCSI_OEM_CMD_GET_MAC=y:
    `make -C ~/src/linux-mainline O=~/src/build-ncsi-bmc-oob ARCH=x86_64
    -j$(nproc) net/ncsi/`
  - live x86_64/KASAN QEMU guest for the GP path: guest `virtio-net`
    registered with NCSI, `SP -> CIS -> GC -> GP` issued over the
    `NCSI` generic-netlink family, and a host tap responder returning
    matching NC-SI frames.  Without the series applied, a GP reply
    with mac_cnt=65 triggers
    `KASAN: slab-out-of-bounds in ncsi_rsp_handler_gp()`.  With the
    series applied, the same reply is rejected with `-ERANGE` and no
    KASAN report.
  - synthetic A/B userspace harness covering the other malformed-
    response cases: without the series, parsing either faults or
    corrupts adjacent state; with the series, each case is rejected
    or clamped at the parser boundary.

Impact / regression notes:

  - libclang call-graph query shows ncsi_validate_rsp_pkt() is only
    reached from ncsi_rcv_rsp() and ncsi_rsp_handler_dc(), so the new
    skb-length guard stays local to the response path.
  - cscope shows ncsi_aen_handler() is only reached from ncsi_rcv_rsp(),
    so the new AEN pulls stay local to AEN dispatch.
  - cscope on n_vids shows the downstream consumers are the response
    parser, the manage-side VLAN bitmap walkers, and ncsi-netlink's
    channel dump path, which is the surface this series intentionally
    tightens.

Michael Bommarito (6):
  net/ncsi: validate response packet lengths against the skb
  net/ncsi: bound filter table state to software limits
  net/ncsi: validate GMCMA address counts against the payload
  net/ncsi: validate OEM response payloads before parsing
  net/ncsi: validate AEN packet lengths against the skb
  net/ncsi: validate GP payload lengths before parsing

 net/ncsi/ncsi-aen.c |  30 +++++++++---
 net/ncsi/ncsi-rsp.c | 114 ++++++++++++++++++++++++++++++++++++++++----
 2 files changed, 128 insertions(+), 16 deletions(-)

-- 
2.53.0

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-04-22 17:07 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-22 16:03 [PATCH net 0/6] net/ncsi: harden packet parsing against malformed BMC replies Michael Bommarito
2026-04-22 16:03 ` [PATCH net 1/6] net/ncsi: validate response packet lengths against the skb Michael Bommarito
2026-04-22 16:03 ` [PATCH net 2/6] net/ncsi: bound filter table state to software limits Michael Bommarito
2026-04-22 16:03 ` [PATCH net 3/6] net/ncsi: validate GMCMA address counts against the payload Michael Bommarito
2026-04-22 16:03 ` [PATCH net 4/6] net/ncsi: validate OEM response payloads before parsing Michael Bommarito
2026-04-22 16:03 ` [PATCH net 5/6] net/ncsi: validate AEN packet lengths against the skb Michael Bommarito
2026-04-22 16:03 ` [PATCH net 6/6] net/ncsi: validate GP payload lengths before parsing Michael Bommarito
2026-04-22 16:44 ` [PATCH net 0/6] net/ncsi: harden packet parsing against malformed BMC replies Paul Fertser
2026-04-22 17:06   ` Michael Bommarito

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox