Skip to content
Heist/ feed
High

bpf: Fix overloading of MEM_UNINIT's meaning

Type: advisorySource: Official CVE List1 source record

In the Linux kernel, the following vulnerability has been resolved: bpf: Fix overloading of MEM_UNINIT's meaning Lonial reported an issue in the BPF verifier where check_mem_size_reg() has the following code: if (!tnum_is_const(reg->var_off)) /* For unprivileged variable accesses, disable raw * mode so that the program is required to * initialize all the memory that the helper could * just partially fill up. */ meta = NULL; This means that writes are not checked when the register containing the size of the passed buffer has not a fixed size. Through this bug, a BPF program can write to a map which is marked as read-only, for example, .rodata global maps. The problem is that MEM_UNINIT's initial meaning that "the passed buffer to the BPF helper does not need to be initialized" which was added back in commit 435faee1aae9 ("bpf, verifier: add ARG_PTR_TO_RAW_STACK type") got overloaded over time with "the passed buffer is being written to". The problem however is that checks such as the above which were added later via 06c1c049721a ("bpf: allow helpers access to variable memory") set meta to NULL in order force the user to always initialize the passed buffer to the helper. Due to the current double meaning of MEM_UNINIT, this bypasses verifier write checks to the memory (not boundary checks though) and only assumes the latter memory is read instead. Fix this by reverting MEM_UNINIT back to its original meaning, and having MEM_WRITE as an annotation to BPF helpers in order to then

Announced Group revision 1
Original source ↗

CVE-2024-50164

Primary source · Revision 1

Imported from structured advisory data. Source references identify upstream records or fields; verify affected versions and your deployed configuration.

Security context

Source reference: cve:CVE-2024-50164

Linux

Source reference: /containers/cna/affected/0/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Linux

Source reference: /containers/cna/affected/1/product

Affected versions
Not stated in this record
Fixed versions
Not stated in this record
Prerequisites
Not stated in this record

Structured affected-version data

Original package identities and version rules from this source.

[
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "97e6d7dab1ca4648821c790a2b7913d6d5d549db",
        "lessThan": "43f4df339a4d375bedcad29a61ae6f0ee7a048f8",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "97e6d7dab1ca4648821c790a2b7913d6d5d549db",
        "lessThan": "48068ccaea957469f1adf78dfd2c1c9a7e18f0fe",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "97e6d7dab1ca4648821c790a2b7913d6d5d549db",
        "lessThan": "54bc31682660810af1bed7ca7a19f182df8d3df8",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "97e6d7dab1ca4648821c790a2b7913d6d5d549db",
        "lessThan": "8ea607330a39184f51737c6ae706db7fdca7628e",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "6099a6c8a749a5c8d5f8b4c4342022a92072a02b",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "bfe25df63048edd4ceaf78a2fc755d5e2befc978",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "717c39718dbc4f7ebcbb7b625fb11851cd9007fe",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "5d0bba8232bf22ce13747cbfc8f696318ff01a50",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "70674d11d14eeecad90be4b409a22b902112ba32",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "a08d942ecbf46e23a192093f6983cb1d779f4fa8",
        "versionType": "git"
      },
      {
        "status": "affected",
        "version": "5.15.45",
        "lessThan": "5.16",
        "versionType": "semver"
      },
      {
        "status": "affected",
        "version": "5.17.13",
        "lessThan": "5.18",
        "versionType": "semver"
      },
      {
        "status": "affected",
        "version": "5.18.2",
        "lessThan": "5.19",
        "versionType": "semver"
      }
    ],
    "programFiles": [
      "kernel/bpf/verifier.c"
    ],
    "defaultStatus": "unaffected"
  },
  {
    "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git",
    "vendor": "Linux",
    "product": "Linux",
    "versions": [
      {
        "status": "affected",
        "version": "5.19"
      },
      {
        "status": "unaffected",
        "version": "0",
        "lessThan": "5.19",
        "versionType": "semver"
      },
      {
        "status": "unaffected",
        "version": "6.1.125",
        "versionType": "semver",
        "lessThanOrEqual": "6.1.*"
      },
      {
        "status": "unaffected",
        "version": "6.6.59",
        "versionType": "semver",
        "lessThanOrEqual": "6.6.*"
      },
      {
        "status": "unaffected",
        "version": "6.11.6",
        "versionType": "semver",
        "lessThanOrEqual": "6.11.*"
      },
      {
        "status": "unaffected",
        "version": "6.12",
        "versionType": "original_commit_for_fix",
        "lessThanOrEqual": "*"
      }
    ],
    "programFiles": [
      "kernel/bpf/verifier.c"
    ],
    "defaultStatus": "affected"
  }
]
Related CVEs
CVE-2024-50164

Source reference: /cveMetadata/cveId

Publisher severity

high

Source reference: /containers/cna/metrics

Event
#26793 · Revision 1
Added to Heist Feed
Publisher date
Read the original announcement