# CVE-2024-42161: bpf: Avoid uninitialized value in BPF\_CORE\_READ\_BITFIELD

> Archived entry. Full-text search covers entries since 2026-11-10; exact IDs work for all years.

- **Severity:** MEDIUM 6.3
- **CVSS:** 6.3 (v3.1, NVD) `CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:L/I:H/A:H`
- **CVSS metrics:** Attack vector: Local; Attack complexity: Low; Privileges required: High; User interaction: None; Scope: Unchanged; Confidentiality impact: Low; Integrity impact: High; Availability impact: High
- **Exploited in the wild:** Not in CISA KEV
- **Public exploit / PoC:** None known
- **Remote exploitation:** Not remotely exploitable (local or adjacent access needed)
- **EPSS:** 0.31% (percentile 16, 2026-11-26)
- **CWE:** CWE-908
- **Published:** 2024-07-30T07:47:03.136Z
- **Modified:** 2026-06-17T07:48:57.520Z

## Who should check

- Anyone running Linux \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< b694989bb13ed5f166e633faa1eb0f21c6d261a6; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 3364c2ed1c241989847f19cf83e3db903ce689e3; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< a21d76bd0b0d39518e9a4c19f6cf7c042a974aff; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 7e5471b5efebc30dd0bc035cda86693a5c73d45f; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< ff941a8449e712eaf7efca1a13bfb9afd3d99fc2; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 009367099eb61a4fc2af44d4eb06b6b4de7de6db
- Anyone running Linux 5.5

## 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.

## Affected and fixed versions

- Linux: \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< b694989bb13ed5f166e633faa1eb0f21c6d261a6; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 3364c2ed1c241989847f19cf83e3db903ce689e3; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< a21d76bd0b0d39518e9a4c19f6cf7c042a974aff; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 7e5471b5efebc30dd0bc035cda86693a5c73d45f; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< ff941a8449e712eaf7efca1a13bfb9afd3d99fc2; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 009367099eb61a4fc2af44d4eb06b6b4de7de6db (cvelist)
- Linux: 5.5 (cvelist)

## Mitigation

- Upgrade Linux to 009367099eb61a4fc2af44d4eb06b6b4de7de6db or later.

## Check your systems with an agent

Paste this into a coding agent:

```text
Check whether anything I run is affected by CVE-2024-42161. Work read-only: do not install, upgrade, delete or change anything.

Details: https://flawdb.com/CVE-2024-42161.md
Affected: Linux >= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < b694989bb13ed5f166e633faa1eb0f21c6d261a6; >= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < 3364c2ed1c241989847f19cf83e3db903ce689e3; >= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, < a21d76bd0b0d39518e9a4c19f6cf7c042a974aff; >= ee26dade0e3bcd8a34ae752…
Fixed in: Linux 3364c2ed1c241989847f19cf83e3db903ce689e3, Linux 7e5471b5efebc30dd0bc035cda86693a5c73d45f, Linux 009367099eb61a4fc2af44d4eb06b6b4de7de6db

Steps:
1. Search this machine and project for Linux: dependency manifests and lockfiles, installed packages, container images and running services.
2. For each match, note the installed version and whether it is inside the affected range.
3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
```

## FAQ

### Is CVE-2024-42161 being exploited?

There is no confirmed exploitation: CVE-2024-42161 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 0.31% chance of exploitation in the next 30 days (as of 2026-11-26).

### How serious is CVE-2024-42161?

Medium: CVSS 6.3 (v3.1, scored by NVD). Not remotely exploitable (local or adjacent access needed).

### Which versions are affected by CVE-2024-42161?

Linux \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< b694989bb13ed5f166e633faa1eb0f21c6d261a6; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 3364c2ed1c241989847f19cf83e3db903ce689e3; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< a21d76bd0b0d39518e9a4c19f6cf7c042a974aff; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 7e5471b5efebc30dd0bc035cda86693a5c73d45f; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< ff941a8449e712eaf7efca1a13bfb9afd3d99fc2; \>= ee26dade0e3bcd8a34ae7520e373fb69365fce7a, \< 009367099eb61a4fc2af44d4eb06b6b4de7de6db; Linux 5.5.

### Is there a fix for CVE-2024-42161?

Yes. Fixed in Linux 3364c2ed1c241989847f19cf83e3db903ce689e3, Linux 7e5471b5efebc30dd0bc035cda86693a5c73d45f, Linux 009367099eb61a4fc2af44d4eb06b6b4de7de6db. Upgrade Linux to 009367099eb61a4fc2af44d4eb06b6b4de7de6db or later.

### How do I check if I'm affected by CVE-2024-42161?

Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.

## References

- patch: <https://git.kernel.org/stable/c/b694989bb13ed5f166e633faa1eb0f21c6d261a6>
- patch: <https://git.kernel.org/stable/c/3364c2ed1c241989847f19cf83e3db903ce689e3>
- patch: <https://git.kernel.org/stable/c/a21d76bd0b0d39518e9a4c19f6cf7c042a974aff>
- patch: <https://git.kernel.org/stable/c/7e5471b5efebc30dd0bc035cda86693a5c73d45f>
- patch: <https://git.kernel.org/stable/c/ff941a8449e712eaf7efca1a13bfb9afd3d99fc2>
- patch: <https://git.kernel.org/stable/c/009367099eb61a4fc2af44d4eb06b6b4de7de6db>
- other: <https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html>

## Attribution

- CVE Program: CVE® is a registered trademark of The MITRE Corporation. CVE records © 1999–2026 The MITRE Corporation. <https://www.cve.org/Legal/TermsOfUse>
- NVD: This product uses data from the NVD API but is not endorsed or certified by the NVD. <https://nvd.nist.gov/vuln/detail/CVE-2024-42161>

HTML: <https://flawdb.com/CVE-2024-42161> · JSON: <https://flawdb.com/api/v1/entries/CVE-2024-42161>
