1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.

Slides:



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

CSc 352 Programming Hygiene Saumya Debray Dept. of Computer Science The University of Arizona, Tucson
Computer Security: Principles and Practice EECS710: Information Security Professor Hossein Saiedian Fall 2014 Chapter 10: Buffer Overflow.
Lecture 16 Buffer Overflow modified from slides of Lawrie Brown.
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.
Chapter 15 : Attacking Compiled Applications Alexis Kirat - International Student.
1 Function Calls Professor Jennifer Rexford COS 217 Reading: Chapter 4 of “Programming From the Ground Up” (available online from the course Web site)
CS 104 Introduction to Computer Science and Graphics Problems
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
Andrea Bittau, Adam Belay, Ali Mashtizadeh, David Maziéres, Dan Boneh
September 22, 2014 Pengju (Jimmy) Jin Section E
CMSC 414 Computer and Network Security Lecture 20 Jonathan Katz.
1 CSC 2405: Computer Systems II Spring 2012 Dr. Tom Way.
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 overflows.
Assembly, Stacks, and Registers Kevin C. Su 9/26/2011.
Computer Security and Penetration Testing
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Introduction: Exploiting Linux. Basic Concepts Vulnerability A flaw in a system that allows an attacker to do something the designer did not intend,
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.
CIS 450 – Network Security Chapter 7 – Buffer Overflow Attacks.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 10 “Buffer Overflow”.
Automatic Diagnosis and Response to Memory Corruption Vulnerabilities Presenter: Jianyong Dai Jun Xu, Peng Ning, Chongkyung Kil, Yan Zhai, Chris Bookhot.
Exploitation possibilities of memory related vulnerabilities
EC week Review. Rules of Engagement Teams selected by instructor Host will read the entire questions. Only after, a team may “buzz” by raise of.
Information Leaks Without Memory Disclosures: Remote Side Channel Attacks on Diversified Code Jeff Seibert, Hamed Okhravi, and Eric Söderström Presented.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
CS 155 Section 1 PP1 Eu-Jin Goh. Setting up Environment Demo.
Buffer Overflow Attack- proofing of Code Binaries Ramya Reguramalingam Gopal Gupta Gopal Gupta Department of Computer Science University of Texas at Dallas.
Buffer Overflows Taught by Scott Coté.-. _ _.-. / \.-. ((___)).-. / \ /.ooM \ / \.-. [ x x ].-. / \ /.ooM \ -/ \ /-----\-----/---\--\ /--/---\-----/-----\ / \-
Web Security Firewalls, Buffer overflows and proxy servers.
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.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
1 Assembly Language: Function Calls Jennifer Rexford.
CNIT 127: Exploit Development Ch 8: Windows Overflows Part 1.
Chapter 7 Memory Management Eighth Edition William Stallings Operating Systems: Internals and Design Principles.
Week-14 (Lecture-1) Malicious software and antivirus: 1. Malware A user can be tricked or forced into downloading malware comes in many forms, Ex. viruses,
Some of the utilities associated with the development of programs. These program development tools allow users to write and construct programs that the.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
Shellcode COSC 480 Presentation Alison Buben.
Mitigation against Buffer Overflow Attacks
Return Oriented Programming
Introduction to Operating Systems
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?
Introduction to Information Security
CSC 495/583 Topics of Software Security Stack Overflows (2)
Von Neumann model - Memory
CMSC 414 Computer and Network Security Lecture 21
Summary by - Bo Zhang and Shuang Guo [Date: 03/31/2014]
Introduction to Operating Systems
O.S Lecture 13 Virtual Memory.
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Advanced Buffer Overflow: Pointer subterfuge
Format String.
Von Neumann model - Memory
Week 2: Buffer Overflow Part 2.
8051 ASSEMBLY LANGUAGE PROGRAMMING
Understanding and Preventing Buffer Overflow Attacks in Unix
Computer Architecture and System Programming Laboratory
Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

1 CHAPTER 8 BUFFER OVERFLOW

2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software fails to sanity check input it’s been given Where more input is given than room set aside, you have an overflow. If the input is just garbage, most of the time the program will simply crash. This is because when the buffer gets filled, it can step on program code

3 How Buffer Overflow Occur? When a function is executing, it needs to store data about what it is doing. To do this, the computer will provide a region of memory called a stack When a function is called, it needs to make sure that the stack has enough room for all of its data If there is not enough room, the function will not be able to use all of its data, and an error will occur

4 How Buffer Overflow Occur? If the function does not realize that there isn’t enough room, the function may go ahead and store the data regardless-overwriting the available stack and corrupting it-usually crashing the program

5 Smashing The Stack Smashing the stack is the terminology for being able to write past the end of a buffer and corrupt the stack The stack is a contiguous block of memory in which data is stored When the stack is smashed, or corrupted, it is possible to manipulate the return address and execute another program Hackers have often write a simple code (called payload) to overflow the buffer

6 What Happens When Buffer is Overflowed Once you know that you have a working buffer overflow, you need to find out what part of your buffer is being used to load the instruction pointer When you built your buffer, simply encode it with a predictable pattern Once a stack overflows is successful, the return address from a function calls pushed onto the stack; a buffer overflow can overwrite the value

7 What Happens When Buffer is Overflowed One of the central challenges to designing a good buffer overflow is finding a new address to overwrite the original The address must enable the attacker to run his or her payload

8 Methods To Execute Payload Direct Jump Direct jumps means that you have told our overflow code to jump directly to a location in memory First, the address of the stack may contain a NULL character, so the entire payload will need to be placed before the injector. So, it will limit the available size for your payload Second, the address of your payload is not always going to be the same. This leaves you guessing the address you wish to jump to

9 Methods To Execute Payload Blind Return The ESP (stack pointer) registers points to the current stack location Any ret instruction causes the topmost value on the stack to be popped into EIP (instruction pointer), and EIP now points to a new code address; this is called popping If the attacker can inject initial EIP value that points to ret instruction, the value stored at ESP will loaded into ESI (source index) A whole series of techniques use the processor registers to get back to the stack

10 Methods To Execute Payload Pop Return If the value on the top of the stack does not point to within the attacker’s buffer, the injected EIP can be set to point to a series of pop instructions, followed by a ret instruction This will cause the stack to be popped a number of times before a value is used for the EIP register The attackers just pop down the stack until the useful address reached This method was used in at least one public exploit for Internet Information Server (IIS)

11 Methods To Execute Payload Call Register If a register is already loaded with an address that points to the payload, the attacker simply needs to load EIP to an instruction that performs a “call edx” or “call edi” or equivalent (depending on the desire register) Push Return Uses the value stored in a register If the register is loaded, but the attacker cannot find a “call” instruction, another option is to find a “push, ” followed by a return

12 Designing Payload Coding the payload There is a better way to encode payload. Just simply write them in C, C++ or inline assembly. Then, copy the compiled code directly into the payload It is easy for integrating assembly and C while using most compilers It is called Fusion Technique It is simple to encode and compile assembly language using Fusion Technique

13 Designing Payload Injection Vector The injection vector is the custom operational code to own the instruction pointer on the remote machine The purpose of injection vector is to get the payload to execute Location of Payload The location of the payload mustn’t be same place with the injection vector It is important to care about how the injection vector interacts with the payload

14 Designing Payload Payload can be stored somewhere. It is to get the processor to start executing that buffer. The common places to store payloads are: 1. Files on the disks, which are then loaded into memory 2. Environment variables controlled by a local user 3. Environment variables passed within a web request 4. User-controlled fields within a network protocol

15 Finding New Buffer Overflow Exploits First step in discovering a new buffer overflow is to insert invalid data into an application To begin, allocate every point where data is accepted into a program Secondly, the best overflows are often those that are injected through TCP/IP Broken cgi-bin program are an example of this type of overflow

16 How To Protect Buffer Overflow Choice of programming languages Use of safe-libraries Stack-smashing protection Executable space protection Address space layout randomization Deep packet inspection

17 End Of Chapter 8