News 4 min read

usb2shell: Linux kernel bug gives root from a USB plug-in


Italian security firm Drivesec has published usb2shell (CVE-2026-98232), a bug in the Linux kernel’s SCSI code that lets a malicious USB device run a command of its choice as root. Nobody has to log in, mount a disk or click anything: the bug fires while the kernel automatically scans a newly connected USB storage device. Every Linux kernel from 6.5 onwards is affected until patched, and fixes are already in the stable releases, so the job for developers and admins is to make sure their kernels, and the kernels in the devices they ship, include them.

What’s new

  • What the bug is. Linux 6.5 added support for Command Duration Limits (CDL), a feature of ATA drives. When the kernel scans a device that says it is an ATA drive with CDL support, the function scsi_cdl_enable() reads a settings page from the device into a 64-byte buffer on the kernel stack and writes it back. According to the CVE record, the length fields in the device’s reply were not checked, so a subtraction could wrap around and a pointer could land past the end of the buffer.
  • What an attacker gets. Drivesec says a malicious device can read up to 64 bytes of kernel stack and overwrite one stack byte at an offset it chooses. That is a small primitive, but the researchers chained it into root command execution.
  • The proof of concept. Drivesec ran its exploit from a Cynthion USB device against a stock Debian 6.12.22+bpo-amd64 kernel over a real USB port, with KASLR enabled. The leak defeats KASLR, and the one-byte write is turned into a controlled write; when the device is unplugged, the kernel runs a command the device supplied, as root. The exploit is probabilistic, but Drivesec says failed attempts don’t crash the machine, so the device can simply retry.
  • Android. On Android the bug is a leak only, according to Drivesec. Android kernels on 6.6 and later still send kernel stack contents to the device, but the builds it checked (Android GKI and the Samsung Galaxy A16 shipping kernel) use compiler bounds checks that keep the write inside the buffer.
  • Timeline. Drivesec says it found the bug on August 26, 2026, reported it privately to the SCSI maintainers on September 2 and sent a patch two days later. The fix was committed on September 9, the Linux kernel’s CVE team published CVE-2026-98232 on October 6, and the full write-up went public on November 30. Drivesec credits Sashiko AI Review with reporting the same bug first on the linux-scsi mailing list; Drivesec found it independently and wrote the fix and the exploit.

Fixed kernel versions

Kernel branch First fixed release
6.6.y 6.6.158
6.12.y 6.12.112
6.18.y 6.18.54
7.2.y 7.2.8
mainline 7.3

Kernels older than 6.5 are not affected, because the CDL code did not exist yet.

Who is exposed

A machine is at risk when all three of these are true, according to Drivesec:

  1. it runs Linux 6.5 or later without the fix;
  2. it supports USB mass storage (the usb-storage or uas drivers), built in or loaded automatically;
  3. someone can plug a device into one of its USB ports.

The attacker needs brief physical access, and Drivesec points to the many Linux systems with ports strangers can reach: car infotainment and telematics units, EV chargers, point-of-sale terminals, kiosks, in-flight entertainment, industrial control panels and smart-home hubs.

The name follows this year’s run of “2shell” bugs, such as ruby2shell and phpAfterShell, and the related Java4Shell. Those were remote bugs reached with a crafted request; usb2shell is the physical version, reached with a crafted USB device.

What it means for developers

  • Update your kernel. On desktops, laptops and servers, install your distribution’s latest kernel update and reboot. Distributions often backport fixes without changing the kernel’s version number, so check your vendor’s advisory for CVE-2026-98232 rather than comparing version strings alone.

  • Check with Drivesec’s script. Drivesec publishes a checker; its advice is to download it, read it, then run it:

    curl -fsSLO https://usb2shell.com/tools/usb2shell-check.sh
    less usb2shell-check.sh
    sh usb2shell-check.sh
  • If you ship a device that runs Linux, backport the upstream fix, commit 3d676e458fe0 (“scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()”), into your vendor kernel and push an update.

  • If you can’t update yet, Drivesec lists two mitigations: don’t build or auto-load usb-storage and uas where mass storage isn’t needed, which removes the attack surface; or use USB allow-listing (USBGuard, or setting authorized_default=0) so the kernel doesn’t scan devices that haven’t been authorized.

The upstream fix caps the copied length at the size of the buffer and validates the mode header and block descriptor lengths before the kernel uses the page, as the CVE record describes.

Sources