VDB

CVE-2025-40123

CVE-2025-40123 PUBLISHED CVSS 7.8 HIGH

bpf: Enforce expected_attach_type for tailcall compatibility

Reported by linux · Published November 12, 2025

In the Linux kernel, the following vulnerability has been resolved: bpf: Enforce expected_attach_type for tailcall compatibility Yinhao et al. recently reported: Our fuzzer tool discovered an uninitialized pointer issue in the bpf_prog_test_run_xdp() function within the Linux kernel's BPF subsystem. This leads to a NULL pointer dereference when a BPF program attempts to deference the txq member of struct xdp_buff object. The test initializes two programs of BPF_PROG_TYPE_XDP: progA acts as the entry point for bpf_prog_test_run_xdp() and its expected_attach_type can neither be of be BPF_XDP_DEVMAP nor BPF_XDP_CPUMAP. progA calls into a slot of a tailcall map it owns. progB's expected_attach_type must be BPF_XDP_DEVMAP to pass xdp_is_valid_access() validation. The program returns struct xdp_md's egress_ifindex, and the latter is only allowed to be accessed under mentioned expected_attach_type. progB is then inserted into the tailcall which progA calls. The underlying issue goes beyond XDP though. Another example are programs of type BPF_PROG_TYPE_CGROUP_SOCK_ADDR. sock_addr_is_valid_access() as well as sock_addr_func_proto() have different logic depending on the programs' expected_attach_type. Similarly, a program attached to BPF_CGROUP_INET4_GETPEERNAME should not be allowed doing a tailcall into a program which calls bpf_bind() out of BPF which is only enabled for BPF_CGROUP_INET4_CONNECT. In short, specifying expected_attach_type allows to open up additional functionality or restrictions beyond what the basic bpf_prog_type enables. The use of tailcalls must not violate these constraints. Fix it by enforcing expected_attach_type in __bpf_prog_map_compatible(). Note that we only enforce this for tailcall maps, but not for BPF devmaps or cpumaps: There, the programs are invoked through dev_map_bpf_prog_run*() and cpu_map_bpf_prog_run*() which set up a new environment / context and therefore these situations are not prone to this issue.

Fixed versions

Upgrade to a fixed version or later. Language registries are listed first, then Linux distributions, then vendor products.

PackageEcosystemFixed in
kernel-livepatch-6.12.53-69.119Amazon Linux1:1.0-0.amzn2023
perf6.12Amazon Linux1:6.12.53-69.119.amzn2023
kernel6.12Amazon Linux1:6.12.53-69.119.amzn2023
bpftoolAmazon Linux1:6.1.156-177.286.amzn2023
kernel-libbpf-develAmazon Linux1:6.1.156-177.286.amzn2023
kernel6.12-libbpf-staticAmazon Linux1:6.12.53-69.119.amzn2023
perfAmazon Linux1:6.1.156-177.286.amzn2023
kernel6.12-modules-extra-commonAmazon Linux1:6.12.53-69.119.amzn2023
kernel6.12-tools-develAmazon Linux1:6.12.53-69.119.amzn2023
python3-perfAmazon Linux1:6.1.156-177.286.amzn2023
kernel6.12-libbpfAmazon Linux1:6.12.53-69.119.amzn2023
bpftool6.12Amazon Linux1:6.12.53-69.119.amzn2023

2 more packages have a fixed version. See every fix in Lookup.

Risk scores

CVSS 3.1
7.8
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Affected products

VendorProductVersions
LinuxLinux5e43f899b03a3492ce5fc44e8900becb04dae9c0, 5e43f899b03a3492ce5fc44e8900becb04dae9c0, 5e43f899b03a3492ce5fc44e8900becb04dae9c0
LinuxLinux4.17, 0, 5.10.270
amazon:2023kernel-livepatch-6.12.53-69.1190
amazon:2023perf6.120
amazon:2023kernel6.120
amazon:2023bpftool0
amazon:2023kernel-libbpf-devel0
amazon:2023kernel6.12-libbpf-static0
amazon:2023perf0
amazon:2023kernel6.12-modules-extra-common0
amazon:2023kernel6.12-tools-devel0
amazon:2023python3-perf0
amazon:2023kernel6.12-libbpf0
amazon:2023bpftool6.120
amazon:2023kernel-modules-extra0
amazon:2023kernel0
linuxlinux_kernel4.17, 4.17, 4.17
amazon:2023kernel6.12-headers0
amazon:2023kernel-devel0
amazon:2023kernel-libbpf-static0

…and 12 more

Timeline

  • Oct 12, 2025 PoC Published (12 in total, the first dated here)
  • Oct 27, 2025 CVE Published
  • Nov 12, 2025 EPSS Score (30 in total, the first dated here)
  • Mar 29, 2026 Distribution Patch (187 in total, the first dated here)
  • Mar 29, 2026 Security Advisory (193 in total, the first dated here)
  • Jun 8, 2026 Coalition ESS Score

Query this with the API

The same record, from the CLI:

vulnetix vdb vuln CVE-2025-40123
vulnetix vdb fixes CVE-2025-40123

Or with curl, using the org id and key from your account page:

curl -s -H "Authorization: ApiKey ${VULNETIX_ORG_ID}:${VULNETIX_API_KEY}" \
  "https://api.vdb.vulnetix.com/v2/vuln/CVE-2025-40123/fixes/registry"

The Community plan is free and allows 50 queries a day. Get a free API key · API quickstart

References

Look up in the Resolve Platform →
$ Lookup Community · 50/day Open Lookup ›