Linux Kernel Vulnerability Grants Root Access via Malicious USB Devices
Share
A critical vulnerability in the Linux kernel, dubbed USB2Shell, allows a crafted USB device to execute commands with root privileges on unpatched systems. The flaw, tracked as CVE-2026-98232, can be exploited without user interaction, even if the machine is locked or the user is logged out.
The issue stems from how the Linux kernel automatically scans USB storage devices the moment they are connected. Researchers at Drivesec, who demonstrated the attack, found that the vulnerability resides in the kernel’s SCSI core. Specifically, the flaw exists within a function responsible for enabling a storage feature known as Command Duration Limits.
Technical Mechanics of USB2Shell
When a malicious USB device identifies itself as an ATA disk supporting Command Duration Limits, the kernel attempts to copy device information into a small buffer on its stack. However, the kernel relies on length values provided by the device itself without verifying them against the actual buffer size. This oversight leads to a stack-based buffer overflow.
According to the researchers, a device that provides manipulated length values can read up to 64 bytes of kernel stack memory and modify a single byte. In their testing, this single-byte change was sufficient to bypass Kernel Address Space Layout Randomisation (KASLR) and gain full write access to kernel memory. This allowed the researchers to execute a chosen command as root immediately after the device was unplugged.
Because the automatic scan occurs before any user-level protections are active, standard security measures—such as locked screens or rules against mounting unknown drives—do not prevent the initial communication between the device and the privileged kernel code.
Affected Versions and Mitigation
The USB2Shell vulnerability was introduced in Linux 6.5 and is present in subsequent releases until the fix is applied. While the upstream kernel received a patch in September 2024, the exact versioning may vary across different Linux distributions due to backporting practices. For instance, while Debian 12’s standard kernel was reportedly unaffected, Red Hat addressed the issue in its version 5.14 kernel.
System administrators are advised to update to a patched kernel immediately. If an immediate update is not possible, the following mitigations are recommended:
- Disable the
usb-storageanduasdrivers on machines that do not require USB storage support. - Implement USB allow-listing using tools like USBGuard or by setting
authorized_default=0in the kernel configuration to require manual approval of new devices.
The vulnerability was notably identified by Sashiko, an AI-driven code-review system developed by Google for the Linux Foundation, before being independently researched and exploited by Drivesec. While the flaw poses a significant risk to physical hardware—such as kiosks, payment terminals, and car infotainment systems—no real-world attacks have been identified to date.



