Forked from the original darksword kexploit (Objective-C reimplementation). Updated with verified kernel struct offsets for iOS 18.4 / iPhone 15 Pro (A17 Pro).
Achieves kernel read/write via a physical memory TOCTOU race condition:
- Creates physically contiguous memory via IOSurface (
PurpleGfxMem) - Races
pwritev/preadvagainstmach_vm_map(VM_FLAGS_OVERWRITE)for OOB physical read/write - Sprays ICMPv6 sockets, corrupts
icmp6_filterpointer for stable kernel r/w - Walks
socket → so_proto → pr_inputto find kernel base and KASLR slide
All offsets verified via kernelcache disassembly (capstone + IDA Hex-Rays) and XNU source (xnu-11215 through xnu-11417).
| Define | iOS 15.x | iOS 18.4 | Verification |
|---|---|---|---|
OFFSET_PCB_SOCKET |
0x40 |
0x40 |
Disasm + source |
OFFSET_SOCKET_SO_COUNT |
0x228 |
0x254 |
Disasm (sorele) |
OFFSET_ICMP6FILT |
0x150 |
0x138 |
Disasm + source |
OFFSET_SO_PROTO |
0x18 |
0x20 |
Disasm (soclose) |
OFFSET_PR_INPUT |
0x28 |
0x20 |
Disasm (ip6_input) |
OFFSET_INP_GENCNT |
0x78 |
0x78 |
IDA + source |
OFFSET_INP_LIST |
0x20/0x28 |
0x20/0x28 |
XNU source |
Kernel: xnu-11417.102.9 (Darwin 24.4.0, RELEASE_ARM64_T8122)
- Offsets: Verified
- Build: Compiles (arm64 + arm64e)
- Tested on device: No — needs a deployment method with private entitlements (no-sandbox, platform-application, IOKit user clients). No known method exists for stock iOS 18.4.
- Race condition patched? Unknown — cannot test without deployment
- A18 support:
pe_v2()still unimplemented
Requires Xcode (iOS SDK) and ldid:
brew install ldid
make # compile
make sign # sign with entitlementsThis is not a jailbreak. Even if KRW works, a full jailbreak additionally requires PPL bypass, CoreTrust/AMFI bypass, codesign bypass, and post-exploitation tooling.
- Original darksword kexploit author
- Offset analysis for iOS 18.4 by @Kev1nLevin