Skip to main content

All Techniques Reference

This page provides a comprehensive reference of all heap exploitation techniques in how2heap, organized by category. Each technique includes its description, glibc version compatibility, patch information, and references to real-world CTF challenges.
Techniques marked with ⏩ have interactive browser-based debugging support via Ret2 Wargames.

Foundational Techniques

These techniques demonstrate basic heap allocator behavior and are essential for understanding more advanced exploits.
Description: Demonstrates glibc malloc’s first-fit algorithm for selecting free chunks.Glibc Version: All versionsType: Educational demonstrationKey Concept: The allocator will reuse the first free chunk that fits the requested size, which can be exploited in use-after-free situations.Source: first_fit.c
Description: Demonstrates glibc’s tcache index calculation and provides a calculator for determining which tcache bin a given size will use.Glibc Version: All versionsType: Educational demonstrationFormula: IDX = (CHUNKSIZE - MINSIZE + MALLOC_ALIGNMENT - 1) / MALLOC_ALIGNMENTSource: calc_tcache_idx.c

Fastbin Techniques

Exploits targeting the fastbin freelist mechanism, primarily for small allocations (< 128 bytes on 64-bit systems).

fastbin_dup.c

Tricking malloc into returning an already-allocated heap pointer by abusing the fastbin freelist.

fastbin_dup_into_stack.c

Tricking malloc into returning a nearly-arbitrary pointer by abusing the fastbin freelist.

fastbin_dup_consolidate.c

Tricking malloc into returning an already-allocated heap pointer by putting a pointer on both fastbin freelist and the top chunk.

fastbin_reverse_into_tcache.c

Exploiting the overwrite of a freed chunk in the fastbin to write a large value into an arbitrary address.

Tcache Techniques

Modern exploitation techniques targeting the thread-local cache introduced in glibc 2.26.

tcache_poisoning.c

Tricking malloc into returning a completely arbitrary pointer by abusing the tcache freelist.

tcache_dup.c (obsolete)

Tricking malloc into returning an already-allocated heap pointer by abusing the tcache freelist.
  • Version: 2.26 - 2.28 (obsolete)
  • Status: Patched in glibc 2.29
  • Patch: Double-free check
  • Note: This technique is obsolete. See house_of_botcake for a modern alternative.

tcache_house_of_spirit.c

Frees a fake chunk to get malloc to return a nearly-arbitrary pointer (tcache variant).

house_of_botcake.c

Bypass double free restriction on tcache. Make tcache_dup great again.

tcache_stashing_unlink_attack.c

Exploiting the overwrite of a freed chunk on small bin freelist to trick malloc into returning an arbitrary pointer.

tcache_metadata_poisoning.c

Trick the tcache into providing arbitrary pointers by manipulating the tcache metadata struct.
  • Version: >= 2.26

tcache_relative_write.c

Arbitrary decimal value and chunk pointer writing in heap by out-of-bounds tcache metadata writing.
  • Version: >= 2.30

House Techniques

Classic and modern “House of X” exploitation techniques, each providing different primitives.

house_of_spirit.c

Frees a fake fastbin chunk to get malloc to return a nearly-arbitrary pointer.

house_of_lore.c

Tricking malloc into returning a nearly-arbitrary pointer by abusing the smallbin freelist.

house_of_force.c

Exploiting the Top Chunk (Wilderness) header to get malloc to return a nearly-arbitrary pointer.

house_of_einherjar.c

Exploiting a single null byte overflow to trick malloc into returning a controlled pointer.

house_of_orange.c

Exploiting the Top Chunk (Wilderness) to gain arbitrary code execution.

Bin & Chunk Manipulation

Techniques that manipulate bin freelists and chunk metadata to achieve overlapping allocations or arbitrary writes.

unsafe_unlink.c

Exploiting free on a corrupted chunk to get arbitrary write.

poison_null_byte.c

Exploiting a single null byte overflow.

overlapping_chunks.c

Exploit the overwrite of a freed chunk size in the unsorted bin to make a new allocation overlap with an existing chunk.

overlapping_chunks_2.c

Exploit the overwrite of an in use chunk size to make a new allocation overlap with an existing chunk.
  • Version: < 2.29
  • Patch: Size validation
  • Debug: ⏩ Browser Debug
  • Note: Variant of overlapping_chunks targeting in-use chunks. See main overlapping_chunks page for details.

mmap_overlapping_chunks.c

Exploit an in use mmap chunk to make a new allocation overlap with a current mmap chunk.
  • Version: Latest

unsorted_bin_into_stack.c

Exploiting the overwrite of a freed chunk on unsorted bin freelist to return a nearly-arbitrary pointer.

unsorted_bin_attack.c

Exploiting the overwrite of a freed chunk on unsorted bin freelist to write a large value into arbitrary address.

large_bin_attack.c

Exploiting the overwrite of a freed chunk on large bin freelist to write a large value into arbitrary address.

Advanced Techniques

Sophisticated exploitation methods including safe-linking bypasses and advanced primitives.

decrypt_safe_linking.c

Decrypt the poisoned value in linked list to recover the actual pointer.
  • Version: >= 2.32
  • Debug: ⏩ Browser Debug
  • Requirement: Safe-linking introduced in glibc 2.32

safe_link_double_protect.c

Leakless bypass for PROTECT_PTR by protecting a pointer twice, allowing for arbitrary pointer linking in t-cache.

sysmalloc_int_free.c

Demonstrating freeing the nearly arbitrary sized Top Chunk (Wilderness) using malloc (sysmalloc _int_free()).
  • Version: Latest

Complete Technique Index

Here’s the complete table from the original repository with all techniques:
This table is kept up-to-date with the main repository and includes version-specific information for each technique.

Version Evolution

Many techniques have multiple implementations for different glibc versions. The repository maintains these in version-specific directories:
When a technique is marked with a version like ”< 2.29”, it means the original technique was patched and you’ll need to use a version-specific implementation or adaptation.

Next Steps

By glibc Version

View techniques organized by glibc version

Glossary

Learn key heap exploitation terminology

Heap Basics

Understand heap internals before diving into techniques

Setup Guide

Set up your environment for testing techniques