Look up another CVE · open CVE-2024-35860 in the interactive tracker
CVE-2024-35860
bpf: support deferring bpf_link dealloc to after RCU grace period
Published 2024-05-19 (2 years ago) by the Linux kernel CNA. Subsystem include/linux. Debian urgency: not yet assigned.
What to do, per Debian release
Debian's own status for CVE-2024-35860 in every release this site tracks, and what each one means in practice. Every status below is the one the Debian Security Team publishes for this CVE. source
| Release | Status | Version | What this means |
|---|---|---|---|
| Debian 12bookworm | vulnerable | 6.1.190-1 | No fix published anywhere yet, neither in Debian nor upstream for the series bookworm tracks. Watch the Debian tracker page for this CVE. Advisories for bookworm have historically landed a median of 23 days after publication. |
| Debian 13trixie | fixed | 6.8.9-1 | Update the kernel and reboot. Fixed in 6.8.9-1. A running kernel keeps the old code until the machine restarts. |
| Debian 14forky | fixed | 6.8.9-1 | Update the kernel and reboot. Fixed in 6.8.9-1. A running kernel keeps the old code until the machine restarts. |
| Debian unstablesid | fixed | 6.8.9-1 | Update the kernel and reboot. Fixed in 6.8.9-1. A running kernel keeps the old code until the machine restarts. |
The vulnerability
What the bug is
BPF link for some program types is passed as a "context" which can be used by those BPF programs to look up additional information. E.g., for multi-kprobes and multi-uprobes, link is used to fetch BPF cookie values. Because of this runtime dependency, when bpf_link refcnt drops to zero there could still be active BPF programs running accessing link data. This patch adds generic support to defer bpf_link dealloc callback to after RCU GP, if requested. This is done by exposing two different deallocation callbacks, one synchronous and one deferred. If deferred one is provided, bpf_link_free() will schedule dealloc_deferred() callback to happen after RCU GP. BPF is using two flavors of RCU: "classic" non-sleepable one and RCU tasks trace one. The latter is used when sleepable BPF programs are used. bpf_link_free() accommodates that by checking underlying BPF program's sleepable flag, and goes either through normal RCU GP only for non-sleepable, or through RCU tasks trace GP *and* then normal RCU GP (taking into account rcu_trace_implies_rcu_gp() optimization), if BPF program is sleepable. We use this for multi-kprobe and multi-uprobe links, which dereference link during program run. We also preventively switch raw_tp link to use deferred dealloc callback, as upcoming changes in bpf-next tree expose raw_tp link data (specifically, cookie value) to BPF program at runtime as well.
Where it lives
The fix touches these files. If the subsystem is one you do not use, the practical exposure is lower, though the package is still the vulnerable one.
include/linux/bpf.h
kernel/bpf/syscall.c
kernel/trace/bpf_trace.c
- What this is
- BPF [CORE]MAINTAINERS section matched on include/linux/bpf* · bpf@vger.kernel.org · Maintained
Check it on the machine
grep -wE 'CONFIG_BPF|CONFIG_BPF_SYSCALL' /boot/config-$(uname -r)Reads the booted kernel's own configuration, on the machine and nowhere else. =y is built in, =m is a module, and an is not set line means the code is not there.
Show whether Debian builds this, per release
Debian builds this code. Every release below compiles the affected file into the kernels it ships.
- bookworm, trixie, forky, sidy
- y
- built into the kernel image on every flavour - only a patch removes it
- Build switches
- CONFIG_BPF, CONFIG_BPF_SYSCALL
- Reads as
- all on means the file is compiled; any one off means it is not.
From the configuration Debian publishes for every kernel flavour it builds. It covers only the architectures Debian ships a linux-config package for, and nothing about a kernel you built yourself. Debian's own status above stays authoritative about the source package.MAINTAINERS kbuild Makefiles Debian linux-config packages
Signals
- Published
- 2024-05-19 (2 years ago)source
- CVSS
- 7.8 high
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:Hsource recompute it - Attack vector
- local (AV:L)source
- EPSS
- 0.24%, higher than 13.6% of all CVEssource
- CISA KEV
- not listedthe KEV catalogue
- Debian urgency
- not yet assignedsource
- Subsystem
- include/linux
Upstream fixes
The versions the CNA records as introducing and fixing this, and the commit for each. source
| Introduced | Fixed in | Commit |
|---|---|---|
| 5.18 | 6.6.26 | 876941f533e7 |
| 5.18 | 6.8.5 | 5d8d44777756 |
| 5.18 | 6.9 | 1a80dbcb2dba |
Why the CNA scored it this way
Quoted from the kernel CNA's own scoring file, word for word. A highlighted metric carries the most severe value CVSS v3.1 defines for it, which is what pushes the score up. source
- AV:LAttack vector, local
- The vulnerability is reached solely through the local `bpf()` syscall — `BPF_PROG_LOAD` plus `BPF_LINK_CREATE` for a kprobe_multi/uprobe_multi link, then closing the link fd while the probes fire. No network or remote-peer input is involved anywhere on the path.
- AC:LAttack complexity, low
- The attacker controls both sides of the race: it picks which kernel/user functions are probed (including ones that block, so return-hooks fire arbitrarily late), drives them in a loop across all CPUs, and closes the link fd at will; three independent syzbot reproducers hit it in practice, so no condition outside attacker influence is required.
- PR:LPrivileges required, low
- Creating these links needs CAP_BPF+CAP_PERFMON, which `bpf_token_capable()` grants at `ns_capable()` level to a delegated BPF token inside a container, and which ordinary non-root tracing/observability service accounts routinely hold — that is a low-privileged account, not administrative control of the host.
- UI:NUser interaction, none
- The whole sequence — load program, create link, trigger the probes, close the fd — happens inside the attacker's own process. No action by any other user or administrator is needed.
- S:UScope, unchanged
- The use-after-free and everything it corrupts stay inside the kernel's own memory and privilege domain; no hypervisor, IOMMU, or other security-authority boundary is crossed.
- C:HConfidentiality impact, high
- `bpf_kprobe_multi_cookie()` bsearches the freed `addrs` array and returns `*cookie` from the freed `cookies` allocation directly to the running BPF program, which can exfiltrate it via a map — a read primitive over attacker-sprayed reclaimed slab, and the freed link is fully groomable.
- I:HIntegrity impact, high
- `kprobe_multi_link_prog_run()`/`uprobe_prog_run()` load `link->link.prog` out of freed memory and then indirect-call through it via `bpf_prog_run()`, and `fprobe_exit_handler()` calls `fp->exit_handler` from the same freed object — an attacker-controlled function-pointer dispatch giving control-flow hijack and full kernel-integrity compromise.
- A:HAvailability impact, high
- Even without weaponization, dereferencing and calling through the freed link produces a KASAN slab-use-after-free splat and a wild indirect branch — an immediate oops or panic — and the attacker can repeat the create/trigger/close cycle indefinitely.