Skip to content

danigargu/heap-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

88 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HeapViewer

License: GPL v3

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 >= 7.0

Tested on

  • glibc 2.23 <= 2.31 (x86, x64)

Features

  • Heap tracer (malloc/free/calloc/realloc)
    • Detection of overlaps and double-frees
    • Visualization using villoc
  • Malloc chunk info
  • Chunk editor
  • 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)
  • Structs view (malloc_state / malloc_par / tcache_perthread)
  • Magic utils:
    • Unlink merge info
    • Freeable/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.

To install just for the current user, copy the files into one of these directories:

OS Plugin path
Linux/macOS ~/.idapro/plugins
Windows %AppData%\Hex-Rays\IDA Pro\plugins

Configuration

Currently the plugin does not require to be configured, since it tries to obtain automatically the necessary offsets to analyze the heap.

However, in case the plugin fails, it is possible to set the different offsets in the configuration tab. To obtain these offsets, you can use any of the tools located in the utils folder.

If you find any inconsistency, let me know :)

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

Contributors 🍺

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 :-)