Skip to main content
CVE Vulnerability Database
Vulnerability Database/CVE-2026-52927

CVE-2026-52927: Linux Kernel Buffer Overflow Vulnerability

CVE-2026-52927 is a buffer overflow in Linux kernel's netfilter ebtables that causes out-of-bounds reads due to improper validation. This article covers the technical details, affected versions, and mitigation.

Published:

CVE-2026-52927 Overview

CVE-2026-52927 is an out-of-bounds read vulnerability in the Linux kernel's netfilter ebtables subsystem. The flaw resides in the compat_mtw_from_user() function, which converts 32-bit user-space ebtables extension structures into kernel-native structures. The function fails to validate the user-supplied match_size and target_size fields against the extension's required compatsize. When an attacker supplies a size smaller than the extension expects, the kernel's ->compat_from_user() callbacks read beyond the allocated buffer, triggering an out-of-bounds read detected by KASAN.

Critical Impact

A local user with the ability to load ebtables rules can trigger an out-of-bounds kernel memory read, potentially leading to information disclosure or kernel instability.

Affected Products

  • Linux kernel versions containing the compat_mtw_from_user() ebtables compatibility translation logic
  • Distributions shipping vulnerable upstream kernels with 32-bit compat support enabled
  • Systems with CONFIG_BRIDGE_NF_EBTABLES and CONFIG_COMPAT enabled

Discovery Timeline

  • Vulnerability reported by Luxiao Xu, who also authored the earlier patch this fix is based on
  • 2026-06-24 - CVE-2026-52927 published to NVD
  • 2026-06-24 - Last updated in NVD database

Technical Details for CVE-2026-52927

Vulnerability Analysis

The ebtables subsystem provides Ethernet bridge frame filtering in the Linux kernel. When a 32-bit user-space process interacts with a 64-bit kernel, the kernel translates the user-supplied rule structures through compatibility helpers. The function compat_mtw_from_user() performs this translation for matches, watchers, and targets attached to bridge filtering rules.

During translation, the kernel invokes the extension-specific ->compat_from_user() callback. These callbacks assume the source buffer contains at least compatsize bytes of valid data, because that is the documented size of the 32-bit representation of the extension. The function did not enforce this assumption against the user-controlled match_size field embedded in the rule blob copied from user space.

The fix adds an explicit check ensuring match_size is at least as large as the extension's required compatsize before invoking the callback. The check covers matches, watchers, and targets while preserving the existing handling for standard targets that use plain memcpy with caller-validated sizes.

Root Cause

The root cause is missing input validation [CWE-125] on a length field copied from user space. The caller validated the per-entry size against the next rule offset and the total blob length, but the per-extension compatsize invariant required by ->compat_from_user() callbacks was never checked. This is an Out-of-Bounds Read driven by an undersized user-supplied length field.

Attack Vector

A local attacker with CAP_NET_ADMIN in a user namespace, or root in the relevant network namespace, can craft a malicious ebtables rule blob via the EBT_SO_SET_ENTRIES setsockopt path. By specifying a match_size smaller than the targeted extension's compatsize, the attacker forces the callback to read past the end of the supplied buffer. The leaked bytes may contain adjacent kernel heap data, enabling KASLR bypass or further exploitation chains. The vulnerability does not require network-reachable exposure and is limited to local privilege contexts that can manipulate netfilter rules.

The kernel patches addressing this issue are referenced in the Kernel Git Commit 21af4c030567 and related stable commits.

Detection Methods for CVE-2026-52927

Indicators of Compromise

  • KASAN splat reports referencing compat_mtw_from_user or ebt_compat_match_offset in kernel logs
  • Unexpected ebtables rule modifications from non-administrative processes or short-lived containers
  • Kernel oops or panic entries originating from the netfilter/ebtables call path

Detection Strategies

  • Enable KASAN on test and staging kernels to surface out-of-bounds reads in the bridge netfilter path
  • Audit invocations of setsockopt with EBT_SO_SET_ENTRIES from unprivileged or containerized workloads
  • Collect and correlate kernel ring buffer messages mentioning ebtables translation failures with the originating process and namespace

Monitoring Recommendations

  • Forward auditd syscall records for setsockopt and socket(AF_INET, SOCK_RAW, ...) activity to a central log store
  • Alert on processes loading ebtable_* kernel modules outside of expected provisioning windows
  • Track creation of user namespaces by non-root users on hosts that do not require unprivileged namespaces

How to Mitigate CVE-2026-52927

Immediate Actions Required

  • Apply the upstream stable kernel updates that include the compat_mtw_from_user() size validation fix
  • Inventory hosts with CONFIG_COMPAT and CONFIG_BRIDGE_NF_EBTABLES enabled and prioritize them for patching
  • Restrict CAP_NET_ADMIN and unprivileged user namespace creation where not operationally required

Patch Information

The fix is distributed across multiple stable branches via commits 21af4c030567, 7ad0e463fc7e, a27cb7325a6c, bf8e8eac7ede, d7a8fb6f10d5, dad9ebf81079, f438d1786d65, and fcc4c043d137. Administrators should consume the patched kernel package from their distribution rather than cherry-picking commits.

Workarounds

  • Disable the ebtables modules (ebtable_filter, ebtable_nat, ebtable_broute) on hosts that do not require bridge filtering
  • Set kernel.unprivileged_userns_clone=0 to prevent unprivileged users from gaining CAP_NET_ADMIN inside a user namespace
  • Remove CAP_NET_ADMIN from container runtime defaults and grant it only to workloads with a documented need
bash
# Configuration example
# Block ebtables modules from loading at boot
echo 'install ebtables /bin/true' | sudo tee /etc/modprobe.d/disable-ebtables.conf
echo 'install ebtable_filter /bin/true' | sudo tee -a /etc/modprobe.d/disable-ebtables.conf
echo 'install ebtable_nat /bin/true'    | sudo tee -a /etc/modprobe.d/disable-ebtables.conf
echo 'install ebtable_broute /bin/true' | sudo tee -a /etc/modprobe.d/disable-ebtables.conf

# Restrict unprivileged user namespaces
sudo sysctl -w kernel.unprivileged_userns_clone=0
echo 'kernel.unprivileged_userns_clone=0' | sudo tee /etc/sysctl.d/99-userns.conf

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.