Skip to main content
QUICK REVIEW

[Paper Review] Automatic Heap Layout Manipulation for Exploitation

Sean Heelan, Tom Melham|arXiv (Cornell University)|Apr 23, 2018
Security and Verification in ComputingComputer Science11 references10 citations
TL;DR

This paper presents the first automatic approach to heap layout manipulation (HLM) for exploiting heap-based buffer overflows, using pseudo-random black-box search to generate inputs that position vulnerable buffers relative to target data structures. The authors introduce Shrike, a system that automates HLM in the PHP interpreter by composing code fragments to achieve desired heap layouts, enabling control-flow hijacking exploits with minimal manual intervention.

ABSTRACT

Heap layout manipulation is integral to exploiting heap-based memory corruption vulnerabilities. In this paper we present the first automatic approach to the problem, based on pseudo-random black-box search. Our approach searches for the inputs required to place the source of a heap-based buffer overflow or underflow next to heap-allocated objects that an exploit developer, or automatic exploit generation system, wishes to read or corrupt. We present a framework for benchmarking heap layout manipulation algorithms, and use it to evaluate our approach on several real-world allocators, showing that pseudo-random black box search can be highly effective. We then present SHRIKE, a novel system that can perform automatic heap layout manipulation on the PHP interpreter and can be used in the construction of control-flow hijacking exploits. Starting from PHP's regression tests, SHRIKE discovers fragments of PHP code that interact with the interpreter's heap in useful ways, such as making allocations and deallocations of particular sizes, or allocating objects containing sensitive data, such as pointers. SHRIKE then uses our search algorithm to piece together these fragments into programs, searching for one that achieves a desired heap layout. SHRIKE allows an exploit developer to focus on the higher level concepts in an exploit, and to defer the resolution of heap layout constraints to SHRIKE. We demonstrate this by using SHRIKE in the construction of a control-flow hijacking exploit for the PHP interpreter.

Motivation & Objective

  • Address the lack of automation in heap layout manipulation (HLM) for exploiting heap-based memory corruption vulnerabilities.
  • Overcome the challenge that heap allocators do not expose APIs for controlling memory layout, requiring indirect manipulation via application APIs.
  • Enable automatic generation of inputs that achieve specific heap layouts necessary for successful exploitation of out-of-bounds heap accesses.
  • Integrate HLM into automated exploit generation pipelines, allowing developers to focus on high-level exploit logic while deferring layout resolution.
  • Demonstrate feasibility and effectiveness of the approach on real-world software, specifically the PHP interpreter, using a novel benchmarking framework.

Proposed method

  • Propose a pseudo-random black-box search algorithm to explore input sequences that indirectly control heap layout through application-side allocations and deallocations.
  • Design a benchmarking framework to evaluate HLM algorithms on real-world allocators, using synthetic and real-world heap layout scenarios.
  • Implement Shrike, a system that discovers and composes code fragments from regression tests to form programs that achieve desired heap layouts.
  • Model heap layout as a state transition problem, where each input sequence alters the heap state, and search for sequences that reach target configurations.
  • Use symbolic execution and constraint solving to guide search toward inputs that place source and destination buffers in desired relative positions.
  • Leverage known allocator behaviors (e.g., best-fit, LIFO free lists) to model heap layout outcomes and reduce search space.

Experimental results

Research questions

  • RQ1Can pseudo-random black-box search effectively solve the heap layout manipulation problem for real-world allocators?
  • RQ2To what extent can automatic input generation achieve precise heap layouts required for control-flow hijacking in heap-based vulnerabilities?
  • RQ3How effective is the proposed approach in real-world systems like the PHP interpreter, where allocator behavior is complex and non-deterministic?
  • RQ4Can a system like Shrike automate the composition of code fragments to achieve complex heap layouts without manual layout analysis?
  • RQ5How does the integration of HLM into exploit development pipelines improve the feasibility and efficiency of automated exploit generation?

Key findings

  • Pseudo-random black-box search achieves high success rates in synthetic benchmarks, demonstrating effectiveness even without prior knowledge of allocator internals.
  • Shrike successfully generates inputs that achieve desired heap layouts in the PHP interpreter, enabling the construction of control-flow hijacking exploits.
  • The system reduces the need for manual heap layout analysis by automating the composition of input sequences from existing code fragments.
  • Evaluation on ten different target structures and three sub-components of PHP shows robustness across diverse heap layout challenges.
  • The framework successfully identifies and leverages allocator interactions (e.g., size-specific allocations) to achieve precise layout control.
  • The approach enables integration into automated exploit generation pipelines, allowing developers to focus on logic while Shrike resolves layout constraints.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.