Automated Exploit Generation for Stack Buffer Overflow Vulnerabilities V

Automated Exploit Generation for Stack Buffer Overflow Vulnerabilities V

ISSN 0361-7688, Programming and Computer Software, 2015, Vol. 41, No. 6, pp. 373–380. © Pleiades Publishing, Ltd., 2015. Original Russian Text © V.A. Padaryan, V.V. Kaushan, A.N. Fedotov, 2015, published in Trudy Instituta Sistemnogo Programmirovaniya, 2014, Vol. 26, No. 3, pp. 127–144 Automated Exploit Generation for Stack Buffer Overflow Vulnerabilities V. A. Padaryan, V. V. Kaushan, and A. N. Fedotov Institute for System Programming, Russian Academy of Sciences, ul. Solzhenitsyna 25, Moscow, 109004 Russia e-mail: [email protected], [email protected], [email protected] Received December 15, 2014 Abstract—An automated method for exploit generation is presented. This method allows one to construct exploits for stack buffer overflow vulnerabilities and to prioritize software bugs. The method is based on the dynamic analysis and symbolic execution of programs. It could be applied to program binaries and does not require debug information. The proposed method was used to develop a tool for exploit generation. This tool was used to generate exploits for eight vulnerabilities in Linux and Windows programs, of which three were not fixed at the time this paper was written. DOI: 10.1134/S0361768815060055 1. INTRODUCTION formulas that describe the sequence of operations on As information technologies develop, software symbolic variables and constants. Each conditional security and tools for ensuring the security become branch that depends on symbolic data adds an equa- more and more important. Complex software is inten- tion describing the execution flow through a certain sively used in critical applications—it controls trans- branch. The system of equations thus constructed is port, medical equipment in hospitals, operation of the path predicate because it describes a scenario of power plants, etc. Failures in the operation of this soft- the program execution. This system of equations is ware can lead to serious consequences, and the inten- passed to a solver in which the symbolic variables are tional malicious use of bugs in software can cause even unknowns. The solution of this system of equations is greater damage. Bugs the use of which can cause the a definite set of values for the symbolic variables. deliberate violation of a system integrity and disturb its The idea of symbolic computations was originally operation are called vulnerabilities. Many large IT aimed at improving testing coverage. However, companies (such as Microsoft, Google, and others) recently this technique was originally aimed at not only support research on bug and vulnerability improving used for guided search of certain program detection but also practically deploy advanced tech- states. Before calling the solver, the path predicate is nologies in the SDLC. extended by equations that describe the program state Bugs and vulnerabilities can be detected both at the to be achieved. In the context of the present paper, this level of source code and binary code analysis. The lat- is the situation in which vulnerabilities are triggered. ter approach is preferable because abstractions of Due to a large number of vulnerability classes and high-level languages hide specifics of the program multiple factors that affect the activation of a vulnera- operation that are important for detecting bugs and bility, attempts to formally describe vulnerabilities at evaluating their severity. In addition, source code is the binary code level were made only for some partic- often unavailable. For that reason, computer security ular cases. experts have to deal with executable (binary) code and use appropriate analysis methods [1]. In recent years, Usually, vulnerabilities are caused by software the approach to bug detection based on symbolic exe- bugs. However, not every bug causes a vulnerability. cution has been intensively developed. Modern fuzzing tools used in industrial software development produce thousands of inputs that cause Symbolic execution was proposed in the end of the abnormal termination [3]. 1970s for software testing [2]. The symbolic execution is the execution of a program in which specific values An important issue is bug prioritizing. Bugs that can of variables are replaced with symbolic values. Typi- be exploited should be fixed first. The bugs that allow an cally, symbolic values correspond to the input data of attacker to execute an arbitrary code are most danger- the program. Operations on symbolic values generate ous for users and most desired for attackers. 373 374 PADARYAN et al. argument 3 argument 3 malicious code argument 2 argument 2 malicious code argument 1 argument 1 pointer to a return address pointer to the code pointer to the code trampoline old value of ebp malicious code Direction of address growth Direction buffer buffer buffer (a) layout of stack (b) code placement (c ) use of frame trampoline Fig. 1. Stack organization and methods of placing injected code on it. In this paper, we propose a method for evaluating interaction with peripheral devices, which makes it the detected bugs based on the symbolic execution of possible to reconstruct the combined static-dynamic binary code. For a given set of input data that bring the representation of all program images executed in the examined program to an abnormal termination, an system and efficiently analyze its properties. The main exploit (i.e., a set of input data that exploit the vulner- purpose of the analysis environment is to automate the ability) is constructed for a widespread type of vulner- method of extracting algorithms from binary code [9] abilities—stack buffer overflow. The bugs for which an and to raise the representation level of these algo- exploit could be constructed are classified as critical— rithms. they must be fixed as soon as possible. The proposed Since the set of input data causing the abnormal method can be automated, and we developed a soft- termination of the program is known, the execution ware tool implementing it. This tool allows generating trace with the abnormal termination can be obtained. exploits for bugs, so that the shell-code specified by To generate an exploit, it suffices to consider only the the user is executed. instructions that deal with the data processing from The paper is organized as follows. The methods input moment until the abnormal termination. To underlying the proposed approach are discussed in select such instructions, a dynamic trace slicing algo- Section 2. In Section 3, the fundamentals of stack buf- rithm augmented with the taint analysis is used. fer overflow exploits are described. In Section 4, the Modern processor architectures contain a lot of proposed method is described, and some implementa- various instructions with complex semantics and side tion features are presented in Section 5. In Section 6, effects. A widespread approach that makes it possible the results and directions of future research are dis- to support a variety of architectures is the use of an cussed. intermediate representation. We use Pivot intermedi- ate representation [10], which provides a unified 2. ANALYSIS TECHNIQUES description of instruction semantics for various archi- tectures. This intermediate representation satisfies the The binary code can be analyzed using the static SSA-form, which considerably simplifies the analysis. and dynamic approach [1]. The symbolic execution The main operators used in Pivot are as follows. within the static approach is limited because of the • The operator NOP has no any effect. high complexity of the resulting system of equations. Only the dynamic [4] or combined [5] analysis was • The operator INIT initializes a local variable by reported to be successful. a constant value. The studies described in the present paper are • The operator APPLY applies one of the opera- based on the capabilities of the binary code analysis tions. Local variables are used as parameters and the environment [6]. The main subject of analysis are result. traces of machine instructions produced by the full • The operator BRANCH transfers control. system emulator described in [7, 8]. The traces contain • The operator LOAD loads a value from an address register states and information about interrupts and space. PROGRAMMING AND COMPUTER SOFTWARE Vol. 41 No. 6 2015 AUTOMATED EXPLOIT GENERATION 375 Exploit Construction construction Subtrace Search for of the path based on the selection trampolines predicate system of formulas Fig. 2. Decomposition of the method into four phases. • The operator STORE writes a value to an address abnormal program termination. Then, the attacker space. can use the return-oriented programming technique To describe the memory and registers, Pivot uses [11], which makes it possible to compose shell-code the model of unified address spaces. From the view- from available code fragments. In addition, address point of this model, all addressable operands of the space randomization hampers exploiting the vulnera- target CPU architecture (registers, memory, and bility by loading the malicious code at different input-output ports) are placed in linear address addresses for different attempts. In this case, the value spaces. The access to such a space uses a pair (space to be written at the place of the return address cannot identifier, offset). To account for side effects, a model be predefined. However, often one of the registers status word is used, which is similar to the flag register points to a stack space at the time of returning from the in the x86 architecture. function. If this space is available for code placing, then the control can be transferred to this code using the instruction jmp 〈reg〉 or call 〈reg〉 that is 3. EXPLOITATION OF STACK BUFFER located at a known address. The instructions of this OVERFLOW VULNERABILITIES type are called trampolines. In this case, upon the return from the function the control will be transferred Consider a situation in which the size of data writ- to the trampoline instruction, and from it to the code ten into a buffer on the stack exceeds the buffer size. placed on the stack (Fig.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    8 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