A Principled Approach for ROP Defense ∗ Rui Qiao Mingwei Zhang R

A Principled Approach for ROP Defense ∗ Rui Qiao Mingwei Zhang R

A Principled Approach for ROP Defense ∗ Rui Qiao Mingwei Zhang R. Sekar Stony Brook University Intel Labs Stony Brook University [email protected] [email protected] [email protected] ABSTRACT Code reuse attacks rely on repeated subversion of control- Return-Oriented Programming (ROP) is an effective attack flows in the victim program. Given the nature of instruction technique that can escape modern defenses such as DEP. sets on modern processors, such subversion is possible only ROP is based on repeated abuse of existing code snippets with indirect control flow transfer instructions. Control-flow ending with return instructions (called gadgets), as com- integrity (CFI) is a general technique for limiting control- pared to using injected code. Several defense mechanisms flow subversions by limiting the targets of such indirect con- have been proposed to counter ROP by enforcing policies trol transfers. The idea of CFI is to restrict these targets on the targets of return instructions, and/or their frequency. so that a program's execution follows a control flow graph However, these policies have been repeatedly bypassed by (CFG) that is computed by a static analysis. more advanced ROP attacks. While stricter policies have CFI defeats most ROP attacks since they tend to violate the potential to thwart ROP, they lead to incompatibilities the statically computed CFG. However, determined attack- which discourage their deployment. In this work, we ad- ers can overcome CFI [17, 14] | specifically, coarse-grained dress this challenge by presenting a principled approach for CFI that is based on simple static analyses can be defeated. ROP defense on COTS binaries. Our experimental evalu- In fact, researchers have shown that a Turing-complete set ation shows that our approach enforces a stronger policy, of gadgets is available on sufficiently large applications even while offering better compatibility and performance as com- when coarse-grained CFI is enforced [14]. pared to previous research. Our prototype is compatible Recognizing the weakness of coarse-grained CFI against with many real-world and low-level programs. On SPEC powerful adversaries, researchers have begun to develop tech- 2006 benchmark program, it adds just 4% overhead above niques for refining CFI policies. These techniques can be the base overhead of 13% imposed by PSI, the platform used broadly classified into those for narrowing down the target in our implementation. of forward edges, which include indirect calls and indirect jumps, and those for narrowing down the backward edges, 1. Introduction consisting of returns. Several forward edge techniques have Programs written in C/C++ are not memory safe. Vul- been developed recently [23, 43, 37, 48], and some of them nerabilities such as buffer overflow, heap overflow and use- are already being deployed in production compilers such as after-free can be exploited by attackers to execute code of gcc and llvm [43]. This factor can greatly reduce the threat their choice. Traditionally, attackers inject payload (called of code reuse attacks based on repeated subversion of for- shellcode) into the address space of a victim process, and ward edges, e.g., call-oriented programming [6, 39]. How- redirect control to this code. However, with widespread ever, mitigating the subversion of backward edges remains deployment of Data Execution Prevention (DEP), injected a challenge. Although techniques for constraining returns code is no longer executable, so attackers have come to have been known for well over a decade [8,9], they have not rely on code reuse attacks. Return-Oriented Programming seen wide deployment due to compatibility and performance (ROP), which chains together a sequence of \gadgets" (code concerns. It is this factor that motivates our work. sequences ending with return instructions), is the most pow- The essential characteristic of ROP is the repeated use of erful and versatile among code reuse attacks. Its power return instructions. Thus, techniques for constraining re- stems from the pervasiveness of returns in binary code. As turns can be very effective in defeating ROP attacks. The a result, there are sufficient gadgets in a reasonably large primary approach for confining returns is the shadow stack, binary to perform Turing-complete computation. Although which relies on a second stack that maintains a duplicate variants such as Jump-oriented programming have been pro- copy of every return address. Each call instruction is modi- posed, ROP remains by far the most dominant code reuse fied so that it stores a second copy of the return address on attack, and the only kind used repeatedly in real-world at- the shadow stack. Before each return, the return address on tacks. For this reason, this paper focuses on ROP attacks, the top of the stack is compared with that atop the shadow and develops a principled approach for defeating them. stack. A mismatch is indicative of an attack, and program execution can be aborted before a successful control-flow hi- ∗This work was completed when he was at Stony Brook University jack. However, previous shadow stack solutions suffer from yThis work was supported in part by grants from NSF (CNS- one or more of the following drawbacks: 0831298 and CNS-1319137) and ONR (N00014-15-1-2378). • Incompleteness. Many shadow stack schemes are based Permission to make digital or hard copies of all or part of this work for personal or on compilers [8, 12]. They do not protect returns in classroom use is granted without fee provided that copies are not made or distributed hand-written assembly code from low-level libraries such for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the as glibc and ld.so that are invariably present in every author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or application. Also left unprotected are third-party libraries republish, to post on servers or to redistribute to lists, requires prior specific permission made available only in binary code form. Moreover, un- and/or a fee. Request permissions from [email protected]. intended returns (See Section 2.1) could be used in ROP, ACSAC ’15, December 07 - 11, 2015, Los Angeles, CA, USA and these won't be checked against the shadow stack. c 2015 Copyright held by the owner/author(s). Publication rights licensed to ACM. ISBN 978-1-4503-3682-6/15/12. $15.00 • Incompatibility. In most complex applications, returns DOI: http://dx.doi.org/10.1145/2818000.2818021 don't always match calls. If these exceptional cases are switching to the right RCAP-stack at runtime, based on not correctly handled, they lead to false positives that the value of stack pointer at the point of return. deter practical deployment of shadow stack approaches. • Strict enforcement: By discovering and always pushing • Lack of systematic protection from all ROP attacks. None the intended target on RCAP-stack, we avoid the need of the previous approaches provide a systematic analysis for \whitelisting" return instructions. By subjecting all of possible hijacks of returns, and how these attempts are returns to a strict policy, we take away an attacker's ca- thwarted. Indeed, most previous approaches incorporate pability to abuse even a single return instruction in the exceptions to the shadow stack policy in order to achieve protected application. compatibility. A resourceful adversary can exploit these • In-depth evaluation: Our evaluation demonstrates excel- policy exceptions to carry out successful ROP attacks. lent compatibility as well as protection against attacks. In this paper, we develop a new defense against ROP that The overhead of our solution is significantly lower than overcomes these drawbacks. We provide an overview of our previous techniques: just 3% over the base 14% overhead approach below, and summarize our key contributions. posed by our platform PSI on SPEC 2006 benchmarks. 1.1 Approach Overview 2. Background and Threat Model Our approach is based on the following simple policy: Return instructions should transfer control to intended 2.1 ROP Attacks return targets. Return-Oriented Programming (ROP) [40] is the most With a static interpretation of \intention", many existing prevalent form of code-reuse attack. It makes use of \gad- coarse-grained CFI schemes can be seen as enforcing this gets," i.e., existing code snippets ending with return instruc- policy. However, as discussed before, a static interpretation tions. A gadget used in a ROP attack could either be an affords far too many choices for return targets, allowing suc- intended code sequence, or unaligned code, which refers to cessful ROP attacks to be mounted. We therefore take a unintended instruction sequence beginning from the middle dynamic interpretation of intent. Specifically: of an (intended) instruction. This is possible on variable- • The ability to return to a location is interpreted as a one- length instruction-set architectures such as the x86. time use capability. These capabilities are inferred from To carry out a ROP-attack, it is necessary to subvert a and associated with specific parts of the program text, program's intended control flow. We develop an effective e.g., a call instruction, or, a move instruction that stores policy to break this step and hence prevent ROP attacks. a function pointer on the stack, with the intent of using 2.2 Control-Flow Integrity (CFI) this pointer as the target of a return. A return capability Control-flow integrity is an important primitive for secure is issued each time this program text is executed. static instrumentation [50, 47], as it can limit control flows • These return capabilities must be used in a last-in-first- so that instrumentation cannot be bypassed. Specifically, out (LIFO) order. As the term \capability" suggests, not control flows cannot go to (a) middle of instructions, or (b) every intended return needs to be taken.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us