Stealth Breakpoints

Stealth Breakpoints

Stealth Breakpoints Amit Vasudevan and Ramesh Yerraballi Department of Computer Science and Engineering University of Texas at Arlington {vasudeva,ramesh}@cse.uta.edu Abstract 1. Introduction Microscopic analysis of malicious code (malware) re- Microscopic malware analysis — a fine-grained analysis quires the aid of a variety of powerful tools. Chief among process that provides insight into malware structure and in- them is a debugger that enables runtime binary analysis at ner functioning — helps in gleaning important information an instruction level. One of the important services provided regarding a malware to facilitate the development of an anti- by a debugger is the ability to stop execution of code at dote. Fine-grained analysis requires the aid of various pow- an arbitrary point during runtime, using breakpoints. Soft- erful tools, chief among them being a debugger that enables ware breakpoints support an unlimited number of breakpoint runtime binary analysis at an instruction level. One of the im- locations by changing the code being debugged so that it portant services provided by a debugger is the ability to stop can be interrupted during runtime. Most, if not all, malware execution of code being debugged at an arbitrary point dur- are very sensitive to code modification with self-modifying ing runtime. This is achieved using breakpoints, which can and/or self-checking (SM-SC) capabilities, rendering the use be of two types: Hardware and Software. Hardware break- of software breakpoints limited in their scope. Hardware points, as the name suggests, are provided by the underly- breakpoints supported by the underlying processor, on the ing processor and support precise breakpoints on code, data other hand, use a subset of the processor register set and ex- and I/O. They are deployed by programming specific pro- ception mechanisms to provide breakpoints that do not en- cessor registers to specify the breakpoint locations and type. tail code modification. This makes hardware breakpoints the Software breakpoints on the other hand are implemented by most powerful breakpoint mechanism for malware analysis. changing the code being debugged to trigger certain excep- However, current processors provide a very limited number tions upon execution (usually a breakpoint exception). of hardware breakpoints (typically 2–4 locations). Thus, a Software breakpoints support unlimited number of break- serious restriction is imposed on the debugger to set a de- point locations but suffer from the fact that they modify the sired number of breakpoints without resorting to the limited target code at runtime. This is clearly unsuitable in the con- alternative of software breakpoints. Also, with the ever evolv- text of malware since most if not all malware possess SM- ing nature of malware, there are techniques being employed SC capabilities and are very sensitive to changes made to that prevent the use of hardware breakpoints. This calls for a their code. For example, viruses such as W32.HIV [18], new breakpoint mechanism that retains the features of hard- W9x.CIH [17], W32.MyDoom [19] etc. use polymor- ware breakpoints while providing an unlimited number of phic/metamorphic code envelopes and employ a host of in- breakpoints, which cannot be detected or countered. tegrity checks to detect any changes made to their internal In this paper, we present the concept of stealth breakpoints code fragments, to prevent their analysis. Hardware break- and discuss the design and implementation of VAMPiRE 1, a points on the other hand do not involve any form of code realization of this concept. VAMPiRE cannot be detected or modification and, hence, are the most powerful tool in the countered and provides unlimited number of breakpoints to repertoire of any debugger tailored for malware. Current pro- be set on code, data, and I/O with the same precision as that cessors , however, provide a very limited number of hard- of hardware breakpoints. It does so by employing a subtle ware breakpoints (typically 2–4 locations). Thus, a serious combination of simple stealth techniques using virtual mem- restriction is imposed on a debugger to set desired number ory and hardware single-stepping mechanisms that are avail- of breakpoints without resorting to the limited alternative of able on all processors, old and new. This technique makes software breakpoints. Also, with the ever evolving nature of VAMPiRE portable to any architecture, providing powerful malware, there are techniques being employed that prevent breakpoint ability similar to hardware breakpoints for mi- the use of hardware breakpoints to analyze them. For exam- croscopic malware analysis. ple, the W32.HIV virus uses the processor debug registers and the breakpoint exception for its internal computations, thereby effectively thwarting hardware breakpoints. This sit- uation calls for a new breakpoint mechanism that retains the 1 VAMPiRE is a beast (in folklore) that attacks in a stealth fashion. features of hardware breakpoints while providing unlimited number of breakpoints that cannot be detected or countered. ICE breakpoints require supporting hardware [8, 1] and is This paper discusses the concept of stealth breakpoints typically used for processor core debugging than normal pro- and presents VAMPiRE, a realization of this concept that of- gram debugging. Many processors also have built-in support fers the best of both worlds in the sense of unlimited num- for hardware breakpoint facilities. This involves a subset of ber of precise breakpoints on code, data and I/O which can- the processor register set and exception mechanisms to pro- not be detected or countered. This is achieved by employing vide precise code, data and/or I/O breakpoints albeit allow- simple stealth techniques that involve virtual memory, single- ing breakpoints to be set on a limited number of locations stepping and task state segments 2 (for processors supporting (typically 2–4 locations). legacy I/O) — features found in most new and old proces- Software breakpoints on the other hand provide an ele- sor architectures. gant, cost-effective and scalable solution with the existing While various ideas using virtual memory for breakpoint hardware. There are various categories of software break- purposes have been explored in many debuggers [2, 15, 6], points. The first variety relies on program source code avail- most if not all, allow only data read and/or write breakpoints. ability. This coupled with help from the compiler is used Also none of them are specifically tailored for malware anal- to insert data and/or code breakpoints. Practical data break- ysis and their breakpoint implementation can be easily de- points [26, 25] use efficient runtime data structures and tected and defeated. To the best of our knowledge, VAM- ideas from compiler optimization to provide several meth- PiRE is the first to combine virtual memory, single-stepping, ods of data breakpoints. The method involves checking all task state segments (TSS) and stealth techniques to provide a read and/or write instructions using complex data flow anal- stealth and portable breakpoint framework highly conducive ysis with a segmented bitmap, reserving registers to hold in- for malware analysis. By stealth we mean that the break- termediate values during address lookup. points inserted using VAMPiRE is completely invisible to The second variety of software breakpoints uses proces- the code being debugged. VAMPiREcurrently runs under the sor supported trap and/or breakpoint instructions to set the Windows (9x, NT, 2K and XP) and Linux operating systems desired breakpoint. There are a host of implementations as in (OS) on IA-32 (and compatible) processors and is portable GDB [15], KDB [3], Windbg [23], DBX [14], WDB [1], on any platform (OS and processor architecture) that sup- Softice [6] etc. In this method, a debugger typically encodes ports virtual memory and single-stepping. The framework a 1 byte trap instruction at the breakpoint location, while sav- performance is well within the limits to suit interactive de- ing the byte that was replaced. When the breakpoint triggers bugging and having a simple and easy-to-use API allows it by means of the trap exception, the debugger gets control and to be incorporated into existing debuggers with ease. the original byte is replaced and the program is restarted to This paper is organized as follows: In Section 2 we con- execute the instruction. While this method solves the prob- sider related work on breakpoints and compare them with lem of the number of breakpoints that could be active simul- VAMPiRE. In Section 3 we discuss the design and imple- taneously, it does not support data and/or I/O breakpoints mentation of VAMPiRE. In Section 4 we demonstrate the and is unsuitable for SM-SC code. Also, there are specula- use of VAMPiRE and present some performance numbers tions regarding the correctness of trap-based breakpoint im- for the framework. We conclude the paper in Section 5 sum- plementations. The combination of trap and single-stepping marizing our contributions with suggestions for future work. may result in missed breakpoints in a multithreaded program if not correctly implemented by the debugger [22]. 2. Background and Related Work Fast breakpoints [12] suggested a novel way to imple- Breakpoints — debugging aids that provide the ability to ment software breakpoints using instruction flow change. stop execution of code at an arbitrary point during execu- The idea is to encode a jump instruction to transfer control to tion — are primarily categorized into hardware and software. the debugger at the breakpoint. While the idea is similar to There are various designs and implementations of break- that of a trap, this method, to some extent, avoids the prob- points. Several authors have speculated that efficient data lem of correctness of a breakpoint in a multi-threaded pro- breakpoints require special purpose hardware [20, 4, 11]. gram. However, the mechanism supports only code break- There are also surveys [21] which discuss the architectural points and is not applicable to SM-SC code.

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