skills/binary-exploitation/ios-exploiting/ios-exploiting/SKILL.md
iOS exploitation research and analysis. Use this skill whenever the user mentions iOS security, exploit mitigations, kernel/userland heap analysis, PAC/BTI/ASLR/DEP, XNU kernel structures, iOS exploit chains, or any iOS security research task. This skill helps understand iOS hardening mechanisms, analyze kernel heap structures, work with exploitation tools like Ghidra/BinDiff, and understand modern iOS exploit patterns.
npx skillsauth add abelrguezr/hacktricks-skills ios-exploitationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
A comprehensive skill for iOS security research, exploit analysis, and understanding iOS hardening mechanisms.
Use this skill when the user needs help with:
| Mitigation | Purpose | Key Details | |------------|---------|-------------| | Code Signing | All executable code must be cryptographically signed | Thwarts payload drop + execute; checks at runtime before loading binaries | | CoreTrust | Runtime signature validation against Apple's root certificate | Thwarts post-install tampering, jailbreak persistence | | DEP/NX/W^X | Writable pages are non-executable, executable pages are non-writable | Thwarts direct shellcode execution | | ASLR | Randomizes base addresses of libraries, heap, stack | Thwarts hardcoded gadget addresses for ROP/JOP | | KASLR | Randomizes kernel base address at boot | Thwarts kernel-level exploits relying on fixed locations | | KPP/AMCC | Monitors kernel text integrity via hash/checksum | Thwarts persistent kernel patching, inline hooks | | KTRR | Hardware-enforced read-only kernel text after boot | Thwarts any kernel code modification at EL1 | | PAC | Pointer Authentication Codes - cryptographic signatures on pointers | Thwarts pointer tampering, return address corruption | | BTI | Branch Target Identification - validates indirect branch targets | Thwarts jumping to arbitrary gadget addresses | | PAN/PXN | Privileged Access/Execute Never | Prevents kernel from accessing/executing user memory | | TBI | Top Byte Ignore - allows pointer tagging | Enables memory tagging, metadata in pointers | | PPL/SPTM | Page Protection Layer / Secure Page Table Monitor | Creates kernel-within-kernel protection boundary | | MTE/EMTE | Memory Tagging Extension / Enhanced MTE | Detects UAF, OOB, invalid accesses via tag checking |
PAC is a hardware feature (ARMv8.3+) that embeds cryptographic signatures in pointer high bits.
Key Types:
APIAKey / APIBKey - Instruction pointer keysAPDAKey / APDBKey - Data pointer keysAPGAKey - Generic key for non-pointer dataInstruction Families:
PACxx - Sign pointer and insert PACAUTxx - Authenticate and strip PACXPACxx - Strip PAC without validationCommon PAC Bypasses:
BTI validates indirect branch targets must have BTI landing pads.
| BTI Variant | Permits | Use Case | |-------------|---------|----------| | BTI C | Call-style indirect branches (BLR) | Function entry points | | BTI J | Jump-style branches (BR) | Jump tables, tail-calls | | BTI JC | Both C and J | General indirect targets |
Apple's Enhanced MTE (EMTE) / Memory Integrity Enforcement (MIE):
Zone Allocator (kalloc):
kalloc.16, kalloc.32, kalloc.64, etc.Freelist Structure:
Zone page (64-byte chunks):
[ A ] [ F ] [ F ] [ A ] [ F ] [ A ] [ F ]
Freelist view:
HEAD ──► [ F ] ──► [ F ] ──► [ F ] ──► [ F ] ──► NULL
Exploitation:
kalloc_type System:
Allocation Flow:
kalloc_type_<object> zoneComparison:
| Feature | Old Heap | Modern Heap | |---------|----------|-------------| | Granularity | Size-based | Size + type-based | | Predictability | High | Low | | Freelist | Raw pointers | Encoded pointers | | Adjacency control | Easy | Hard | | Exploit reliability | High | Low |
Modern iOS userland allocator (iOS 17+):
Architecture:
malloc_type_id_t for type-aware allocationSecurity Features:
Exception Flow:
trap.c, exception.c)exception_triage() routes exceptionException Ports:
task_set_exception_ports()
thread_set_exception_ports()
host_set_exception_ports()
Mach Exception to Signal Mapping:
| Mach Exception | Signal | |----------------|--------| | EXC_BAD_ACCESS | SIGSEGV/SIGBUS | | EXC_BAD_INSTRUCTION | SIGILL | | EXC_ARITHMETIC | SIGFPE | | EXC_SOFTWARE | SIGTRAP | | EXC_BREAKPOINT | SIGTRAP | | EXC_CRASH | SIGKILL | | EXC_ARM_PAC | SIGILL (non-fatal) |
PAC Exceptions:
EXC_ARM_PAC raised on signature mismatchTFRO_PAC_EXC_FATAL flag makes PAC failures fatal (bypasses debugger)Installation:
/Applications/BinDiff/Extra/Ghidra/BinExportKernel Version Diffing:
Check iOS version to XNU mapping at: https://www.theiphonewiki.com/wiki/kernel
Example: iOS 15.1 RC/15.1/15.1.1 → Darwin Kernel Version 21.1.0 (xnu-8019.43.1~1)
Pattern:
WebKit renderer RCE → kernel IPC UAF → kernel arbitrary R/W → code-sign bypass → unsigned system stager
Key Components:
CVE-2023-41992 (IPC UAF):
CVE-2023-41991 (Code-sign bypass):
systemWatcher anti-analysis:
security.mac.amfi.developer_mode_statusHelper surveillance:
/tmp/helper.sock communication/private/var/tmp/l/voip_%lu_%u_PART.m4a)HiddenDot suppression:
SBSensorActivityDataProvider._handleNewDomainData:self pointerosfmk/kern/exception.c, osfmk/arm64/trap.c, bsd/kern/kern_sig.c# Install BinDiff extension in Ghidra
ghidraRun
# File → Install Extensions → Add /Applications/BinDiff/Extra/Ghidra/BinExport
# Download iOS IPSW files
# Visit https://ipsw.me/ and download target versions
# Decompress IPSW to extract kernelcache
# Use standard archive tools to extract .ipsw → .dmg → kernelcache
# Check XNU version for iOS
# Visit https://www.theiphonewiki.com/wiki/kernel
TFRO_PAC_EXC_FATAL prevents debugger interception on platform binariesIf the user needs:
Provide the conceptual framework and direct them to appropriate resources or suggest they consult with security professionals for implementation details.
testing
How to perform a House of Lore (small bin attack) heap exploitation. Use this skill whenever the user mentions heap exploitation, small bin attacks, fake chunks, glibc heap vulnerabilities, or needs to insert fake chunks into small bins for arbitrary read/write. Trigger for CTF challenges involving heap corruption, glibc 2.31+ exploitation, or when the user needs to bypass malloc sanity checks using fake chunk linking.
testing
How to perform House of Force heap exploitation attacks. Use this skill whenever the user mentions heap exploitation, House of Force, top chunk manipulation, arbitrary memory allocation, malloc manipulation, or wants to allocate chunks at specific addresses. Also trigger for CTF challenges involving heap overflows, top chunk size overwrites, or when the user needs to calculate evil_size for heap attacks. Make sure to use this skill for any binary exploitation task involving glibc heap manipulation, even if they don't explicitly say "House of Force".
tools
How to perform House of Einherjar heap exploitation to allocate memory at arbitrary addresses. Use this skill whenever the user mentions heap exploitation, glibc heap attacks, arbitrary memory allocation, off-by-one overflow exploitation, tcache poisoning, fast bin attacks, or any CTF challenge involving heap manipulation. This is essential for binary exploitation tasks where you need to control malloc() return addresses.
testing
How to identify, analyze, and exploit heap overflow vulnerabilities in binary exploitation challenges and real-world scenarios. Use this skill whenever the user mentions heap overflows, memory corruption, heap grooming, tcache poisoning, fast-bin attacks, or any heap-related vulnerability in CTF challenges, binary analysis, or security research. This skill covers heap overflow fundamentals, exploitation techniques, heap grooming strategies, and real-world CVE analysis.