CVE-2024-43840

Description

From CVE.org

In the Linux kernel, the following vulnerability has been resolved: bpf, arm64: Fix trampoline for BPF_TRAMP_F_CALL_ORIG When BPF_TRAMP_F_CALL_ORIG is set, the trampoline calls __bpf_tramp_enter() and __bpf_tramp_exit() functions, passing them the struct bpf_tramp_image *im pointer as an argument in R0. The trampoline generation code uses emit_addr_mov_i64() to emit instructions for moving the bpf_tramp_image address into R0, but emit_addr_mov_i64() assumes the address to be in the vmalloc() space and uses only 48 bits. Because bpf_tramp_image is allocated using kzalloc(), its address can use more than 48-bits, in this case the trampoline will pass an invalid address to __bpf_tramp_enter/exit() causing a kernel crash. Fix this by using emit_a64_mov_i64() in place of emit_addr_mov_i64() as it can work with addresses that are greater than 48-bits.

Statement

A flaw was found in the Linux kernel's BPF trampoline implementation on the 64-bit ARM (arm64) architecture. When a BPF trampoline is created with the BPF_TRAMP_F_CALL_ORIG flag, the arm64 JIT emits instructions that load the address of the struct bpf_tramp_image into R0 for the __bpf_tramp_enter() and __bpf_tramp_exit() calls. The emit_addr_mov_i64() helper assumes a vmalloc() address and encodes only 48 bits, but bpf_tramp_image is allocated with kzalloc(), so its address can use more than 48 bits. The trampoline then passes an invalid address to __bpf_tramp_enter()/__bpf_tramp_exit(), causing a kernel crash (denial of service). Only arm64 systems are affected, and triggering the crash requires local access with the privileges needed to load BPF programs, so Red Hat rates the impact of this flaw as Low. Red Hat Enterprise Linux 9 (kernel and kernel-rt) on arm64 is affected, but the fix is deferred for the affected RHEL 9 streams; the residual risk is that a privileged local user could trigger a kernel crash, causing denial of service, with no impact on confidentiality or integrity. Red Hat Enterprise Linux 6, 7, and 8 are not affected because the vulnerable code was introduced upstream in kernel 6.0. In Fedora, which follows the upstream community kernel, this has been addressed through community kernel updates. The CVEorg record scores this flaw 7.8 (Important) with high confidentiality and integrity impact; however, the defect can only crash the kernel and does not disclose or modify data, which is why Red Hat (4.4, Moderate) and NIST (5.5, Moderate) rate it lower with availability-only impact.

Mitigation

Mitigation for this issue is either not available or the currently available options do not meet the Red Hat Product Security criteria comprising ease of use and deployment, applicability to widespread installation base, or stability.

Common Vulnerability Scoring System (CVSS) Score Details

Info alert:Important note

CVSS scores for open source components depend on vendor-specific factors (e.g. version or build chain). Therefore, Red Hat's score and impact rating can be different from NVD and other vendors. Red Hat remains the authoritative CVE Naming Authority (CNA) source for its products and services (see Red Hat classifications).

The following CVSS metrics and score provided are preliminary and subject to review.

CVSS v3 Score Breakdown

Red HatNVDcve.org
Base Score4.45.57.8
Attack VectorLocalLocalLocal
Attack ComplexityLowLowLow
Privileges RequiredHighLowLow
User InteractionNoneNoneNone
ScopeUnchangedUnchangedUnchanged
ConfidentialityNoneNoneHigh
Integrity ImpactNoneNoneHigh
Availability ImpactHighHighHigh

Vector

Red Hat: CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:N/I:N/A:H

NVD: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

cve.org: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Understanding the Weakness (CWE)

Availability

Technical Impact: DoS: Crash, Exit, or Restart

If the incorrect calculation causes the program to move into an unexpected state, it may lead to a crash or impairment of service.

Integrity,Confidentiality,Availability

Technical Impact: DoS: Crash, Exit, or Restart; DoS: Resource Consumption (Other); Execute Unauthorized Code or Commands

If the incorrect calculation is used in the context of resource allocation, it could lead to an out-of-bounds operation (CWE-119) leading to a crash or even arbitrary code execution. Alternatively, it may result in an integer overflow (CWE-190) and / or a resource consumption problem (CWE-400).

Access Control

Technical Impact: Gain Privileges or Assume Identity

In the context of privilege or permissions assignment, an incorrect calculation can provide an attacker with access to sensitive resources.

Access Control

Technical Impact: Bypass Protection Mechanism

If the incorrect calculation leads to an insufficient comparison (CWE-697), it may compromise a protection mechanism such as a validation routine and allow an attacker to bypass the security-critical code.

Frequently Asked Questions

Want to get errata notifications? Sign up here.