skills/binary-exploitation/ios-exploiting/ios-example-heap-exploit/SKILL.md
How to exploit heap buffer overflows on iOS/macOS ARM64 systems. Use this skill whenever the user mentions heap exploitation, buffer overflows, function pointer overwrites, malloc manipulation, Corellium iOS challenges, or CTF heap challenges on Apple platforms. This skill covers heap grooming, zone manipulation, and function pointer hijacking techniques.
npx skillsauth add abelrguezr/hacktricks-skills ios-heap-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 skill for exploiting heap buffer overflows on iOS and macOS systems, particularly in CTF challenges and security research.
Use this skill when:
macOS uses different heap zones for different allocation sizes:
Critical: Set MallocNanoZone=0 to disable NanoZone and get predictable adjacent allocations.
The technique of allocating specific chunks in a specific order to control heap layout:
clang -O0 -Wall -Wextra -std=c11 -o heap_groom vuln.c
Use -O0 to prevent compiler optimizations that might change heap layout.
The distance between allocations depends on:
Common pattern with MallocNanoZone=0:
Use the bundled exploit script as a template:
python3 scripts/heap_overflow_exploit.py
The script:
export MallocNanoZone=0
python3 scripts/heap_overflow_exploit.py
Solution: Set MallocNanoZone=0 to force allocations into the same zone.
Solution: Try multiple padding values. The exploit script includes common candidates:
Solution:
Solution: Run the exploit multiple times. Heap layout can be probabilistic, especially with different malloc implementations.
p64() for address packingp64() for address packingscripts/heap_overflow_exploit.py - Template exploit script for heap buffer overflowsUser: "I have a CTF challenge with a heap overflow on iOS. The binary leaks addresses and I need to overwrite a function pointer."
Response: Use this skill to:
MallocNanoZone=0 for predictable heap layoutUser: "How do I exploit a buffer overflow in malloc'd memory on macOS?"
Response: This skill covers heap exploitation on macOS. The key is:
MallocNanoZone=0testing
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.