mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2026-09-22 09:34:56 +02:00
ieee802154: admin-gate legacy LLSEC dump operations
commit9c1e0b6d49upstream. In net/ieee802154/netlink.c, the legacy IEEE802154_NL family ops table builds the LLSEC dump entries (LLSEC_LIST_KEY, LLSEC_LIST_DEV, LLSEC_LIST_DEVKEY, LLSEC_LIST_SECLEVEL) with IEEE802154_DUMP() which sets no .flags, so generic netlink runs them ungated. The modern nl802154 family admin-gates the equivalent reads via NL802154_CMD_GET_SEC_KEY and friends with .flags = GENL_ADMIN_PERM. Any local uid that can open AF_NETLINK / NETLINK_GENERIC can resolve the "802.15.4 MAC" family and dump LLSEC_LIST_KEY on any wpan netdev that has an LLSEC key installed; the dump handler writes the raw 16-byte AES-128 key bytes (IEEE802154_ATTR_LLSEC_KEY_BYTES, copied verbatim from struct ieee802154_llsec_key.key) into the reply. Recovering the AES key compromises 802.15.4 LLSEC link confidentiality and authenticity, since LLSEC uses CCM* and the same key authenticates and encrypts frames. Impact: any local uid with no capabilities can read the raw 16-byte AES-128 LLSEC key from the kernel keytable on any wpan netdev that has an administrator-installed LLSEC key, by issuing an LLSEC_LIST_KEY dump on the legacy IEEE802154_NL generic-netlink family. Introduce IEEE802154_DUMP_PRIV() mirroring IEEE802154_DUMP() but setting .flags = GENL_ADMIN_PERM, and use it for the four LLSEC dump entries. LIST_PHY and LIST_IFACE retain IEEE802154_DUMP() because the modern nl802154 family exposes their equivalents to unprivileged readers by design (NL802154_CMD_GET_WPAN_PHY and NL802154_CMD_GET_INTERFACE carry "can be retrieved by unprivileged users" annotations). Fixes:3e9c156e2c("ieee802154: add netlink interfaces for llsec") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Michael Bommarito <michael.bommarito@gmail.com> Link: https://lore.kernel.org/20260520141640.1149513-2-michael.bommarito@gmail.com Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
1d4d8ee002
commit
5abe94a205
@@ -23,6 +23,14 @@ void ieee802154_nl_exit(void);
|
||||
.dumpit = _dump, \
|
||||
}
|
||||
|
||||
#define IEEE802154_DUMP_PRIV(_cmd, _func, _dump) \
|
||||
{ \
|
||||
.cmd = _cmd, \
|
||||
.doit = _func, \
|
||||
.dumpit = _dump, \
|
||||
.flags = GENL_ADMIN_PERM, \
|
||||
}
|
||||
|
||||
struct genl_info;
|
||||
|
||||
struct sk_buff *ieee802154_nl_create(int flags, u8 req);
|
||||
|
||||
@@ -98,20 +98,20 @@ static const struct genl_small_ops ieee802154_ops[] = {
|
||||
IEEE802154_OP(IEEE802154_SET_MACPARAMS, ieee802154_set_macparams),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_GETPARAMS, ieee802154_llsec_getparams),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_SETPARAMS, ieee802154_llsec_setparams),
|
||||
IEEE802154_DUMP(IEEE802154_LLSEC_LIST_KEY, NULL,
|
||||
ieee802154_llsec_dump_keys),
|
||||
IEEE802154_DUMP_PRIV(IEEE802154_LLSEC_LIST_KEY, NULL,
|
||||
ieee802154_llsec_dump_keys),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_ADD_KEY, ieee802154_llsec_add_key),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_DEL_KEY, ieee802154_llsec_del_key),
|
||||
IEEE802154_DUMP(IEEE802154_LLSEC_LIST_DEV, NULL,
|
||||
ieee802154_llsec_dump_devs),
|
||||
IEEE802154_DUMP_PRIV(IEEE802154_LLSEC_LIST_DEV, NULL,
|
||||
ieee802154_llsec_dump_devs),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_ADD_DEV, ieee802154_llsec_add_dev),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_DEL_DEV, ieee802154_llsec_del_dev),
|
||||
IEEE802154_DUMP(IEEE802154_LLSEC_LIST_DEVKEY, NULL,
|
||||
ieee802154_llsec_dump_devkeys),
|
||||
IEEE802154_DUMP_PRIV(IEEE802154_LLSEC_LIST_DEVKEY, NULL,
|
||||
ieee802154_llsec_dump_devkeys),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_ADD_DEVKEY, ieee802154_llsec_add_devkey),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_DEL_DEVKEY, ieee802154_llsec_del_devkey),
|
||||
IEEE802154_DUMP(IEEE802154_LLSEC_LIST_SECLEVEL, NULL,
|
||||
ieee802154_llsec_dump_seclevels),
|
||||
IEEE802154_DUMP_PRIV(IEEE802154_LLSEC_LIST_SECLEVEL, NULL,
|
||||
ieee802154_llsec_dump_seclevels),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_ADD_SECLEVEL,
|
||||
ieee802154_llsec_add_seclevel),
|
||||
IEEE802154_OP(IEEE802154_LLSEC_DEL_SECLEVEL,
|
||||
|
||||
Reference in New Issue
Block a user