feat(exploit): Add checkm8 DFU exploit engine with payload headers

Four-stage checkm8 exploit (reset, spray, setup, patch) targeting
A5-A11 BootROM vulnerability. Includes ROP chain headers for A10/A11
and shellcode placeholder. Verify via PWND: serial marker.

Files created:
- include/exploit/exploit.h
- include/exploit/checkm8.h
- include/exploit/checkm8_internal.h
- src/exploit/checkm8.c
- src/exploit/checkm8_stages.c
- src/exploit/payload/rop_a10.h
- src/exploit/payload/rop_a11.h
- src/exploit/payload/shellcode.h
- src/exploit/payload/ramdisk.h

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
tr4m0ryp 2026-04-05 02:16:52 +02:00
parent 82bec20452
commit 17fca828a5
9 changed files with 911 additions and 0 deletions

53
include/exploit/checkm8.h Normal file
View file

@ -0,0 +1,53 @@
/* checkm8.h -- checkm8 DFU exploit for A5-A11 BootROM */
#ifndef CHECKM8_H
#define CHECKM8_H
#include "device/device.h"
#include "exploit/exploit.h"
/*
* checkm8_exploit -- Top-level entry point. Sets up context, runs all four
* stages (reset, spray, setup, patch), verifies pwned state, cleans up.
* Returns 0 on success, -1 on failure.
*/
int checkm8_exploit(device_info_t *dev);
/*
* Individual exploit stages. Each advances ctx->phase on success.
* All return 0 on success, -1 on failure.
*/
/*
* Stage 1: Reset DFU state machine to a known clean state.
* Sends DFU_DNLOAD with empty data, then DFU_ABORT.
*/
int checkm8_stage_reset(exploit_ctx_t *ctx);
/*
* Stage 2: Heap spray. Send carefully sized USB transfers to create
* a predictable heap layout in the DFU SRAM region.
*/
int checkm8_stage_spray(exploit_ctx_t *ctx);
/*
* Stage 3: Trigger use-after-free. Abort a DFU transfer mid-stream
* to free the io_buffer while the pointer remains live.
*/
int checkm8_stage_setup(exploit_ctx_t *ctx);
/*
* Stage 4: Overwrite freed buffer with ROP chain and shellcode.
* After this stage the BootROM executes our payload and the serial
* string should contain "PWND:[checkm8]".
*/
int checkm8_stage_patch(exploit_ctx_t *ctx);
/*
* checkm8_verify_pwned -- Re-read the USB serial string descriptor and
* check whether it contains "PWND:".
* Returns 1 if pwned, 0 if not pwned, -1 on read error.
*/
int checkm8_verify_pwned(device_info_t *dev);
#endif /* CHECKM8_H */