In the Linux kernel, the following vulnerability has been resolved:
eth: nfp: bound the ntuple rule dump by the caller's buffer size
nfp_net_get_fs_loc() dumps every entry of nn->fs.list into rule_locs[]
without consulting cmd->rule_cnt, which is how many entries the caller
had room for. ETHTOOL_GRXCLSRLALL requires no CAP_NET_ADMIN and the
ioctl sizes the buffer from the rule_cnt userspace passes in, so once an
admin has installed flow steering rules any user can ask for fewer slots
than there are rules and run off the end of the allocation. A rule_cnt
of 0 leaves the buffer pointer NULL and the walk dereferences it.
Bail out with -EMSGSIZE when the buffer fills up, the way the other
ntuple capable drivers do, and report how many locations were filled so
a shrinking rule list does not leave the caller reading stale slots.
CVSS Vector: CVSS:3.1/AV:L/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 7
AV:L - The trigger is a local SIOCETHTOOL ioctl (ETHTOOL_GRXCLSRLALL) on a socket, reaching ethtool_get_rxnfc() -> nfp_net_get_rxnfc() -> nfp_net_get_fs_loc(). The rule_cnt that sizes the buffer comes from the local caller, not from any packet off the wire.
AC:H - The overflow needs a non-empty nn->fs.list on an NFP NIC with NFP_NET_CFG_CTRL_FLOW_STEER. Only an admin can create those rules, via set_rxnfc/nfp_net_fs_add with CAP_NET_ADMIN on a physical init-netns device. The unprivileged attacker cannot create this state and must wait for it to exist.
PR:L - dev_ethtool() lists ETHTOOL_GRXCLSRLALL among the commands anyone may run and skips the ns_capable(CAP_NET_ADMIN) check for it. Any local unprivileged user can call it with a small rule_cnt.
UI:N - No victim action is needed. The attacker issues the ioctl whenever they like, once the rules exist as a standing configuration.
S:U - Kernel heap corruption leading to local privilege escalation or a crash stays within the kernel's own security authority.
C:H - ethtool_get_rxnfc() sizes rule_buf with kcalloc(rule_cnt), so the attacker chooses the slab cache. nfp_net_get_fs_loc() then writes up to ~4KB of u32 rule locations past it. That corrupts adjacent kmalloc objects, which can be leveraged into an information leak.
I:H - This is an out-of-bounds heap write into neighbouring slab objects in a cache the attacker chooses, with an attacker-chosen overflow length (rule count minus rule_cnt). It is a memory corruption primitive usable against adjacent object fields.
A:H - With rule_cnt=0, rule_buf stays NULL and rule_locs[0] = entry->loc writes through the NULL pointer, oopsing the kernel. Larger overflows corrupt the slab and can panic the kernel. Either can be repeated at will by an unprivileged user.
| Attack Vector |
Local |
Scope |
Unchanged |
| Attack Complexity |
High |
Confidentiality Impact |
High |
| Privileges Required |
Low |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:L - The trigger is a local SIOCETHTOOL ioctl (ETHTOOL_GRXCLSRLALL) on a socket, reaching ethtool_get_rxnfc() -> nfp_net_get_rxnfc() -> nfp_net_get_fs_loc(). The rule_cnt that sizes the buffer comes from the local caller, not from any packet off the wire.
AC:H - The overflow needs a non-empty nn->fs.list on an NFP NIC with NFP_NET_CFG_CTRL_FLOW_STEER. Only an admin can create those rules, via set_rxnfc/nfp_net_fs_add with CAP_NET_ADMIN on a physical init-netns device. The unprivileged attacker cannot create this state and must wait for it to exist.
PR:L - dev_ethtool() lists ETHTOOL_GRXCLSRLALL among the commands anyone may run and skips the ns_capable(CAP_NET_ADMIN) check for it. Any local unprivileged user can call it with a small rule_cnt.
UI:N - No victim action is needed. The attacker issues the ioctl whenever they like, once the rules exist as a standing configuration.
S:U - Kernel heap corruption leading to local privilege escalation or a crash stays within the kernel's own security authority.
C:H - ethtool_get_rxnfc() sizes rule_buf with kcalloc(rule_cnt), so the attacker chooses the slab cache. nfp_net_get_fs_loc() then writes up to ~4KB of u32 rule locations past it. That corrupts adjacent kmalloc objects, which can be leveraged into an information leak.
I:H - This is an out-of-bounds heap write into neighbouring slab objects in a cache the attacker chooses, with an attacker-chosen overflow length (rule count minus rule_cnt). It is a memory corruption primitive usable against adjacent object fields.
A:H - With rule_cnt=0, rule_buf stays NULL and rule_locs[0] = entry->loc writes through the NULL pointer, oopsing the kernel. Larger overflows corrupt the slab and can panic the kernel. Either can be repeated at will by an unprivileged user.
CVSS 3.1