VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.

Slides:



Advertisements
Similar presentations
Defenses. Preventing hijacking attacks 1. Fix bugs: – Audit software Automated tools: Coverity, Prefast/Prefix. – Rewrite software in a type safe languange.
Advertisements

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.
CMSC 414 Computer and Network Security Lecture 22 Jonathan Katz.
K. Salah1 Buffer Overflow The crown jewel of attacks.
Breno de MedeirosFlorida State University Fall 2005 Buffer overflow and stack smashing attacks Principles of application software security.
Stack-Based Buffer Overflows Attacker – Can take over a system remotely across a network. local malicious users – To elevate their privileges and gain.
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.
CS 153 Design of Operating Systems Spring 2015 Lecture 19: Page Replacement and Memory War.
Buffer Overflow Exploits CS-480b Dick Steflik. What is a buffer overflow? Memory global static heap malloc( ), new Stack non-static local variabled value.
Teaching Buffer Overflow Ken Williams NC A&T State University.
© 2003 School of Computing, University of Leeds SY32 Secure Computing, Lecture 13 Implementation Flaws Part 1: Buffer Overruns.
Teaching Buffer Overflow Ken Williams NC A&T State University.
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.
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-
Buffer Overflow Defenses. ©2002, Jedidiah R. Crandall, Susan L. Gerhart, Jan G. Hogle. Buffer Overflow Defenses Author:
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.
Fall 2008CS 334: Computer SecuritySlide #1 Smashing The Stack A detailed look at buffer overflows as described in Smashing the Stack for Fun and Profit.
Lecture 0 Appendix on Implementation Threats Material from Warren Page & Chpt 11, Information Security by Mark Stamp.
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.
Attacking Applications: SQL Injection & Buffer Overflows.
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.
Buffer Overflow Maddikayala, jagadish. CSCI 5931 Web Security Prof. T. Andrew Yang Monday Feb. 23.
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
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”.
Buffer Overflow CS461/ECE422 Spring Reading Material Based on Chapter 11 of the text.
Buffer Overflow Attack-proofing by Transforming Code Binary Gopal Gupta Parag Doshi, R. Reghuramalingam The University of Texas at Dallas 11/15/2004.
Exploitation possibilities of memory related vulnerabilities
Buffer Overflow. Introduction On many C implementations, it is possible to corrupt the execution stack by writing past the end of an array. Known as smash.
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.
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.
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
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.
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.
Buffer Overflows: Attacks and Defenses for the Vulnerability of the Decade Crispin Cowan SANS 2000.
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.
CS703 - Advanced Operating Systems By Mr. Farhan Zaidi.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Lec. Waleed Bin Shahid.  You might have noticed a lot of issues related to software implementation.  The ultimate requirement of developer(s) is to.
Secure Programming Dr. X
Shellcode COSC 480 Presentation Alison Buben.
Mitigation against Buffer Overflow Attacks
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Protecting Memory What is there to protect in memory?
Buffer Overflow Defenses
Protecting Memory What is there to protect in memory?
Secure Programming Dr. X
Module 30 (Unix/Linux Security Issues II)
Protecting Memory What is there to protect in memory?
CMSC 414 Computer and Network Security Lecture 21
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Software Security Lesson Introduction
Format String.
Buffer Overflow Defenses
Understanding and Preventing Buffer Overflow Attacks in Unix
Return-to-libc Attacks
Presentation transcript:

VM: Chapter 7 Buffer Overflows

csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types of buffer overflows heap overflow stack overflow Defense against buffer overflows Examples

csci5233 computer security & integrity (VM: Ch. 7) 3 Impact of buffer overflows [Wagner, 2000]: Contributed to as much as 50% of security problems (see Fig. 7-1, p.136) The problem is not getting better. (see Fig. 7-2) Why? Bad language design (e.g., C/C++) Poor programming

csci5233 computer security & integrity (VM: Ch. 7) 4 Impact of buffer overflows The unsafe C language: C is inherently unsafe. There is no bounds checking on array and pointer references. It is the programmer’s responsibility to do the checking. Unsafe string operations in the standard C lib.

csci5233 computer security & integrity (VM: Ch. 7) 5 What is buffer overflow? Buffer is a memory area where contiguous chunks of the same data type are allocated. Buffer overflow occurs when a program writes past the bounds of a buffer. P1’s buffer P2 The bound of P1’s buffer Overflow area P2’s memory area Buffer Overflow Q: What could be the impact of a buffer overflow? How would the impact be determined?

csci5233 computer security & integrity (VM: Ch. 7) 6 The impact of a buffer overflow Factors that determine the impact of a buffer overflow: 1. What data or code in P2 were over-written? 2. What data were written into the overflow area? 3. How would P1 access the overflow area? 4. How would P2 access the overflow area? Overall, the outcome is unpredictable!

csci5233 computer security & integrity (VM: Ch. 7) 7 Why are buffer overflows a security problem? Reason: A malicious program may exploit buffer overflow to gain privileged access to a system. The exploit is usually tied to specific architecture of particular operating systems. Example: stack smashing – An overflow overwrites the return address in a stack frame. Privilege escalation: A privilege is granted to a sequence of users through a chain of granting process In an OS, many applications and/or utilities are given super user privilege, usually only temporarily, to perform part of its job that requires the privilege.  regular mode versus privileged mode

csci5233 computer security & integrity (VM: Ch. 7) 8 Why are buffer overflows a security problem? Threat: When a malicious program (M) gain control of a process (P), it “inherits” its privileges. For example: In UNIX, applications such as lpr and xterm have been abused into giving up root privileges thru the exploit of buffer overflow in suid regions of the code. Another example: A malicious program finds a buffer overflow in an suid root program, and then exploits to trigger an interactive shell (with root privilege).

csci5233 computer security & integrity (VM: Ch. 7) 9 Buffer Overflow and C/C++ Functions C functions that do not check bounds: pp See also Table 7-1, p.152 Any solution? Defensive programming by 1.Set an upper bound of an argument, or use an function that allows a bound to be set Example: strncpy( ) in place of strcpy( ) 2.Check the length of an argument before passing it to a library function  To avoid internal buffer overflow (p.147) Example: relpath( ), syslog( ), getopt( ), getpass( ), etc. Are these the ultimate solutions? Probably not.

csci5233 computer security & integrity (VM: Ch. 7) 10 Types of Buffer Overflows Stack overflows versus heap overflows Compared to other parts of a process (such as data segment and program segment, which are static), the stack and the heap are dynamic. Stack is used for allocating the context of the current function call, such as non-static local variables, parameters passed by value, return address, …  activation record (or stack frame) Heap is for allocating data requested dynamically by a user program, such as via malloc( ) in C or new in C++. Heap overflows are generally much harder to exploit than stack overflows. Why?

csci5233 computer security & integrity (VM: Ch. 7) 11 Heap Overflows A less likely attack than stack overflows. The attacker needs to know many things: 1.Which variable(s) are security critical; 2.How the variables are allocated in the heap; 3.The number of bytes allocated to a variable; 4.A buffer that can overflow the target variable; 5.… Example: pp

csci5233 computer security & integrity (VM: Ch. 7) 12 Stack Overflows Steps: p Find a stack-allocated buffer that allows us to overwrite the return address in a stack frame; 2.Place some hostile code in memory to which we can jump when the function we’re attacking returns; 3.Write over the return address on the stack with a value that causes the program to jump to our hostile code. Examples: pp

csci5233 computer security & integrity (VM: Ch. 7) 13 “Solutions” to Buffer Overflows 1. Software scanning tools (VM: Chapter 6) can help to find and remove buffer overflow problems. 2. Nonexecutable stacks: requires OS support or patch 3. Get a compiler that performs array bounds checking for C programs. 4. Stackguard tools adds a little bit of data at the end of stack-allocated data (called a canary), and later checks the canary to see whether the allocated data is still valid.

csci5233 computer security & integrity (VM: Ch. 7) 14 “Solutions” to Buffer Overflows 5. Memory integrity checking tools, such as Rational’s Purify 6. Replace vulnerable calls with “safe” versions. 7. Don’t use C. Use a type-safe language such as Java!

csci5233 computer security & integrity (VM: Ch. 7) 15 Summary Buffer overflow is the most common attack at C programs. It is difficult to write secure C programs. The best approach is to use a “safe” language. The challenge is there exist lots of C/C++ codes out there. Next: –Applying cryptography (VM: Ch 11) –CSCI5931 Web Security (Spring 2003)