From apple-vuln-research-txm-sptm-firmware-extraction
Extract and analyze Apple Silicon TXM (Trusted Execution Monitor) and SPTM (Secure Page Table Monitor) firmware binaries from IM4P containers on macOS. Use when: (1) need to reverse-engineer TXM panic codes, (2) analyzing SPTM/TXM trust boundary behavior, (3) extracting firmware from /System/Volumes/Preboot for static analysis, (4) mapping panic strings to error codes in Apple's secure monitor. Covers: IM4P container format, pyimg4 extraction, LZFSE decompression, Mach-O arm64e analysis.
How this skill is triggered — by the user, by Claude, or both
Slash command
/apple-vuln-research-txm-sptm-firmware-extraction:apple-vuln-research-txm-sptm-firmware-extractionThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Apple's TXM (Trusted Execution Monitor) and SPTM (Secure Page Table Monitor) run at
Apple's TXM (Trusted Execution Monitor) and SPTM (Secure Page Table Monitor) run at higher privilege than the kernel (GL0 and GL2 respectively). When they panic, the error codes are opaque (e.g., "TXM [Panic]: [code: 0x0000001A | 1]"). Understanding what triggered the panic requires extracting and reversing the firmware binary.
# TXM firmware (universal, same on all Apple Silicon with TXM)
find /System/Volumes/Preboot -name "txm.macosx.release.im4p" 2>/dev/null
# SPTM firmware (chip-specific)
find /System/Volumes/Preboot -name "sptm.macosx.release.im4p" 2>/dev/null
# Both are in the restore firmware directory:
# /System/Volumes/Preboot/<UUID>/restore/Firmware/
pip3 install --break-system-packages pyimg4
pyimg4 handles Apple's IM4P container format (ASN.1 DER wrapper + LZFSE compression).
# Extract TXM
pyimg4 im4p extract -i txm.macosx.release.im4p -o txm.raw
# Extract SPTM
pyimg4 im4p extract -i sptm.macosx.release.im4p -o sptm.raw
Output: decompressed Mach-O arm64e binary.
Typical sizes:
file txm.raw
# Expected: Mach-O 64-bit executable arm64e
strings txm.raw | head -5
# Should show TXM version string and panic messages
# List all panic conditions
strings txm.raw | grep "panic:"
# Find specific panic code context
strings txm.raw | grep -i "invalid\|boot.*state\|security.*mode"
# Get version info
strings txm.raw | grep "Version"
From TXM panic logs, you get: TXM [Panic]: [code: 0xNN | M]
The code maps to a specific panic() call in the binary. Common patterns:
panic: invalid secure boot state: %#xpanic: attempt to destroy already destroyed bufferpanic: bogus digest length: %lupanic: should never be called# Disassemble with objdump
objdump -d txm.raw > txm_disasm.txt
# Or load into Ghidra/IDA for full RE
# Base address from panic log: TXM load address field
# e.g., "TXM load address: 0xfffffe004031c000"
file txm.raw returns "Mach-O 64-bit executable arm64e"strings txm.raw | grep -c panic returns 20+ panic stringsFrom panic log:
panic(cpu 2 caller 0xfffffe0055140010): TXM [Panic]: [code: 0x0000001A | 1]
TXM UUID: FC4B4161-29AA-3A66-8A86-5211332F59FB
After extraction:
$ strings txm.raw | grep "invalid secure boot"
panic: invalid secure boot state: %#x
→ Code 0x1A = "invalid secure boot state" assertion in TXM's boot state machine.
trxm for TXM, sptm for SPTMCreates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub dmaynor/dmaynor-skills-marketplace --plugin apple-vuln-research-txm-sptm-firmware-extraction