Computer Security and Penetration Testing

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.
Java Card Technology Ch07: Applet Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Computer Science & Engineering.
Breno de MedeirosFlorida State University Fall 2005 Buffer overflow and stack smashing attacks Principles of application software security.
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.
CMSC 414 Computer and Network Security Lecture 24 Jonathan Katz.
Chapter 15 : Attacking Compiled Applications Alexis Kirat - International Student.
By Brian Vees.  SQL Injection  Username Enumeration  Cross Site Scripting (XSS)  Remote Code Execution  String Formatting Vulnerabilities.
Chapter 10.
Teaching Buffer Overflow Ken Williams NC A&T State University.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
Chapter 11 Operating Systems
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 13 Disk Storage, Basic File Structures, and Hashing.
Assembly תרגול 8 פונקציות והתקפת buffer.. Procedures (Functions) A procedure call involves passing both data and control from one part of the code to.
SQL Injection and Buffer overflow
Guide To UNIX Using Linux Third Edition
Computer Security and Penetration Testing
Buffer Overflow Attacks. Memory plays a key part in many computer system functions. It’s a critical component to many internal operations. From mother.
University of Washington CSE 351 : The Hardware/Software Interface Section 5 Structs as parameters, buffer overflows, and lab 3.
Chapter Seven Advanced Shell Programming. 2 Lesson A Developing a Fully Featured Program.
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
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.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 17 Disk Storage, Basic File Structures, and Hashing.
Chapter 6 Buffer Overflow. Buffer Overflow occurs when the program overwrites data outside the bounds of allocated memory It was one of the first exploited.
CNG 140 C Programming (Lecture set 9) Spring Chapter 9 Character Strings.
OSI and TCP/IP Models And Some Vulnerabilities AfNOG th May 2011 – 10 th June 2011 Tanzania By Marcus K. G. Adomey.
Chapter 8 Cookies And Security JavaScript, Third Edition.
CS 4010 Hacking Samba Server Vulnerabilities. Recon Telnet headers claim the following: –Red Hat Linux release 9 (Shrike) –Kernel smp on an i686.
1 Application Security: Electronic Commerce and Chapter 9 Copyright 2003 Prentice-Hall.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflows can be triggered by inputs that are designed to execute code, or alter the way the program.
By Sean Rose and Erik Hazzard.  SQL Injection is a technique that exploits security weaknesses of the database layer of an application in order to gain.
Buffer Overflow Group 7Group 8 Nathaniel CrowellDerek Edwards Punna ChalasaniAxel Abellard Steven Studniarz.
Chapter 8 Lecture 1 Software Testing. Program testing Testing is intended to show that a program does what it is intended to do and to discover program.
Security Attacks CS 795. Buffer Overflow Problem Buffer overflow Analysis of Buffer Overflow Attacks.
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.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Sairajiv Burugapalli. This chapter covers three main categories of classic software vulnerability: Buffer overflows Integer vulnerabilities Format string.
CHAPTER 7 Unexpected Input. INTRODUCTION What is Unexpected Input? Something (normally user-supplied data) that is unexpected happen to an application.
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.
Announcements You will receive your scores back for Assignment 2 this week. You will have an opportunity to correct your code and resubmit it for partial.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
Defensive Programming. Good programming practices that protect you from your own programming mistakes, as well as those of others – Assertions – Parameter.
Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.
Debugging Malloc Lab Detecting Memory-Related Errors.
By Collin Donaldson. Hacking is only legal under the following circumstances: 1.You hack (penetration test) a device/network you own. 2.You gain explicit,
Chapter 11 Software Security. Many vulnerabilities result from poor programming practices Consequence from insufficient checking and validation of data.
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
( ) 1 Chapter # 8 How Data is stored DATABASE.
CSC 482/582: Computer Security
Shellcode COSC 480 Presentation Alison Buben.
Major Problem Areas for Secure Programming
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
SQL and SQL*Plus Interaction
Secure Programming Dr. X
Module 30 (Unix/Linux Security Issues II)
Protecting Memory What is there to protect in memory?
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Format String.
Buffer Overflows.
CS5123 Software Validation and Quality Assurance
Understanding and Preventing Buffer Overflow Attacks in Unix
Format String Vulnerability
Return-to-libc Attacks
Presentation transcript:

Computer Security and Penetration Testing Chapter 12 Buffer Overflows

Objectives Describe buffer overflow List types of buffer overflows Identify techniques used to cause a buffer overflow Comprehend techniques used to detect buffer overflow conditions Understand methods used in preventing buffer overflows Computer Security and Penetration Testing

Buffer Overflows Buffer overflow Condition common to structured programming languages such as the “C” language Happens when input applied to a variable is larger than the memory allotted to that variable When an attacker sends input in excess of the expected range of the value The target system will either crash or execute the malicious code sent by the attacker Computer Security and Penetration Testing

Standard Execution of a C program main function Entry point to the detailed code in the application Responsible for calling other functions Each of which executes a particular task, and may call other functions in turn Functions use variables to store values that may be stored temporarily or permanently Once a function has completed, the program control returns to the calling or invoking function Computer Security and Penetration Testing

Standard Execution of a C program (continued) Buffer overflow bug targets the variables that are used by functions to store values Variables are assigned a fixed memory space to store the data Buffer overflow has a goal of overloading the memory space provided to the variable Extra characters are stored in a memory space that is not assigned to the variable Computer Security and Penetration Testing

Computer Security and Penetration Testing

Standard Execution of a C program (continued) Function with an overloaded variable is not able to determine the function that called it Could result in the crashing of the program Hackers are able to manipulate the value provided to the variable So it is stored in a specific memory space to execute some predetermined malicious code Buffer overflows are not always intentional attacks Computer Security and Penetration Testing

Standard Execution of a C program (continued) Avoiding buffer overflows Check to see that no value greater than the memory assigned to the variable is specified for it Define the sequence of steps that the program has to follow in case of a buffer overflow Executable space protection On some specific operating systems, the kernel can be patched in such a way that running processes are not affected by buffer overflow conditions Computer Security and Penetration Testing

Types of Buffer Overflows Buffer overflows can be divided into two categories: stack overflow and heap overflow Computer Security and Penetration Testing

Stack Overflow Programs use a memory stack area to store values for variables Stack is intended to ensure that there is sufficient memory space for all functions to operate Occasionally the stack is insufficient to complete the functions and an error is generated Stack stores details regarding the function that called the currently executing function Information can be lost after the stack is corrupted Computer Security and Penetration Testing

Stack Overflow (continued) Hackers write the code for a buffer overflow in such a manner that The code to which a function’s pointers are indicating is code of the hacker’s choosing Process of an exploit Hacker searches for a chance to overflow the buffer Hacker determines memory assigned to the variable Hacker specifies a value greater than the maximum capacity of the variable Variable takes the value Computer Security and Penetration Testing

Stack Overflow (continued) Hacker checks for some specific functions to ascertain the possibility of a buffer overflow strcpy scanf fgets wstrcpy wstrncat sprintf gets strcat Computer Security and Penetration Testing

Heap Overflows A heap is similar to a stack Provides memory to the application various functions Provides a permanent memory space Data stored in a heap can be used throughout various functions and commands A heap is randomly accessed because it stores values statically Size of a heap usually grows as new variables’ values are introduced Computer Security and Penetration Testing

Heap Overflows (continued) Computer Security and Penetration Testing

Computer Security and Penetration Testing

Heap Overflows (continued) Heap overflow is known as the corruption of the instruction pointer Instruction pointer points to the memory area where the function to be executed is stored Computer Security and Penetration Testing

More Methods for Causing a Buffer Overflow Traditional methods include Providing input values that are greater than the memory allocated for a variable This section details two other methods: Character-set decoding Nybble-to-byte compression Computer Security and Penetration Testing

Character-Set Decoding Uses the characters that are read differently by the computer and acquire larger space Additional bytes of data may cause the input value to exceed the memory limitation of the variable Applicable to situations in which the user specifies a value from an HTML page Becomes a weakness whenever a back-end script reads the code And, after expanding the value, results in a buffer overflow Computer Security and Penetration Testing

Character-Set Decoding (continued) Computer Security and Penetration Testing

Computer Security and Penetration Testing

Character-Set Decoding (continued) Size of the stack is computer-dependent Buffer overflow may not happen until a value that exceeds the stack size is specified Buffer overflow may occur when verification for the length of the input value is made at the client-side And the back-end script accepts it without performing checks Double validation Indicates to potential hackers that buffer overflow exploits are not possible on your Web site Computer Security and Penetration Testing

Character-Set Decoding (continued) Computer Security and Penetration Testing

Nybble-to-Byte Compression Compression of data that is passed as input value to variables of the function that might be overflowed Method uses the buffer in a more efficient manner with a higher amount of data Focus is to minimize code size So hackers can double the amount of code in buffer Computer Security and Penetration Testing

Buffer Overflows: Detection and Prevention Identify programming practices and functions that are potentially vulnerable to buffer overflow Computer Security and Penetration Testing

Detecting Buffer Overflow Identify the functions and variables that can lead to buffer overflows Check the reaction of the application whenever a large set of character data is supplied to a variable Function may include length verification And thus return an error message if the data exceeds the expected size Can be a painstaking, tedious process Because all variables that accept values must be checked Computer Security and Penetration Testing

Detecting Buffer Overflow (continued) Precaution should be taken to ensure that the input data is provided in the correct format For interactive Web pages Consider that the hidden data is also a part of the input that is given to the string When specifying the input data It is important to check that no NULL characters (empty fields) are being passed Computer Security and Penetration Testing

Preventing Buffer Overflow After a buffer overflow exploit has been detected The probability of its existence in other applications by the same vendor is higher Bug is typically fixed by programming the functions to perform an input validity check Providing a null terminator will prevent the buffer overflow even If additional values have been specified Computer Security and Penetration Testing

Preventing Buffer Overflow (continued) Consider developing specific programming guideline policies for your organization Having, understanding, and applying secure-coding best practices may not be entirely foolproof Options are available to avoid the use of function calls that are vulnerable to buffer overflows Computer Security and Penetration Testing

Preventing Buffer Overflow (continued) Computer Security and Penetration Testing

Preventing Buffer Overflow (continued) Checks must be made to validate the input values in both the new and old applications Software can be installed to keep a continuous check on a buffer overflow condition Software must be updated with all available security patches Computer Security and Penetration Testing

Summary Buffer overflow Common in structured programming languages Happens when input applied to a variable is larger than the memory allotted to that variable Buffer overflow bug targets the variables that are used by functions to store values Best ways to avoid buffer overflow are programmatic Two main categories of buffer overflow: stack overflow and heap overflow Computer Security and Penetration Testing

Summary (continued) Three steps in traditional process of buffer overflow: Hacker searches for a chance to overflow the buffer Hacker determines memory assigned to the variable Hacker specifies a value greater than the maximum capacity of the variable Two less-traditional methods Character-set decoding Nybble-to-byte compression Computer Security and Penetration Testing

Summary (continued) To identify the functions and variables that can lead to buffer overflow, the reaction of the application has to be checked If a buffer overflow exploit has been detected, the probability of its existence in other applications by the same vendor is high Buffer overflow can be prevented by programming the functions to perform an input validity check Computer Security and Penetration Testing