Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2021-34866

CVE-2021-34866: Linux Kernel Privilege Escalation Flaw

CVE-2021-34866 is a privilege escalation vulnerability in Linux Kernel 5.14-rc3 affecting eBPF program handling. Attackers can exploit type confusion to execute code as kernel. Learn about technical details and fixes.

Updated:

CVE-2021-34866 Overview

CVE-2021-34866 is a local privilege escalation vulnerability in the Linux kernel's extended Berkeley Packet Filter (eBPF) subsystem. The flaw affects Linux Kernel 5.14-rc3 and stems from improper validation of user-supplied eBPF programs, which leads to a type confusion condition [CWE-843]. A local attacker with the ability to execute low-privileged code can leverage this flaw to execute arbitrary code in the context of the kernel. The vulnerability was reported through the Zero Day Initiative under identifier ZDI-CAN-14689 and tracked as ZDI-21-1148. NetApp HCI compute and storage node firmware images that ship the affected kernel are also impacted.

Critical Impact

Successful exploitation grants kernel-level code execution and full root privileges from an unprivileged user account on affected Linux systems.

Affected Products

  • Linux Kernel 5.14-rc3
  • NetApp HCI compute nodes (H410C, H300E, H500E, H700E) and associated firmware
  • NetApp HCI storage nodes (H410S, H300S, H500S, H700S) and associated firmware

Discovery Timeline

  • 2022-01-25 - CVE-2021-34866 published to the National Vulnerability Database
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2021-34866

Vulnerability Analysis

The vulnerability resides in the Linux kernel's eBPF verifier, which is responsible for statically validating eBPF programs submitted from user space before they are executed in the kernel. The verifier failed to correctly track the type of certain values during program analysis, allowing an attacker-supplied program to bypass safety checks. Once loaded, the program executes inside the kernel with inconsistent type assumptions, producing a type confusion condition classified as [CWE-843]. This condition enables arbitrary read and write primitives within kernel memory, which an attacker can chain into code execution at ring 0.

Root Cause

The root cause is insufficient validation of user-supplied eBPF programs within the verifier. The verifier treats a register or memory operand as one type while the underlying data conforms to a different, attacker-controlled type. Because eBPF programs run in the kernel after passing verification, any logic gap in the type-tracking state machine collapses the boundary between unprivileged user code and privileged kernel code.

Attack Vector

The attack requires local access and the ability to load eBPF programs, which on many distributions is reachable from an unprivileged user when kernel.unprivileged_bpf_disabled is set to 0. The attacker compiles a crafted eBPF program designed to trigger the verifier's type-tracking flaw, loads it through the bpf() syscall, and then invokes it through an attached hook such as a socket filter. Execution of the malformed program yields out-of-bounds memory access primitives that escalate to arbitrary kernel code execution and root privileges. No user interaction is required.

No public proof-of-concept exploit code has been catalogued for this CVE, and it is not listed in the CISA Known Exploited Vulnerabilities catalog. Refer to the Zero Day Initiative Advisory ZDI-21-1148 for additional technical context.

Detection Methods for CVE-2021-34866

Indicators of Compromise

  • Unexpected bpf() syscall activity from non-root, non-service user accounts loading BPF_PROG_LOAD requests.
  • Kernel log entries referencing verifier rejections, oops messages, or general protection faults originating in kernel/bpf/verifier.c.
  • New SUID binaries, modified /etc/passwd or /etc/shadow entries, or unexplained root-owned processes spawned by previously unprivileged sessions.

Detection Strategies

  • Audit eBPF program loads with auditd rules on the bpf syscall and correlate the loading UID against expected service accounts.
  • Monitor for processes that transition from a low-privileged UID to UID 0 without invoking a legitimate setuid binary.
  • Hunt for anomalous loading of socket filter, tracepoint, or kprobe programs by interactive shells or compiled binaries placed in user-writable directories.

Monitoring Recommendations

  • Forward kernel ring buffer (dmesg) and auditd logs to a centralized analytics platform and alert on verifier-related errors.
  • Track the value of kernel.unprivileged_bpf_disabled across the fleet and flag hosts where it is set to 0.
  • Baseline expected eBPF tooling (such as bcc, bpftrace, observability agents) and alert when programs originate outside the approved set.

How to Mitigate CVE-2021-34866

Immediate Actions Required

  • Upgrade affected Linux systems to a kernel version where the eBPF verifier type confusion has been patched; the vulnerable code path is specific to the 5.14-rc3 development snapshot, so move to a fixed stable release.
  • Apply NetApp firmware updates referenced in the NetApp Security Advisory NTAP-20220217-0008 for affected HCI H-series compute and storage nodes.
  • Inventory hosts that allow unprivileged eBPF program loading and restrict that capability until patches are deployed.

Patch Information

Linux kernel maintainers addressed the verifier flaw in mainline releases following 5.14-rc3. Distribution vendors shipped backported fixes through their normal kernel update channels. NetApp published fixed firmware for H410C, H300E, H500E, H700E, H410S, H300S, H500S, and H700S platforms. Consult the NetApp Security Advisory and the Zero Day Initiative Advisory ZDI-21-1148 for fixed-version details.

Workarounds

  • Disable unprivileged eBPF program loading by setting kernel.unprivileged_bpf_disabled=1 and persisting the value in /etc/sysctl.d/.
  • Remove or restrict the CAP_BPF and CAP_SYS_ADMIN capabilities from user-facing service accounts and containers.
  • Apply seccomp or SELinux/AppArmor profiles that deny the bpf() syscall to workloads that do not require it.
bash
# Configuration example: disable unprivileged eBPF program loading
sudo sysctl -w kernel.unprivileged_bpf_disabled=1
echo 'kernel.unprivileged_bpf_disabled=1' | sudo tee /etc/sysctl.d/90-disable-unpriv-bpf.conf
sudo sysctl --system

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.