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

CVE-2026-31522: Linux Kernel Memory Leak Vulnerability

CVE-2026-31522 is a memory leak flaw in the Linux Kernel's HID magicmouse driver that causes improper memory management. This article covers the technical details, affected versions, security impact, and mitigation.

Updated:

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-31522 Overview

CVE-2026-31522 is a memory leak vulnerability in the Linux kernel's Human Interface Device (HID) subsystem, specifically within the magicmouse driver. The magicmouse_report_fixup() function allocated a buffer via kmemdup() and returned it to the caller, which does not take ownership of the pointer. Because the caller may legitimately return a sub-portion of the input rdesc, the allocated buffer was never freed, resulting in a kernel memory leak each time the fixup ran. Repeated triggering can exhaust kernel memory and cause denial of service on the local system. The issue is tracked under CWE-401: Missing Release of Memory after Effective Lifetime.

Critical Impact

A local low-privileged actor able to trigger repeated HID descriptor fixups on a vulnerable host can leak kernel memory and degrade availability of the system.

Affected Products

  • Linux Kernel (multiple stable branches prior to the fix commits)
  • Linux Kernel 7.0-rc1
  • Linux Kernel 7.0-rc2

Discovery Timeline

  • 2026-04-22 - CVE-2026-31522 published to NVD
  • 2026-04-28 - Last updated in NVD database

Technical Details for CVE-2026-31522

Vulnerability Analysis

The vulnerability resides in the magicmouse_report_fixup() function of the Apple Magic Mouse / Magic Trackpad HID driver (drivers/hid/hid-magicmouse.c). The HID core invokes report_fixup() callbacks to allow individual drivers to patch a device's report descriptor before it is parsed. By contract, the caller of report_fixup() does not assume ownership of any newly allocated buffer the callback returns. Drivers are permitted to return either a sub-range of the input rdesc (whose lifetime the caller already manages) or a modified copy.

The magicmouse implementation used kmemdup() to allocate a freshly modified descriptor and returned that pointer directly. Because no reference to the duplicated buffer was retained anywhere and the HID core never freed it, every call path that reached the fixup function leaked the allocation. The leaked memory is kernel slab memory and cannot be reclaimed without rebooting.

Root Cause

The root cause is an ownership and lifetime mismatch between the magicmouse driver and the HID core API. The driver assumed the caller would free the duplicated buffer, while the HID core assumed the returned pointer aliased caller-owned memory. This API contract violation falls under CWE-401 (Missing Release of Memory after Effective Lifetime).

Attack Vector

Exploitation requires local access with low privileges on a system running a vulnerable kernel and supporting HID device attach paths reachable by the unprivileged user. Each invocation of the fixup leaks a small kernel buffer. Repeated triggering — for example, through scripted USB/Bluetooth device events on systems where userspace can initiate HID parsing — accumulates leaked memory and can drive the system toward an out-of-memory condition impacting availability. The flaw does not expose data confidentiality or integrity.

No public exploit code, proof-of-concept, or CISA KEV listing is associated with this CVE at the time of publication.

Detection Methods for CVE-2026-31522

Indicators of Compromise

  • Gradual, unexplained growth of kernel slab memory consumption visible in /proc/meminfo (Slab, SUnreclaim) and slabtop output, particularly for kmalloc-* caches.
  • Frequent HID device attach/detach events in dmesg or journalctl -k correlated with rising kernel memory usage.
  • Out-of-memory killer activity on long-running hosts with attached or simulated Apple Magic Mouse / Magic Trackpad devices.

Detection Strategies

  • Audit installed kernel versions against the fixed commits listed in the kernel.org stable advisories to confirm whether the hid-magicmouse patch is applied.
  • Enable CONFIG_DEBUG_KMEMLEAK on test systems and exercise HID descriptor fixup paths to observe unreferenced allocations originating in magicmouse_report_fixup.
  • Monitor kernel slab statistics over time and alert on anomalous, monotonically increasing SUnreclaim values on endpoints that interact with USB/Bluetooth HID peripherals.

Monitoring Recommendations

  • Centralize kernel logs and memory telemetry from Linux endpoints to identify hosts exhibiting kernel memory pressure patterns consistent with the leak.
  • Track HID subsystem messages (hid-magicmouse, usbhid) for repeated device probe events that could be used to amplify the leak.
  • Maintain an inventory of kernel build versions across the fleet so unpatched hosts can be prioritized for remediation.

How to Mitigate CVE-2026-31522

Immediate Actions Required

  • Apply the upstream Linux kernel fixes referenced in the kernel.org stable tree commits and update to a distribution kernel that includes the hid-magicmouse fixup patch.
  • Restrict physical and Bluetooth pairing access on multi-user or kiosk systems to limit who can trigger HID device probe paths.
  • Schedule reboots of long-running hosts that have already accumulated leaked kernel memory; the leak is not reclaimable at runtime.

Patch Information

Fixes are available in the Linux stable tree. Refer to the following commits for the corrected magicmouse_report_fixup() implementation, which avoids returning a separately allocated buffer:

Consume the patch through your distribution's kernel update channel (for example, apt, dnf, or zypper) once the vendor publishes a kernel that includes one of these commits.

Workarounds

  • Unload or blacklist the hid-magicmouse kernel module on systems that do not require Apple Magic Mouse or Magic Trackpad support.
  • Disable USB and Bluetooth HID device autoload on hardened servers using udev rules or modprobe blacklisting until the patched kernel is deployed.
bash
# Temporarily prevent the vulnerable driver from loading
echo "blacklist hid-magicmouse" | sudo tee /etc/modprobe.d/blacklist-magicmouse.conf
sudo rmmod hid_magicmouse 2>/dev/null
sudo update-initramfs -u

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

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

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.