Skip to main content
Learn heap exploitation techniques by running real examples. This guide will get you started quickly with the basics.

Quick Setup

The fastest way to get started is with the Quick Setup method, which uses your system’s glibc.
1

Install Required Tools

Make sure you have the following packages installed:
Also ensure /usr/bin/python points to your Python binary:
2

Clone and Build

Clone the repository and build the base binaries:
This builds the base binaries: malloc_playground, first_fit, and calc_tcache_idx.
3

Run Malloc Playground

The malloc playground is an interactive tool to experiment with heap operations:
You’ll see a prompt where you can enter commands:

Using Malloc Playground

The malloc playground allows you to allocate, free, and manipulate memory interactively.

Basic Commands

Available Commands

The malloc playground tracks up to 20 pointers at once. Use clearlist to reset and free all allocations.

Your First Technique: First Fit

Now let’s run your first heap exploitation technique demo.
1

Compile first_fit

The first_fit example demonstrates glibc’s first-fit allocation behavior:
2

Run the Example

Execute the compiled binary:
You’ll see output demonstrating how glibc reuses freed chunks:
3

Understand the Technique

The example shows:
  • Allocate chunk A (0x512 bytes)
  • Allocate chunk B (0x256 bytes)
  • Free chunk A
  • Allocate chunk C (0x500 bytes) - gets the same address as A!
This demonstrates the use-after-free condition where pointer A still points to data from allocation C.

Exploring Techniques

The repository includes dozens of techniques organized by glibc version:

Fastbin Techniques

  • fastbin_dup - Double free attack
  • fastbin_dup_into_stack - Arbitrary pointer
  • fastbin_dup_consolidate - Bypass checks

Tcache Techniques

  • tcache_poisoning - Poison tcache entries
  • tcache_dup - Double free in tcache
  • house_of_botcake - Advanced tcache exploit

House Techniques

  • house_of_spirit - Fake fastbin chunks
  • house_of_lore - Smallbin exploitation
  • house_of_einherjar - Null byte overflow

Advanced

  • unsafe_unlink - Arbitrary write
  • poison_null_byte - Single byte overflow
  • large_bin_attack - Large bin exploitation
The Quick Setup method links binaries against your system libc. For working with specific glibc versions, see the Setup Guide for complete configuration options.

Next Steps

Complete Setup

Configure specific glibc versions using Docker or linker methods

Debugging

Use GDB with heap visualization tools like pwndbg or gef

Running with GDB

To debug techniques with GDB:
Recommended GDB plugins for heap exploitation:
  • pwndbg - Exploitation-focused GDB plugin
  • gef - GDB Enhanced Features
  • Pwngdb - Heap examination tools