
CVE-2022-38694 Hardened Exploit - RP2350 USB Host Auto Flasher for Unisoc devices
Exploiting CVE-2022-38694 Unisoc BootROM vulnerability via Raspberry Pi RP2350 USB Host to automatically send SPL Loader on boot and start arbitrary u-boot.
Moves the exploit chain — originally requiring a PC + spd_dump — onto an RP2350 microcontroller. Plug in device, flash automatically, supports continuous flashing.
CVE-2022-38694 is a one-time signature verification bypass in Unisoc BootROM. By sending an exec stub to a specific memory address, the return address is overwritten, bypassing signature checks and allowing BootROM to accept and execute arbitrary FDL1.
Key insight: FDL1 and SPL Loader share the same load address (0x28007000), so a patched SPL Loader can be sent in place of FDL1, booting arbitrary u-boot.
First-time setup requires a PC with spd_dump:
┌──────────────────────────────────────────────────────────────────────────┐
│ Stage 1: PC-side Initial Unlock │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ Step 1: Exploit CVE-2022-38694 to boot patched SPL │
│ ┌────────────┐ ┌────────────┐ ┌─────────────────┐ │
│ │ Exec Stub │───►│ spl-unlock │───►│ Device boots │ │
│ │ @0x3F28 │ │ @0x28007000│ │ into DL mode │ │
│ └────────────┘ └────────────┘ └────────┬────────┘ │
│ │ │
│ Step 2: Send patched FDL2 via spd_dump, flash u-boot without │
│ secure boot, erase splloader │
│ │ │
│ ┌─────────────────┐ ┌──────────────────────▼───────────┐ │
│ │ Send fdl2-dl │───►│ Write u-boot (secure boot removed│ │
│ │ (patched FDL2) │ │ + Erase splloader partition) │ │
│ └─────────────────┘ └──────────────────────────────────┘ │
│ │
│ ★ After erasing splloader, device enters BootROM DL mode on every boot │
└──────────────────────────────────────────────────────────────────────────┘
Steps:
spl-unlock.bin and boot the devicefdl2-dl.bin (FDL2 with secure boot verification removed)With splloader erased, the device enters BootROM download mode on every power-on. The RP2350 USB Host automatically handles the exploit chain:
┌──────────────────────────────────────────────────────────────────────────┐
│ Stage 2: RP2350 Automated Boot │
├──────────────────────────────────────────────────────────────────────────┤
│ │
│ Power on → no splloader → BootROM download mode │
│ │
│ ┌─────────┐ ┌────────────┐ ┌─────────────┐ ┌──────────────┐ │
│ │ BootROM │───►│ Exec Stub │───►│ spl-unlock │───►│ U-Boot │ │
│ │ Handshk │ │ Bypass sig │ │ as FDL1 │ │ (no secboot) │ │
│ └─────────┘ └────────────┘ └─────────────┘ │ Boot OK ✓ │ │
│ └──────────────┘ │
│ │
│ ★ Fully automatic. Unplug → auto-reset → ready for next device. │
└──────────────────────────────────────────────────────────────────────────┘
Why erase splloader?
┌─────────────┐ ┌──────────────────┐ ┌───────────────────┐ ┌──────────────┐
│ BootROM │ │ Exec Stub │ │ SPL Loader │ │ U-Boot │
│ Handshake │ ──► │ @0x3F28 (136B) │ ──► │ @0x28007000 │ ──► │ Boot OK │
│ CHECK_BAUD │ │ Bypass sig chk │ │ Replaces FDL1 │ │ │
└─────────────┘ └──────────────────┘ └───────────────────┘ └──────────────┘
CHECK_BAUD + CONNECT, establish BSL communication0x3F28, exploit CVE-2022-38694 to overwrite return address, bypass signature verification0x28007000, signature already bypassedThis project does not include universal patched firmware. You must patch your device's firmware yourself.
Refer to TomKing062's Wiki:
xxd -i spl-unlock.bin > fdl1_data.h
Update array name and macros in fdl1_data.h to match code references.
This project currently uses the UDX710 exec stub (custom_exec_3f28.bin).
To adapt for other chips, replace the exec stub and load address in custom_exec_data.h:
Full support list: SupportList
| Component | Description |
|---|---|
| RP2350 Board | e.g. Raspberry Pi Pico 2 |
| USB Host Cable | OTG or hardware mod for RP2350 USB Host |
| Target SPD Device | splloader erased, auto-enters BootROM DL mode on power-on |
| Pin | Function |
|---|---|
| USB D+/D- | Connect to target SPD device |
| GP4 (TX) | UART debug output |
| GP5 (RX) | UART debug input |
USB port is used for Host communication. Debug logs via UART1 (GP4/GP5, 115200bps).
cd spd_flasher
mkdir build && cd build
cmake .. -DTARGET_CHIP=rp2350
make -j$(nproc)
Output: spd_flasher.uf2 (drag-and-drop via BOOTSEL) / spd_flasher.bin (programmer)
spd_flasher.uf2 to RP2350spd_flasher/
├── main.c # Main program, USB Host init & device management
├── spd_protocol.c # SPD BSL protocol (HDLC framing, state machine)
├── spd_protocol.h # Protocol definitions
├── tusb_config.h # TinyUSB Host configuration
├── custom_exec_data.h # Exec Stub data (136B @0x3F28)
├── fdl1_data.h # SPL Loader data (spl-unlock.bin @0x28007000)
├── spl-unlock.bin # SPL Loader raw binary
├── CMakeLists.txt # CMake build configuration
└── signing_key.pem / aes_key.bin / iv_salt.bin # RP2350 secure boot keys
This project is for security research and educational purposes only. Users must comply with all applicable laws and regulations. The author assumes no responsibility for any direct or indirect damages resulting from the use of this tool.
This project is licensed under the GNU General Public License v3.0.
| Firmware | Patch | Output | Purpose |
|---|
| FDL2 (u-boot/lk) | NOP secure partition write checks | fdl2-dl.bin | Stage 1: sent via spd_dump for partition writes |
| U-Boot | Patch do_cboot() to remove secure boot | Modified uboot | Stage 1: written to device, replaces stock uboot |
| SPL Loader | NOP signcheck() and result checks | spl-unlock.bin | Stage 1 & 2: sent via CVE-2022-38694 |
| Platform | Exec Address | Reference |
|---|
| UDX710 | 0x3F28 | This project (default) |
| UMS312 / UMS512 | 0x3EE8 | exec_addr_v2 |
| UMS9230 | 0x65017F08 | exec_addr_v2 |
| SC9820E / SC9832E | 0x4F18 / 0x4EE8 | CVE-2022-38694 |
| PC + spd_dump | RP2350 Hardened |
|---|
| Size | Requires PC | Single MCU |
| Operation | Manual commands | Power on = running |
| Continuous | Manual per device | Auto-reset |
| Deployment | Inconvenient | Production-ready |
| Cost | — | ~$3 |