{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-21958",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-21958"
  ],
  "published": "2025-04-01T15:46:27Z",
  "summary": "Revert \"openvswitch: switch to per-action label counting in conntrack\"",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nRevert \"openvswitch: switch to per-action label counting in conntrack\"\n\nCurrently, ovs_ct_set_labels() is only called for confirmed conntrack\nentries (ct) within ovs_ct_commit(). However, if the conntrack entry\ndoes not have the labels_ext extension, attempting to allocate it in\novs_ct_get_conn_labels() for a confirmed entry triggers a warning in\nnf_ct_ext_add():\n\n  WARN_ON(nf_ct_is_confirmed(ct));\n\nThis happens when the conntrack entry is created externally before OVS\nincrements net->ct.labels_used. The issue has become more likely since\ncommit fcb1aa5163b1 (\"openvswitch: switch to per-action label counting\nin conntrack\"), which changed to use per-action label counting and\nincrement net->ct.labels_used when a flow with ct action is added.\n\nSince there\u2019s no straightforward way to fully resolve this issue at the\nmoment, this reverts the commit to avoid breaking existing use cases.",
  "severity": [
    {
      "type": "CVSS_V3",
      "score": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
    }
  ],
  "affected": [
    {
      "package": {
        "ecosystem": "Raspberry Pi OS:13",
        "name": "linux"
      },
      "versions": [
        "1:6.12.19-1+rpt1~bpo12+1",
        "1:6.12.19-1+rpt1"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-2712",
            "binary_version": "1:6.12.19-1+rpt1~bpo12+1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v6",
            "binary_version": "1:6.12.19-1+rpt1~bpo12+1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v7",
            "binary_version": "1:6.12.19-1+rpt1~bpo12+1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v7l",
            "binary_version": "1:6.12.19-1+rpt1~bpo12+1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v8",
            "binary_version": "1:6.12.19-1+rpt1~bpo12+1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-2712",
            "binary_version": "1:6.12.19-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v6",
            "binary_version": "1:6.12.19-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v7",
            "binary_version": "1:6.12.19-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v7l",
            "binary_version": "1:6.12.19-1+rpt1"
          },
          {
            "binary_name": "linux-image-6.12.19+rpt-rpi-v8",
            "binary_version": "1:6.12.19-1+rpt1"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.12.19-1+rpt1~bpo12+1": {
            "linux_commit": "121c2c384b9c2f4790ffb31b2cd25c7d75c8fda0",
            "upstream_version": "6.12.19",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.12.20"
          },
          "1:6.12.19-1+rpt1": {
            "linux_commit": "121c2c384b9c2f4790ffb31b2cd25c7d75c8fda0",
            "upstream_version": "6.12.19",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.12.20"
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-21958"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/9e79fdabd52cfce1a021640a81256878a2c516a2"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/d91bfc64a4886102746e74d2c6f3a61e9a77fd7d"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/1063ae07383c0ddc5bcce170260c143825846b03"
    }
  ],
  "database_specific": {
    "source": "https://git.kernel.org/pub/scm/linux/security/vulns.git",
    "upstream_modified": "2026-08-05T12:19:11Z",
    "severity": {
      "source": "kernel CNA",
      "cvss_v3_score": 7.8,
      "cvss_v3_severity": "High",
      "scenario": "AV:L - Triggering requires installing an OVS datapath flow carrying a ct action with a non-zero label mask via the openvswitch generic-netlink interface, which is a local operation. Although the packet that fires the bug can arrive from the wire on an OVS/OVN host, the necessary local netlink configuration step makes Local the defensible vector.\nAC:L - The attacker fully controls the ordering that creates the bug \u2014 create the conntrack entry while net->ct.labels_used is zero, then install the ct-label flow, then re-send a packet of that connection \u2014 and equally controls the concurrent traffic that turns the krealloc of a hash-visible ct->ext into a use-after-free. No condition lies outside attacker influence.\nPR:L - All OVS datapath/flow/vport netlink commands use GENL_UNS_ADMIN_PERM, i.e. CAP_NET_ADMIN in the netns owner user namespace, which any unprivileged user obtains with unshare -Urn; nftables in the same namespace supplies the externally created conntrack entry.\nUI:N - The attacker performs every step \u2014 namespace setup, flow installation and packet injection \u2014 with no action from any other user.\nS:U - The corruption is confined to kernel heap objects belonging to the same kernel security authority; no VM, IOMMU or sandbox boundary is crossed.\nC:H - nf_ct_ext_add() reallocates ct->ext on a confirmed, hash-table-visible conntrack with no RCU grace period, so lock-free readers such as nf_conn_acct_find(), nfct_nat(), nf_ct_ecache_find() and nf_ct_labels_find() dereference freed memory, giving a use-after-free read that can be groomed to disclose arbitrary kernel heap contents.\nI:H - The same window is a use-after-free write \u2014 nf_ct_acct_update() performs atomic64_add() into the freed extension block, and nf_ct_ext_add() itself writes offsets and memsets into a buffer another CPU may already have reallocated \u2014 yielding heap corruption exploitable for control-flow hijack.\nA:H - The WARN_ON(nf_ct_is_confirmed(ct)) splat is an immediate kernel warning that panics the machine under panic_on_warn, and the underlying use-after-free readily causes oopses and slab corruption crashes."
    }
  }
}
