USB2Shell: One Malicious USB Device. Root on Linux, No Login Needed.

USB2Shell: One Malicious USB Device. Root on Linux, No Login Needed.

A USB stick that never asks permission

Plug a USB drive into a Linux machine and the kernel acts before you do anything: it scans the device, reads what kind of storage it claims to be, and prepares to talk to it. No login. No mount. No click. That automatic hello is exactly where USB2Shell lives.

Researchers at Drivesec showed this week that a crafted USB device can turn that first handshake into a root shell. The flaw, published as CVE-2026-98232, sits in the kernel’s SCSI core Fixed in September 2026 and published in October, it only threatens machines that have not taken the update. No real-world attacks have been found.

How one bad length value becomes root

The bug is in the function that switches on Command Duration Limits, a storage feature. When a USB device claims to be an ATA disk that supports it, the kernel copies device-supplied information into a small stack buffer — using the length values the device itself supplies, never checking them against the buffer’s size.

A device that lies about those lengths can read up to 64 bytes of kernel stack memory and change a single byte of it. On the researchers’ test machine that was enough to write anywhere in kernel memory, defeat KASLR — the randomization hiding where kernel code sits — build fake kernel data structures, and run their command as root the moment the device was unplugged.

All of this happens during the automatic scan the instant a device is connected. A locked screen does not stop it. A logged-out session does not stop it. A rule against mounting unknown drives does not stop it: the device is already talking to privileged kernel code. USB2Shell is not the first attack to run straight past a locked screen.

Diagram: six stages from plugging in a malicious USB device to a root shell on Linux
How a USB stick becomes root: six stages from plug-in to a root shell on unplug.

Who is exposed — and who is not

Linux kernel flaws that lead to root are a recurring theme — just last week, a single NFS flaw put root on every Linux file server at risk. The flaw was introduced in Linux 6.5 and is present in every release from 6.5 onward until the fix is applied. But version numbers alone do not decide exposure: a system is only at risk if it has USB mass storage support — the usb-storage or uas driver — and a USB port somebody can physically reach. Distributions backport features and fixes, so check your own distribution’s numbers: Debian 12’s standard kernel never had the flawed code, while Red Hat shipped the fix in a kernel it numbers 5.14.

The researchers proved the attack on a Debian machine running kernel 6.12.22 with KASLR on, using a Cynthion programmable USB tool. The exploit is probabilistic, with no published success rate — but a failed attempt does not crash the machine, so an attacker can try again. On Android, phone kernels 6.6 and newer leak a little kernel memory — but not root: the builds checked use a compiler check that blocks the memory-changing step.

Diagram: four checks decide whether a Linux machine is exposed to the USB2Shell flaw
Is your machine exposed? Four checks decide whether USB2Shell can reach you.

Why a physical-access flaw still matters

USB2Shell is not remotely exploitable, and it is not in the U.S. government’s Known Exploited Vulnerabilities catalog. A physical attack is hard to scale, and the fix has been available since September

The researchers point to equipment where strangers can reach a USB port as the practical concern: self-service kiosks, payment terminals, car infotainment units, EV chargers, and smart-home hubs. None has been shown compromised — they are examples, not a list of affected products. The lock screen is not a security boundary against hardware. The boundary is the port itself.

What to do

1. Patch the kernel. Update to a kernel that includes the fix, or backport the upstream fix commit. This is the real fix; the rest below is a stopgap for machines that cannot update right away. The researchers’ check script can miss vendor-backported fixes — treat its result as a hint, not proof.

2. Unload the drivers you do not need. Stop usb-storage and uas from loading where USB storage is never needed.

3. Allow-list USB devices. Require approval before the kernel loads a driver for a device — USBGuard, or the authorized_default=0 setting. Unknown hardware stays inert until somebody explicitly trusts it.

4. Treat exposed ports as part of the asset inventory. List every Linux box with a reachable USB port: kiosks, terminals, chargers, hubs, lab machines. If a stranger can touch the port, that machine belongs on the patch list.

One footnote: the bug was first flagged by an AI

USB2Shell was first spotted by Sashiko, an AI code-review system Google built for the Linux kernel. Drivesec says it found the same flaw on its own, wrote the fix, and built the working exploit — the AI did not write the exploit. Google credits Sashiko in 528 kernel CVE fixes this year, while cautioning it is too early to say how much credit the tool deserves.

A USB device is a stranger at the door. USB2Shell is a reminder that the kernel answers that door before anyone inside has even woken up — and that the answer should be a patched kernel, a locked-down port, and a short list of devices allowed to speak.

Comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.