CVE-2025-40123

bpf: Enforce expected_attach_type for tailcall compatibility

7.8 high EPSS 0.17%

Published 12 Nov 2025 Updated 15 Oct 2026 CNA: Linux

Check your servers for CVE-2025-40123

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2025-40123 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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.

Severity (CVSS)

7.8 high CVSS 3.1 from Linux (CNA)
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Attack vector
local: the attacker needs local access, or a user has to open a prepared file
Attack complexity
low: an attack works without special conditions
Privileges required
low: the attacker needs an ordinary user account
User interaction
none: nobody has to click or open anything
Scope
unchanged: the damage stays inside the vulnerable component
Impact
confidentiality high, integrity high, availability high: what an attacker can read (confidentiality), change (integrity) or stop (availability)

Exploitation

EPSS 0.17%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 6.10% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 15 Oct 2026):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
total: full control of the component or of its data

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before e53a59e7cee5c1605d1ed595933098c2b69108f9
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before dc4f348952173beb8ceb15be30b249276eccb605
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before a99de19128aec0913f3d529f529fbbff5edfaff8
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before 08cb3dc9d2b44f153d0bcf2cb966e4a94b5d0f32
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before f856c598080ba7ce1252867b8ecd6ad5bdaf9a6a
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before c1ad19b5d8e23123503dcaf2d4342e1b90b923ad
affected from 5e43f899b03a3492ce5fc44e8900becb04dae9c0, before 4540aed51b12bc13364149bf95f6ecef013197c0
Other versions: unaffected
Linux
affected 4.17
unaffected before 4.17
unaffected from 5.10.270 up to and including 5.10.*
unaffected from 5.15.221 up to and including 5.15.*
unaffected from 6.1.156 up to and including 6.1.*
unaffected from 6.6.112 up to and including 6.6.*
unaffected from 6.12.53 up to and including 6.12.*
unaffected from 6.17.3 up to and including 6.17.*
unaffected 6.18 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2025-40123 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2025-40123

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2025-40123
trivy image --scanners vuln IMAGE | grep CVE-2025-40123

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2025-40123 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.