High Coverage Detection of Input-Related Security Faults

Slides:



Advertisements
Similar presentations
C Characters & Strings Character Review Character Handling Library Initialization String Conversion Functions String Handling Library Standard Input/Output.
Advertisements

Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
Bellevue University CIS 205: Introduction to Programming Using C++ Lecture 3: Primitive Data Types.
Securing software by enforcing data-flow integrity Manuel Costa Joint work with: Miguel Castro, Tim Harris Microsoft Research Cambridge University of Cambridge.
LIFT: A Low-Overhead Practical Information Flow Tracking System for Detecting Security Attacks Feng Qin, Cheng Wang, Zhenmin Li, Ho-seop Kim, Yuanyuan.
Advanced Computer Architecture Lab University of Michigan 1 Efficient Dynamic Detection of Input-Related Security Faults Eric Larson Dissertation Defense.
Static Analysis for Security Amir Bazine Per Rehnberg.
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-
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.
CS 501: Software Engineering Fall 1999 Lecture 16 Verification and Validation.
Computer Security and Penetration Testing
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
Advanced Computer Architecture Lab University of Michigan USENIX Security ’03 Slide 1 High Coverage Detection of Input-Related Security Faults Eric Larson.
Overflow Examples 01/13/2012. ACKNOWLEDGEMENTS These slides where compiled from the Malware and Software Vulnerabilities class taught by Dr Cliff Zou.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
1 A Plethora of Paths Eric Larson May 18, 2009 Seattle University.
Highly Scalable Distributed Dataflow Analysis Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan Chelsea LeBlancTodd.
An Undergraduate Course on Software Bug Detection Tools and Techniques Eric Larson Seattle University March 3, 2006.
Chapter 1 Introduction Major Data Structures in Compiler
Protecting C Programs from Attacks via Invalid Pointer Dereferences Suan Hsi Yong, Susan Horwitz University of Wisconsin – Madison.
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.
Sampling Dynamic Dataflow Analyses Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan University of British Columbia.
Sairajiv Burugapalli. This chapter covers three main categories of classic software vulnerability: Buffer overflows Integer vulnerabilities Format string.
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.
1 Program Analysis Too Loopy? Set the Loops Aside Eric Larson September 25, 2011 Seattle University.
DYNAMIC MEMORY ALLOCATION. Disadvantages of ARRAYS MEMORY ALLOCATION OF ARRAY IS STATIC: Less resource utilization. For example: If the maximum elements.
Dynamic Allocation in C
Secure Coding Rules for C++ Copyright © 2016 Curt Hill
Content Coverity Static Analysis Use cases of Coverity Examples
Shellcode COSC 480 Presentation Alison Buben.
Major Problem Areas for Secure Programming
Buffer Overflow By Collin Donaldson.
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Sabrina Wilkes-Morris CSCE 548 Student Presentation
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Chapter 6 CS 3370 – C++ Functions.
Configuration Fuzzing for Software Vulnerability Detection
Software Testing.
Types for Programs and Proofs
Protecting Memory What is there to protect in memory?
Testing and Debugging PPT By :Dr. R. Mall.
Module 30 (Unix/Linux Security Issues II)
Context-Sensitive Analysis
Protecting Memory What is there to protect in memory?
Compiler Construction (CS-636)
Computer Programming BCT 1113
© 2016 Pearson Education, Ltd. All rights reserved.
Input Space Partition Testing CS 4501 / 6501 Software Testing
Ik-Soon Kim December 18, 2010 Embedded Software Platform Team
Secure Software Development: Theory and Practice
Taint tracking Suman Jana.
C Basics.
Secure Coding Rules for C++ Copyright © Curt Hill
Some Basics for Problem Analysis and Solutions
CS 465 Buffer Overflow Slides by Kent Seamons and Tim van der Horst
Some Basics for Problem Analysis
SUDS: An Infrastructure for Creating Bug Detection Tools
7 Arrays.
Memory Allocation CS 217.
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
CSC 495/583 Topics of Software Security Format String Bug (2) & Heap
Dynamic Allocation in C
Introduction to Static Analyzer
Introduction to Data Structure
Course Overview PART I: overview material PART II: inside a compiler
Testing & Security Dr. X.
SOFTWARE ENGINEERING INSTITUTE
SPL – PS2 C++ Memory Handling.
Sampling Dynamic Dataflow Analyses
Presentation transcript:

High Coverage Detection of Input-Related Security Faults Eric Larson and Todd Austin August 7, 2003 University of Michigan

Introduction Failing to properly bound input data can be exploited by malicious users bugs found in Windows especially important for network data Common security exploits array references string library functions Exploitable bugs are often difficult to find precise input is often necessary to expose the bug bug may not produce an error in the output

Static vs. Dynamic Bug Finding Approaches Compile-time (static) bug detection + no dependence on input + can prove that a particular operation is safe in some cases often computationally infeasible  scope is limited Run-time (dynamic) bug detection + can analyze all variables (including those on the heap) + execution is on a real path  fewer false alarms depends on program input

Overview of Our Approach Dynamic approach to detecting input-related security faults Program instrumentation tracks input derived data possible range of integer variables maximum size and termination of strings Dangerous operations are checked over entire range of possible values Found 16 bugs in 8 programs, including 2 known high security faults in OpenSSH Relaxes constraint that the user provides an input that exposes the bug

Testing Process Instrumentation specification Source Code Debug and fix errors Compile (GCC w/MUSE) Error reports Instrumented Executable Run test suite

Detecting Array Buffer Overflows Interval constraint variables are introduced when external inputs are read Holds the lower and upper bounds of each input value Initial values encompass the entire range of values Control points narrow the bounds Arithmetic operations adjust the bounds Potentially dangerous operations are checked: array indexing controlling a loop (to prevent DoS attacks) arithmetic operations (overflow)

Array Buffer Overflow Example Code Segment Value of x Interval Constraint on x unsigned int x; int array[5]; scanf(“%d”, &x); if (x > 4) fatal(“bounds”); x++; a = array[x]; 2 3 0  x  MAX_UINT 0  x  4 1  x  5 ERROR! When x = 5, array reference is out of bounds!

Detecting Dangerous String Operations Strings are shadowed by: max_str_size: largest possible size of the string known_null: set if string is known to contain a null character Checking string operations: source string will fit into the destination source strings are guaranteed to be null terminated Integers that store string lengths are shadowed by: base address of corresponding string difference between its value and actual string length Operations involving a string length can narrow the maximum string size

String Fault Detection Example Code Segment String max_str_size known_null char *bad_strcopy(char *src) { char *dest; char temp[16]; if (strlen(src) > 16) return NULL; strncpy(temp, src, 16); dest = (char *)malloc(16); strcpy(dest, temp); return dest; } src temp dest MAX_INT 16 17 TRUE FALSE ERROR! temp may not be null terminated during strcpy

String Fault Detection Example Code Segment String max_str_size known_null char *bad_strcopy(char *src) { char *dest; if (strlen(src) > 16) return NULL; dest = (char *)malloc(16); strcpy(dest, src); return dest; } src dest MAX_INT 17 16 TRUE FALSE ERROR! src may not fit into dest during strcpy

Implementation Our technique was implemented in MUSE general-purpose instrumentation tool implemented in gcc at the abstract syntax tree (AST) level simplification phase removes C nuances instrumented code is not optimized (future work) Shadowed state for stored in hash tables separate tables for arrays and integers hash tables are indexed by address pointers are shadowed by base address Debug tracing mode can help find source of error

Results Program Description Defects Found Add’l False Alarms TOTAL anagram anagram generator 2 ks graph partitioning 4 yacr2 channel router 1 betaftpd file transfer protocol daemon gaim (v0.59.8) instant messaging client ghttpd web server 3 openssh (v3.0.2) secure shell client / server thttpd (v2.20c) TOTAL 16 7

Performance Results Program Original (seconds) Instrumented Increase Useless Instr. anagram 0.11 17.79 162 73.7% ks 8.75 1923.62 219 50.1% yacr2 0.55 96.79 176 75.2% betaftpd 0.08 1.09 13 81.2% ghttpd 0.34 6.70 20 96.7% openssh 0.02 0.38 19 78.8% thttpd 0.32 8.47 26 77.8%

Future Work Improve performance by eliminating unnecessary instrumentation calls Interprocedural dataflow analysis will determine which variables never hold input data Inline instrumentation to avoid call overhead and hash table lookups Add symbolic analysis support to find more defects and reduce false alarms Address these common scenarios: pointer walking (manual string handling) multiple string concatenation into a single buffer

Conclusion Our dynamic approach shadows variables derived from input with additional state Integers: upper and lower bounds Strings: maximum string size and known null flag Found 16 bugs in 8 programs 2 known high security faults in OpenSSH Run-time performance overhead is high Instrumentation has not been optimized

Questions and Answers