{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2025-21884","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","state":"PUBLISHED","assignerShortName":"Linux","dateReserved":"2024-12-29T08:45:45.782Z","datePublished":"2025-03-27T14:57:12.486Z","dateUpdated":"2026-08-05T11:55:06.894Z"},"containers":{"cna":{"providerMetadata":{"orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","shortName":"Linux","dateUpdated":"2026-08-05T11:55:06.894Z"},"descriptions":[{"lang":"en","value":"In the Linux kernel, the following vulnerability has been resolved:\n\nnet: better track kernel sockets lifetime\n\nWhile kernel sockets are dismantled during pernet_operations->exit(),\ntheir freeing can be delayed by any tx packets still held in qdisc\nor device queues, due to skb_set_owner_w() prior calls.\n\nThis then trigger the following warning from ref_tracker_dir_exit() [1]\n\nTo fix this, make sure that kernel sockets own a reference on net->passive.\n\nAdd sk_net_refcnt_upgrade() helper, used whenever a kernel socket\nis converted to a refcounted one.\n\n[1]\n\n[  136.263918][   T35] ref_tracker: net notrefcnt@ffff8880638f01e0 has 1/2 users at\n[  136.263918][   T35]      sk_alloc+0x2b3/0x370\n[  136.263918][   T35]      inet6_create+0x6ce/0x10f0\n[  136.263918][   T35]      __sock_create+0x4c0/0xa30\n[  136.263918][   T35]      inet_ctl_sock_create+0xc2/0x250\n[  136.263918][   T35]      igmp6_net_init+0x39/0x390\n[  136.263918][   T35]      ops_init+0x31e/0x590\n[  136.263918][   T35]      setup_net+0x287/0x9e0\n[  136.263918][   T35]      copy_net_ns+0x33f/0x570\n[  136.263918][   T35]      create_new_namespaces+0x425/0x7b0\n[  136.263918][   T35]      unshare_nsproxy_namespaces+0x124/0x180\n[  136.263918][   T35]      ksys_unshare+0x57d/0xa70\n[  136.263918][   T35]      __x64_sys_unshare+0x38/0x40\n[  136.263918][   T35]      do_syscall_64+0xf3/0x230\n[  136.263918][   T35]      entry_SYSCALL_64_after_hwframe+0x77/0x7f\n[  136.263918][   T35]\n[  136.343488][   T35] ref_tracker: net notrefcnt@ffff8880638f01e0 has 1/2 users at\n[  136.343488][   T35]      sk_alloc+0x2b3/0x370\n[  136.343488][   T35]      inet6_create+0x6ce/0x10f0\n[  136.343488][   T35]      __sock_create+0x4c0/0xa30\n[  136.343488][   T35]      inet_ctl_sock_create+0xc2/0x250\n[  136.343488][   T35]      ndisc_net_init+0xa7/0x2b0\n[  136.343488][   T35]      ops_init+0x31e/0x590\n[  136.343488][   T35]      setup_net+0x287/0x9e0\n[  136.343488][   T35]      copy_net_ns+0x33f/0x570\n[  136.343488][   T35]      create_new_namespaces+0x425/0x7b0\n[  136.343488][   T35]      unshare_nsproxy_namespaces+0x124/0x180\n[  136.343488][   T35]      ksys_unshare+0x57d/0xa70\n[  136.343488][   T35]      __x64_sys_unshare+0x38/0x40\n[  136.343488][   T35]      do_syscall_64+0xf3/0x230\n[  136.343488][   T35]      entry_SYSCALL_64_after_hwframe+0x77/0x7f"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The bug is triggered entirely through local syscalls — `unshare(CLONE_NEWUSER|CLONE_NEWNET)` to create the netns, netlink/rtnetlink to add a device and a delaying qdisc, then namespace exit to run `cleanup_net()`; the syzbot traces show the path rooted at `__x64_sys_unshare`. No remote peer input is required or sufficient to reach it.\nAC:L - The attacker controls both halves of the window: they configure the device/qdisc that holds the kernel socket's TX skb (e.g. netem delay) and they choose exactly when to destroy the namespace, so the socket reliably outlives `net_passive_dec()`; the syzkaller reproducer hit it repeatably. Namespace churn also lets the attacker groom the freed `net_cachep` object before the deferred `__sk_destruct()` runs.\nPR:L - An unprivileged local account can create the network namespace and its per-netns kernel sockets via unprivileged user namespaces (`unshare -Urn`), which is enabled by default on mainstream distributions and Android. CAP_NET_ADMIN inside the new netns — granted automatically — is enough to add the device and qdisc needed to delay the kernel socket's skbs.\nUI:N - The attacking process performs every step itself: create the namespace, configure the delaying queue, trigger MLD/NDISC transmission, and exit. No victim action or cooperating process is needed.\nS:U - The freed `struct net`/`net->gen` slab objects and the sockets that dereference them all live in the kernel's own security authority. No hypervisor, IOMMU, or sandbox boundary is crossed, so this is standard in-kernel corruption.\nC:H - The kernel socket retains a completely unreferenced `struct net *`, so after `net_passive_dec()` frees `net->gen` and returns the `struct net` to `net_cachep`, subsequent `sock_net(sk)` dereferences read reallocated slab contents — the same class of defect that produced a KASAN slab-use-after-free read in the companion commit `65161fb544aa`. A use-after-free on a long-lived, attacker-groomable object yields an information-disclosure primitive.\nI:H - `__sk_destruct()` performs `__netns_tracker_free(sock_net(sk), &sk->ns_tracker, false)` on the dangling pointer, driving `ref_tracker_free()`'s list unlink and counter updates into the freed-and-reallocated `struct net`, which is a write into attacker-groomed memory. Reallocating the freed slot with a fresh namespace also lets the stale socket operate on the wrong `struct net`, corrupting per-netns state and enabling escalation to control-flow hijack.\nA:H - Use-after-free of `struct net` and its freed `net->gen` array produces oopses and panics even when not weaponized, and the pre-fix condition additionally trips `ref_tracker_dir_exit()`'s WARN with `CONFIG_NET_NS_REFCNT_TRACKER=y` (fatal under `panic_on_warn`). The sequence can be repeated in a loop by an unprivileged user until the box crashes."}]}],"affected":[{"product":"Linux","vendor":"Linux","defaultStatus":"unaffected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/sock.h","net/core/sock.c","net/mptcp/subflow.c","net/netlink/af_netlink.c","net/rds/tcp.c","net/smc/af_smc.c","net/sunrpc/svcsock.c","net/sunrpc/xprtsock.c"],"versions":[{"version":"0cafd77dcd032d1687efaba5598cf07bce85997f","lessThan":"2668e038800b946d269f96ec1b258c01930a242c","status":"affected","versionType":"git"},{"version":"0cafd77dcd032d1687efaba5598cf07bce85997f","lessThan":"4ceb0bd4ffd009821b585ce6a8033b12b59fb5fb","status":"affected","versionType":"git"},{"version":"0cafd77dcd032d1687efaba5598cf07bce85997f","lessThan":"c31a732fac46b00b95b78fcc9c37cb48dd6f2e0c","status":"affected","versionType":"git"},{"version":"0cafd77dcd032d1687efaba5598cf07bce85997f","lessThan":"5c70eb5c593d64d93b178905da215a9fd288a4b5","status":"affected","versionType":"git"}]},{"product":"Linux","vendor":"Linux","defaultStatus":"affected","repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["include/net/sock.h","net/core/sock.c","net/mptcp/subflow.c","net/netlink/af_netlink.c","net/rds/tcp.c","net/smc/af_smc.c","net/sunrpc/svcsock.c","net/sunrpc/xprtsock.c"],"versions":[{"version":"6.2","status":"affected"},{"version":"0","lessThan":"6.2","status":"unaffected","versionType":"semver"},{"version":"6.6.103","lessThanOrEqual":"6.6.*","status":"unaffected","versionType":"semver"},{"version":"6.12.43","lessThanOrEqual":"6.12.*","status":"unaffected","versionType":"semver"},{"version":"6.13.6","lessThanOrEqual":"6.13.*","status":"unaffected","versionType":"semver"},{"version":"6.14","lessThanOrEqual":"*","status":"unaffected","versionType":"original_commit_for_fix"}]}],"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.6.103"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.12.43"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.13.6"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.2","versionEndExcluding":"6.14"}]}]}],"references":[{"url":"https://git.kernel.org/stable/c/2668e038800b946d269f96ec1b258c01930a242c"},{"url":"https://git.kernel.org/stable/c/4ceb0bd4ffd009821b585ce6a8033b12b59fb5fb"},{"url":"https://git.kernel.org/stable/c/c31a732fac46b00b95b78fcc9c37cb48dd6f2e0c"},{"url":"https://git.kernel.org/stable/c/5c70eb5c593d64d93b178905da215a9fd288a4b5"}],"title":"net: better track kernel sockets lifetime","x_generator":{"engine":"bippy-1.2.0"}}}}