Skip to contentSkip to conversation

CVE-2026-23359: bpf: Fix stack-out-of-bounds write in devmap

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Mar 25

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

bpf: Fix stack-out-of-bounds write in devmap

get_upper_ifindexes() iterates over all upper devices and writes their indices into an array without checking bounds.

Also the callers assume that the max number of upper devices is MAX_NEST_DEV and allocate excluded_devices[1+MAX_NEST_DEV] on the stack, but that assumption is not correct and the number of upper devices could be larger than MAX_NEST_DEV (e.g., many macvlans), causing a stack-out-of-bounds write.

Add a max parameter to get_upper_ifindexes() to avoid the issue. When there are too many upper devices, return -EOVERFLOW and abort the redirect.

To reproduce, create more than MAX_NEST_DEV(8) macvlans on a device with an XDP program attached using BPF_F_BROADCAST | BPF_F_EXCLUDE_INGRESS. Then send a packet to the device to trigger the XDP redirect path.

The Linux kernel CVE team has assigned CVE-2026-23359 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 6.1.167 with commit 5000e40acc8d0c36ab709662e32120986ac22e7e
	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 6.6.130 with commit 8a95fb9df1105b1618872c2846a6c01e3ba20b45
	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 6.12.77 with commit d2c31d8e03d05edc16656e5ffe187f0d1da763d7
	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 6.18.17 with commit 75d474702b2ba8b6bcb26eb3004dbc5e95ffd5d2
	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 6.19.7 with commit ca831567908fd3f73cf97d8a6c09a5054697a182
	Issue introduced in 5.15 with commit aeea1b86f9363f3feabb496534d886f082a89f21 and fixed in 7.0-rc2 with commit b7bf516c3ecd9a2aae2dc2635178ab87b734fef1

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-23359

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:
kernel/bpf/devmap.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/5000e40acc8d0c36ab709662e32120986ac22e7e
	https://git.kernel.org/stable/c/8a95fb9df1105b1618872c2846a6c01e3ba20b45
	https://git.kernel.org/stable/c/d2c31d8e03d05edc16656e5ffe187f0d1da763d7
	https://git.kernel.org/stable/c/75d474702b2ba8b6bcb26eb3004dbc5e95ffd5d2
	https://git.kernel.org/stable/c/ca831567908fd3f73cf97d8a6c09a5054697a182
	https://git.kernel.org/stable/c/b7bf516c3ecd9a2aae2dc2635178ab87b734fef1