CVE-2025-21884 (GCVE-0-2025-21884)
Vulnerability from cvelistv5
Published
2025-03-27 14:57
Modified
2026-08-05 11:55
Summary
In the Linux kernel, the following vulnerability has been resolved: net: better track kernel sockets lifetime While kernel sockets are dismantled during pernet_operations->exit(), their freeing can be delayed by any tx packets still held in qdisc or device queues, due to skb_set_owner_w() prior calls. This then trigger the following warning from ref_tracker_dir_exit() [1] To fix this, make sure that kernel sockets own a reference on net->passive. Add sk_net_refcnt_upgrade() helper, used whenever a kernel socket is converted to a refcounted one. [1] [ 136.263918][ T35] ref_tracker: net notrefcnt@ffff8880638f01e0 has 1/2 users at [ 136.263918][ T35] sk_alloc+0x2b3/0x370 [ 136.263918][ T35] inet6_create+0x6ce/0x10f0 [ 136.263918][ T35] __sock_create+0x4c0/0xa30 [ 136.263918][ T35] inet_ctl_sock_create+0xc2/0x250 [ 136.263918][ T35] igmp6_net_init+0x39/0x390 [ 136.263918][ T35] ops_init+0x31e/0x590 [ 136.263918][ T35] setup_net+0x287/0x9e0 [ 136.263918][ T35] copy_net_ns+0x33f/0x570 [ 136.263918][ T35] create_new_namespaces+0x425/0x7b0 [ 136.263918][ T35] unshare_nsproxy_namespaces+0x124/0x180 [ 136.263918][ T35] ksys_unshare+0x57d/0xa70 [ 136.263918][ T35] __x64_sys_unshare+0x38/0x40 [ 136.263918][ T35] do_syscall_64+0xf3/0x230 [ 136.263918][ T35] entry_SYSCALL_64_after_hwframe+0x77/0x7f [ 136.263918][ T35] [ 136.343488][ T35] ref_tracker: net notrefcnt@ffff8880638f01e0 has 1/2 users at [ 136.343488][ T35] sk_alloc+0x2b3/0x370 [ 136.343488][ T35] inet6_create+0x6ce/0x10f0 [ 136.343488][ T35] __sock_create+0x4c0/0xa30 [ 136.343488][ T35] inet_ctl_sock_create+0xc2/0x250 [ 136.343488][ T35] ndisc_net_init+0xa7/0x2b0 [ 136.343488][ T35] ops_init+0x31e/0x590 [ 136.343488][ T35] setup_net+0x287/0x9e0 [ 136.343488][ T35] copy_net_ns+0x33f/0x570 [ 136.343488][ T35] create_new_namespaces+0x425/0x7b0 [ 136.343488][ T35] unshare_nsproxy_namespaces+0x124/0x180 [ 136.343488][ T35] ksys_unshare+0x57d/0xa70 [ 136.343488][ T35] __x64_sys_unshare+0x38/0x40 [ 136.343488][ T35] do_syscall_64+0xf3/0x230 [ 136.343488][ T35] entry_SYSCALL_64_after_hwframe+0x77/0x7f
Impacted products
Vendor Product Version
Linux Linux Version: 0cafd77dcd032d1687efaba5598cf07bce85997f
Version: 0cafd77dcd032d1687efaba5598cf07bce85997f
Version: 0cafd77dcd032d1687efaba5598cf07bce85997f
Version: 0cafd77dcd032d1687efaba5598cf07bce85997f
Create a notification for this product.
Show details on NVD website


{
  "containers": {
    "cna": {
      "affected": [
        {
          "defaultStatus": "unaffected",
          "product": "Linux",
          "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"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "lessThan": "2668e038800b946d269f96ec1b258c01930a242c",
              "status": "affected",
              "version": "0cafd77dcd032d1687efaba5598cf07bce85997f",
              "versionType": "git"
            },
            {
              "lessThan": "4ceb0bd4ffd009821b585ce6a8033b12b59fb5fb",
              "status": "affected",
              "version": "0cafd77dcd032d1687efaba5598cf07bce85997f",
              "versionType": "git"
            },
            {
              "lessThan": "c31a732fac46b00b95b78fcc9c37cb48dd6f2e0c",
              "status": "affected",
              "version": "0cafd77dcd032d1687efaba5598cf07bce85997f",
              "versionType": "git"
            },
            {
              "lessThan": "5c70eb5c593d64d93b178905da215a9fd288a4b5",
              "status": "affected",
              "version": "0cafd77dcd032d1687efaba5598cf07bce85997f",
              "versionType": "git"
            }
          ]
        },
        {
          "defaultStatus": "affected",
          "product": "Linux",
          "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"
          ],
          "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
          "vendor": "Linux",
          "versions": [
            {
              "status": "affected",
              "version": "6.2"
            },
            {
              "lessThan": "6.2",
              "status": "unaffected",
              "version": "0",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.6.*",
              "status": "unaffected",
              "version": "6.6.103",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.12.*",
              "status": "unaffected",
              "version": "6.12.43",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "6.13.*",
              "status": "unaffected",
              "version": "6.13.6",
              "versionType": "semver"
            },
            {
              "lessThanOrEqual": "*",
              "status": "unaffected",
              "version": "6.14",
              "versionType": "original_commit_for_fix"
            }
          ]
        }
      ],
      "cpeApplicability": [
        {
          "nodes": [
            {
              "cpeMatch": [
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.6.103",
                  "versionStartIncluding": "6.2",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.12.43",
                  "versionStartIncluding": "6.2",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.13.6",
                  "versionStartIncluding": "6.2",
                  "vulnerable": true
                },
                {
                  "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*",
                  "versionEndExcluding": "6.14",
                  "versionStartIncluding": "6.2",
                  "vulnerable": true
                }
              ],
              "negate": false,
              "operator": "OR"
            }
          ]
        }
      ],
      "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-\u003eexit(),\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-\u003epassive.\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": {
            "baseScore": 7.8,
            "baseSeverity": "HIGH",
            "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H",
            "version": "3.1"
          },
          "scenarios": [
            {
              "lang": "en",
              "value": "AV:L - The bug is triggered entirely through local syscalls \u2014 `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\u0027s 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 \u2014 granted automatically \u2014 is enough to add the device and qdisc needed to delay the kernel socket\u0027s 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-\u003egen` slab objects and the sockets that dereference them all live in the kernel\u0027s 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-\u003egen` and returns the `struct net` to `net_cachep`, subsequent `sock_net(sk)` dereferences read reallocated slab contents \u2014 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), \u0026sk-\u003ens_tracker, false)` on the dangling pointer, driving `ref_tracker_free()`\u0027s 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-\u003egen` array produces oopses and panics even when not weaponized, and the pre-fix condition additionally trips `ref_tracker_dir_exit()`\u0027s 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."
            }
          ]
        }
      ],
      "providerMetadata": {
        "dateUpdated": "2026-08-05T11:55:06.894Z",
        "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
        "shortName": "Linux"
      },
      "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"
      }
    }
  },
  "cveMetadata": {
    "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
    "assignerShortName": "Linux",
    "cveId": "CVE-2025-21884",
    "datePublished": "2025-03-27T14:57:12.486Z",
    "dateReserved": "2024-12-29T08:45:45.782Z",
    "dateUpdated": "2026-08-05T11:55:06.894Z",
    "state": "PUBLISHED"
  },
  "dataType": "CVE_RECORD",
  "dataVersion": "5.2"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or seen somewhere by the user.
  • Confirmed: The vulnerability is confirmed from an analyst perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: This vulnerability was exploited and seen by the user reporting the sighting.
  • Patched: This vulnerability was successfully patched by the user reporting the sighting.
  • Not exploited: This vulnerability was not exploited or seen by the user reporting the sighting.
  • Not confirmed: The user expresses doubt about the veracity of the vulnerability.
  • Not patched: This vulnerability was not successfully patched by the user reporting the sighting.


Loading…

Loading…