{
  "schema_version": "1.6.1",
  "id": "RPI-CVE-2025-23157",
  "modified": "2026-10-09T11:39:44Z",
  "upstream": [
    "CVE-2025-23157"
  ],
  "published": "2025-05-01T13:03:03Z",
  "summary": "media: venus: hfi_parser: add check to avoid out of bound access",
  "details": "In the Linux kernel, the following vulnerability has been resolved:\n\nmedia: venus: hfi_parser: add check to avoid out of bound access\n\nThere is a possibility that init_codecs is invoked multiple times during\nmanipulated payload from video firmware. In such case, if codecs_count\ncan get incremented to value more than MAX_CODEC_NUM, there can be OOB\naccess. Reset the count so that it always starts from beginning.",
  "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.135",
            "compiled_filter": false
          }
        }
      }
    }
  ],
  "references": [
    {
      "type": "ADVISORY",
      "url": "https://www.cve.org/CVERecord?id=CVE-2025-23157"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/e5133a0b25463674903fdc0528e0a29b7267130e"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/2b8b9ea4e26a501eb220ea189e42b4527e65bdfa"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/1ad6aa1464b8a5ce5c194458315021e8d216108e"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/26bbedd06d85770581fda5d78e78539bb088fad1"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/d4d88ece4ba91df5b02f1d3f599650f9e9fc0f45"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/53e376178ceacca3ef1795038b22fc9ef45ff1d3"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/b2541e29d82da8a0df728aadec3e0a8db55d517b"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/cb5be9039f91979f8a2fac29f529f746d7848f3e"
    },
    {
      "type": "FIX",
      "url": "https://git.kernel.org/stable/c/172bf5a9ef70a399bb227809db78442dc01d9e48"
    }
  ],
  "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 parser is reached through the local V4L2 device nodes (/dev/video*) \u2014 session-init parsing on V1 hardware and core-init parsing after a driver-triggered firmware re-init \u2014 plus the HFI shared-memory queue from the on-die video co-processor; there is no network or physical-bus reachability.\nAC:L - No race and no dependence on uncontrolled memory layout: the attacker either supplies a payload with repeated CODEC_SUPPORTED properties (fully attacker-chosen index and value) or, on HFI_VERSION_1XX where codecs_count is never reset, simply loops session init/deinit until the counter exceeds MAX_CODEC_NUM; the driver is enabled in standard arm64/Android/embedded Qualcomm configurations.\nPR:L - Triggering the session-init parse path only requires opening the venus decoder/encoder node and issuing REQBUFS/STREAMON, which any local user in the video group (desktop uaccess ACL) or any Android app with normal mediacodec access can do \u2014 no root or capability is needed.\nUI:N - The attacker's own process drives the ioctl sequence and the firmware message handling runs asynchronously in the driver's IRQ/worker context; no victim action is involved.\nS:U - The out-of-bounds accesses corrupt and disclose kernel heap memory within the same kernel security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Overflowing into codecs_count makes venus_caps_by_codec() iterate far past core->caps[], and the out-of-bounds hfi_plat_caps contents (formats, profile/levels, capability min/max) are handed back to userspace via V4L2 format and control enumeration, giving a broad kernel memory disclosure; the write primitive further enables leveraged reads.\nI:H - This is an out-of-bounds write with an attacker-controlled index (up to megabytes past a ~30 KB allocation) and attacker-selected power-of-two values, corrupting kernel pointers (core->root, core->ocs) and adjacent heap objects \u2014 a classic primitive for control-flow hijack.\nA:H - Corrupting codecs_count to a huge value causes an immediate unbounded scan of kernel memory, and clobbering the adjacent dentry/of_changeset pointers leads to an oops or panic on next use."
    }
  }
}
