Giter Club home page Giter Club logo

heap-viewer's Introduction

HeapViewer

An IDA Pro plugin to examine the heap, focused on exploit development.

Currently supports the glibc malloc implementation (ptmalloc2).

3rd place winner of the 2018 Hex-Rays Plugin Contest

Requirements

  • IDA Pro >= 6.9

Tested on

  • glibc <= 2.27 (x86, x64)

Features

  • Heap tracer (malloc/free/calloc/realloc)
  • Malloc chunk info
  • Multi-arena info (chunks, top, last-remainder)
  • Bins info (fastbins, unsortedbin, smallbins y largebins)
  • Tcache info (glibc >= 2.26)
  • GraphView for linked lists (bins/tcache)
  • Magic utils:
    • Unlink merge info
    • Fake fastbin finder
    • House of force helper
    • Useful libc offsets
    • Calc chunk size (request2size)
    • IO_FILE structs

Install

Just drop the heap_viewer.py file and the heap_viewer folder into IDA's plugin directory.

Because IDA not load libc-dbg symbols in the debug session, is necesary generate a config file before using the plugin. To make this, simply install the libc6-dbg package in the remote linux machine and execute the script utils\get_config.py. Then, paste the content in the heap_viewer\files\config.json file.

get_config.py

$ python get_config.py
[*] config.json:

{
  "libc_offsets": {
    "32": {
      "mp_": 1921312,
      "main_arena": 1922976,
    },
    "64": {
      "mp_": 3883648,
      "main_arena": 3886144,
    }
  },
  "libc_version": "2.27"
}

If you not have the dbg symbols for given libc (ex: CTFs ;D), you can use the get_main_arena tool, and get the main_arena offset for that libc. This is enough so the plugin works correctly. Simply put the main_arena offset in the config.json file.

Examples:

$ ./main_arena_offset
[*] libc version:       2.27
[*] libc file:          /lib/i386-linux-gnu/libc-2.27.so
[*] libc address:       0xf7ceb000
[*] main_arena:         0xf7ec07a0
[*] main_arena offset:  0x1d57a0

$ LD_PRELOAD=./libc_64.so.6 ./main_arena_offset
...

Screenshots

Tracer

Tracer

Arena & chunk info

Arena-Chunk

Tcache entries

Tcache entries

Bins

Bins

Bin graph

BinGraph

Fastbin graph

fastbin graph

Tcache graph

tcache graph

Find fake fastbin

Find fake fastbin

Unlink merge info

Unlink merge info

Useful libc offsets

Useful libc offsets

Learning Resources

I'd recommend the following resources alongside this tool for learning heap exploiting.

Author

  • Daniel García Gutiérrez - @danigargu

Contribuitors 🍺

Special mention to my colleagues soez, wagiro and DiaLluvioso for give me some ideas during the development of the plugin. And of course, the @pwndbg project, from which I picked up some things about heap parsing.

Contributors

Bugs / Feedback / PRs

Any comment, issue or pull request will be highly appreciated :-)

heap-viewer's People

Contributors

andreafioraldi avatar danigargu avatar ga-ryo avatar mebeim 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.