79% vs 51%: independent neobanks lag on app security. Read the report

Deep Dive

Deep Dive

USB2Shell: Linux Kernel Root From a USB Device (CVE-2026-98232)

A crafted USB device can run commands as root on Linux 6.5 and later during automatic scan, before login. Fixed in 6.6.158, 6.12.112, 6.18.54, 7.2.8 and 7.3.

TL;DR

  • USB2Shell is an out-of-bounds stack write in the Linux SCSI code that scans a USB storage device when it is plugged in. Drivesec published its analysis on 2026-12-01.
  • Linux 6.5 and later with the usb-storage or uas driver and a reachable USB port is exposed. Distributions backport both the feature and the fix, so check the vendor advisory for your kernel.
  • Red Hat rates it CVSS v3.1 8.4, Important. Drivesec demonstrated root on a Debian machine running 6.12.22; no in-the-wild attacks are known, and it is not in CISA KEV as of 2026-12-01.
  • Update to 6.6.158, 6.12.112, 6.18.54, 7.2.8 or 7.3 or later, then reboot. See "How do I fix it?" for the USB storage workaround.

Am I affected?

You are exposed when all of these conditions hold:

  • The kernel is Linux 6.5 or later, or a distribution kernel that backported the Command Duration Limits code.
  • The kernel has USB mass storage enabled through usb-storage or uas.
  • A USB port the attacker can physically reach is available, including a port inside a locked enclosure.
  • The host runs a vulnerable kernel when the device is plugged in, either at boot with the device attached or over hotplug at any time. A locked screen or a logged-out session does not help, because the scan runs in kernel context during enumeration.

The CVE record lists every upstream release from 6.5 through 7.2.7 as affected.

The fixed versions are 6.6.158, 6.12.112, 6.18.54, 7.2.8 and 7.3 or later. Red Hat says it shipped the fix in a kernel it numbers 5.14, which shows why the upstream version is only a starting point. According to The Hacker News, Debian's security tracker says the standard Debian 12 kernel never contained the flawed code.

Branch Affected versions Fixed version
6.5.x and 6.6.x 6.5 to 6.6.157 6.6.158 or later
6.7.x to 6.12.x 6.7 to 6.12.111 6.12.112 or later
6.13.x to 6.18.x 6.13 to 6.18.53 6.18.54 or later
6.19.x to 7.2.x 6.19 to 7.2.7 7.2.8 or later
7.3.x and later None Not affected

Check the running kernel:

uname -r

Check whether the USB storage drivers are loaded:

lsmod | grep -E '^(usb_storage|uas)'

Check whether the kernel was built with USB mass storage support:

grep -E '^CONFIG_(BLK_DEV_SD|USB_STORAGE|USB_UAS)=' /boot/config-$(uname -r) 2>/dev/null \
  || zcat /proc/config.gz 2>/dev/null | grep -E '^CONFIG_(BLK_DEV_SD|USB_STORAGE|USB_UAS)='

Debian's popularity contest counts 279,102 installs of linux-image-amd64, an opt-in figure and a lower bound. A kernel without CONFIG_BLK_DEV_SD or without usb-storage and uas cannot reach the vulnerable path. A kernel with them is a candidate, but the version check alone does not prove the fix is missing. Compare with your distribution's kernel advisory, because vendors backport and renumber the fix.

How do I fix it?

Upgrade to a kernel that contains the fix, then reboot into it. The upstream fixed releases are 6.6.158, 6.12.112, 6.18.54, 7.2.8 and 7.3 or later.

On Debian or Ubuntu:

sudo apt update
sudo apt full-upgrade
sudo reboot

On Fedora or Red Hat Enterprise Linux:

sudo dnf upgrade --refresh kernel
sudo reboot

On SUSE:

sudo zypper update kernel-default
sudo reboot

On Arch Linux:

sudo pacman -Syu linux
sudo reboot

Containers share the host kernel. Updating an image or a container does not remove the flaw; the host must run a fixed kernel.

If you cannot upgrade yet, remove the automatic USB storage path:

  1. Stop the two drivers from loading:
printf 'blacklist usb-storage\nblacklist uas\n' | sudo tee /etc/modprobe.d/disable-usb-storage.conf
sudo modprobe -r usb-storage uas 2>/dev/null || true
  1. Reboot, then confirm the modules are absent:
lsmod | grep -E '^(usb_storage|uas)' || echo 'USB storage drivers not loaded'
  1. If you need some USB devices, use a USB authorization policy instead of blocking the drivers. USBGuard lets you allow-list known devices and reject everything else. Setting authorized_default to 0 on the USB root hubs does the same at the kernel level for new devices:
echo 0 | sudo tee /sys/bus/usb/devices/usb*/authorized_default

The blacklist removes USB storage from the machine, including legitimate drives. The authorization policy blocks new devices until an administrator approves them, which can break keyboards and other input devices if they are not allow-listed first. Neither workaround patches the kernel, and both must be applied to every host with a reachable port.

Drivesec offers a checker script, but it can miss a fix that a vendor backported. Treat its result as a hint and confirm the kernel build in the vendor advisory.

What is the root cause?

scsi_cdl_enable() trusts three length fields from the device when it locates the ATA Command Duration Limits feature page in a 64-byte stack buffer. The function runs during the automatic SCSI scan of a USB storage device, so the device controls those fields before any userspace process touches it.

The buffer and the read-modify-write are in drivers/scsi/scsi.c:

/* drivers/scsi/scsi.c, scsi_cdl_enable(), before commit 3d676e458fe0 */
char buf[64];
...
ret = scsi_mode_sense(sdev, 0x08, 0x0a, 0xf2, buf, sizeof(buf),
                      5 * HZ, 3, &data, NULL);
if (ret)
    return -EINVAL;

len = min_t(size_t, sizeof(buf),
            data.length - data.header_length -
            data.block_descriptor_length);
buf_data = buf + data.header_length +
    data.block_descriptor_length;

if (enable) {
    if ((buf_data[4] & 0x03) == 0x02)
        goto out;
    buf_data[4] &= ~0x03;
    buf_data[4] |= 0x02;
} else {
    if ((buf_data[4] & 0x03) == 0x00)
        goto out;
    buf_data[4] &= ~0x03;
}

ret = scsi_mode_select(sdev, 1, 0, buf_data, len, 5 * HZ, 3,
                       &data, &sshdr);

scsi_mode_sense() fills data.length, data.header_length and data.block_descriptor_length from the device's MODE SENSE response.

Nothing checks that the header and the block descriptors fit inside the 64 bytes that were read. When the device reports a total length shorter than its header plus its block descriptors, the subtraction is unsigned and wraps. The min_t() then caps len at 64, but buf_data is computed separately and points past the end of buf.

During the automatic scan the kernel calls scsi_cdl_enable(sdev, false).

The write path takes the else branch and clears the low two bits of buf_data[4], a byte outside the buffer. scsi_mode_select() then builds the outgoing MODE SELECT from buf_data and copies up to 64 bytes from outside the buffer into the payload that goes back to the device. The same code with enable set gives the attacker a controlled out-of-bounds read-modify-write instead.

How is it exploited?

  1. The attacker plugs in a crafted USB storage device that enumerates through usb-storage or uas.
  2. The device identifies itself as an ATA device and advertises support for Command Duration Limits, so the kernel calls scsi_cdl_enable() during the scan.
  3. The device answers MODE SENSE with a length field shorter than its own header and block descriptor fields.
  4. The unsigned subtraction wraps, buf_data points beyond the 64-byte stack buffer, and the kernel clears two bits of an out-of-bounds stack byte.
  5. scsi_mode_select() copies up to 64 bytes from outside the buffer into the reply, which discloses kernel stack memory to the device.
  6. Drivesec turned the single-byte change into a controlled kernel write, defeated KASLR, built fake kernel structures and ran a command as root when the device was unplugged. The company published the analysis on 2026-12-01.

The kernel commit records a proof that ran on a one-vCPU QEMU guest with a Raw Gadget device. It executed a fixed command inside the guest and created a UID-0-owned marker during automatic enumeration, with KASLR and NX enabled. Drivesec says its exploit is probabilistic and that a failed attempt does not crash the machine, so the attacker can retry.

No exploit code has been released publicly. The public material is the kernel commit and Drivesec's write-up, not a ready-to-run tool.

How does the attack flow?

A USB device that lies about its MODE SENSE lengths moves the SCSI core past a 64-byte stack buffer during automatic scan. The out-of-bounds change and the stack leak are the primitives that lead to root.

flowchart LR A["Crafted USB storage device"] --> B["Enumerates as ATA
and advertises CDL"] B --> C["Automatic scan calls
scsi_cdl_enable()"] C --> D["Device reports a short
MODE SENSE length"] D --> E["Unsigned subtraction wraps
and buf_data leaves buf"] E --> F["Out-of-bounds byte change
and 64-byte stack leak"] F --> G["Attacker builds a kernel write
and runs a command as root"]

What can an attacker do?

An attacker with physical access to a USB port can run arbitrary commands as root on the host. The kernel commit records a proof that did exactly that during enumeration, with KASLR and NX enabled. Drivesec reports a working exploit on a Debian machine running 6.12.22. The impact depends on the host, and these conditions must all hold:

  • The attacker can plug a device into a port the kernel scans. A locked screen, a logged-out session and a policy against mounting unknown drives do not block the scan.
  • The kernel is 6.5 or later, or a distribution kernel that carries the vulnerable SCSI code.
  • The USB mass storage driver is loaded and can bind to the device.
  • The attacker can retry, because the exploit is probabilistic and failures do not crash the machine.

The devices Drivesec names as examples are self-service kiosks, payment terminals, car infotainment units, EV chargers and smart-home hubs. None of them has been shown compromised, and the list describes where an exposed port matters.

The picture is narrower on Android. Drivesec found a kernel memory leak on the builds it checked, including Google's generic Android kernel and a Samsung Galaxy A16, but not root. Those builds use a compiler check that blocks the memory-changing step.

No in-the-wild attacks and no victims have been reported. CISA had not added CVE-2026-98232 to the Known Exploited Vulnerabilities catalog as of 2026-12-01.

Why does the fix work?

The fix validates every device-controlled length before it is used, so neither the subtraction nor the pointer can leave the 64-byte buffer. The change in scsi_cdl_enable() is:

-       len = min_t(size_t, sizeof(buf),
-               data.length - data.header_length -
-               data.block_descriptor_length);
-       buf_data = buf + data.header_length +
-           data.block_descriptor_length;
+       avail = min_t(size_t, data.length, sizeof(buf));
+       if (data.header_length > avail)
+           return -EINVAL;
+
+       offset = data.header_length;
+       avail -= data.header_length;
+
+       if (data.block_descriptor_length > avail)
+           return -EINVAL;
+
+       offset += data.block_descriptor_length;
+       avail -= data.block_descriptor_length;
+
+       if (avail < 5)
+           return -EINVAL;
+
+       buf_data = buf + offset;
+       len = avail;

avail starts as the smaller of the reported total length and 64, so it cannot exceed the bytes that were actually read.

The two length fields are then compared with what remains before each is subtracted. A device that reports a header or a block descriptor larger than the buffer is rejected with -EINVAL. The final check requires the five bytes the code reads at buf_data[4], so the read-modify-write and the MODE SELECT payload always stay inside buf.

The fix covers the only copy of this logic. scsi_cdl_enable() is the function the SCSI scan calls for an ATA device that advertises CDL, and the commit changes no other path.

How do I check if I was compromised?

No indicators of compromise have been published. The kernel and Drivesec describe the exploit at the protocol level, and a failed attempt does not crash the machine, so there may be nothing to find after the fact.

If you suspect a device was used, start with the kernel log and the USB history on the host:

journalctl -k --since "30 days ago" | grep -i -E 'usb-storage|uas|new .* USB device|scsi'

Look for an unknown storage device that was enumerated around the time of the suspected access. Compare the serial numbers and vendor strings with the devices you own:

lsusb -v 2>/dev/null | grep -E 'idVendor|idProduct|iSerial|iProduct'

Check whether the kernel logged a MODE SENSE or CDL error from a device you cannot identify:

dmesg | grep -i -E 'command duration|mode sense|cdl'

A hit is a lead, not proof. Legitimate USB drives also appear in these logs. The stronger check is the kernel version: a host running an affected build without the vendor backport is exposed whether or not an attempt is visible.

Timeline

The first stable kernels carried the fix 15 days after the merged patch and the remaining branches on October 3, while the public analysis arrived 137 days after the report
Figure 1: From the Sashiko report to the Drivesec analysis. Source: Linux kernel commit, kernel.org release files and Drivesec, checked December 1, 2026

  • 2026-07-17: Sashiko, an AI code-review system, reports the flaw on the linux-scsi mailing list.
  • 2026-09-10: The upstream fix, commit 3d676e458fe0, is merged.
  • 2026-09-25: Linux 6.18.54 and 7.2.8 are released with the fix.
  • 2026-10-03: Linux 6.6.158 and 6.12.112 are released with the fix.
  • 2026-10-06: CVE-2026-98232 is published by the Linux kernel CNA.
  • 2026-12-01: Drivesec publishes its usb2shell analysis and demonstration.

FAQ

Does an attack need physical access? Yes. The attacker must plug a crafted USB device into a port that the kernel scans. A remote attacker cannot deliver the device over the network.

Is every Linux 6.5 or later system affected? No. The host also needs USB mass storage and a reachable port, and the device must be able to bind as an ATA device that advertises CDL. A kernel without those drivers cannot reach the function.

Is Debian 12 affected? Debian says its standard Debian 12 kernel never contained the flawed code, because that kernel predates 6.5. Other distributions backport kernel features, so check the vendor advisory rather than the upstream version alone.

Does this give root on Android phones? Drivesec found a memory leak, not root, on the Android builds it checked. The same code is present on phone kernels from 6.6, but a compiler check in those builds blocks the memory-changing step.

Is there a public exploit? Drivesec published a technical analysis and a demonstration, and the kernel commit describes a proof that ran a command as UID 0. No ready-to-run exploit code has been released.

Was it exploited in the wild? No exploitation has been reported. CISA had not added the CVE to KEV as of 2026-12-01.

References

  • CVE-2026-98232 record, https://www.cve.org/CVERecord?id=CVE-2026-98232 (checked December 1, 2026)
  • Linux kernel fix commit 3d676e458fe0c566f5a62753dc696b6a862fc412, https://github.com/torvalds/linux/commit/3d676e458fe0c566f5a62753dc696b6a862fc412 (checked December 1, 2026)
  • Linux stable backport for 6.6.158, https://github.com/torvalds/linux/commit/39491a1ae93054fea10b4030180e5c797b2c0343 (checked December 1, 2026)
  • Linux stable backport for 6.12.112, https://github.com/torvalds/linux/commit/60b0b8ce803e3c2b2a9e5485ab3f88599fb4c7a4 (checked December 1, 2026)
  • Linux stable backport for 6.18.54, https://github.com/torvalds/linux/commit/6233d0b3ef4623df0d6934dc8b93b161e9854f6b (checked December 1, 2026)
  • Linux stable backport for 7.2.8, https://github.com/torvalds/linux/commit/99a6e4a9176da456904b67dcbae6e77d122782b7 (checked December 1, 2026)
  • Linux 6.6.158 release files, https://cdn.kernel.org/pub/linux/kernel/v6.x/ (checked December 1, 2026)
  • Red Hat CVE-2026-98232 page, https://access.redhat.com/security/cve/CVE-2026-98232 (checked December 1, 2026)
  • Drivesec, usb2shell: our PT team finds a way to take over Linux systems with a USB device, https://www.drivesec.com/usb2shell-linux-usb-vulnerability/ (published 2026-12-01, checked December 1, 2026)
  • The Hacker News, USB2Shell Linux Kernel Flaw Lets Malicious USB Devices Gain Root Access Without Login, https://thehackernews.com/2026/12/usb2shell-linux-kernel-flaw-lets.html (published 2026-12-01, checked December 1, 2026)
  • Linux kernel source at the commit before the fix, drivers/scsi/scsi.c, https://github.com/torvalds/linux/blob/0cb1fd924126f1f581621a5e804df98a02be9dff/drivers/scsi/scsi.c (checked December 1, 2026)
  • Debian popularity contest, package install counts, https://popcon.debian.org/by_inst (checked December 1, 2026)
  • CISA Known Exploited Vulnerabilities catalog, https://www.cisa.gov/known-exploited-vulnerabilities-catalog (checked December 1, 2026)

Free scan

Scan your own app for free

or book a demo

Keep reading

Related articles

Browse the blog