{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-40202",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-40202"
  ],
  "published": "2025-11-12T22:01:07Z",
  "summary": "ipmi: Rework user message limit handling",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nipmi: Rework user message limit handling\n\nThe limit on the number of user messages had a number of issues,\nimproper counting in some cases and a use after free.\n\nRestructure how this is all done to handle more in the receive message\nallocation routine, so all refcouting and user message limit counts\nare done in that routine.  It's a lot cleaner and safer.",
  "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:12",
        "name": "linux"
      },
      "versions": [
        "1:6.1.47-1+rpt4"
      ],
      "ecosystem_specific": {
        "binaries": [
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-2712",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v6",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v7l",
            "binary_version": "1:6.1.47-1+rpt4"
          },
          {
            "binary_name": "linux-image-6.1.0-rpi3-rpi-v8",
            "binary_version": "1:6.1.47-1+rpt4"
          }
        ]
      },
      "database_specific": {
        "per_version": {
          "1:6.1.47-1+rpt4": {
            "linux_commit": "655fc658a15ae7a6f37103754adb39ba52a9a14e",
            "upstream_version": "6.1.47",
            "assessment": "commit ancestry (strak rule)",
            "upstream_fixed": "6.1.157",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-40202"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/f63723ca7d7623f9dae1990973cd158671f03c56"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/348121b29594d42d1635648fd3ed31dfa25351d5"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/53d6e403affbf6df2c859a0ea00ccfc1e72090ca"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/0ed73be9a2547ffb9b5c1d879ad9bfab73d920b5"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b52da4054ee0bf9ecb44996f2c83236ff50b3812"
    }
  ],
  "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 - The vulnerable paths are entered through ioctls on the `/dev/ipmiN` character device (`IPMICTL_SEND_MSG`, `IPMICTL_SET_GETS_EVENTS_CMD`, `IPMICTL_REGISTER_FOR_CMD`), i.e. local access to the machine. Although BMC-originated IPMB/LAN traffic also exercises the same miscounted paths, the reliable and documented trigger is the local device interface.\nAC:L - The counting imbalance is deterministic, not a race: `ipmi_set_gets_events()` sets `msg->user` without incrementing `nr_msgs` while delivery always decrements it, so a single `IPMICTL_SET_GETS_EVENTS_CMD` that drains queued events reliably underflows the counter and defeats the allocation limit. No memory-layout or timing conditions outside the attacker's control are required.\nPR:L - Neither `ipmi_devintf.c` nor `ipmi_msghandler.c` performs any capability check \u2014 reaching the bug only requires an open file descriptor on `/dev/ipmiN`, which server, appliance and embedded/telecom deployments commonly grant to an unprivileged monitoring/management group via udev so agents such as ipmitool can run without root.\nUI:N - The attacker performs everything itself with open()/ioctl() on the IPMI device; no victim action, mount, or file-open by another user is needed.\nS:U - The corrupted state (`struct ipmi_recv_msg`, `struct ipmi_user`, the driver's static watchdog/poweroff message objects) and all consequences stay within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The fix removes a genuine use-after-free (`ipmi_free_recv_msg(msg)` followed by dereferencing `msg->user`) plus release of caller-owned message objects; a freed `ipmi_recv_msg`/`ipmi_user` that the attacker can reclaim via heap grooming yields a controlled read primitive, and IPMI messages carry BMC/management-plane data.\nI:H - The use-after-free performs an atomic decrement through a stale `msg->user` pointer \u2014 an attacker-placed replacement object turns that into an arbitrary 32-bit decrement primitive, and the double release of the watchdog/poweroff static messages corrupts driver state, both leveragable toward control-flow hijack.\nA:H - Underflowing `nr_msgs` makes the signed/unsigned comparison reject every further request with `-EBUSY`, permanently disabling IPMI management (the reported real-world failure), while simultaneously defeating the `max_msgs_per_user` guard that exists specifically to stop a rogue program exhausting kernel memory; the use-after-free additionally causes oopses."
    }
  }
}
