CVE-2024-42161

bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD

No CVSS score yet EPSS 0.22%

Published 30 Jul 2024 Updated 11 May 2026 CNA: Linux

Check your servers for CVE-2024-42161

The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-42161 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.

Check my servers

Description

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

bpf: Avoid uninitialized value in BPF_CORE_READ_BITFIELD

[Changes from V1: - Use a default branch in the switch statement to initialize `val'.]

GCC warns that `val' may be used uninitialized in the BPF_CRE_READ_BITFIELD macro, defined in bpf_core_read.h as:

[...] unsigned long long val; \ [...] \ switch (__CORE_RELO(s, field, BYTE_SIZE)) { \ case 1: val = *(const unsigned char *)p; break; \ case 2: val = *(const unsigned short *)p; break; \ case 4: val = *(const unsigned int *)p; break; \ case 8: val = *(const unsigned long long *)p; break; \ } \ [...] val; \ } \

This patch adds a default entry in the switch statement that sets `val' to zero in order to avoid the warning, and random values to be used in case __builtin_preserve_field_info returns unexpected values for BPF_FIELD_BYTE_SIZE.

Tested in bpf-next master. No regressions.

Exploitation

EPSS 0.22%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 13.4% of all scored CVEs. Scores of 1 Dec 2026.

The assessment of CISA (SSVC, 10 Sep 2024):

Exploitation
none: CISA did not find evidence of exploitation or a public proof of concept
Automatable
no: each attack takes manual steps
Technical impact
partial: limited control or limited data

Affected products

As the CNA lists them.

ProductVersions
Linux
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before b694989bb13ed5f166e633faa1eb0f21c6d261a6
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before 3364c2ed1c241989847f19cf83e3db903ce689e3
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before a21d76bd0b0d39518e9a4c19f6cf7c042a974aff
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before 7e5471b5efebc30dd0bc035cda86693a5c73d45f
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before ff941a8449e712eaf7efca1a13bfb9afd3d99fc2
affected from ee26dade0e3bcd8a34ae7520e373fb69365fce7a, before 009367099eb61a4fc2af44d4eb06b6b4de7de6db
Other versions: unaffected
Linux
affected 5.5
unaffected before 5.5
unaffected from 5.10.222 up to and including 5.10.*
unaffected from 5.15.163 up to and including 5.15.*
unaffected from 6.1.98 up to and including 6.1.*
unaffected from 6.6.39 up to and including 6.6.*
unaffected from 6.9.9 up to and including 6.9.*
unaffected 6.10 and later
Other versions: affected

Is my server affected?

This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:

uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2024-42161 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-42161

With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:

trivy rootfs --scanners vuln / | grep CVE-2024-42161
trivy image --scanners vuln IMAGE | grep CVE-2024-42161

Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.

References

Other references

Source: the record CVE-2024-42161 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.