Updated exploit stages with actual USB transfer sequences from gaster. Added real callback overwrite structures, magic constants, and heap spray logic (both large_leak and no-leak paths). Replaced shellcode placeholders with actual ARM64 and ARMv7 bytes from ipwndfu binary. Payload assembly now builds correct per-chip header structs using the full chip_db offset table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
56 lines
1.7 KiB
C
56 lines
1.7 KiB
C
/* 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 suffix-length zeroes, polls through manifest
|
|
* states, then resets to dfuIDLE.
|
|
*/
|
|
int checkm8_stage_reset(exploit_ctx_t *ctx);
|
|
|
|
/*
|
|
* Stage 2: Setup -- trigger use-after-free. Sends an async DFU_DNLOAD
|
|
* with DFU_MAX_TRANSFER_SZ bytes, then overwrite padding to provoke
|
|
* a stall that frees the io_buffer while the pointer remains live.
|
|
*/
|
|
int checkm8_stage_setup(exploit_ctx_t *ctx);
|
|
|
|
/*
|
|
* Stage 3: Heap spray. Two paths based on chip config:
|
|
* Path A (large_leak > 0): stall-based GET_DESCRIPTOR spray.
|
|
* Path B (large_leak == 0): send/stall cycles to create heap holes.
|
|
*/
|
|
int checkm8_stage_spray(exploit_ctx_t *ctx);
|
|
|
|
/*
|
|
* Stage 4: Overwrite freed callback with controlled data, then send
|
|
* the payload (chip-specific header + shellcode) in DFU_MAX_TRANSFER_SZ
|
|
* chunks. After execution the serial string contains "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 */
|