Jorge Turbica / blog · Blog ← All articles ES · Leer en español
Technologies

usb2shell: plugging in a USB device gets root on Linux 6.5+, no login needed

CVE-2026-98232: a crafted USB device runs commands as root on Linux 6.5+ during the device scan. Fixed versions and mitigations.

Plug a crafted USB device in for a few seconds and the Linux kernel scans it on its own, with nobody logged in and nothing mounted, then runs the device's command as root. That is CVE-2026-98232, which Drivesec's team named usb2shell and fully documented on November 30, 2026, with a working chain against a stock Debian kernel with KASLR enabled. The patch has been out since September; what is new is the proof that the bug gets you root.

A 64-byte bug in the SCSI scan

The flaw lives in scsi_cdl_enable() in the SCSI core, a function added in Linux 6.5 to support Command Duration Limits (CDL) on ATA disks. When the kernel finds a storage device that claims to be ATA and to support CDL, it reads a mode page into a 64-byte stack buffer and writes it back. The lengths reported by the device were trusted: an unsigned subtraction could wrap, and the pointer to the page data could end up past the buffer.

According to the CVE record, the device gets back up to 64 bytes of kernel stack and can clear bits in a stack byte at an offset of its choosing. That sounds minor, but Drivesec chained it like this:

  1. The stack leak exposes addresses and defeats KASLR.
  2. With those addresses, it builds fake kernel structures and turns the one-byte overwrite into a controlled write.
  3. When the device is unplugged, the kernel runs the command it carries, as root.

The demo uses a Cynthion device against Debian 6.12.22+bpo-amd64: the first two attempts miss and retry without crashing the machine, and the third runs whoami and uname as root. The lack of a kernel panic on a miss is exactly what makes it dangerous: an attacker can keep trying until it lands, and the box stays up.

One striking detail: the first report of the bug on the linux-scsi list came not from a person but from Sashiko AI Review, an automated reviewer. Drivesec found it independently, wrote the fix and built the exploit.

Who is exposed

Three things must all be true: a 6.5+ kernel without the fix, USB mass storage support (usb-storage or uas) built in or auto-loaded, and someone able to reach a USB port. No user interaction is needed.

In a data center with physical access control the risk is lower. It really matters for Linux boxes with ports strangers can reach, and Drivesec lists them: car infotainment and telematics units, EV chargers, point-of-sale terminals, kiosks, in-flight entertainment, industrial HMIs and smart-home hubs. I would add team laptops and any lab or CI machine sitting in a shared room.

On Android it stays an information leak: 6.6+ kernels still hand back stack contents, but the builds Drivesec checked (Android GKI and the Samsung Galaxy A16 shipping kernel) use compiler bounds checks that keep the write inside the buffer.

Fixed versions

Stable branchFirst fixed release
6.6.y6.6.158
6.12.y6.12.112
6.18.y6.18.54
7.2.y7.2.8
mainline7.3

The fix is commit 3d676e458fe0 ("scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()"). On Debian, trixie ships it in 6.12.113-1 (DSA-6568-1), and bookworm running the 6.12 backports kernel in 6.12.113-1~deb12u1 (DLA-4850-1). Bookworm's default 6.1 kernel is not affected, since it predates the CDL code.

How to check and patch

The caveat that matters: version numbers lie. Distributions and device vendors backport fixes without bumping the base version, so an old-looking 6.12.x may already be patched and a version check alone is not enough. The reliable check is your distribution's advisory for CVE-2026-98232, or the fix commit in your kernel's source tree.

On Debian and derivatives, upgrade the kernel and reboot:

bash
uname -r
sudo apt update && sudo apt full-upgrade
sudo reboot

Drivesec also publishes a checker script (usb2shell-check.sh) and asks you to read it before running it, which is good practice for anything you fetch with curl.

If a machine can't be rebooted yet, there are two mitigations:

  • Remove the attack surface: don't build or auto-load usb-storage and uas where USB storage isn't needed. Servers and kiosks rarely need it.
  • USB allow-listing: with USBGuard or authorized_default=0, the kernel never scans unauthorized devices, so the vulnerable code never runs.

For a fleet of edge devices, I would start with the second one: it closes this bug and the next variant of the same idea.

Sources

Jorge Turbica

Software Engineer and SRE. I write about the real challenges I run into in production.

See portfolio ↗