HIGH 7.8

CVE-2026-52919: Linux batman-adv Use-After-Free Privilege Escalation

A flaw in the Linux kernel's batman-adv network module can cause a counter to go negative when multiple code paths attempt to shut down the packet transmission meter. When this counter drops below zero, the sender thread mistakenly believes it still has work to do and enters an infinite loop. If the network interface is removed while this zombie thread is running, the kernel accesses memory that has already been freed, potentially allowing local privilege escalation.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.8 HIGH · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-191
Affected products
5 configuration(s)
Published / Modified
2026-06-24 / 2026-07-08

NVD description (verbatim)

In the Linux kernel, the following vulnerability has been resolved: batman-adv: fix tp_meter counter underflow during shutdown batadv_tp_sender_shutdown() unconditionally decrements the "sending" atomic counter. If multiple paths (e.g. timeout, user cancel, and normal finish) call this function, the counter can underflow to -1. Since the sender logic treats any non-zero value as "still sending", a negative value causes the sender kthread to loop indefinitely. This leads to a use-after-free when the interface is removed while the zombie thread is still active. Fix this by using atomic_xchg() to ensure the counter only transitions from 1 to 0 once. [sven: added missing change in batadv_tp_send]

8 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-52919 is a use-after-free vulnerability in the batman-adv module (kernel/net/batman-adv) caused by improper atomic counter management during shutdown. The batadv_tp_sender_shutdown() function unconditionally decrements the 'sending' atomic counter without checking its current state. When multiple shutdown paths (timeout handler, user cancellation, normal completion) invoke this function concurrently or sequentially, the counter can underflow to negative values. Since the sender kthread interprets any non-zero counter value as an active transmission state, negative values cause the thread to loop indefinitely. When the network interface is subsequently removed, the orphaned kthread continues to reference freed kernel structures, creating a use-after-free condition. The fix employs atomic_xchg() to atomically swap the counter from 1 to 0 in a single operation, ensuring the shutdown logic executes only once regardless of how many code paths attempt to trigger it.

Business impact

This vulnerability enables local privilege escalation on systems running affected Linux kernel versions with batman-adv compiled in. An unprivileged user can trigger the vulnerability through network interface manipulation, leading to kernel memory corruption and potential code execution with kernel privileges. On systems where batman-adv is used (mesh networking deployments, some IoT and edge computing platforms), this creates a critical path to full system compromise. The indefinite kthread loop also causes denial of service by consuming CPU resources and preventing graceful interface shutdown.

Affected systems

The Linux kernel with batman-adv module support is affected. Batman-adv is included in standard kernel builds but is primarily used in mesh networking scenarios, including some embedded distributions and IoT platforms. Systems with batman-adv compiled as a module (most distributions) can mitigate by unloading the module if not needed. The vulnerability affects all kernel versions containing the vulnerable batadv_tp_sender_shutdown() code path; consult kernel changelogs and vendor advisories to determine exact affected version ranges for your distribution.

Exploitability

Local exploitability is straightforward. An unprivileged user can trigger the vulnerability by manipulating batman-adv network interfaces (e.g., via netlink or sysfs interfaces) to cause multiple shutdown paths to execute concurrently. No kernel module reloading or special capabilities are required beyond standard user-level network interface permissions. The race condition is deterministic and reliable. Remote exploitation is not possible; an attacker must have local user access. The CVSS score of 7.8 (High) reflects the high impact (privilege escalation, memory corruption) and low attack complexity, though local access is required.

Remediation

Apply a kernel update containing the fix for CVE-2026-52919. The fix replaces the unconditional atomic_dec() call in batadv_tp_sender_shutdown() with an atomic_xchg() operation that safely transitions the counter from 1 to 0 exactly once. Verify your kernel version and distribution's patch timeline; most major distributions should have backported this fix into their stable branches within weeks of the June 2026 publication date. For systems where batman-adv is not actively used, unloading the module (rmmod batman_adv) immediately eliminates the attack surface.

Patch guidance

Apply the kernel update provided by your distribution's security advisories for CVE-2026-52919. The patch modifies the batman-adv tp_meter shutdown logic to use atomic_xchg() instead of atomic_dec(). Verify the patched kernel includes the fix in batadv_tp_sender_shutdown() and related batadv_tp_send() changes referenced in the commit message. After patching, reboot to load the fixed kernel. No special configuration changes are required. If batman-adv is loaded as a module, you may be able to unload and reload the module without rebooting, but a full reboot is recommended to ensure all affected code paths are replaced.

Detection guidance

Monitor kernel logs for repeated messages related to batman-adv kthread hangs, interface removal delays, or use-after-free warnings (KASAN, if enabled). Check for zombie kthreads named 'bat_*' in 'ps' or '/proc' that consume high CPU and do not respond to kill signals. Inspect dmesg for batman-adv shutdown errors or use-after-free backtraces. Systems with active batman-adv mesh deployments should audit network interface teardown logs and kthread state transitions. Consider enabling kernel address sanitizer (KASAN) in test environments to detect use-after-free memory access attempts. Preventively monitor for unusual interface removal failures or kernel softlockup warnings on batman-adv interfaces.

Why prioritize this

This vulnerability merits immediate patching priority for systems running batman-adv. The combination of local privilege escalation, deterministic exploitability, and denial-of-service impact makes it a critical risk. While batman-adv is not universally deployed, systems that do use it (mesh networks, edge computing, some IoT platforms) face direct compromise risk. The fix is safe and straightforward, making rapid patching feasible without operational risk.

Risk score, explained

The CVSS 3.1 score of 7.8 (High) reflects: (1) Local attack vector (AV:L) requiring user-level access but no special privileges, (2) Low attack complexity (AC:L) due to deterministic counter underflow, (3) Low privilege requirement (PR:L) for triggering network interface operations, (4) No user interaction needed (UI:N), (5) Scope unchanged (S:U), and (6) High impact across confidentiality, integrity, and availability (C:H/I:H/A:H) due to use-after-free enabling privilege escalation and denial of service. The score accurately reflects a high-risk local vulnerability suitable for rapid remediation.

Frequently asked questions

Does this affect my system if batman-adv is not installed or used?

No. This vulnerability is specific to the batman-adv kernel module. If your system does not load or compile batman-adv (check 'lsmod | grep batman' or kernel config), you are not at risk. Most standard desktop and server distributions do not enable batman-adv by default.

Can this be exploited remotely over the network?

No. The vulnerability requires local user-level access to manipulate batman-adv network interfaces. An attacker must have a user account on the target system or otherwise achieve local execution context. Remote network-based exploitation is not possible.

What is the immediate mitigation if I cannot patch immediately?

If batman-adv is not actively needed, unload the module immediately: 'sudo rmmod batman_adv'. This eliminates the attack surface until a patched kernel is deployed. If batman-adv is essential to your network, prioritize kernel patching as the primary mitigation and restrict local user access to sensitive systems as a temporary measure.

How long should I expect it to take for my distribution to release a patch?

Major Linux distributions (Red Hat, Debian, Ubuntu, SUSE) typically release kernel security updates within 2-4 weeks of a CVE publication. Check your distribution's security advisories and subscribe to security mailing lists for your specific kernel version. Verify the patch includes the atomic_xchg() fix in batadv_tp_sender_shutdown() before deploying.

This analysis is based on the vulnerability description and CVSS scoring provided and is accurate as of the publication date. Actual affected kernel versions, patch availability, and deployment timelines vary by distribution; consult your vendor's official security advisories for definitive information. No exploit code or detailed reproduction steps are provided. Organizations should conduct their own risk assessment based on their specific batman-adv deployments and access controls. This is not a substitute for professional security consultation or vendor guidance. Source: NVD (public-domain), retrieved 2026-07-30. Analysis generated by SEC.co (claude-haiku-4-5).