CVE-2025-40123
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.
| Package | Ecosystem | Fixed in |
|---|---|---|
| kernel-livepatch-6.12.53-69.119 | Amazon Linux | 1:1.0-0.amzn2023 |
| perf6.12 | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| kernel6.12 | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| bpftool | Amazon Linux | 1:6.1.156-177.286.amzn2023 |
| kernel-libbpf-devel | Amazon Linux | 1:6.1.156-177.286.amzn2023 |
| kernel6.12-libbpf-static | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| perf | Amazon Linux | 1:6.1.156-177.286.amzn2023 |
| kernel6.12-modules-extra-common | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| kernel6.12-tools-devel | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| python3-perf | Amazon Linux | 1:6.1.156-177.286.amzn2023 |
| kernel6.12-libbpf | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
| bpftool6.12 | Amazon Linux | 1:6.12.53-69.119.amzn2023 |
2 more packages have a fixed version. See every fix in Lookup.
Risk scores
Affected products
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | 5e43f899b03a3492ce5fc44e8900becb04dae9c0, 5e43f899b03a3492ce5fc44e8900becb04dae9c0, 5e43f899b03a3492ce5fc44e8900becb04dae9c0 |
| Linux | Linux | 4.17, 0, 5.10.270 |
| amazon:2023 | kernel-livepatch-6.12.53-69.119 | 0 |
| amazon:2023 | perf6.12 | 0 |
| amazon:2023 | kernel6.12 | 0 |
| amazon:2023 | bpftool | 0 |
| amazon:2023 | kernel-libbpf-devel | 0 |
| amazon:2023 | kernel6.12-libbpf-static | 0 |
| amazon:2023 | perf | 0 |
| amazon:2023 | kernel6.12-modules-extra-common | 0 |
| amazon:2023 | kernel6.12-tools-devel | 0 |
| amazon:2023 | python3-perf | 0 |
| amazon:2023 | kernel6.12-libbpf | 0 |
| amazon:2023 | bpftool6.12 | 0 |
| amazon:2023 | kernel-modules-extra | 0 |
| amazon:2023 | kernel | 0 |
| linux | linux_kernel | 4.17, 4.17, 4.17 |
| amazon:2023 | kernel6.12-headers | 0 |
| amazon:2023 | kernel-devel | 0 |
| amazon:2023 | kernel-libbpf-static | 0 |
…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