CVE-2024-36937
Severity CVSS v4.0:
Pending analysis
Type:
CWE-476
NULL Pointer Dereference
Publication date:
30/05/2024
Last modified:
17/09/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
xdp: use flags field to disambiguate broadcast redirect<br />
<br />
When redirecting a packet using XDP, the bpf_redirect_map() helper will set<br />
up the redirect destination information in struct bpf_redirect_info (using<br />
the __bpf_xdp_redirect_map() helper function), and the xdp_do_redirect()<br />
function will read this information after the XDP program returns and pass<br />
the frame on to the right redirect destination.<br />
<br />
When using the BPF_F_BROADCAST flag to do multicast redirect to a whole<br />
map, __bpf_xdp_redirect_map() sets the &#39;map&#39; pointer in struct<br />
bpf_redirect_info to point to the destination map to be broadcast. And<br />
xdp_do_redirect() reacts to the value of this map pointer to decide whether<br />
it&#39;s dealing with a broadcast or a single-value redirect. However, if the<br />
destination map is being destroyed before xdp_do_redirect() is called, the<br />
map pointer will be cleared out (by bpf_clear_redirect_map()) without<br />
waiting for any XDP programs to stop running. This causes xdp_do_redirect()<br />
to think that the redirect was to a single target, but the target pointer<br />
is also NULL (since broadcast redirects don&#39;t have a single target), so<br />
this causes a crash when a NULL pointer is passed to dev_map_enqueue().<br />
<br />
To fix this, change xdp_do_redirect() to react directly to the presence of<br />
the BPF_F_BROADCAST flag in the &#39;flags&#39; value in struct bpf_redirect_info<br />
to disambiguate between a single-target and a broadcast redirect. And only<br />
read the &#39;map&#39; pointer if the broadcast flag is set, aborting if that has<br />
been cleared out in the meantime. This prevents the crash, while keeping<br />
the atomic (cmpxchg-based) clearing of the map pointer itself, and without<br />
adding any more checks in the non-broadcast fast path.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.14 (including) | 5.15.159 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 6.1.91 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.31 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.8.10 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.9:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc4:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc5:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.9:rc6:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/12481f30128fbebc2eeb55eb2d56390fdfa30c5e
- https://git.kernel.org/stable/c/272bfb019f3cc018f654b992115774e77b4f3ffc
- https://git.kernel.org/stable/c/5bcf0dcbf9066348058b88a510c57f70f384c92c
- https://git.kernel.org/stable/c/6fd81f9d333e7b3532036577b1beb74ba1323553
- https://git.kernel.org/stable/c/e22e25820fa04ea5eaac4ef7ee200e9923f466a4
- https://git.kernel.org/stable/c/12481f30128fbebc2eeb55eb2d56390fdfa30c5e
- https://git.kernel.org/stable/c/272bfb019f3cc018f654b992115774e77b4f3ffc
- https://git.kernel.org/stable/c/5bcf0dcbf9066348058b88a510c57f70f384c92c
- https://git.kernel.org/stable/c/6fd81f9d333e7b3532036577b1beb74ba1323553
- https://git.kernel.org/stable/c/e22e25820fa04ea5eaac4ef7ee200e9923f466a4



