CVE-2025-21852

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-21852
Import Source
https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2025-21852.json
JSON Data
https://api.osv.dev/v1/vulns/CVE-2025-21852
Downstream
Related
Published
2025-03-12T10:15:17Z
Modified
2025-03-13T16:30:07Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
[none]
Details

In the Linux kernel, the following vulnerability has been resolved:

net: Add rxskb of kfreeskb to rawtpnull_args[].

Yan Zhai reported a BPF prog could trigger a null-ptr-deref [0] in tracekfreeskb if the prog does not check if rx_sk is NULL.

Commit c53795d48ee8 ("net: add rxsk to tracekfreeskb") added rxsk to tracekfreeskb, but rx_sk is optional and could be NULL.

Let's add kfreeskb to rawtpnullargs[] to let the BPF verifier validate such a prog and prevent the issue.

Now we fail to load such a prog:

libbpf: prog 'drop': -- BEGIN PROG LOAD LOG -- 0: R1=ctx() R10=fp0 ; int BPFPROG(drop, struct skbuff *skb, void *location, @ kfreeskbsknull.bpf.c:21 0: (79) r3 = *(u64 *)(r1 +24) func 'kfreeskb' arg3 has btfid 5253 type STRUCT 'sock' 1: R1=ctx() R3w=trustedptrornullsock(id=1) ; bpfprintk("sk: %d, %d\n", sk, sk->skcommon.skcfamily); @ kfreeskbsknull.bpf.c:24 1: (69) r4 = *(u16 *)(r3 +16) R3 invalid mem access 'trustedptrornull' processed 2 insns (limit 1000000) maxstatesperinsn 0 totalstates 0 peakstates 0 markread 0 -- END PROG LOAD LOG --

Note this fix requires commit 838a10bd2ebf ("bpf: Augment rawtp arguments with PTRMAYBE_NULL").

PF: supervisor read access in kernel mode PF: errorcode(0x0000) - not-present page PGD 0 P4D 0 PREEMPT SMP RIP: 0010:bpfprog5e21a6db8fcff1aadrop+0x10/0x2d Call Trace: <TASK> ? _die+0x1f/0x60 ? pagefaultoops+0x148/0x420 ? searchbpfextables+0x5b/0x70 ? fixupexception+0x27/0x2c0 ? excpagefault+0x75/0x170 ? asmexcpagefault+0x22/0x30 ? bpfprog5e21a6db8fcff1aadrop+0x10/0x2d bpftracerun4+0x68/0xd0 ? unixstreamconnect+0x1f4/0x6f0 skskbreasondrop+0x90/0x120 unixstreamconnect+0x1f4/0x6f0 _sysconnect+0x7f/0xb0 _x64sysconnect+0x14/0x20 dosyscall64+0x47/0xc30 entrySYSCALL64afterhwframe+0x4b/0x53

References

Affected packages

Debian:13 / linux

Package

Name
linux
Purl
pkg:deb/debian/linux?arch=source

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
6.12.17-1

Ecosystem specific

{
    "urgency": "not yet assigned"
}