How the ELF Ruined Christmas

How the ELF Ruined Christmas

How the ELF Ruined Christmas Alessandro Di Federico1,2, Amat Cama1, Yan Shoshitaishvili1, Christopher Kruegel1, and Giovanni Vigna1 1University of California, Santa Barbara, CA, USA amat,yans,chris,vigna @cs.ucsb.edu { 2Politecnico di Milano,} Milan, Italy [email protected] Abstract vulnerabilities has finally begun to decrease in recent years, classic buffer overflows remain the third most common Throughout the last few decades, computer software has form of software vulnerability, and four other memory experienced an arms race between exploitation techniques corruption vulnerabilities pad out the top 25 [13]. leveraging memory corruption and detection/protection One reason behind the decreased prevalence of mem- mechanisms. Effective mitigation techniques, such as ory corruption vulnerabilities is the heavy investment in Address Space Layout Randomization, have significantly research on their prevention and mitigation. Specifically, increased the difficulty of successfully exploiting a vul- many mitigation techniques have been adopted in two nerability. A modern exploit is often two-stage: a first main areas: system-level hardening (such as CGroups [23], information disclosure step to identify the memory layout, AppArmor [4], Capsicum [41], and GRSecurity [18]) and and a second step with the actual exploit. However, be- application-level hardening (such as stack canaries [3], cause of the wide range of conditions under which memory Address Space Layout Randomization (ASLR), and the corruption occurs, retrieving memory layout information No-eXecute (NX) bit [8]). from the program is not always possible. In particular, Address Space Layout Randomization In this paper, we present a technique that uses the (ASLR), by placing the dynamic libraries in a random lo- dynamic loader’s ability to identify the locations of critical cation in memory (unknown to the attacker), lead attackers functions directly and call them, without requiring an to perform exploits in two stages. In the first stage, the information leak. We identified several fundamental weak attacker must use an information disclosure vulnerability, points in the design of ELF standard and dynamic loader in which information about the memory layout of the appli- implementations that can be exploited to resolve and cation (and its libraries) is revealed, to identify the address execute arbitrary library functions. Through these, we of code that represents security-critical functionality (such are able to bypass specific security mitigation techniques, as the system() library function). In the second stage, the including partial and full RELRO, which are specifically attacker uses a control flow redirection vulnerability to designed to protect ELF data-structures from being co- redirect the program’s control flow to this functionality. opted by attackers. We implemented a prototype tool, Leakless, and evaluated it against different dynamic loader However, because of the wide range of conditions under implementations, previous attack techniques, and real- which memory corruptions occur, retrieving this informa- life case studies to determine the impact of our findings. tion from the program is not always possible. For example, Among other implications, Leakless provides attackers memory corruption vulnerabilities in parsing code (e.g., with reliable and non-invasive attacks, less likely to trigger decoding images and video) often take place without a intrusion detection systems. direct line of communication to an attacker, precluding the possibility of an information disclosure. Without this in- formation, performing an exploit against ASLR-protected 1 Introduction binaries using current techniques is often infeasible or unreliable. Since the first widely-exploited buffer overflow used by the As noted in [36], despite the race to harden applications 1998 Morris worm [27], the prevention, exploitation, and and systems, the security of some little-known aspects of mitigation of memory corruption vulnerabilities have oc- application binary formats and the system components cupied the time of security researchers and cybercriminals using them, have not received much scrutiny. In particular alike. Even though the prevalence of memory corruption we focus on the dynamic loader, a userspace component of 1 USENIX Association 24th USENIX Security Symposium 643 the operating system, responsible for loading binaries, and In summary, we make the following contributions: the libraries they depend upon, into memory. Binaries use • We develop a new, architecture- and platform- the dynamic loader to support the resolution of imported agnostic attack, using functionality inherent in ELF- symbols. Interestingly, this is the exact behavior that an based system that supports dynamic loading, to en- attacker of a hardened application attempts to reinvent by able an attacker to execute arbitrary library functions leaking a library’s address and contents. without an information disclosure vulnerability. Our insight is that a technique to eliminate the need for • We detail, and overcome, the challenges of imple- an information disclosure vulnerability could be developed menting our system for different dynamic loader by abusing the functionality of the dynamic loader. Our implementations and in the presence of multiple technique leverages weaknesses in the dynamic loader and mitigation techniques (including RELRO). in the general design of the ELF format to resolve and exe- • Finally, we perform an in-depth evaluation, including cute arbitrary library functions, allowing us to successfully a case study of previously complicated exploits that exploit hardened applications without the need for an infor- are made more manageable with our technique, an as- mation disclosure vulnerability. Any library function can sessment of the security of several different dynamic be executed with this technique, even if it is not otherwise loader implementations, a survey of the applicability used by the exploited binary, as long as the library that it of our technique to different operating system config- resides in is loaded. Since almost every binary depends urations, and a measurement of the improvement in on the C Library, this means our technique allows us to the length of ROP chains produced by Leakless. execute security-critical functions such as system() and execve(), allowing arbitrary command execution. We will also show application-specific library functions can be 2 Related Work: re-used to perform sophisticated and stealthy attacks. The The Memory Corruption Arms Race presented technique is reliable, architecture-agnostic, and does not require the attacker to know the version, layout, The memory corruption arms race (i.e., the process of content, or any other unavailable information about the defenders developing countermeasures against known library and library function in question. exploit techniques, and attackers coming up with new We implemented our ideas in a prototype tool, called exploitation techniques to bypass these countermeasures) Leakless1. To use Leakless, the attacker must possess has been ongoing for several decades. While the history the target application, and have the ability to exploit the of this race has been documented elsewhere [37], this vulnerability (i.e., hijack control flow). Given this infor- section focuses on the sequence of events that has required mation, Leakless can automatically construct an exploit many modern exploits to be two-stage, that is, needing an that, without the requirement of an information disclosure, information disclosure step before an attacker can achieve invokes one or more critical library functions of interest. arbitrary code execution. To evaluate our technique’s impact, we performed a Early buffer overflow exploits relied on the ability to survey of several different distributions of Linux (and inject binary code (termed shellcode) into a buffer, and FreeBSD) and identified that the vast majority of binaries overwrite a return address on the stack to point into this in the default installation of these distributions are suscep- buffer. Subsequently, when the program would return from tible to the attack carried out by Leakless, if a memory its current function, execution would be redirected to the corruption vulnerability is present in the target binary. We attacker’s shellcode, and the attacker would gain control also investigated the dynamic loader implementations of of the program. various C Libraries, and found that most of them are sus- As a result, security researchers introduced another ceptible to Leakless’ techniques. Additionally, we showed mitigation technique: the NX bit. The NX bit has the effect that a popular mitigation technique, RELocation Read- of preventing memory areas not supposed to contain code Only (RELRO), which protects library function calls from (typically, the stack) from being executed. being redirected by an attacker, is completely bypassable The NX bit has pushed attackers to adapt the concept by Leakless. Finally, we compared the length of Leakless’ of code reuse: using functionality already in the program ROP chains against ROP compilers implementing similar (such as system calls and security-critical library functions) functionality. Leakless produces significantly shorter ROP to accomplish their goals. In return-into-libc exploits [30, chains than existing techniques, which, as we show, allows 39], an attacker redirects the control flow directly to a it to be used along with a wider variety of exploits

View Full Text

Details

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