DEV Community

RC
RC

Posted on Originally published at randomchaos.us

Drivesec demonstrated USB2Shell, a USB-to-root Linux attack

A crafted USB device can make an unpatched Linux machine run an attacker's command as root, with nobody logged in, no drive mounted, and nothing clicked. Researchers at Drivesec demonstrated the attack yesterday and called it USB2Shell. It is CVE-2026-98232, fixed upstream in September and published in October, so the exposure is limited to kernels that have not taken the update.

The bug lives in the kernel's SCSI core, in the code that enables a feature called Command Duration Limits. When a USB device claims to be an ATA disk that supports the feature, the kernel copies information out of the device into a small buffer on its stack. It trusts the length values the device supplies and never checks them against the buffer size. A device that lies about those lengths can read up to 64 bytes of kernel stack and flip a single byte of it, according to the kernel advisory.

What makes this worse than a typical bounds bug is when it fires. The kernel scans a USB storage device the instant it is connected, before anyone signs in. A locked screen, a logged-out session, or a policy against mounting unknown drives does none of its work here, because the device is already talking to privileged kernel code before any of those gates apply.

On one test machine, the Drivesec researchers turned that single-byte write into a full write-anywhere primitive in kernel memory. They defeated KASLR, forged kernel data structures, and arranged for the device's chosen command to run as root at the moment it was unplugged. Their write-up describes the target as a Debian box on kernel 6.12.22 with KASLR enabled, driven by a Cynthion, a small programmable USB tool.

Several caveats come straight from the researchers. The exploit is probabilistic and did not always work on their test machine, and there is no published success rate. A failed attempt does not crash the host, so an attacker can simply try again. No real-world use has been found and no victims identified, the flaw is not in CISA's KEV catalog as of publication, and a physical attack is hard to carry across many machines with the fix out since September.

The bug was introduced in Linux 6.5 and is present in every release from 6.5 up to the fix. A system is only in scope if it has USB mass storage support through the usb-storage or uas driver and a USB port someone can reach.

The upstream version numbers do not translate directly to what distributions ship, because distributions backport both features and fixes. Debian's standard version 12 kernel never contained the flawed code, according to its security tracker, and Red Hat shipped the fix in a kernel it numbers 5.14. Check your own distribution rather than reasoning from the 6.5 figure.

What to do

Update to a kernel that carries the fix, or backport the upstream commit. If you cannot update immediately:

  • Block the usb-storage and uas drivers from loading on machines that have no reason to read USB storage.
  • Require devices to be approved before the kernel binds a driver, using USB allow-listing such as USBGuard or the authorized_default=0 setting.

Drivesec publishes a script to check a system, but it can miss fixes a vendor has backported, so treat a result as a hint, not proof.

Android comes off better. Phone kernels on 6.6 and newer are affected and will hand the device some kernel memory, but every build the researchers checked, including Google's generic Android kernel and the kernel on a Samsung Galaxy A16, uses a compiler check that blocks the memory-write step. The result there is a memory leak, not root.

The bug was first flagged by Sashiko, an AI code-review system Google built for the Linux kernel and handed to the Linux Foundation, which reported it on the kernel mailing list. Drivesec says it found the same flaw independently, wrote the fix, and built the exploit, and that the AI wrote none of the exploit. Google says Sashiko has been credited on 528 Linux kernel CVE fixes this year, while cautioning that it is "too early to make strong claims" about how much credit the tool deserves.

Drivesec frames the practical concern as equipment where strangers can reach a USB port and keep retrying: self-service kiosks, payment terminals, car infotainment units, EV chargers, smart-home hubs. None has been shown compromised; the researchers list them as places where an exposed port matters, not as affected products.

Top comments (0)