shellphish /how2heap
A repository for learning various heap exploitation techniques.
★ 8,981⑂ 1,299👁 254⑃ 172● 70▤ 0
+3
日增长
8,981
stars
1,299
forks
254
watchers
172
prs
70
issues
0
releases
README
Educational Heap Exploitation This repo is for learning various heap exploitation techniques. We use Ubuntu's Libc releases as the gold-standard. Each technique is verified to work on corresponding Ubuntu releases. You can run apt source libc6 to download the source code of the Libc you are using on a Debian-based operating system. You can also click :arrow_forward: to debug the technique in your browser using gdb. We came up with the idea during a hack meeting, and have implemented the following techniques: | File | :arrow_forward: | Technique | Glibc-Version | Patch | Applicable CTF Challenges | |------|-----|-----------|---------------|-------|---------------------------| | first_fit.c | | Demonstrating glibc malloc's first-fit behavior. | | | | | calc_tcache_idx.c| | Demonstrating glibc's tcache index calculation.| | | | | fastbin_dup.c | :arrow_forward: | Tricking malloc into returning an already-allocated heap pointer by abusing the fastbin freelist. | :arrow_forward: | Tricking malloc into returning a nearly-arbitrary pointer by abusing the fastbin freelist. | :arrow_forward: | Tricking malloc into returning an already-allocated heap pointer by putting a pointer on both fastbin freelist and the top chunk. | :arrow_forward: | Exploiting free on a corrupted chunk to get arbitrary write. | latest | | HITCON CTF 2014-stkof, Insomni'hack 2017-Wheel of Robots | | house_of_spirit.c | :arrow_forward: | Frees a fake fastbin chunk to get malloc to return a nearly-arbitrary pointer. | latest | | hack.lu CTF 2014-OREO | | poison_null_byte.c | :arrow_forward: | Exploiting a single null byte overflow. | latest | | PlaidCTF 2015-plaiddb, BalsnCTF 2019-PlainNote| | house_of_lore.c | :arrow_forward: | Tricking malloc into returning a nearly-arbitrary pointer by abusing the smallbin freelist. | latest | | | | overlapping_chunks.c | :arrow_forward: | Exploit the overwrite of a freed chunk size in the unsorted bin in order to make a new allocation overlap with an existing chunk | :arrow_forward: | Exploit the overwrite of an in use chunk size in order to make a new allocation overlap with an existing chunk | :arrow_forward: | Exploiting the Top Chunk (Wilderness) header in order to get malloc to return a nearly-arbitrary pointer | :arrow_forward: | Exploiting the overwrite of a freed chunk on unsorted bin freelist to return a nearly-arbitrary pointer. | :arrow_forward: | Exploiting the overwrite of a freed chunk on unsorted bin freelist to write a large value into arbitrary address | :arrow_forward: | Exploiting the overwrite of a freed chunk on large bin freelist to write a large value into arbitrary address | :arrow_forward: | Exploiting a single null byte overflow to trick malloc into returning a controlled pointer | latest | | Seccon 2016-tinypad | | house_of_water.c | | Exploit a UAF or double free to gain leakless control of the t-cache metadata and a leakless way to link libc in t-cache | latest | | 37c3 Potluck - Tamagoyaki| | sysmalloc_int_
Top issues
#38Figure out a good balance for "Applicable CTF Challenges"3 comments · 2017-03-26#31Linux Kernel (SLUB/SLAB)2 comments · 2017-01-25#242fix(demo): sysmalloc_int_free emits a -Wformat warning0 comments · 2026-08-09#241fix(docker): glibc_run.sh -d overwrites the tracked Dockerfile first line0 comments · 2026-08-09