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.

USB2Shell (CVE-2026-98232) Linux Kernel SCSI CDL Vulnerability Architecture
🛡️
Vulnerability Intelligence: CVE ID: 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.

USB2Shell (CVE-2026-98232) Linux Kernel SCSI CDL Architecture
Figure 1: Architectural overview of CVE-2026-98232 (USB2Shell), tracing automatic USB mass-storage enumeration into scsi_cdl_enable(), the unvalidated MODE SENSE length arithmetic on buf[64], and the bounds validation introduced by upstream commit 3d676e458fe0.

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;
}
🔬
How the Length Underflow Creates Both a Stack Read & Stack Write Although 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;
  1. Hard Buffer Ceiling: Caps avail at min_t(size_t, data.length, sizeof(buf)) (at most 64 bytes).
  2. Underflow Prevention: Validates data.header_length <= avail and data.block_descriptor_length <= avail sequentially before advancing offset.
  3. Minimum Mode-Page Guard: Enforces avail >= 5 before dereferencing buf_data[4] or calling scsi_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.98232

2. 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_events

3. 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_change

5. Remediation & Defense-in-Depth Hardening Playbook

Step 1: Upgrade to a Patched Linux Kernel

  • Linux 6.6 LTS: Upgrade to 6.6.158 or later
  • Linux 6.12 LTS: Upgrade to 6.12.112 or later
  • Linux 6.18 Stable: Upgrade to 6.18.54 or later
  • Linux 7.2 Stable: Upgrade to 7.2.8 or 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 usbguard

Step 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 -u
⚠️
Why Disabling Automount Is Insufficient Disabling desktop automount (udisks2 / 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.

Read more

ColibriSec Weekly Security Roundup — Week of December 4, 2026 Threat Intelligence Matrix

Security Roundup: CISA KEV Acronis/HFS/TYPO3 Wave, Agentic AI CyberStrikeAI & DoorDash Attacks, TeamCity & HPE CVSS 10.0, Linux 21-Year Netfilter & USB2Shell, Woolworths 14M & Roche 169GB Breaches (Week of December 4, 2026)

Executive Summary: The week of November 28 to December 4, 2026 marks a decisive operational inflection point across enterprise security, kernel engineering, autonomous AI threats, sovereign cyber legislation, and global data breaches. Between November 30 and December 3, the U.S. Cybersecurity and Infrastructure Security Agency (CISA) expanded its Known

By James Luther
CISA KEV Wave: Acronis CVE-2026-87887, Rejetto HFS CVE-2026-61500 & TYPO3 CVE-2026-125160

CISA KEV Nov 30–Dec 3 Wave: Acronis Backup Zero-Day (CVE-2026-87887), Rejetto HFS Math.random() RCE (CVE-2026-61500) & TYPO3 Path Disclosure (CVE-2026-125160)

📌Security Roundup Series: Week of December 4, 2026 • 7 min read deep dive🚨Vulnerability Intelligence: CVE ID: CVE-2026-87887 (Acronis), CVE-2026-61500 (Rejetto HFS) & CVE-2026-125160 (TYPO3) (CWE-863 Incorrect Authorization / CWE-338 Weak PRNG / CWE-209 Error Info Exposure) Severity: CRITICAL (ACTIVE EXPLOITATION IN WILD / MANDATORY CISA KEV BOD 26-04) (CVSS 9.8 Critical

By James Luther
JetBrains TeamCity CVE-2026-136858 and HPE Networking Central COP CVSS 10.0 Architecture

Enterprise CI/CD & Network Control-Plane Criticals: JetBrains TeamCity Build Agent Hijack (CVE-2026-136858) & HPE Networking Central On-Premises CVSS 10.0 SSH Backdoor

📌Security Roundup Series: Week of December 4, 2026 • 7 min read deep dive🚨Vulnerability Intelligence: CVE ID: CVE-2026-136858 (TeamCity) & CVE-2026-137285 / CVE-2026-137286 (HPE Central COP) (CWE-287 Improper Authentication / CWE-798 Use of Hard-coded Credentials) Severity: CRITICAL (TEAMCITY ACTIVELY EXPLOITED < 24H / HPE CVSS 10.0 HARD-CODED SSH) (CVSS 10.0 Critical

By James Luther
Linux Netfilter CVE-2026-139281, USB2Shell CVE-2026-98232 & RongYuan Keyboard Port 3814 Architecture

Linux Kernel & Peripheral Hardware Siege: 21-Year Netfilter IPv6 Firewall Bypass (CVE-2026-139281), USB2Shell (CVE-2026-98232) & 283-Brand RongYuan Keyboard Port 3814 CSWSH RCE

📌Security Roundup Series: Week of December 4, 2026 • 8 min read deep dive🚨Vulnerability Intelligence: CVE ID: CVE-2026-139281 (Linux Netfilter), CVE-2026-98232 (USB2Shell) & RongYuan Port 3814 CSWSH (CWE-681 Integer Truncation / CWE-191 Integer Underflow / CWE-306 Missing Auth & Wildcard CORS) Severity: CRITICAL (21-YEAR FIREWALL BYPASS, PRE-LOGIN KERNEL CORRUPTION & 283-BRAND BROWSER-TO-FIRMWARE

By James Luther