CVE-2024-50253

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-50253
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-50253.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-50253
Downstream
Related
Published
2024-11-09T10:15:06Z
Modified
2025-10-14T13:29:35.484067Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
bpf: Check the validity of nr_words in bpf_iter_bits_new()
Details

In the Linux kernel, the following vulnerability has been resolved:

bpf: Check the validity of nrwords in bpfiterbitsnew()

Check the validity of nrwords in bpfiterbitsnew(). Without this check, when multiplication overflow occurs for nrbits (e.g., when nrwords = 0x0400-0001, nrbits becomes 64), stack corruption may occur due to bpfprobereadkernelcommon(..., nrbytes = 0x2000-0008).

Fix it by limiting the maximum value of nrwords to 511. The value is derived from the current implementation of BPF memory allocator. To ensure compatibility if the BPF memory allocator's size limitation changes in the future, use the helper bpfmemallocchecksize() to check whether nrbytes is too larger. And return -E2BIG instead of -ENOMEM for oversized nr_bytes.

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
4665415975b0827e9646cab91c61d02a6b364d59
Fixed
c9539e09c67880ecd88b51188c346a2cc078b06c
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
4665415975b0827e9646cab91c61d02a6b364d59
Fixed
393397fbdcad7396639d7077c33f86169184ba99

Affected versions

v6.*

v6.10
v6.10-rc1
v6.10-rc2
v6.10-rc3
v6.10-rc4
v6.10-rc5
v6.10-rc6
v6.10-rc7
v6.11
v6.11-rc1
v6.11-rc2
v6.11-rc3
v6.11-rc4
v6.11-rc5
v6.11-rc6
v6.11-rc7
v6.11.1
v6.11.2
v6.11.3
v6.11.4
v6.11.5
v6.11.6
v6.12-rc1
v6.12-rc2
v6.12-rc3
v6.12-rc4

Database specific

{
    "vanir_signatures": [
        {
            "target": {
                "file": "kernel/bpf/helpers.c",
                "function": "bpf_iter_bits_new"
            },
            "id": "CVE-2024-50253-13dbd729",
            "digest": {
                "length": 777.0,
                "function_hash": "286619344926691849586749509758980928849"
            },
            "signature_version": "v1",
            "deprecated": false,
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9539e09c67880ecd88b51188c346a2cc078b06c",
            "signature_type": "Function"
        },
        {
            "target": {
                "file": "kernel/bpf/helpers.c",
                "function": "bpf_iter_bits_new"
            },
            "id": "CVE-2024-50253-1fcc47af",
            "digest": {
                "length": 777.0,
                "function_hash": "286619344926691849586749509758980928849"
            },
            "signature_version": "v1",
            "deprecated": false,
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@393397fbdcad7396639d7077c33f86169184ba99",
            "signature_type": "Function"
        },
        {
            "target": {
                "file": "kernel/bpf/helpers.c"
            },
            "id": "CVE-2024-50253-6e5c071e",
            "digest": {
                "threshold": 0.9,
                "line_hashes": [
                    "226361041639457846051100558604160092970",
                    "159218597182975943824986172676287863012",
                    "223436542602968676702990084754094678187",
                    "212180745433967380375672773854455878399",
                    "319952221230249267574587412405290724032",
                    "86284838646526042649448607880904316290",
                    "238209006581985087079089407354092539648",
                    "243798019274113436374310268204118168509",
                    "248457698035754977921064413432484555806",
                    "92365054117397062062310210725241146859",
                    "112428789303117896175820153913867609294",
                    "283589088276563200561169016406162062032",
                    "309544300120043729762027055319393682161"
                ]
            },
            "signature_version": "v1",
            "deprecated": false,
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@393397fbdcad7396639d7077c33f86169184ba99",
            "signature_type": "Line"
        },
        {
            "target": {
                "file": "kernel/bpf/helpers.c"
            },
            "id": "CVE-2024-50253-9d6631c9",
            "digest": {
                "threshold": 0.9,
                "line_hashes": [
                    "226361041639457846051100558604160092970",
                    "159218597182975943824986172676287863012",
                    "223436542602968676702990084754094678187",
                    "212180745433967380375672773854455878399",
                    "319952221230249267574587412405290724032",
                    "86284838646526042649448607880904316290",
                    "238209006581985087079089407354092539648",
                    "243798019274113436374310268204118168509",
                    "248457698035754977921064413432484555806",
                    "92365054117397062062310210725241146859",
                    "112428789303117896175820153913867609294",
                    "283589088276563200561169016406162062032",
                    "309544300120043729762027055319393682161"
                ]
            },
            "signature_version": "v1",
            "deprecated": false,
            "source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9539e09c67880ecd88b51188c346a2cc078b06c",
            "signature_type": "Line"
        }
    ]
}

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.11.0
Fixed
6.11.7