Skip to content

About

A local Bash scanner to check whether a Linux host is exposed to usb2shell (CVE-2026-98232), a stack out-of-bounds vulnerability in the Linux SCSI core triggered during automatic scanning of a newly connected USB storage device.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

usb2shell-check

A local Bash scanner to check whether a Linux host is exposed to usb2shell (CVE-2026-98232), a stack out-of-bounds vulnerability in the Linux SCSI core triggered during automatic scanning of a newly connected USB storage device.

Advisory & full write-up: https://usb2shell.com/

Vulnerability Overview (CVE-2026-98232)

Introduced with Command Duration Limits (CDL) support in Linux 6.5, CVE-2026-98232 resides in scsi_cdl_enable() in the Linux SCSI core. When a newly connected USB mass storage device advertises itself as an ATA device supporting CDL, the kernel reads a mode page into a 64-byte stack buffer and writes it back without properly validating lengths from the device's reply:

len = min_t(size_t, sizeof(buf),
            data.length - data.header_length -
            data.block_descriptor_length);   /* can wrap -> 64 */
buf_data = buf + data.header_length +
        data.block_descriptor_length;         /* can point past buf */

Because data.length, data.header_length, and data.block_descriptor_length are not validated, a malicious USB device can:

  • Cause the kernel to leak up to 64 bytes of kernel stack memory back to the device.
  • Overwrite/clear a single stack byte at a controlled offset during the automatic scan—before userspace ever sees a disk, and without requiring login, mounting, or user interaction.

Impact & Affected Versions

  • Affected kernels: Linux 6.5 and later without the fix.

  • First fixed releases:

  • 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

  • Exploitation: Discovered and demonstrated by Drivesec (Z3r0n37, Alberto247 — Drivesec S.r.l.) using a Cynthion USB device against a stock Debian 6.12.22+bpo-amd64 kernel with KASLR enabled, achieving root command execution upon unplugging the device without crashing on failed attempts. On Android kernels (6.6+), compiler bounds checks tested by Drivesec (Android GKI and Samsung Galaxy A16) limited the impact to an information leak.

  • High-risk targets: Systems with physically reachable USB ports such as kiosks, POS terminals, EV chargers, automotive infotainment/telematics units, industrial HMIs, smart-home hubs, and in-flight entertainment systems.

How to Fix & Mitigate

  • Update / Backport: Upgrade to a fixed kernel release or backport upstream commit 3d676e458fe0 ("scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()").
  • Disable mass storage drivers: Do not build or auto-load usb-storage and uas where USB mass storage is not needed.
  • USB allow-listing: Restrict unauthorized USB devices using USBGuard or setting authorized_default=0.

Note: Distribution vendors frequently backport security fixes without changing the upstream version string. Always confirm against your vendor's advisory or source tree for 3d676e458fe0 / CVE-2026-98232.

Usage

bash usb2shell-check.sh [OPTIONS]

Options

Flag Description
-h, --help Display the help message and exit
-d, --debug Enable debug tracing (set -x) with automatic cleanup on exit
-s, --scan Run the local kernel and USB mass storage check

Examples

# Run a local scan
bash usb2shell-check.sh -s

# Run with debug tracing enabled
bash usb2shell-check.sh -d -s

Author

Created by @Pauloxc6

License

License: MIT @2026

About

A local Bash scanner to check whether a Linux host is exposed to usb2shell (CVE-2026-98232), a stack out-of-bounds vulnerability in the Linux SCSI core triggered during automatic scanning of a newly connected USB storage device.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages