CVE-2025-21852

Source
https://nvd.nist.gov/vuln/detail/CVE-2025-21852
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-21852.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-21852
Downstream
Related
Published
2025-03-12T09:42:07Z
Modified
2025-10-10T07:01:17.974474Z
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
net: Add rx_skb of kfree_skb to raw_tp_null_args[].
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

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
c53795d48ee8f385c6a9e394651e7ee914baaeba
Fixed
f579afacd0a66971fc8481f30d2d377e230a8342
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
c53795d48ee8f385c6a9e394651e7ee914baaeba
Fixed
4dba79c1e7aad6620bbb707b6c4459380fd90860
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
c53795d48ee8f385c6a9e394651e7ee914baaeba
Fixed
5da7e15fb5a12e78de974d8908f348e279922ce9

Affected versions

v6.*

v6.10
v6.10-rc4
v6.10-rc5
v6.10-rc6
v6.10-rc7
v6.11
v6.11-rc1
v6.11-rc2
v6.11-rc3
v6.11-rc4
v6.11-rc5
v6.11-rc6
v6.11-rc7
v6.12
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4
v6.12-rc5
v6.12-rc6
v6.12-rc7
v6.12.1
v6.12.10
v6.12.11
v6.12.12
v6.12.13
v6.12.14
v6.12.15
v6.12.16
v6.12.2
v6.12.3
v6.12.4
v6.12.5
v6.12.6
v6.12.7
v6.12.8
v6.12.9
v6.13
v6.13-rc1
v6.13-rc2
v6.13-rc3
v6.13-rc4
v6.13-rc5
v6.13-rc6
v6.13-rc7
v6.13.1
v6.13.2
v6.13.3
v6.13.4

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.11.0
Fixed
6.12.17
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.13.5