On the Effectiveness of Address-Space Randomization Hovav Shacham, Matthew Page, Ben Pfaff, Eu-Jin Goh, Nagendra Modadugu, Dan Boneh.

Slides:



Advertisements
Similar presentations
Buffer Overflows Nick Feamster CS 6262 Spring 2009 (credit to Vitaly S. from UT for slides)
Advertisements

Defenses. Preventing hijacking attacks 1. Fix bugs: – Audit software Automated tools: Coverity, Prefast/Prefix. – Rewrite software in a type safe languange.
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Computer Security: Principles and Practice First Edition by William Stallings and Lawrie Brown Lecture slides by Lawrie Brown Chapter 11 – Buffer Overflow.
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
Part III Counter measures The best defense is proper bounds checking but there are many C/C++ programmers and some are bound to forget  Are there any.
DIEHARDER: SECURING THE HEAP. Previously in DieHard…  Increase Reliability by random positioning of data  Replicated Execution detects invalid memory.
Buffer Overflow Prevention ”\x31\xc0\x50\x68\x2f\x2f\x73\x68\x68\x2f\x62\x69\x6e \x89\xe3\x50\x53\x50\x54\x53\xb0\x3b\x50\xcd\x80” Presented to CRAB April.
Breno de MedeirosFlorida State University Fall 2005 Buffer overflow and stack smashing attacks Principles of application software security.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Maziéres, Dan Boneh
1 RISE: Randomization Techniques for Software Security Dawn Song CMU Joint work with Monica Chew (UC Berkeley)
Lecture 16 Buffer Overflow
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2012.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2013.
Address Obfuscation: An Efficient Approach to Combat a Broad Range of Memory Error Exploits Sandeep Bhatkar, Daniel C. DuVarney, and R. Sekar Stony Brook.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Shuo Chen, Jun Xu, Emre C. Sezer, Prachi Gauriar, and Ravishankar K. Iyer Brett Hodges April 8, 2010.
Address Space Layout Permutation
On the Effectiveness of Address-Space Randomization CS6V Brian Ricks and Vasundhara Chimmad.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
Buffer Overflow Detection Stuart Pickard CSCI 297 June 14, 2005.
Mitigation of Buffer Overflow Attacks
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 10 “Buffer Overflow”.
{ Enhanced Operating System Security Through Efficient and Fine-grained Address Space Randomization Cristiano Giuffrida, Anton Kuijsten & Andrew S.Tanenbaum.
Vigilante: End-to-End Containment of Internet Worms Authors : M. Costa, J. Crowcroft, M. Castro, A. Rowstron, L. Zhou, L. Zhang, and P. Barham In Proceedings.
Enhanced Operating System Security Through Efficient and Fine-grained Address Space Randomization Vikram Reddy Enukonda.
Topic 2d High-Level languages and Systems Software
Exploit Defenses: ASLR, W X, TaintCheck Brad Karp UCL Computer Science CS GZ03 / th December, 2007.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Buffer Overflow Attack Proofing of Code Binary Gopal Gupta, Parag Doshi, R. Reghuramalingam, Doug Harris The University of Texas at Dallas.
Lecture 9: Buffer Ovefflows and ROP EEN 312: Processors: Hardware, Software, and Interfacing Department of Electrical and Computer Engineering Spring 2014,
A Tool for Pro-active Defense Against the Buffer Overrun Attack D. Bruschi, E. Rosti, R. Banfi Presented By: Warshavsky Alex.
Information Leaks Without Memory Disclosures: Remote Side Channel Attacks on Diversified Code Jeff Seibert, Hamed Okhravi, and Eric Söderström Presented.
Lecture 13 Page 1 CS 236 Online Major Problem Areas for Secure Programming Certain areas of programming have proven to be particularly prone to problems.
Buffer overflow and stack smashing attacks Principles of application software security.
Where’s the FEEB?: Effectiveness of Instruction Set Randomization Nora Sovarel, David Evans, Nate Paul University of Virginia Computer Science USENIX Security.
A Survey on Runtime Smashed Stack Detection 坂井研究室 M 豊島隆志.
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
Information Security - 2. A Stack Frame. Pushed to stack on function CALL The return address is copied to the CPU Instruction Pointer when the function.
Group 9. Exploiting Software The exploitation of software is one of the main ways that a users computer can be broken into. It involves exploiting the.
Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.
Security Attacks Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.
Chapter 10 Buffer Overflow 1. A very common attack mechanism o First used by the Morris Worm in 1988 Still of major concern o Legacy of buggy code in.
1 Introduction to Information Security , Spring 2016 Lecture 2: Control Hijacking (2/2) Avishai Wool.
CS703 - Advanced Operating Systems By Mr. Farhan Zaidi.
Mitigation against Buffer Overflow Attacks
Remix: On-demand Live Randomization
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Module 30 (Unix/Linux Security Issues II)
Protecting Memory What is there to protect in memory?
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2016.
Jump Over ASLR: Attacking Branch Predictors to Bypass ASLR
CSC 495/583 Topics of Software Security Return-oriented programming
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Software Security Lesson Introduction
Format String.
Smashing the Stack for Fun and Profit
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2011.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2009.
CS703 - Advanced Operating Systems
Understanding and Preventing Buffer Overflow Attacks in Unix
CNT4704: Analysis of Computer Communication Network Special Topic: Buffer Overflow II: Defense Techniques Cliff Zou Fall 2011.
Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

On the Effectiveness of Address-Space Randomization Hovav Shacham, Matthew Page, Ben Pfaff, Eu-Jin Goh, Nagendra Modadugu, Dan Boneh

Introduction Randomizing the address-space layout of a program prevents attackers from using the same exploit code against all instantiations of the program containing the same flaw. Attackers must make a specific exploit for each instance of a randomized program, or perform brute force attacks to guess the address-space layout.

Exploits Examples: Buffer overflows (stack smashing), heap overflows, format string errors, integer overflows, and double free() errors. Stack Smashing - The return address of the current stack frame is overwritten to point to injected code.

Counter Measures StackGuard - Detects stack smashing attacks by placing canary values next to the return address. StackShield - Makes a second copy of the return address to check against before using it. ProPolice - Reorders local variables and function arguments, then places canaries in the stack. Copies function pointers to an area preceding local variable buffers.

Write or Execute Only (W ⊕ X) Pages Nullifies attacks that inject and execute code in a process’s address space. Pages in memory segments are marked either writable (W) or executable (X), but not both. Based on the observation that most exploits inject malicious code into a process’s address space, then circumvent program control to execute the injected code. Attackers must use existing executable code. Either the program’s own code or code in libraries loaded by the program. (Ex. return-to-libc)

Return-to-libc Attackers call functions in the standard C library, libc, because it is loaded into every Unix program and encapsulates the system-call API for forking child processes and communicating over network sockets.

Address-Space Randomization return-to-libc attack needs to know the virtual addresses of the libc functions to be written into a function pointer or return address. If the base address of the libc memory segment is randomized, the success rate of the attack decreases.

PaX ASLR Overview PaX applies ASLR to ELF binaries and dynamic libraries. For the purposes of ASLR, a process’s user address space consists of three areas: executable, mapped, and stack areas. ASLR randomizes these three areas separately.

Taking Advantage of PaX ALSR PaX ASLR randomizes only the base addresses of the three memory areas. Once any of the three variables is found, the attacker can fix the addresses of any memory location within the area controlled by the variable. In PaX each offset variable is fixed throughout a process’s lifetime (including any processes that fork() from a parent process). Finding the layout of any one of these related processes reveals that layout for all of them.

Attack on PaX ALSR Using non-standard return-to-libc technique. PaX does not randomize the stack layout, which allows us to locate a pointer to attacker supplied data on the stack. Step 1: Determine the value of delta_mmap using a brute force attack that finds an address in libc. Step 2: Mount a return-to-libc attack to obtain a shell.

Attack on PaX ALSR cont. The attack repeatedly overflows the stack buffer with guesses for the address of the libc function usleep() in an attempt to return into the usleep() function. An unsuccessful guess causes the child process to crash, and the parent process to fork a new child in its place, with the same randomization deltas. A successful guess causes the connection to hang for 16 seconds and gives enough information for us to deduce the value of delta_mmap.

Attack on PaX ALSR cont. After finding delta_mmap, we now know the location of all functions in libc, including the system() function. We can now mount a return-to-libc attack on the same buffer exposed by the Oracle hole to invoke the system() function. Attack searches for usleep(). Attack can be mounted even if libc entry points are independently randomized.

Experiments The brute force exploit was executed on a 2.4 GHz Pentium 4 machine against a PaX ASLR (for Linux kernel version 2.6.1) protected Apache server (version ) running on a Athlon 1.8 GHz machine. The two machines were connected over a 100 Mbps network. Results after 10 trials (timings in seconds) Avg: 216, Max: 810, Min: 29

64-Bit Architectures In 32-bit x86 machines, 16 of the 32 address bits are available for randomization. 16 bits of address randomization can be defeated by a brute force attack in a matter of minutes. 64-bit machines are unlikely to have fewer than 40 address bits available for randomization. An attack of this magnitude is unlikely to go unnoticed.

Randomizing At Compile-Time Compiler and linker can be easily modified to randomize variable and function addresses within their segments. Easy to add random padding into stack frames. Not limited by the page granularity of the virtual memory system. The location of entry points within shared libraries can be discovered by any user or revealed by any compromised daemon on the same machine.

Randomizing at Runtime No more difficult to guess a single function’s address. Attack can be modified so that it only needs to find the system() function’s address. Therefore this technique is ineffective against brute force attacks. Effective against return-to-libc attacks that use multiple libc function calls.

Monitoring and Catching Errors PaX developers suggest that ASLR be combined with “a crash detection and reaction mechanism”. Attacker who attempts to discover addresses within ASLR-protected executables will trigger segmentation violations through his incorrect guesses. This mechanism can shut down the program under attack.

Monitoring and Catching Errors cont. If the watcher alerts an administrator, then it is difficult for the administrator to react in time. The tested attacks are completed on average in 216 seconds. If the watcher shuts down the daemon pending administrator attention, then it is effectively a force multiplier for denial of service. Neither an automated program nor a system administrator can be expected to make the correct decision.

Anti-Buffer Overflow Techniques Make it more difficult for an attacker to use a stack based overflow to write arbitrary data onto the stack. Some vulnerabilities cannot be exploited in the presence of overflow mitigation. Overflow mitigation by itself defeats many attacks.

Conclusions Buffer-overflow attacks can work against Apache running under PaX Address Space Layout Randomization and Write or Execute Only pages. Experimentally, the attack took an average of 216 seconds to obtain a remote shell. For current 32-bit architectures: address-space randomization is ineffective against generic exploit code for a single flaw; and brute force attacks can be effective.

Conclusions cont. One cannot effectively prevent attacks without introducing a serious denial-of-service vulnerability. Compile-time address-space randomization is more effective than runtime randomization because it can randomize addresses at a finer granularity, but the randomization it produces is more vulnerable to information leakage. Buffer overflow mitigation can protect against the attack, even without address-space randomization.

Conclusions cont. Combining compile-time and runtime randomization can yield good security. Upgrading to 64-bit architecture is a more promising solution because there are many more bits available for the address space randomization. This means it would take significantly longer to guess a correct address.