Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013.

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

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.
Review: Software Security David Brumley Carnegie Mellon University.
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.
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.
CS 153 Design of Operating Systems Spring 2015 Lecture 19: Page Replacement and Memory War.
Prof. Bodik CS 164 Lecture 261 Language Security Lecture 26.
Foundations of Network and Computer Security J J ohn Black Lecture #22 Nov 17 th 2005 CSCI 6268/TLEN 5831, Fall 2005.
Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus Microsoft Research Brandon Baker Microsoft Carl Hartung CSCI 7143:
Foundations of Network and Computer Security J J ohn Black Lecture #20 Nov 10 th 2005 CSCI 6268/TLEN 5831, Fall 2005.
Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Maziéres, Dan Boneh
Lecture 16 Buffer Overflow
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
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-
Exploiting Buffer Overflows on AIX/PowerPC HP-UX/PA-RISC Solaris/SPARC.
Buffer Overflows Lesson 14. Example of poor programming/errors Buffer Overflows result of poor programming practice use of functions such as gets and.
Host and Application Security Lesson 10: Code Injection.
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”.
Overflows & Exploits. In the beginning 11/02/1988 Robert Morris, Jr., a graduate student in Computer Science at Cornell, wrote an experimental, self-replicating,
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.
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.
Shellcode Development -Femi Oloyede -Pallavi Murudkar.
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.
On the Effectiveness of Address-Space Randomization Hovav Shacham, Matthew Page, Ben Pfaff, Eu-Jin Goh, Nagendra Modadugu, Dan Boneh.
Worm enabling exploits Cyber Security Lab Spring ‘10.
A Survey on Runtime Smashed Stack Detection 坂井研究室 M 豊島隆志.
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.
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.
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 1.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
ROP Exploit. ROP Return Oriented Programming (ROP): is a hacking exploit technique where you exploit buffer overflow to inject a chain of gadgets. Each.
Buffer Overflows: Attacks and Defenses for the Vulnerability of the Decade Crispin Cowan SANS 2000.
Automatic Diagnosis and Response to Memory Corruption Vulnerabilities Authors: Jun Xu, Peng Ning, Chongkyung Kil, Yan Zhai, Chris Bookholt Cyber Defense.
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.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Secure Programming Dr. X
Major Problem Areas for Secure Programming
Mitigation against Buffer Overflow Attacks
Secure Programming Dr. X
CSC 495/583 Topics of Software Security Stack Overflows (2)
CSC 495/583 Topics of Software Security Return-oriented programming
Software Security.
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Advanced Buffer Overflow: Pointer subterfuge
Software Security Lesson Introduction
Format String.
Address Space Layout Randomization (ASLR) Dirk Gordon
Foundations of Network and Computer Security
CTF Class 2018 By: Shawn Stone
Week 2: Buffer Overflow Part 2.
Understanding and Preventing Buffer Overflow Attacks in Unix
Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

Foundations of Network and Computer Security J J ohn Black CSCI 6268/TLEN 5550, Spring 2013

Defenses Now that we understand how these attacks work, it is natural to think about ways to defeat them –There are countless suggested defenses; we look at a few: StackGuard (Canaries) Non-executable Stacks ASLR Static Analysis

StackGuard Idea (1996): –Change the compiler to insert a “canary” on to the stack just after the return address –The canary is a random value assigned by the compiler that the attacker cannot predict –If the canary is clobbered, we assume the return address was altered and we terminate the program –Built in to Windows 2003 Server and provided by Visual C++.NET Use the /GS flag; on by default (slight performance hit)

Sample Stack with Canary c b a ret buffer bytes Return address sfp canary

Canaries can be Defeated A nice idea, but depending on the code near a buffer overflow, they can be defeated –Example: if a pointer (int *a) is a local and we copy another local (int *b) to it somewhere in the function, we can still over-write the return address Not too far fetched since we commonly copy ptrs around

Avoiding Canaries ret buffer Return address sfp canary int *a int *b int i Address of ret Address of i SSSSSSSSSSSSSSSS SSSSSSSSSSSSSSSS SSSSSSSSSSSSSSSS First, overflow the buffer as shown above. Then when executing *a = *b we will copy code start addr into ret Address of buffer

Moral: If Overruns Exist, High Probability of an Exploit There have been plenty of documented buffer overruns which were deemed unexploitable But plenty of them are exploitable, even when using canaries Canaries are a hack, and of limited use

Non-Executing Stacks and Return to LibC Suppose the stack is marked as non-executable –Most hardware can enforce bounded regions for executable code Note the data seg was not executable on the class machine –This is not the case on generic Linux, however, since all our example programs for stack overruns work just fine, but there is a Linux version which supports this Has to do all kinds of special stuff to accommodate programs which need an executable stack Linux uses executable stacks for signal handling Some functional languages use an executable stack for dynamic code generation The special version of Linux has to detect this and allow executable stacks for these processes

Return to LibC: Getting around the Non-Executing Stack Problem Assume we can still over-write the stack –1) Set return address to system() in LibC Use address of dynamically-linked entry point –2) Write any sfp –3) Write address of exit() as new ret addr –4) Write pointer to “/bin/sh” –5) Write string “/bin/sh”

Return to LibC: Stack Configuration buffer sfp ret --Anything-- Address of system() Garbage -- Unimportant First, overflow the buffer as shown above. When function returns, we go to system(“/bin/sh”) which spawns a shell retAddress of exit() ptr to s s“/bin/sh”

Address Space Layout Randomization The stack is placed at addresses that are randomly chosen –On by default in most Linuxes –I explicitly disabled this for our homework Attacker can still brute force until he’s lucky –Much harder on a 64-bit machine however

Automated Source Code Analysis Advantages: –Can be used as a development tool (pre-release tool) –Can be used long after release (legacy applications) –Method is proactive rather than reactive Avoid vulnerabilities rather than trying to detect them at run- time In order to conduct the analysis, we need to build a model of the program –The model will highlight features most important for security