CVE-2026-139661

bpf, lsm: Reject writes into the BPF LSM program context

Published Nov 30, 2026 CVSS 3.1 · 6.7 Medium EPSS < 1% KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

bpf, lsm: Reject writes into the BPF LSM program context

The verifier types a load from a tracing-style context by its offset
alone: btf_ctx_access() looks the offset up in the attach hook's
prototype, and check_mem_access() stamps the resulting type onto the
destination register. Nothing tracks what the slot actually holds.
That is sound only as long as the context is read-only, and for BPF LSM
it is not. lsm_verifier_ops wires ->is_valid_access() straight to
btf_ctx_access(), which never looks at enum bpf_access_type, so a store
into the context passes verification. Every other user of the helper
either goes through bpf_tracing_btf_ctx_access() or open-codes the same
type != BPF_READ test first; BPF LSM is the only one that does neither.

A program can therefore store a scalar of its choosing into a context
slot, read the slot back, and get a register the verifier believes is a
trusted pointer of the hook's argument type. Handing that to a kfunc or
helper which dereferences a trusted argument turns it into an arbitrary
kernel access. Route BPF LSM through bpf_tracing_btf_ctx_access() like
everyone else.

Analysis

AI-generated

Technical impact

A flaw in the Linux kernel’s BPF LSM verifier allows a BPF LSM program to write arbitrary data into its program context. The verifier incorrectly treats the context as read‑only and accepts a store operation, treating the written value as a trusted pointer of the hook’s argument type. When that pointer is later dereferenced by a kernel helper or kfunc, the attacker can read or write arbitrary kernel memory, which can lead to privilege escalation or full control of the system.

Affected Systems

All Linux kernel releases vulnerable to the bug that have not applied the patch referenced in the kernel commits. The specific affected kernel versions are not enumerated in the advisory, but any kernel built before the application of the fix is considered vulnerable.

Risk and Exploitability

The CVE lacks an EPSS score and is not listed in the CISA KEV catalogue, but the flaw involves kernel memory manipulation and privileged BPF programs, implying a high impact if exploited. An attacker would need the ability to load a custom BPF LSM program—a capability normally restricted to privileged users or containers with CAP_SYS_ADMIN. Once a malicious program is loaded, the vulnerability can be exercised immediately, leading to arbitrary kernel memory access and potential escalation of privileges. The absence of a workaround and the high severity of kernel corruption make the risk significant for affected systems.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Install the kernel patch that forces BPF LSM to use bpf_tracing_btf_ctx_access() for context access, as detailed in the official kernel commits.
  • If the patch cannot be applied, disable or remove the BPF LSM hook by altering kernel configuration or by using the relevant kernel command line options to exclude BPF LSM functionality.
  • Deploy additional kernel hardening features such as SELinux, AppArmor, or Compiled-in Security Modules (CSM) to restrict BPF program capabilities and reduce the attack surface.

Generated by OpenCVE AI on December 1, 2026 at 13:36 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
First Time appeared Linux linux
Vendors & Products Linux linux
Type Values Removed Values Added
Weaknesses CWE-843
References
Metrics threat_severity

None

cvssV3_1

{'score': 6.7, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H'}

threat_severity

Moderate

Type Values Removed Values Added
Weaknesses CWE-269
CWE-272
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: bpf, lsm: Reject writes into the BPF LSM program context The verifier types a load from a tracing-style context by its offset alone: btf_ctx_access() looks the offset up in the attach hook's prototype, and check_mem_access() stamps the resulting type onto the destination register. Nothing tracks what the slot actually holds. That is sound only as long as the context is read-only, and for BPF LSM it is not. lsm_verifier_ops wires ->is_valid_access() straight to btf_ctx_access(), which never looks at enum bpf_access_type, so a store into the context passes verification. Every other user of the helper either goes through bpf_tracing_btf_ctx_access() or open-codes the same type != BPF_READ test first; BPF LSM is the only one that does neither. A program can therefore store a scalar of its choosing into a context slot, read the slot back, and get a register the verifier believes is a trusted pointer of the hook's argument type. Handing that to a kfunc or helper which dereferences a trusted argument turns it into an arbitrary kernel access. Route BPF LSM through bpf_tracing_btf_ctx_access() like everyone else.
Title bpf, lsm: Reject writes into the BPF LSM program context
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-269

    Improper Privilege Management

  • CWE-272

    Least Privilege Violation

  • CWE-843

    Access of Resource Using Incompatible Type ('Type Confusion')

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:36 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM
Severity
Moderate
Public date
Nov 30, 2026, 1:36 PM