skills/binary-exploitation/libc-heap/heap-memory-functions/heap-functions-security-checks/SKILL.md
Reference for libc heap memory function security checks and error messages. Use this skill whenever the user is debugging heap vulnerabilities, analyzing heap exploitation, studying glibc malloc/free internals, or needs to understand what specific heap error messages mean. Trigger on mentions of heap corruption, malloc/free errors, tcache, fastbins, unsorted bins, or any libc heap function security checks.
npx skillsauth add abelrguezr/hacktricks-skills heap-security-checksInstall 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.
This skill provides a comprehensive reference for security checks performed by libc heap management functions. Use it to understand error messages, identify exploitation opportunities, and debug heap vulnerabilities.
When you see a heap error message, find it below to understand what check failed:
| Error Message | Function | What It Means |
|--------------|----------|---------------|
| corrupted size vs. prev_size | unlink | Chunk size doesn't match prev_size in next chunk |
| corrupted double-linked list | unlink | Forward/backward pointers don't match |
| malloc(): unaligned fastbin chunk detected | _int_malloc | Fastbin chunk address is misaligned |
| malloc(): memory corruption (fast) | _int_malloc | Fastbin chunk size doesn't match bin index |
| malloc(): smallbin double linked list corrupted | _int_malloc | Small bin linked list integrity check failed |
| malloc(): invalid size (unsorted) | _int_malloc | Unsorted bin chunk size is out of range |
| malloc(): unsorted double linked list corrupted | _int_malloc | Unsorted bin linked list integrity check failed |
| malloc(): corrupted top size | _int_malloc | Top chunk size exceeds system memory |
| malloc(): unaligned tcache chunk detected | tcache_get_n | Tcache chunk address is misaligned |
| realloc(): invalid pointer | __libc_realloc | Realloc pointer is misaligned or size incorrect |
| free(): invalid pointer | _int_free | Free pointer is not aligned |
| free(): invalid size | _int_free | Chunk size is too small or misaligned |
| free(): too many chunks detected in tcache | _int_free | Tcache count exceeds limit |
| free(): double free detected in tcache 2 | _int_free | Chunk already in tcache |
| double free or corruption (fasttop) | _int_free | Chunk already at top of fastbin |
| double free or corruption (top) | _int_free_merge_chunk | Attempting to free top chunk |
| double free or corruption (out) | _int_free_merge_chunk | Next chunk outside arena boundaries |
| double free or corruption (!prev) | _int_free_merge_chunk | Previous chunk not marked as in-use |
| free(): invalid next size (normal) | _int_free_merge_chunk | Next chunk size out of range |
| corrupted size vs. prev_size while consolidating | _int_free_merge_chunk | Prev_size mismatch during consolidation |
| free(): corrupted unsorted chunks | _int_free_create_chunk | Unsorted bin linked list corrupted |
unlinkPerforms checks when unlinking chunks from bins:
Size vs prev_size check
prev_size in next chunkcorrupted size vs. prev_sizeDouble-linked list integrity
P->fd->bk == P and P->bk->fw == Pcorrupted double-linked listNextsize list integrity (non-small chunks)
P->fd_nextsize->bk_nextsize == P and P->bk_nextsize->fd_nextsize == Pcorrupted double-linked list (not small)_int_mallocChunk alignment
malloc(): unaligned fastbin chunk detected 2Forward chunk alignment
malloc(): unaligned fastbin chunk detectedSize vs bin index
malloc(): memory corruption (fast)Tcache fill alignment
malloc(): unaligned fastbin chunk detected 3victim->bk->fd != victimmalloc(): smallbin double linked list corruptedChunk alignment
malloc_consolidate(): unaligned fastbin chunk detectedSize vs bin index
malloc_consolidate(): invalid chunk sizePrev_size consistency
corrupted size vs. prev_size in fastbinsChunk size range
malloc(): invalid size (unsorted)Next chunk size range
malloc(): invalid next size (unsorted)Prev_size consistency
malloc(): mismatching next->prev_size (unsorted)Linked list integrity
victim->bck->fd == victim and victim->fd == av (arena)malloc(): unsorted double linked list corruptedPrev_inuse flag
malloc(): invalid next->prev_inuse (unsorted)Nextsize list integrity
malloc(): largebin double linked list corrupted (nextsize)Backward list integrity
malloc(): largebin double linked list corrupted (bk)By index search
bck->fd->bk != bckmalloc(): corrupted unsorted chunksNext bigger search
bck->fd->bk != bckmalloc(): corrupted unsorted chunks2chunksize(av->top) > av->system_memmalloc(): corrupted top sizetcache_get_nmalloc(): unaligned tcache chunk detectedtcache_thread_shutdowntcache_thread_shutdown(): unaligned tcache chunk detected__libc_reallocrealloc(): invalid pointer_int_freePointer alignment
free(): invalid pointerSize validity
free(): invalid sizeTcache count limit
mp_.tcache_countfree(): too many chunks detected in tcacheEntry alignment
free(): unaligned chunk detected in tcache 2Double free detection
free(): double free detected in tcache 2Next size validity
free(): invalid next size (fast)Fastbin top check
double free or corruption (fasttop)Top chunk size consistency
invalid fastbin entry (free)_int_free_merge_chunkTop chunk check
double free or corruption (top)Arena boundary check
double free or corruption (out)Prev_inuse check
double free or corruption (!prev)Next chunk size
free(): invalid next size (normal)Prev_size during consolidation
corrupted size vs. prev_size while consolidating_int_free_create_chunkunsorted_chunks(av)->fd->bk == unsorted_chunks(av)free(): corrupted unsorted chunksdo_check_malloc_statedo_check_malloc_state(): unaligned fastbin chunk detectedmalloc_consolidateFast bin alignment
malloc_consolidate(): unaligned fastbin chunk detectedFast bin size
malloc_consolidate(): invalid chunk size_int_reallocOld size validity
realloc(): invalid old sizeNext size validity
realloc(): invalid next sizeunlink.md - Detailed unlink operation analysismalloc-and-sysmalloc.md - Malloc internalsfree.md - Free operation internalsreferences/schemas.md - JSON structures for evalstesting
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.