GithubHelp home page GithubHelp logo

thehepta / how2heap Goto Github PK

View Code? Open in Web Editor NEW

This project forked from escapingbug/how2heap

0.0 1.0 0.0 56 KB

A repository for learning various heap exploitation techniques.

Makefile 1.23% C 98.77%

how2heap's Introduction

Educational Heap Exploitation

This repo is for learning various heap exploitation techniques. We came up with the idea during a hack meeting, and have implemented the following techniques:

File Technique Applicable CTF Challenges
first_fit.c Demonstrating glibc malloc's first-fit behavior.
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. 9447-search-engine
unsafe_unlink.c Exploiting free on a corrupted chunk to get arbitrary write. HITCON CTF 2014-stkof
house_of_spirit.c Frees a fake fastbin chunk to get malloc to return a nearly-arbitrary pointer. hack.lu CTF 2014-OREO
poison_null_byte.c Exploiting a single null byte overflow. PlaidCTF 2015-plaiddb
house_of_lore.c Tricking malloc into returning a nearly-arbitrary pointer by abusing the smallbin freelist.
overlapping_chunks.c Exploit the overwrite of a freed chunk size in the unsorted bin in order to make a new allocation overlap with an existing chunk hack.lu CTF 2015-bookstore
house_of_force.c Exploiting the Top Chunk (Wilderness) header in order to get malloc to return a nearly-arbitrary pointer Boston Key Party 2016-cookbook, BCTF 2016-bcloud
unsorted_bin_attack.c Exploiting the overwrite of a freed chunk on unsorted bin freelist to write a large value into arbitrary address 0ctf 2016-zerostorage

Have a good example? Add it here! Try to inline the whole technique in a single .c -- it's a lot easier to learn that way.

Heap Exploitation Tools

There are some heap exploitation tools floating around.

libheap

Examine the glibc heap in gdb: https://github.com/cloudburst/libheap

Malloc Playground

The malloc_playground.c file given is the source for a program that prompts the user for commands to allocate and free memory interactively.

Other resources

Some good heap exploitation resources, roughly in order of their publication, are:

Hardening

There are a couple of "hardening" measures embedded in glibc, like export MALLOC_CHECK_=1 (enables some checks), export MALLOC_PERTURB_=1 (data is overwritten), export MALLOC_MMAP_THRESHOLD_=1 (always use mmap()), ...

More info: mcheck(), mallopt().

There's also some tracing support as mtrace(), malloc_stats(), malloc_info(), memusage, and in other functions in this family.

how2heap's People

Contributors

zardus avatar antoniobianchi333 avatar crowell avatar salls avatar grazfather avatar nickstephens avatar andigena avatar thehepta avatar rhelmot avatar jacopo avatar degrigis avatar jinblack avatar owlz avatar conand avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.