skills/binary-exploitation/libc-heap/fast-bin-attack/SKILL.md
How to perform fast bin heap exploitation attacks. Use this skill whenever the user mentions heap exploitation, fast bin attacks, use-after-free vulnerabilities, malloc manipulation, or wants to allocate chunks at arbitrary addresses. This skill covers the core fast bin attack pattern, common CTF techniques, and variations like global_max_fast manipulation. Make sure to use this skill when analyzing heap vulnerabilities, planning exploitation strategies, or working with malloc/free primitives.
npx skillsauth add abelrguezr/hacktricks-skills fast-bin-attackInstall 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 fast bin attack exploits the singly-linked list structure of fast bins in glibc's malloc implementation. By modifying the next pointer of a freed chunk, you can cause malloc to return a pointer to an arbitrary memory address.
1. Allocate two chunks of the same size (e.g., 0x20)
ptr0 = malloc(0x20)
ptr1 = malloc(0x20)
2. Free both chunks (they go to fast bin)
free(ptr0)
free(ptr1)
3. Use UAF to modify ptr1's next pointer
*ptr1 = (unsigned long)&<target_address>
4. Allocate to consume ptr0
ptr2 = malloc(0x20) // Gets ptr0
5. Allocate to get chunk at target address
ptr3 = malloc(0x20) // Gets chunk at &<target_address>
Fast bins are singly-linked lists with minimal validation:
next pointernext pointer is simply the first 8 bytes of the freed chunknextUse fast bin attack to allocate a chunk at &free@got or &printf@got, then write a one-gadget address:
1. Leak libc address (via unsorted bin or other technique)
2. Calculate &free@got = libc_base + free_offset
3. Fast bin attack to allocate chunk at &free@got
4. Write system() address to that chunk
5. Call free() on a chunk containing "/bin/sh"
Allocate a chunk at &__malloc_hook - 0x10 (to account for chunk header), then write a one-gadget:
1. Leak libc address
2. Calculate &__malloc_hook = libc_base + __malloc_hook_offset
3. Fast bin attack to allocate at &__malloc_hook - 0x10
4. Write one-gadget address to the chunk
5. Trigger malloc to execute the gadget
If the target has a global array of function pointers or chunk pointers:
1. Leak address of the pointer array
2. Fast bin attack to allocate chunk at the array
3. Overwrite pointers to controlled addresses
4. Trigger the function call
If you can't use fast bins due to size restrictions:
1. Use unsorted bin attack to leak libc
2. Overwrite global_max_fast with a large value (e.g., 0x1000)
3. Now larger chunks go to fast bins instead of unsorted bins
4. Perform fast bin attack with larger chunks
Note: This works only 1/16 times due to ASLR (need to match 12 bits out of 16).
Use the scripts/generate_fastbin_exploit.py script to create a basic exploit template:
python scripts/generate_fastbin_exploit.py \
--chunk-size 0x30 \
--target-address 0x404040 \
--output exploit.py
global_max_fast (default 0x80)&__malloc_hook, allocate at &__malloc_hook - 0x10# In GDB with pwndbg/gef
heap_analysis
fastbins
# After freeing, check what's in the chunk
x/10gx ptr0
x/10gx ptr1
# After allocation, verify you got the target address
p ptr3
# Should equal your target address
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.