CVE-2025-40123
Description
A constraint validation bypass was found in the Linux kernel's BPF tailcall compatibility checking. A local user with BPF privileges can trigger this issue by creating two programs with mismatched expected_attach_type values where the entry program performs a tailcall into a target program that has permissions to access different context fields or helper functions. This causes NULL pointer dereferences or undefined behavior when the target program attempts operations only valid for its attach type, resulting in kernel crashes and denial of service.
Statement
BPF programs specify expected_attach_type to enable attach-point-specific functionality beyond the base prog_type. For XDP, BPF_XDP_DEVMAP programs can access xdp_md's egress_ifindex field, while regular XDP programs cannot. For CGROUP_SOCK_ADDR, different attach types permit different helper functions like bpf_bind. Tailcalls allow one program to jump to another, but the compatibility check only verified prog_type matches—not expected_attach_type. An attacker creates progA (e.g., regular XDP) that tailcalls into progB (e.g., XDP_DEVMAP), which then accesses fields or calls helpers it shouldn't have permission to use, causing crashes or uninitialized pointer accesses. The fix enforces expected_attach_type matching for tailcall maps.
Common Vulnerability Scoring System (CVSS) Score Details
Info alert:Important note
CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).
The following CVSS metrics and score provided are preliminary and subject to review.
CVSS v3 Score Breakdown
| Red Hat | NVD | cve.org | |
|---|---|---|---|
| Base Score | 4.4 | N/A | 7.8 |
| Attack Vector | Local | N/A | Local |
| Attack Complexity | Low | N/A | Low |
| Privileges Required | High | N/A | Low |
| User Interaction | None | N/A | None |
| Scope | Unchanged | N/A | Unchanged |
| Confidentiality | None | N/A | High |
| Integrity Impact | None | N/A | High |
| Availability Impact | High | N/A | High |
Vector
Red Hat: CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H
cve.org: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Understanding the Weakness (CWE)
Availability,Integrity,Confidentiality
Technical Impact: Read Memory; Modify Memory; Execute Unauthorized Code or Commands; DoS: Crash, Exit, or Restart
When a memory buffer is accessed using the wrong type, it could read or write memory out of the bounds of the buffer, if the allocated buffer is smaller than the type that the code is attempting to access, leading to a crash and possibly code execution.
Frequently Asked Questions
Not sure what something means? Check out our Security Glossary.
Want to get errata notifications? Sign up here.