$ show shellphish/how2heap
This repository is a collection of proof-of-concept (PoC) exploit codes demonstrating various heap exploitation techniques in the GNU C Library (glibc) across versions 2.23 to 2.43. Each PoC is a standalone C program designed to be compiled and executed to showcase a specific heap corruption technique (e.g., fastbin dup, tcache poisoning, house of spirit, etc.) under controlled conditions. The primary purpose is educational, targeting security researchers, CTF participants, and students studying binary exploitation. The architecture is organized around a build system (Makefile) that compiles version-specific exploits located in directories named after glibc versions. Each exploit is self-contained with a main function, simulating heap manipulations to achieve arbitrary memory writes or code execution. Key entry points include the Makefile for building, an interactive heap exploration tool (malloc_playground.c), and a CI workflow for automated testing across multiple environments. The repository relies on glibc, build tools, and Docker for environment setup, with a submodule providing access to multiple glibc releases. The repository exhibits strong engineering practices through its reusable components: the Makefile employs wildcard and foreach functions to manage version-specific builds without duplication; malloc_playground.c offers an interactive interface for heap analysis that can be reused in other educational contexts; and the CI workflow uses a matrix strategy to test exploits across glibc and Ubuntu versions. Actively maintained with recent commits and low technical drift, the project adapts to glibc's evolving security mitigations by updating techniques for new versions, ensuring continued relevance in heap exploitation education.
The LLM identified 3 files worth highlighting for reuse:
The Makefile uses wildcard and foreach functions to automatically build exploits for multiple glibc versions and techniques. It defines targets for building specific versions, all versions, and running tests. This pattern reduces duplication and allows easy extension to new versions.
This program provides an interactive command-line interface to explore the heap state, including viewing chunks, bins, and memory layouts. It is self-contained, educational, and can be reused in other heap exploitation learning environments without modification.
The CI workflow uses a matrix strategy to test the exploits across multiple glibc versions (2.23-2.43) and Ubuntu versions (18.04, 20.04, 22.04). It defines reusable actions for building and testing, making it easy to extend to new versions and environments.