Protecting C and C++ programs from current and future code injection attacks Yves Younan, Wouter Joosen and Frank Piessens DistriNet Department of Computer.

Slides:



Advertisements
Similar presentations
ROP is Still Dangerous: Breaking Modern Defenses Nicholas Carlini et. al University of California, Berkeley USENIX Security 2014 Presenter: Yue Li Part.
Advertisements

Introduction to Memory Management. 2 General Structure of Run-Time Memory.
Chapter 17 vector and Free Store John Keyser’s Modifications of Slides By Bjarne Stroustrup
Exploring Security Vulnerabilities by Exploiting Buffer Overflow using the MIPS ISA Andrew T. Phillips Jack S. E. Tan Department of Computer Science University.
Dynamic Memory Allocation I Topics Basic representation and alignment (mainly for static memory allocation, main concepts carry over to dynamic memory.
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Memory Allocator Security Yves Younan, Wouter Joosen, Frank Piessens and Hans Van den Eynden DistriNet, Department of Computer Science Katholieke Universiteit.
Week 7 - Friday.  What did we talk about last time?  Allocating 2D arrays.
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
DIEHARDER: SECURING THE HEAP. Previously in DieHard…  Increase Reliability by random positioning of data  Replicated Execution detects invalid memory.
Security of Memory Allocators for C and C++ Yves Younan, Wouter Joosen, Frank Piessens and Hans Van den Eynden DistriNet, Department of Computer Science.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
A Practical Dynamic Buffer Overflow Detector (CRED) Olatunji Ruwase Monica S. Lam Transmeta Corp. Stanford University Network and Distributed Security.
Achieving Trusted Systems by Providing Security and Reliability Ravishankar K. Iyer, Zbigniew Kalbarczyk, Jun Xu, Shuo Chen, Nithin Nakka and Karthik Pattabiraman.
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.
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.
A survey of Buffer overflow exploitation on HTC touch mobile phone Advanced Defense Lab CSIE NCU Chih-Wen Ou.
Address Space Layout Permutation
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
Secure Virtual Architecture John Criswell, Arushi Aggarwal, Andrew Lenharth, Dinakar Dhurjati, and Vikram Adve University of Illinois at Urbana-Champaign.
Web Application Access to Databases. Logistics Test 2: May 1 st (24 hours) Extra office hours: Friday 2:30 – 4:00 pm Tuesday May 5 th – you can review.
2012/02/07 1 John Wilander, Mariam Kamkar Linkopings Universitet Nick Nikiforakis, Yves Younan, Wouter Joosen Katholieke Universiteit Leuven.
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
Three fundamental concepts in computer security: Reference Monitors: An access control concept that refers to an abstract machine that mediates all accesses.
BLENDED ATTACKS EXPLOITS, VULNERABILITIES AND BUFFER-OVERFLOW TECHNIQUES IN COMPUTER VIRUSES By: Eric Chien and Peter Szor Presented by: Jesus Morales.
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.
Vasileios P. Kemerlis, Georgios Portokalidis, Angelos D. Keromytis Network Security Lab, Department of Computer Science, Columbia University, USA 21 st.
Buffer Overflow Maddikayala, jagadish. CSCI 5931 Web Security Prof. T. Andrew Yang Monday Feb. 23.
Mitigation of Buffer Overflow Attacks
Brian E. Brzezicki. This tutorial just illustrates the underlying concepts of buffer overflows by way of an extremely simple stack overflow  Most buffer.
CNIT 127: Exploit Development Ch 4: Introduction to Format String Bugs.
Title of Selected Paper: IMPRES: Integrated Monitoring for Processor Reliability and Security Authors: Roshan G. Ragel and Sri Parameswaran Presented by:
Buffer Overflow Attack-proofing by Transforming Code Binary Gopal Gupta Parag Doshi, R. Reghuramalingam The University of Texas at Dallas 11/15/2004.
Smashing the Stack Overview The Stack Region Buffer Overflow
Exploitation possibilities of memory related vulnerabilities
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.
Stack-based buffer overflows Yves Younan DistriNet, Department of Computer Science Katholieke Universiteit Leuven Belgium
A Tool for Pro-active Defense Against the Buffer Overrun Attack D. Bruschi, E. Rosti, R. Banfi Presented By: Warshavsky Alex.
Shellcode Development -Femi Oloyede -Pallavi Murudkar.
Exploiting Instruction Streams To Prevent Intrusion Milena Milenkovic.
Sairajiv Burugapalli. This chapter covers three main categories of classic software vulnerability: Buffer overflows Integer vulnerabilities Format string.
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.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.
Buffer Overflows: Attacks and Defenses for the Vulnerability of the Decade Crispin Cowan SANS 2000.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Shellcode COSC 480 Presentation Alison Buben.
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
Module 30 (Unix/Linux Security Issues II)
CSC 495/583 Topics of Software Security Heap Exploitation
Jump Over ASLR: Attacking Branch Predictors to Bypass ASLR
Advanced Buffer Overflow: Pointer subterfuge
CSC 495/583 Topics of Software Security Format String Bug (2) & Heap
Smashing the Stack for Fun and Profit
CAP6135: Malware and Software Vulnerability Analysis Buffer Overflow II: Defense Techniques Cliff Zou Spring 2009.
RUN-TIME STORAGE Chuen-Liang Chen Department of Computer Science
Understanding and Preventing Buffer Overflow Attacks in Unix
System and Cyber Security
FIGURE Illustration of Stack Buffer Overflow
Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

Protecting C and C++ programs from current and future code injection attacks Yves Younan, Wouter Joosen and Frank Piessens DistriNet Department of Computer Science Katholieke Universiteit Leuven Belgium

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Overview  Introduction  Code Injection Attacks  Model-based countermeasure design  Metamodel and methodology  Conclusion

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Introduction  Code injection attacks: foreign code injected into application  Still a major security problem: 24/28 CERT advisories in 2003 related to code injection  Attackers are using more advanced techniques to bypass countermeasures  Current countermeasures are often built in an ad hoc manner  A more structured approach to designing countermeasures is needed

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Overview  Introduction  Code Injection Attacks  First wave  Second wave  Third wave  Model-based countermeasure design  Metamodel and methodology  Conclusion

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, First wave: stack-based buffer overflows  An attacker inserts gives code as input to the program, the program stores it as data.  The attacker then overflows the bounds of a stack- allocated array and overwrites the return address  When the function returns the injected code is executed  Countermeasure: StackGuard (Cowan et al), places random 32-bit value before the return address and checks it before returning  Attackers developed indirect pointer overwriting (IPO) to bypass the countermeasure

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Second wave: Heap-based attacks  Dynamically allocated memory  No return addresses  IPO or function pointer overwriting  Overwrite memory management information to perform indirect pointer overwrite  Exploitable with heap-overflow and dangling pointer reference (double free)  Some allocators can be misused by overflowing just 1 byte

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Doug Lea’s malloc Size of prev chunk Size of chunk1 Chunk1 Chunk2 User data Size of chunk1 Size of chunk2 Old user data Forward Pointer Backward Pointer High addr Size of chunk1 Size of chunk2 Old user data Forward Pointer Backward Pointer Size of chunk1 Size of chunk2 Old user data Forward Pointer Backward Pointer Chunk3 Chunk4

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Backward Pointer Return address Heap-based buffer overflows Size of prev chunk Size of chunk1 Chunk1 Chunk2 User data Size of chunk1 Size of chunk2 Old user data Forward Pointer Size of chunk1 Size of chunk2 Old user data Forward Pointer Backward Pointer Size of chunk1 Size of chunk2 Old user data Forward Pointer Backward Pointer Chunk3 Chunk4 Stack Injected code

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Heap-vulnerabilities  Attacks for heap-based buffer overflows and double frees exist for other memory allocators as well:  CSRI (overflow)  Quickfit (overflow)  Phkmalloc (overflow)  Boehm’s Garbage Collector (overflow, double free)

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Second Wave  Second wave:  Overflows in Data section (contains global and static compile-time initialized data)  Overflows in bss section (contains global and static uninitialized data)  Can be used to overwrite execution abstractions that the runtime environment relies on

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Third wave  Third wave:  Integer errors  Integer signedness errors  Integer overflows  Format string vulnerabilities  Fourth wave?

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Overview  Introduction  Code Injection Attacks  Model-based countermeasure design  Machinemodel  A partial machinemodel of dlmalloc  Countermeasure based on the machine model  A countermeasure for dlmalloc  Metamodel and methodology  Conclusion

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Model-based countermeasure design  Most countermeasures use an ad-hoc approach when protecting applications  Attackers are using more advanced techniques to bypass them.  A more methodical approach is needed to combat code injection attacks  Building a model of the execution environment allows us to evaluate which memory locations to protect.

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Machinemodel  Addresses and abstractions of control flow  Addresses that could lead to IPO  Contextual information:  What is used when  What operations are performed

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Countermeasures based on the machinemodel  Most architectures separate code from data  Apply a similar approach to data  Separate control-flow information from regular data  Requires several far reaching changes to the memory of the process  Design is aided by the machine model

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Countermeasures based on the machine model  Built a machine model for Linux on Intel architecture  Designed a modified machine model for the memory allocator  Implemented the separation of management information from chunk data  Implementation was named DistriNet malloc (dnmalloc)

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Machinemodel for dlmalloc

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Machinemodel for dnmalloc

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Dlmalloc - Dnmalloc performance overhead ProgramDlmalloc runtime (± stderr)Dnmalloc runtime (± stderr)Overhead percentage gzip253 (± 0) (± 0.01) 1.18% vpr (± 0.16) (± 0.13) -0.11% gcc (± 0.05) (± 0.04) 0.54% mcf (± 0.07) (± 0.07) 1.01% crafty253 (± 0)254 (± 0) 0.40% parser (± 0.02) (± 0.05) -0.10% eon (± 0.13) (± 0.11) -0.58% perlbmk (± 0.04) (± 0.05) 4.24% (highest) gap (± 0.02)184 (± 0) -0.04% vortex250 (± 0) (± 0.04) 3.52% bzip (± 0.05) (± 0.07) 0.45% twolf (± 0.43) (± 0.41) -1.76% (lowest) Spec CPU2000 results for dlmalloc and dnmalloc (13 runs on 8 identical PCs (P4 2.8ghz, 512mb) = 104 runs)

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Countermeasures based on the machinemodel  Modify the way the stack is organized: 3 stacks  Control information: return address, frame pointer, pointers and arrays of pointers (bounds checked)  Integers and floating types  Regular data  Work in progress  Prototype running with 3 stacks  Preliminary performance results look promising

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Countermeasure based on the machinemodel  Reorganize the data segment  Memory in the data segment must be reorganized

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Overview  Introduction  Attacks  Model-based countermeasure design  Metamodel and methodology  Conclusion

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Metamodel and methodology  A machine model is strongly linked to an architecture: limited usefulness  Metamodel is built as an abstraction of several machine models  Accompanied by a methodology for building machine models  Allows reasoning about countermeasures at a very high level of abstraction  Platform expert: metamodel + methodology: build a machinemodel  Security expert: design countermeasure on a machinemodel

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Overview  Introduction  Attacks  Model-based countermeasure design  Metamodel and methodology  Conclusion

Yves Younan - Protecting C and C++ programs from current and future code injection attacks October 25, Conclusion  Many countermeasures can be bypassed using one of the techniques described earlier.  A more structured approach is needed at a higher level of abstraction  By using machine models and a metamodel  Supports collaboration (platform/security expert)  Less prone to porting errors (uniform representation)  Better design (easier to notice shortcomings)  Platform for comparing and evaluating countermeasures  For more information: papers are available SoBeNet user group website