USB2Shell (CVE-2026-98232): Defensive Analysis of the Linux Kernel SCSI CDL Length-Validation Flaw and Kernel Hardening
Code-level analysis of USB2Shell (CVE-2026-98232): how missing MODE SENSE length validation in scsi_cdl_enable() causes kernel stack memory exposure and corruption on Linux 6.5+, how commit 3d676e458fe0 fixes it, and why disabling automount is insufficient.
CVE-2026-98232 ("USB2Shell") - Linux Kernel SCSI CDL Stack Length-Validation Vulnerability (CWE-191 Integer Underflow, CWE-125 Out-of-Bounds Read & CWE-787 Out-of-Bounds Write)
Severity: HIGH (KERNEL STACK MEMORY EXPOSURE & CORRUPTION DURING USB ENUMERATION) (CVSS 8.4 High (Physical Access Vector AV:P, Full Kernel Privilege Impact))
Threat Actor: Z3r0n37 & Alberto247 (Drivesec) — Disclosed Late November 2026
Status: Upstream Patch Merged (Commit 3d676e458fe0); Backported to Active LTS & Stable Branches
Affected Systems: Linux kernel 6.5 through 6.6.157, 6.12.111, 6.18.53, and 7.2.7 (USB storage / SCSI CDL enabled)
Fixed In: Linux 6.6.158, 6.12.112, 6.18.54, 7.2.8, and 7.3+
In late November 2026, security researchers Z3r0n37 and Alberto247 at Drivesec publicly disclosed CVE-2026-98232—widely tracked as "USB2Shell"—a high-severity memory-safety vulnerability inside the Linux kernel’s SCSI core subsystem (drivers/scsi/scsi.c). Unlike traditional BadUSB keystroke-injection hardware that emulates a Human Interface Device (HID) and requires an unlocked desktop session, USB2Shell targets the automatic kernel-level SCSI enumeration path triggered immediately when a USB mass-storage peripheral is attached. Because the flaw occurs inside scsi_cdl_enable() during initial hardware probing—before any user logs in or any filesystem is mounted—locked workstations, headless servers, public kiosks, EV chargers, and industrial control panels running unpatched Linux 6.5+ kernels are exposed. Crucially, disabling user-space automounting does not mitigate CVE-2026-98232.

1. Vulnerability Intelligence & Threat Scope
When a USB storage device is connected to a Linux system, the USB core subsystem matches its interface descriptor against in-kernel storage drivers such as usb-storage or uas (USB Attached SCSI). The SCSI mid-layer then queries the device using standard Inquiry and Vital Product Data (VPD) commands to discover storage geometry and supported protocol extensions.
In Linux kernel 6.5, support was introduced for Command Duration Limits (CDL)—a storage feature standardized in SPC-6 and ACS-5 that allows operating systems to enforce latency budgets on storage I/O commands. For ATA drives behind a SCSI-to-ATA Translation (SAT) bridge (such as USB-to-SATA enclosures), the kernel manages CDL state by reading and writing the ATA Feature Control mode page (Mode Page 0x0A, Subpage 0xF2) inside scsi_cdl_enable().
| Parameter | Technical Specification |
|---|---|
| CVE Identifier | CVE-2026-98232 ("USB2Shell") |
| CVSS v3.1 Base Score | 8.4 High (Physical Access Vector, Zero User Interaction) |
| CWE Classification | CWE-191 (Integer Underflow), CWE-125 (OOB Read), CWE-787 (OOB Write) |
| Affected Subsystem | Linux Kernel SCSI Core (drivers/scsi/scsi.c :: scsi_cdl_enable()) |
| Upstream Fix Commit | 3d676e458fe0 ("scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()") |
| Affected Kernels | Linux 6.5 through 6.6.157, 6.12.111, 6.18.53, and 7.2.7 |
| Patched Kernels | 6.6.158, 6.12.112, 6.18.54, 7.2.8, and 7.3+ (Windows & macOS unaffected) |
Why Locked and Headless Systems Are Exposed
Physical USB Connection
│
▼
[1] Kernel USB Core (usbcore) enumerates descriptors & binds driver
└─► Matches USB Mass Storage (usb-storage / uas)
│
▼
[2] Kernel SCSI Mid-Layer scans target (BEFORE user-space / automount!)
├─► Queries VPD / ATA Translation identity -> sdev->is_ata = true
├─► Checks Command Duration Limits support -> sdev->cdl_supported = true
└─► Calls scsi_cdl_enable(sdev, false) during disk revalidation
│
▼
[3] drivers/scsi/scsi.c :: scsi_cdl_enable()
├─► Allocates 64-byte stack buffer: char buf[64];
├─► Sends MODE SENSE (Page 0x0A, Subpage 0xF2) -> device supplies lengths
├─► BUG: Unvalidated length subtraction underflows & shifts buf_data past buf[64]
└─► Modifies buf_data[4] and transmits 64 bytes via scsi_mode_select()
│
▼
[4] User-Space / Desktop Automount / Login Screen (NEVER REACHED BEFORE TRIGGER)2. Code-Level Root Cause Analysis (drivers/scsi/scsi.c)
Inside drivers/scsi/scsi.c, scsi_cdl_enable() allocates a fixed 64-byte stack buffer (char buf[64]) and issues a MODE SENSE request to fetch the device’s ATA Feature Control mode page (0x0A / 0xF2):
/* Vulnerable implementation prior to commit 3d676e458fe0 (drivers/scsi/scsi.c) */
int scsi_cdl_enable(struct scsi_device *sdev, bool enable)
{
char buf[64];
struct scsi_mode_data data;
struct scsi_sense_hdr sshdr;
char *buf_data;
size_t len;
int ret;
if (!sdev->cdl_supported)
return -EOPNOTSUPP;
if (sdev->is_ata) {
ret = scsi_mode_sense(sdev, 0x08, 0x0a, 0xf2, buf, sizeof(buf),
5 * HZ, 3, &data, NULL);
if (ret)
return -EINVAL;
/* BUG 1: Unsigned subtraction can underflow if device reports
* data.length < (data.header_length + data.block_descriptor_length) */
len = min_t(size_t, sizeof(buf),
data.length - data.header_length -
data.block_descriptor_length);
/* BUG 2: Pointer arithmetic is not validated against sizeof(buf) */
buf_data = buf + data.header_length + data.block_descriptor_length;
/* Read-modify-write on byte 4 of the mode page (CDL_CTRL bits) */
if (enable)
buf_data[4] = (buf_data[4] & ~0x03) | 0x02;
else
buf_data[4] &= ~0x03;
/* Sends 'len' bytes starting at 'buf_data' back to the USB device */
ret = scsi_mode_select(sdev, 1, 0, buf_data, len,
5 * HZ, 3, &data, &sshdr);
/* ... */
}
return 0;
}scsi_mode_sense() sets the DBD (Disable Block Descriptors, 0x08) flag, the SCSI mid-layer still parses data.length, data.header_length, and data.block_descriptor_length from the device’s response header. When a non-compliant device reports a header or block descriptor length exceeding data.length, the unsigned subtraction wraps around to a huge value—causing min_t(size_t, sizeof(buf), ...) to clamp len to 64 bytes. Meanwhile, buf_data advances past buf[64] on the kernel stack. During automatic initialization (enable == false), buf_data[4] &= ~0x03 clears two bits at that out-of-bounds stack offset, and scsi_mode_select() transmits 64 bytes of kernel stack memory back to the device, exposing kernel pointers (defeating KASLR).3. Upstream Kernel Patch Analysis (Commit 3d676e458fe0)
The Linux SCSI maintainers resolved CVE-2026-98232 in upstream commit 3d676e458fe0 ("scsi: core: Validate MODE SENSE lengths in scsi_cdl_enable()"), replacing the unvalidated subtraction with step-by-step bounds checking against sizeof(buf):
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -1010,13 +1010,27 @@ int scsi_cdl_enable(struct scsi_device *sdev, bool enable)
if (sdev->is_ata) {
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;
+ 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;- Hard Buffer Ceiling: Caps
availatmin_t(size_t, data.length, sizeof(buf))(at most 64 bytes). - Underflow Prevention: Validates
data.header_length <= availanddata.block_descriptor_length <= availsequentially before advancingoffset. - Minimum Mode-Page Guard: Enforces
avail >= 5before dereferencingbuf_data[4]or callingscsi_mode_select().
4. Detection Engineering & Telemetry Rules
1. Sigma Detection Rule (USB SCSI CDL Anomalies & Kernel Stack Faults)
title: Suspicious USB SCSI CDL Enumeration or Kernel Stack Fault (CVE-2026-98232 / USB2Shell)
id: 9b4e2f10-7c3d-4a8e-9823-202698232001
status: experimental
description: Detects Linux kernel messages indicating repeated USB mass-storage hotplugs, SCSI CDL mode sense/select anomalies, or kernel stack faults involving scsi_cdl_enable().
references:
- https://colibrisec.org/usb2shell-cve-2026-98232-linux-kernel-scsi-cdl-vulnerability-analysis/
author: James Luther (ColibriSec)
date: 2026-12-01
logsource:
category: system
product: linux
detection:
selection_scsi_cdl:
message|contains:
- "scsi_cdl_enable"
- "scsi_mode_select"
- "Command Duration Limits"
- "Enable CDL failed"
- "Disable CDL failed"
selection_usb_mass_storage:
message|contains:
- "usb-storage"
- "uas"
selection_fault:
message|contains:
- "stack-protector"
- "general protection fault"
- "BUG: unable to handle page fault"
- "Oops:"
condition: selection_scsi_cdl or (selection_usb_mass_storage and selection_fault)
falsepositives:
- Faulty enterprise SATA-to-USB enclosures reporting malformed mode pages
level: high
tags:
- attack.initial_access
- attack.t1091
- attack.privilege_escalation
- attack.t1068
- cve.2026.982322. Splunk SPL Hunt Query (Rapid USB Storage Re-Enumeration)
index=os (sourcetype="linux:messages" OR sourcetype="journald" OR sourcetype="syslog")
("usb-storage" OR "uas" OR "scsi_cdl_enable" OR "New USB device found")
| rex field=_raw "idVendor=(?<usb_vid>[0-9a-fA-F]{4}),s+idProduct=(?<usb_pid>[0-9a-fA-F]{4})"
| bin _time span=5m
| stats count as attach_events, values(usb_vid) as vendors, values(usb_pid) as products, values(message) as sample_logs by host, _time
| where attach_events >= 3 OR match(sample_logs, "scsi_cdl_enable|CDL|Oops|BUG:")
| sort - attach_events3. Linux auditd Hardening Telemetry
# /etc/audit/rules.d/usb2shell-hardening.rules
-w /etc/usbguard/rules.conf -p wa -k usbguard_policy_change
-w /etc/modprobe.d/ -p wa -k kernel_modprobe_change
-w /sys/bus/usb/drivers/usb-storage/ -p wa -k usb_storage_driver_change5. Remediation & Defense-in-Depth Hardening Playbook
Step 1: Upgrade to a Patched Linux Kernel
- Linux 6.6 LTS: Upgrade to
6.6.158or later - Linux 6.12 LTS: Upgrade to
6.12.112or later - Linux 6.18 Stable: Upgrade to
6.18.54or later - Linux 7.2 Stable: Upgrade to
7.2.8or later - Linux 7.3 Mainline: Upgrade to
7.3+
Step 2: Deploy USBGuard Allow-Listing
sudo apt install usbguard
sudo usbguard generate-policy > /etc/usbguard/rules.conf
echo 'reject with-interface one-of { 08:*:* }' | sudo tee -a /etc/usbguard/rules.conf
sudo systemctl enable --now usbguardStep 3: Kernel Boot Hardening & Module Blacklisting
On kiosks, payment terminals, EV chargers, and headless servers where external USB drives are never required, set usbcore.authorized_default=0 in your kernel command line and blacklist usb-storage and uas:
cat << 'EOF' | sudo tee /etc/modprobe.d/disable-usb-storage.conf
install usb-storage /bin/false
blacklist usb-storage
install uas /bin/false
blacklist uas
EOF
sudo update-initramfs -uudisks2 / autofs) only prevents user-space from mounting filesystems. scsi_cdl_enable() executes in kernel space during automatic SCSI target probing the moment usb-storage or uas binds to the USB peripheral.