GithubHelp home page GithubHelp logo

house_of_io_many_more's Introduction

House of IO - Heap Reuse

What Is This?

  • A heap exploitation technique that allows for returns an arbitrary memory address from Malloc.
  • An exploit primitive improvement for the House of IO - Underflow.
  • A bypass for pointer mangling.

How Does this Work?

  • Overwritting the TCache Bin struct pointers, since it is on the heap itself. This allows an arbitrary chunk to be returned from Malloc.

What Is the Primitive Improvement?

  • The original technique uses an out of bounds write going backwards in order to corrupt the TCache Bins data structure to add an arbitrary memory location to the data struture. The underflow is required because the TCache Bin struct is normally the first allocation of the heap.
  • By using careful manipulating of the heap memory via threading, it is possible to put the TCache Bin struct in the middle of the heap. This is because the TCache Bin struct is unique for threads and the heap memory can be reused between threads. By combining both of these properties, it is possible to corrupt the TCache Bin struct with a more common primitive, such as a use after free, buffer overflow or double free.

Damn, this sounds real complex

  • Yeah, this is!
  • I broke this down in an article on my blog called House of IO - Heap Reuse. This has an overview of everything about the allocator that is needed to understand the technique and a full explanation of how the technique works with pretty diagrams.

What's In this Repo Then?

  • A proof of concept of the House of IO - Heap Reuse on GLibC Malloc 2.31. Theoretically, this should work on all versions of Malloc 2.30+.
  • The reason for this difference in versions is that from GLibC Malloc 2.26-2.29 the counts array of the TCache Bin has slightly different storage size (char vs. uint16_t).

Pros and Cons

Pros

  • Bypasses pointer mangling for the classic fd poison attack.
  • Relative overwrites on the heap pointers in the TCache Bin data structures can be used to bypass heap ASLR.
  • Multiple fake pointers can be written to the TCache Bin, if NULLbytes can be used. This allows for multiple write primitives.
  • Added improvement and flexibility on the required exploit primitive when compared to the original House of IO - Underflow.

Cons

  • Practically, the settings for the arenas do not make it trivial to reuse heaps. This means that a way to exhaust threads for a process in the application is required. This is the highest bar of this technique.
  • A leak for another address, such as LibC, .bss or other sections of memory may be required.
  • If a continuous write is done from the bottom of the chunk, this destroys the TCache counts array. From this point on, all bins will have chunks in them, according to the allocator.

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.