2006 2 nd Joint Workshop between Security Research Labs in JAPAN and KOREA Annulling Data Injection Attacks with Return Address Randomization 2006.02.20.

Slides:



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

Architectural Support for Software-Based Protection Mihai Budiu Úlfar Erlingsson Martín Abadi ASID Workshop, Oct 21, 2006 Silicon Valley.
SE-292: High Performance Computing
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.
David Brumley Carnegie Mellon University Credit: Some slides from Ed Schwartz.
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.
Dec 5, 2007University of Virginia1 Efficient Dynamic Tainting using Multiple Cores Yan Huang University of Virginia Dec
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
Review: Software Security David Brumley Carnegie Mellon University.
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.
Foundations of Network and Computer Security J J ohn Black Lecture #30 Nov 26 th 2007 CSCI 6268/TLEN 5831, Fall 2007.
Breno de MedeirosFlorida State University Fall 2005 Buffer overflow and stack smashing attacks Principles of application software security.
Intro to Exploitation Stack Overflows James McFadyen UTD Computer Security Group 10/20/2011.
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.
Stack buffer overflow
Security Protection and Checking in Embedded System Integration Against Buffer Overflow Attacks Zili Shao, Chun Xue, Qingfeng Zhuge, Edwin H.-M. Sha International.
C and Data Structures Baojian Hua
Memory Layout C and Data Structures Baojian Hua
1 RISE: Randomization Techniques for Software Security Dawn Song CMU Joint work with Monica Chew (UC Berkeley)
Efficient Instruction Set Randomization Using Software Dynamic Translation Michael Crane Wei Hu.
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
Address Obfuscation: An Efficient Approach to Combat a Broad Range of Memory Error Exploits Sandeep Bhatkar, Daniel C. DuVarney, and R. Sekar Stony Brook.
University of Washington CSE 351 : The Hardware/Software Interface Section 5 Structs as parameters, buffer overflows, and lab 3.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2011.
Lecture 6: Buffer Overflow CS 436/636/736 Spring 2014 Nitesh Saxena *Adopted from a previous lecture by Aleph One (Smashing the Stack for Fun and Profit)
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
Buffer Overflows : An In-depth Analysis. Introduction Buffer overflows were understood as early as 1972 The legendary Morris Worm made use of a Buffer.
Mitigation of Buffer Overflow Attacks
University of Washington Today Happy Monday! HW2 due, how is Lab 3 going? Today we’ll go over:  Address space layout  Input buffers on the stack  Overflowing.
Buffer Overflow CS461/ECE422 Spring Reading Material Based on Chapter 11 of the text.
Topic 2d High-Level languages and Systems Software
Introduction to Honeypot, measurement, and vulnerability exploits
Overflows & Exploits. In the beginning 11/02/1988 Robert Morris, Jr., a graduate student in Computer Science at Cornell, wrote an experimental, self-replicating,
Lecture 8: Buffer Overflow CS 436/636/736 Spring 2013 Nitesh Saxena *Adopted from a previous lecture by Aleph One (Smashing the Stack for Fun and Profit)
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Buffer Overflow Group 7Group 8 Nathaniel CrowellDerek Edwards Punna ChalasaniAxel Abellard Steven Studniarz.
Buffer Overflow Attack Proofing of Code Binary Gopal Gupta, Parag Doshi, R. Reghuramalingam, Doug Harris The University of Texas at Dallas.
What is exactly Exploit writing?  Writing a piece of code which is capable of exploit the vulnerability in the target software.
A Tool for Pro-active Defense Against the Buffer Overrun Attack D. Bruschi, E. Rosti, R. Banfi Presented By: Warshavsky Alex.
Buffer overflow and stack smashing attacks Principles of application software security.
CS 155 Section 1 PP1 Eu-Jin Goh. Setting up Environment Demo.
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.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow : Example of Using GDB to Check Stack Memory Cliff Zou Spring 2014.
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.
Buffer Overflow By Collin Donaldson.
Mitigation against Buffer Overflow Attacks
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
The Hardware/Software Interface CSE351 Winter 2013
Introduction to Information Security
CMSC 414 Computer and Network Security Lecture 21
Software Security.
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Defending against Stack Smashing attacks
Software Security Lesson Introduction
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2011.
System Calls David Ferry CSCI 3500 – Operating Systems
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2009.
Understanding and Preventing Buffer Overflow Attacks in Unix
System and Cyber Security
CNT4704: Analysis of Computer Communication Network Special Topic: Buffer Overflow II: Defense Techniques Cliff Zou Fall 2011.
Return-to-libc Attacks
Presentation transcript:

nd Joint Workshop between Security Research Labs in JAPAN and KOREA Annulling Data Injection Attacks with Return Address Randomization Researcher: Deokjin Kim Presenter: Cheolsoon Yim High Performance Computing Laboratory, POSTECH, Republic of KOREA

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 2/16 Contents  Introduction  Backgrounds  Related Works  Proposed Scheme  Analysis  Conclusion & Future Work

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 3/16 Introduction  Buffer overflow vulnerability is one of the today's most serious security problems.  Many attackers are able to take the vulnerability to intrude software systems.  Various defense schemes have been proposed such as Compiler based scheme Dynamically loadable library based scheme Instruction sets randomization based scheme

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 4/16 Backgrounds (1/2)  Buffer overflow vulnerability A buffer which does not check the boundary in the program will be overflowed when it is stuffed with more data than it can handle.  Step of a buffer overflow attack 1. Overflowing the vulnerable buffer 2. Redirecting control flow to the position intended by attacker  Classification of buffer overflow attacks 1. Code-injection attack inserts instruction codes(shellcode) and jumping into it. 2. Data-injection attack inserts data(arguments of function) and jumping into shared libraries.

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 5/16 buffer frame pointer RA=XXXX buffer frame pointer RA=XXXX Backgrounds (2/2) buffer frame pointer RA=XXXX system(cmd){... } int main(int argc, char *argv[]) { char buffer[20]; strcpy(buffer, argv[1]); return 0; } dummy buffer overflowed RA=YYYY shellcode * : Overflowed region * RA : Return address High Address Low Address NormalCode-injection attackData-injection attack faked RA 1 st argument “/bin/sh\0” buffer overflowed RA=ZZZZ * In standard C library * * Vulnerable program code *

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 6/16 Related Works (1/3)  Compiler based scheme Modifies C compiler to interpose a canary word. Ex> StackGuard, StackShield, Propolice, SplitStack Shortcoming  It needs a program source code for recompilation.  The methods of bypassing this scheme are explored. buffer Return Addr. High Address Low Address Stack of a process canary local variable Stack Growth String Growth

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 7/16 Related Works (2/3)  Dynamically loadable library based scheme Intercepts the vulnerable functions in the standard C library and uses instead its own safe implementation of the function. Ex> Libsafe Shortcoming  It needs patching dynamic libraries.  It can protect only C library function introduced vulnerabilities. void main() { char buffer[20];... strcpy(buf, input_string);... } char *strcpy(char *dest, const char *src) { // Compute the length of input_string. // Compute the upper bound of size of buf(dest). // Check the bound. // Call original libc’s memcpy().... } void *memcpy(void *dest, const void *src, size_t n) {... } Program code Libsafe library Original libc library

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 8/16 Related Works (3/3)  Instruction sets randomization based scheme Performs exclusive-or operation to instruction bytes with random keys. It defends all typical code-injection attacks. It dose not need recompiling and patching a kernel or a protected program. It dose not need a program source code. Ex> RISE/Valgrind, Boch emulator Shortcoming  It can not cover the data-injection attacks.

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 9/16 Proposed Scheme (1/5)  Instruction Set Randomization Scheme When loading a binary image, a loader scrambles all instruction codes using a secret randomization key and loads them into memory. When fetching instructions, the instructions are unscrambled and executed correctly. Random key Code from binary file Injected code from network Normally executing SIGILL fault !! In memory = XORing LoadingFetching

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 10/16 Proposed Scheme (2/5)  Return Address Randomization Scheme When calling function, CALL instruction scrambles a return address and pushes it into memory. When returning from function, RET instruction pops a return address from memory and unscrambles it. Random key Return address (address of next instruction) Return address in injected code Normally executing SIGSEGV fault !! Stack section in memory = XORing pushed injected popped CALLRET

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 11/16 Proposed Scheme (3/5)  We modified CALL, RET micro-instructions. ANI : Address of Next Instruction RANI : Randomized Address of Next Instruction TR: Temporary Register instr.OriginalModified CALL func() 1. push ANI into [%esp] 2. jump to func() 1. Randomize ANI 2. push RANI into [%esp] 3. jump to func() RET1. pop from [%esp] into %eip 2. jump to %eip 1. pop from [%esp] into TR 2. De-randomize TR 3. move TR to %eip 4. jump to %eip

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 12/16  A random key is generated by the Linux /dev/urandom device when a program is loaded on the memory. The key is dynamically allocated in the heap region.  We should select a random key so as to avoid infinite loops or unwilling instructions.  We should select a random key which makes the scrambled address of a injected address to lead to a memory access violation. Proposed Scheme (4/5)

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 13/16 Proposed Scheme (5/5)  Ex> Excluding this key Intended address: 0x42 Random key: 0xfd, 4a, 00  Scrambled address: 0xbf, 08, 42 Other random keys lead to a memory access violation. (SIGSEGV) # cat /proc/`ps -C hello -o pid=`/maps address perms offset r-xp (hello.code) a000 rw-p (hello.data) r-xp (loader.code) rw-p (loader.data) e000 r-xp (libc.code) 4212e rw-p 0012e000 (libc.data) bfffe000-c rwxp fffff000 (hello stack) 0x x code static data bss heap shared library stack kernel space 0x xffffffff loader 0x xc xbf x x SIGSEGV [ The memory map of simple process “hello” ]

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 14/16 ~/exercise/ch2]$ rise./vulne `perl -e 'print "ABCD"x7. "\x60\x33\x17\x40"."\xb0\xe7\x15\x40"."\xc3\xfe\xff\xbf";'` ==15566== RISE, for x86-linux. ==15566== buffer is at 0xbffffa60 ==15570== RISE, for x86-linux. ==15570== sh-2.05b$ id ==15571== RISE, for x86-linux. ==15571== uid=1000(elitemir) gid=100(users) groups=100(users),10(wheel),18(audio) ==15571==. ~/exercise/ch2]$ risara./vulne `perl -e 'print "ABCD"x7. "\x60\x93\x05\x40"."\xb0\x47\x04\x40"."\x61\xfe\xff\xbf";'` ==18794== RISARA, for x86-linux. ==18794== buffer is at 0xbffffa30 Segmentation fault ~/exercise/ch2]$ [ Output under the RISE : protection failure ] [ Output under the proposed scheme : protection success ] Analysis - Protection against a Data-injection Attack

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 15/16 Analysis - Performance  The proposed scheme executes about 1 % more slowly than RISE for the same program.  Though there is 5 times performance penalty due to implement with emulator, this penalty can be removed by implementing with supporting of hardware in the future. Type of operation RISERISARARISARA / RISE Operation of integer Operation of floating-point Operation of I/O Table. Comparison of the Execution Time Per Operation between the RISE and the proposed scheme(RISARA) [ Environment ] Linux kernel CPU : Xeon 2.66GHz*3 RAM : 2GB

nd Joint Workshop between Security Research Labs in JAPAN and KOREA 16/16 Conclusion & Future work  Conclusion We proposed a new defense scheme against both code- injection and data-injection attacks through network. It scrambles instruction sets and return addresses using a random key. It implemented without significant extra overheads in comparison with RISE.  Future work We are planning to implement on hardware in the near future for decreasing overheads which incurred because of using the emulator.