skills/binary-exploitation/libc-heap/house-of-lore/SKILL.md
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.
npx skillsauth add abelrguezr/hacktricks-skills house-of-lore-exploitInstall 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 heap exploitation technique that inserts fake small chunks into the small bin to gain arbitrary read/write capabilities.
Inserts a fake small chunk into the small bin so it can be allocated, allowing you to read/write pointers inside it. The fake chunk is attacker-controlled, not a legitimate freed chunk.
You need:
legit.fd to point to your fake chunkYou must create this exact linking pattern:
fake0.bk -> fake1
fake1.fd -> fake0
fake0.fd -> legit (requires pointer write primitive)
legit.bk -> fake0
legit)legit (moves to unsorted bin)legit to small bin)Generate two fake chunks with proper metadata:
# Example fake chunk structure (little-endian)
fake0 = struct.pack('<QQ', size0, fake1_addr) # size, fd
fake0 += struct.pack('<QQ', fake1_addr, 0) # bk, fd_nextsize
fake0 += struct.pack('<QQ', 0, 0) # bk_nextsize, padding
fake1 = struct.pack('<QQ', size1, fake0_addr) # size, fd
fake1 += struct.pack('<QQ', fake0_addr, 0) # bk, fd_nextsize
fake1 += struct.pack('<QQ', 0, 0) # bk_nextsize, padding
Key requirements for fake chunks:
size must be valid small bin size (typically 0x20-0x100)PREV_INUSE bit must be set (bit 0 of size)fd and bk must point to valid heap addressesfake0 and fake1 to heap memory (via overflow or other primitive)legit.fd = fake0_addrlegit.bk = fake0_addr (may need another write)legit, making fake0 the new head of small binfake0 (your fake chunk!)fake0 to control heap metadata| Issue | Solution |
|-------|----------|
| malloc(): unaligned tcache chunk detected | Ensure 8-byte alignment on 64-bit systems |
| malloc(): corrupted top size | Verify size field has PREV_INUSE bit set |
| double free or corruption | Don't free chunks that are already in bins |
| Sanity check failures | Double-check all fd/bk pointers are valid heap addresses |
Use these as reference implementations:
Use the bundled scripts to generate and verify fake chunks:
# Generate fake chunk metadata
python scripts/generate_fake_chunks.py --size 0x20 --addr1 0x555555556000 --addr2 0x555555556100
# Verify linking structure
python scripts/verify_linking.py --fake0 0x555555556000 --fake1 0x555555556100 --legit 0x555555556200
Once you control fake0:
fd/bk pointers to redirect allocationsunlink() style attacks for code executiontesting
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.
testing
How to analyze and exploit the unlink operation in glibc heap management. Use this skill whenever the user mentions heap exploitation, unlink attacks, glibc malloc, heap chunks, double-linked lists, heap leaks, libc leaks, or any CTF challenge involving heap memory corruption. This skill helps understand the unlink mechanism, security checks, and how to leak addresses from unlinked chunks.