tr4mpass/tasks/010-checkm8-exploit.md
tr4m0ryp adb0ec097b Initial project structure: design notes, architecture, and task breakdown
- Design notes covering two bypass paths (A5-A11 checkm8, A12+ session activation)
- Full architecture document with directory layout, data structures, control flow
- 14 task files for phased implementation across 6 parallel groups
- Future research notes for iOS 26.2+ (VU#346053 XML injection vector)
- Scope: iOS <= 26.1 for v1

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-05 01:48:34 +02:00

3.2 KiB

Task 010: checkm8 Exploit

Objective

Implement the checkm8 DFU exploit in C -- the four-stage heap corruption attack (reset, spray, setup, patch) that achieves code execution on A5-A11. Include payload headers with ROP chains and shellcode.

Scope

Files to create:

  • Itr4m/include/exploit/exploit.h
  • Itr4m/include/exploit/checkm8.h
  • Itr4m/src/exploit/checkm8.c
  • Itr4m/src/exploit/payload/rop_a10.h
  • Itr4m/src/exploit/payload/rop_a11.h
  • Itr4m/src/exploit/payload/shellcode.h
  • Itr4m/src/exploit/payload/ramdisk.h

Files to read (not modify):

  • tasks/rules.md
  • notes/architecture.md (exploit_ctx_t structure, Path A flow)
  • Itr4m/include/exploit/dfu_proto.h (from task 007)
  • Itr4m/include/device/chip_db.h (from task 003)

Out of scope:

  • DFU protocol (task 007, already done)
  • Path A orchestration (task 012)

Dependencies

  • Requires: 003 (chip_db), 007 (dfu_proto)
  • Produces: checkm8_exploit() function used by Path A

Technical Details

exploit.h -- common types

typedef struct {
    device_info_t *dev;
    const chip_info_t *chip;
    int phase;          /* 0=init, 1=reset, 2=spray, 3=setup, 4=patch, 5=done */
    uint8_t *payload_buf;
    size_t payload_len;
} exploit_ctx_t;

int exploit_init(exploit_ctx_t *ctx, device_info_t *dev);
int exploit_deliver(exploit_ctx_t *ctx);
void exploit_cleanup(exploit_ctx_t *ctx);

checkm8.h -- checkm8-specific

int checkm8_exploit(device_info_t *dev);

/* Individual stages (called by checkm8_exploit) */
int checkm8_stage_reset(exploit_ctx_t *ctx);
int checkm8_stage_spray(exploit_ctx_t *ctx);
int checkm8_stage_setup(exploit_ctx_t *ctx);
int checkm8_stage_patch(exploit_ctx_t *ctx);

/* Verify device is pwned (serial contains PWND:) */
int checkm8_verify_pwned(device_info_t *dev);

Exploit stages (from gaster analysis)

  1. Reset: Send DFU_DNLOAD with empty data, then DFU_ABORT to reset state
  2. Spray: Send carefully sized USB transfers to create predictable heap layout
  3. Setup: Trigger UAF by aborting a DFU transfer mid-stream (frees io_buffer)
  4. Patch: Overwrite freed buffer with ROP chain pointing to shellcode

Payload headers

rop_a10.h and rop_a11.h contain static const byte arrays with chip-specific ROP gadget chains. shellcode.h contains the stage1 shellcode that marks the device serial with PWND:[checkm8].

Use placeholder byte arrays with correct sizes based on gaster's payload sizes. Mark them with TODO comments for filling in actual exploit data.

ramdisk.h: helper to load boot.tar.lzma from payloads/ directory and send via the pwned DFU interface.

Rules

  • Read tasks/rules.md before starting
  • Reference gaster (0x7ff/gaster) for exploit stage structure
  • Payload headers contain placeholder data (actual ROP chains require device testing)
  • Mark all placeholder payloads with clear TODO comments
  • Max 300 lines per file -- split checkm8.c if needed

Verification

  • checkm8.c under 300 lines
  • All four stages implemented as separate functions
  • exploit_ctx_t properly initializes and cleans up
  • Payload headers have correct structure even if data is placeholder

Stop Conditions

  • If checkm8.c exceeds 300 lines, split into checkm8_stages.c