Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.

Slides:



Advertisements
Similar presentations
Dynamic memory allocation
Advertisements

Smashing the Stack for Fun and Profit
Defenses. Preventing hijacking attacks 1. Fix bugs: – Audit software Automated tools: Coverity, Prefast/Prefix. – Rewrite software in a type safe languange.
Exploring Security Vulnerabilities by Exploiting Buffer Overflow using the MIPS ISA Andrew T. Phillips Jack S. E. Tan Department of Computer Science University.
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.
User-Level Memory Management in Linux Programming
Dynamic memory allocation. The process of allocating memory at run time is known as dynamic memory allocation. C have four library functions for allocating.
Breno de MedeirosFlorida State University Fall 2005 Buffer overflow and stack smashing attacks Principles of application software security.
Buffer Overflows By Tim Peterson Joel Miller Dan Block.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
Stack-Based Buffer Overflows Attacker – Can take over a system remotely across a network. local malicious users – To elevate their privileges and gain.
Chapter 15 : Attacking Compiled Applications Alexis Kirat - International Student.
Gabe Kanzelmeyer CS 450 4/14/10.  What is buffer overflow?  How memory is processed and the stack  The threat  Stack overrun attack  Dangers  Prevention.
Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus Microsoft Research Brandon Baker Microsoft Carl Hartung CSCI 7143:
Windows XP SP2 Stack Protection Jimmy Hermansson Johan Tibell.
Run time vs. Compile time
1 RISE: Randomization Techniques for Software Security Dawn Song CMU Joint work with Monica Chew (UC Berkeley)
Lecture 16 Buffer Overflow
Address Obfuscation: An Efficient Approach to Combat a Broad Range of Memory Error Exploits Sandeep Bhatkar, Daniel C. DuVarney, and R. Sekar Stony Brook.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Fall 2008CS 334: Computer SecuritySlide #1 Program Security Buffer Overflows Incomplete Access Control.
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
Computer Security and Penetration Testing
BLENDED ATTACKS EXPLOITS, VULNERABILITIES AND BUFFER-OVERFLOW TECHNIQUES IN COMPUTER VIRUSES By: Eric Chien and Peter Szor Presented by: Jesus Morales.
Software attacks Lorenzo Dematté Software attacks Advanced buffer overflow: heap smashing.
Mitigation of Buffer Overflow Attacks
CIS 450 – Network Security Chapter 7 – Buffer Overflow Attacks.
July 30, 2001Systems Architecture II1 Systems Architecture II (CS ) Lecture 8: Exploiting Memory Hierarchy: Virtual Memory * Jeremy R. Johnson Monday.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 10 “Buffer Overflow”.
Buffer Overflow CS461/ECE422 Spring Reading Material Based on Chapter 11 of the text.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
Buffer Overflow Attack-proofing by Transforming Code Binary Gopal Gupta Parag Doshi, R. Reghuramalingam The University of Texas at Dallas 11/15/2004.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
CNIT 127: Exploit Development Ch 4: Introduction to Heap Overflows
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,
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 2.
+ Dynamic memory allocation. + Introduction We often face situations in programming where the data is dynamics in nature. Consider a list of customers.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
Buffer overflow and stack smashing attacks Principles of application software security.
1 Lecture07: Memory Model 5/2/2012 Slides modified from Yin Lou, Cornell CS2022: Introduction to C.
Dilip Dwarakanath.  The topic I’m about to present was taken from a paper titled “Apple iOS 4 Security Evaluation” written by Dino A Dai Zovi.  Dino.
Buffer Overflow Attack- proofing of Code Binaries Ramya Reguramalingam Gopal Gupta Gopal Gupta Department of Computer Science University of Texas at Dallas.
A Survey on Runtime Smashed Stack Detection 坂井研究室 M 豊島隆志.
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.
Security Attacks Tanenbaum & Bo, Modern Operating Systems:4th ed., (c) 2013 Prentice-Hall, Inc. All rights reserved.
1988 Morris Worm … estimated 10% penetration 2001 Code Red … 300,00 computers breached 2003 Slammer/Sapphire … 75,00 infections in 10 min Zotob …
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
1988 Morris Worm … estimated 10% penetration 2001 Code Red … 300,00 computers breached 2003 Slammer/Sapphire … 75,00 infections in 10 min Zotob …
Chapter 10 Chapter 10 Implementing Subprograms. Implementing Subprograms  The subprogram call and return operations are together called subprogram linkage.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
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.
Lec. Waleed Bin Shahid.  You might have noticed a lot of issues related to software implementation.  The ultimate requirement of developer(s) is to.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Mitigation against Buffer Overflow Attacks
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
© Craig Zilles (adapted from slides by Howard Huang)
Security mechanisms and vulnerabilities in .NET
A System for Protecting the Integrity of Virtual Function Tables
Chapter 9 :: Subroutines and Control Abstraction
Advanced Buffer Overflow: Pointer subterfuge
Understanding and Preventing Buffer Overflow Attacks in Unix
© Craig Zilles (adapted from slides by Howard Huang)
FIGURE Illustration of Stack Buffer Overflow
Return-to-libc Attacks
Presentation transcript:

Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and Privacy , Vol 2, no.4, July 2004. Presented by Meenakshi Lakshmikanthan on 03/25/2010

Introduction Buffer overflows have been the most common form of security vulnerability for the last ten years. If buffer overflow vulnerabilities could be effectively eliminated, a very large portion of the most serious security threats would also be eliminated. Buffer overflow vulnerability presents the attacker the ability to inject and execute attack code.

Buffer Overflow Buffer Overflow vulnerabilities and attacks come in a variety of forms. The traditional approach to exploiting buffer overruns is Stack Smashing. Discussions of buffer overrun exploitation in literature typically concentrate on stack-smashing attacks. However, over the decade, hackers have developed several additional approaches to exploit buffer overruns.

Buffer Overflow Types Stack Smashing Arc Injection Pointer Subterfuge Function Pointer Clobbering Data Pointer Modification Exception Handler Hijacking VPTR Smashing Heap Smashing

Stack Smashing Changing the return address of a function thereby changing the flow of execution of the program. Execute some code (potentially supplied by the attacker). Stack smashing relies on the fact that most C compilers store the saved return address on the same stack used for local variables.

Stack Smashing * Buffer overrun if len > 100 * Void f1a(void * arg, size_t len) { char buff[100]; memcpy(buff, arg, len); /* ... */ return; } * Buffer overrun if len > 100 * Return Address Modification

Arc Injection Arc injection (return-into-libc), involves transferring control to code that already exists in the program's memory space. In other words, the exploit just inserts a new arc (control flow transfer) into the program’s control flow graph, as opposed to code injection exploits. A straightforward version of arc injection is to use a stack buffer overrun to modify the saved return address to point to a location already in the program’s address space.

Arc Injection – Example Program Void system(char * arg) { check_validity(arg); R = arg; target: execl(R, ...) } If an attacker can arrange for R to point to an attacker supplied string and then jump directly to the location target, thus bypassing the validity check and assignment, the system will treat the attacker-supplied string as a command line and execute it.

Void f1a(void * arg, size_t len) { char buff[100]; memcpy(buff, arg, len); /* ... */ return; } Assuming Register R contains the address of arg or buff then Void system(char * arg) { check_validity(arg); R = arg; target: execl(R, ...) Buffer Overflow Buff > 100 Return Address

Arc Injection Cont’ Arc-injection exploits are especially useful when the program has memory protection which prevents any area of memory from being simultaneously writeable and executable. Because no attacker-supplied code is executed, these mitigations do not prevent arc injection exploits.

Pointer Subterfuge A pointer is a variable that contains the address of a function, array element, or other data structure. Pointer subterfuge is a general term for exploits that involve modifying a pointer’s value. Four varieties of Pointer Subterfuge exist.

Function Pointer Clobbering (Method 1) Function pointers can be overwritten to transfer control to attacker-supplied code. Clobbering a function pointer allows an attacker to directly transfer control to arbitrary, attacker-supplied code When the program executes a call via the function pointer, the attacker’s code is executed instead of the originally intended code.

Function Point Clobbering : Example Program void f2a(void * arg, size_t len) { char buff[100]; void (*f)() = ...; memcpy(buff, arg, len); // Buffer Overrun// f(); /* ... */ return; } Calls the malicious code

Data Pointer Modification (Method 2) Data pointers can be modified by an attacker when exploiting a buffer overflow vulnerability. If a data pointer is used as a target for a subsequent assignment, attackers can control the address to modify other memory locations. In other words, Arbitrary Memory Write occurs when an attacker can control an address to modify other memory locations.

Data Pointers – Example Program void f2b(void * arg, size_t len) { char buff[100]; long val = ...; long *ptr = ...; extern void (*f)(); memcpy(buff, arg, len); // Buffer Overrun// *ptr = val; f(); /* ... */ return; } By overflowing the buffer, an attacker can overwrite ptr and val. When *ptr = val is evaluated (line 6), an arbitrary memory write is performed. External Function Pointer

Exception Handler Hijacking (Method 3) Several variations of exploit techniques target the Microsoft Windows Structured Exception Handling mechanism. When an exception is generated, Windows examines a linked list of exception handlers and invokes one of them via a function pointer stored in the list entry. Because the list entries are stored on the stack, it is possible to replace the exception-handler function pointer via buffer overflow, thus allowing an attacker to transfer control to an arbitrary location

VPTR Smashing (Method 4) A virtual function is a function member of a class, declared using the virtual keyword. Most C++ compilers implement virtual functions via a virtual function table (VTBL) associated with each class. VTBL is a list of function pointers to the virtual functions. VPTR is the pointer to the VTBL.

VPTR Smashing – Example Program void f4(void * arg, size_t len) { char *buff = new char[100]; C *ptr = new C;  New object of class C memcpy(buff, arg, len); /* buffer overrun! */ ptr->vf(); // Call to a virtual function return; }

Heap Smashing A buffer overrun is characterized as a stack buffer overrun or heap buffer overrun depending on what memory gets overrun. Heaps, refer to any dynamic memory implementations such as the C standard library’s malloc, C++’s new/delete etc. The key insight behind heap smashing is to exploit the implementation of the dynamic memory allocator by violating some assumed invariants.

Heap Smashing Example Program void f1b(void * arg, size_t len) { char * ptr = malloc(100); if (ptr == NULL) return; memcpy(ptr, arg, len); /* buffer overrun if len > 100 */ /* ... */ return; }

Heap Smashing - Problems The attacker typically does not know the heap block’s location ahead of time and hence it might be difficult to exploit the heap. Also, it is difficult to predict when the heap free operation will occur. Finally, in some situations, it is difficult to predict whether the next block has been allocated at the time the overrun occurs.

Contributions This paper has attempted to explain the different types of buffer overflows. Stack Smashing is the traditional approach which works by modifying the return address to transfer the control flow. Heap Smashing works by exploiting the dynamic memory allocator. Arc Injection transfers the control to code that already exists in the program’s memory space. Pointer Subterfuge methods involve the exploits that modify a pointer’s value.

Weakness Heap Smashing Techniques have not been dealt in detail. Lot of mismatch between references to the figure and content.

Thank You!!!!!!!