Rémi Douence, Thomas Fritz Nicolas Loriant, Jean-Marc Menaud Marc Ségura-Devillechaise, Mario Südholt OBASCO group EMN/INRIA An expressive aspect language.

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

Integrity & Malware Dan Fleck CS469 Security Engineering Some of the slides are modified with permission from Quan Jia. Coming up: Integrity – Who Cares?
Abstraction and Modular Reasoning for the Verification of Software Corina Pasareanu NASA Ames Research Center.
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.
Extensibility, Safety and Performance in the SPIN Operating System Presented by Allen Kerr.
1 JAC : Aspect Oriented Programming in Java An article review by Yuval Nir and Limor Lahiani.
Constructing Component-Based Extension Interfaces in Legacy Systems Code Gilles Muller École des Mines de Nantes Julia Lawall DIKU, University of Copenhagen.
1 CHAPTER 8 BUFFER OVERFLOW. 2 Introduction One of the more advanced attack techniques is the buffer overflow attack Buffer Overflows occurs when software.
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.
Beyond Stack Smashing: Recent Advances in Exploiting Buffer Overruns Jonathan Pincus Microsoft Research Brandon Baker Microsoft Carl Hartung CSCI 7143:
CS 536 Spring Run-time organization Lecture 19.
Memory Management 2010.
LIFT: A Low-Overhead Practical Information Flow Tracking System for Detecting Security Attacks Feng Qin, Cheng Wang, Zhenmin Li, Ho-seop Kim, Yuanyuan.
Run-time Environment and Program Organization
1. 2 FUNCTION INLINE FUNCTION DIFFERENCE BETWEEN FUNCTION AND INLINE FUNCTION CONCLUSION 3.
1 RAKSHA: A FLEXIBLE ARCHITECTURE FOR SOFTWARE SECURITY Computer Systems Laboratory Stanford University Hari Kannan, Michael Dalton, Christos Kozyrakis.
Efficient Instruction Set Randomization Using Software Dynamic Translation Michael Crane Wei Hu.
Software security patches Audit, deployment and hot update Nicolas Loriant, Marc Ségura-Devillechaise, Jean-Marc Menaud, Obasco Group EMN/INRIA Workshop.
Reduced Instruction Set Computers (RISC) Computer Organization and Architecture.
Statically Detecting Likely Buffer Overflow Vulnerabilities David Larochelle David Evans University of Virginia Department of Computer Science Supported.
Address Obfuscation: An Efficient Approach to Combat a Broad Range of Memory Error Exploits Sandeep Bhatkar, Daniel C. DuVarney, and R. Sekar Stony Brook.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
System Calls 1.
Address Space Layout Permutation
Security Exploiting Overflows. Introduction r See the following link for more info: operating-systems-and-applications-in-
CH13 Reduced Instruction Set Computers {Make hardware Simpler, but quicker} Key features  Large number of general purpose registers  Use of compiler.
15-740/ Oct. 17, 2012 Stefan Muller.  Problem: Software is buggy!  More specific problem: Want to make sure software doesn’t have bad property.
Web Cache Prefetching as an Aspect: Towards a Dynamic-Weaving Based Solution Marc Ségura-Devillechaise, Jean-Marc Menaud, Gilles Muller OBASCO Project.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
Analysis of Branch Predictors
CS533 Concepts of Operating Systems Jonathan Walpole.
Computer Science Detecting Memory Access Errors via Illegal Write Monitoring Ongoing Research by Emre Can Sezer.
Lecture slides prepared for “Computer Security: Principles and Practice”, 3/e, by William Stallings and Lawrie Brown, Chapter 10 “Buffer Overflow”.
Chapter 4 Memory Management Virtual Memory.
Lecture 3 Classes, Structs, Enums Passing by reference and value Arrays.
Buffer Overflow Proofing of Code Binaries By Ramya Reguramalingam Graduate Student, Computer Science Advisor: Dr. Gopal Gupta.
Highly Scalable Distributed Dataflow Analysis Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan Chelsea LeBlancTodd.
A Tool for Pro-active Defense Against the Buffer Overrun Attack D. Bruschi, E. Rosti, R. Banfi Presented By: Warshavsky Alex.
Operating Systems CSE 411 CPU Management Sept Lecture 10 Instructor: Bhuvan Urgaonkar.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
Sampling Dynamic Dataflow Analyses Joseph L. Greathouse Advanced Computer Architecture Laboratory University of Michigan University of British Columbia.
Dynamic Taint Analysis for Automatic Detection, Analysis, and Signature Generation of Exploits on Commodity Software Paper by: James Newsome and Dawn Song.
A Survey on Runtime Smashed Stack Detection 坂井研究室 M 豊島隆志.
David Evans CS201j: Engineering Software University of Virginia Computer Science Lecture 9: Designing Exceptionally.
Web Security Firewalls, Buffer overflows and proxy servers.
Slides by Kent Seamons and Tim van der Horst Last Updated: Nov 11, 2011.
VM: Chapter 7 Buffer Overflows. csci5233 computer security & integrity (VM: Ch. 7) 2 Outline Impact of buffer overflows What is a buffer overflow? Types.
Beyond Stack Smashing: Recent Advances In Exploiting Buffer Overruns Jonathan Pincus and Brandon Baker Microsoft Researchers IEEE Security and.
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.
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.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
2.2 Threads  Process: address space + code execution  There is no law that states that a process cannot have more than one “line” of execution.  Threads:
@Yuan Xue Worm Attack Yuan Xue Fall 2012.
1 Chapter 5: Threads Overview Multithreading Models & Issues Read Chapter 5 pages
Buffer Overflow Buffer overflows are possible because C doesn’t check array boundaries Buffer overflows are dangerous because buffers for user input are.
Introduction to Operating Systems
The Hardware/Software Interface CSE351 Winter 2013
Protecting Memory What is there to protect in memory?
Threads Cannot Be Implemented As a Library
Chapter 9 :: Subroutines and Control Abstraction
Introduction to Operating Systems
Software Security Lesson Introduction
System Calls David Ferry CSCI 3500 – Operating Systems
CS5123 Software Validation and Quality Assurance
Course Overview PART I: overview material PART II: inside a compiler
Dynamic Binary Translators and Instrumenters
Presentation transcript:

Rémi Douence, Thomas Fritz Nicolas Loriant, Jean-Marc Menaud Marc Ségura-Devillechaise, Mario Südholt OBASCO group EMN/INRIA An expressive aspect language for system applications with Arachne

2 Outline Why another aspect system? How to program with Arachne? How does Arachne work? How fast are Arachne aspects?

3 Aspects for adapting legacy applications ● Adaptation and evolution usually mismatch with the original program architecture legacy C applications ● Difficult to anticipate adaptation and evolution ● How to adapt, evolve an application? Highly available server, waste of money/resources ● Can AOP help?

4 Three concerns from the squid web cache Switching network protocols uses UDP instead of TCP when safe to improve performance Buffer overflows programming error where data written in an array (ie buffer) exceeds the array size often exploited by hackers (Slammer, Code Red,...) crosscutting: all squid source files use buffers Prefetching predict the page that the user will access and download before the user asks for it

5 Motivations for a new aspect system in the imperative world of C-written applications: sequence of events in the execution of the base program Weaving: needs to be dynamic can not be anticipated should not suspend the base program execution Efficiency adaptation often occurs for performance reasons

6 Outline Why another aspect system? How to program with Arachne? How does Arachne work? How fast are Arachne aspects?

7 Sequence instances Buggy base program: char* two = malloc(2); gets(two);/*fills one with input typed by the user*/ free(two); char* one = malloc(1); gets(one);/*fills two with input typed by the user*/ free(one); Sample naive gets implementation (standard C library): char* gets(char* buffer) { int i=0; do { buffer[i]=getchar(); i++;} while(buffer[i]!='\n'); buffer[i-1]='\0'; return buffer; }

8 The problem: relating events Execution trace when user types “A” create two, a one character long buffer [ two=malloc(2) ] call gets, buffer now alias two [ gets(two) ] set i to 0 [ int i=0; ] read A [ getchar() ] put A in two at index 0 [ buffer[i]=... ] Ok set i to 1 [ i++ ] compare with \n [ buffer[i]!='\n' ] put O in two at index 1 [ buffer[i]=... ] Ok

9 Sequence instances Execution trace when user types “A” then “OP” create two a 2 characters buffer [ two=malloc(2) address 0x800] call gets, buffer now alias two [ gets(two) ]... put A in two at index 0 [ buffer[i]=... ],... put \n in two at index 1 [ buffer[i]=... ],... replace \n by \0 in two at index 1 [ buffer[i-1]='\0' ],... destroy two a 2 characters buffer [ free(two) ] create one a 1 characters buffer [ one=malloc(1) address 0x800] call gets, buffer now alias one [ gets(one) ]... put O in one at index 0 [ buffer[i]=... ],... put P in one at index 1 [ buffer[i]=... ],...

10 A solution: aspect detecting overflow seq( call(void* malloc(size_t))&& args(size) && return(buffer); /*possibly other events in between*/ write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* /*possibly other events in between*/ call(void free(void*))&& args(array) && if(buffer==array)); );

11 Advice definition (around semantic) seq( call(void* malloc(size_t))&& args(size) && return(buffer); write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* call(void free(void*))&& args(array) && if(buffer==array)); );

12 Defining the steps of the sequence A step has the form pointcut [ then advice] opt ; [ * ] opt with * the pointcut can match 0 or n times A step has a pointcut defined with: ● call : direct function calls ● cflowstar, cflow : sequence of nested function calls ● readGlobal, writeGlobal : global variable accesses ● read, write : memory accesses Each step can retain some information about its joinpoint: args, return, size... if can be used to test against this information Possible to write sequence less aspect

13 Relating events through time: start seq( call(void* malloc(size_t))&& args(size) && return(buffer); write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* call(void free(void*))&& args(array) && if(buffer==array)); );

14 Relating events through time: step 2 seq( call(void* malloc(size_t))&& args(size) && return(buffer); write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* call(void free(void*))&& args(array) && if(buffer==array)); );

15 Relating events through time: end seq( call(void* malloc(size_t))&& args(size) && return(buffer); write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* call(void free(void*))&& args(array) && if(buffer==array)); );

16 Relating events through data seq( call(void* malloc(size_t))&& args(size) && return(buffer); write(buffer)&& size(newSize) && if(newSize>size)) then reportOverflow(buffer);* call(void free(void*))&& args(array) && if(buffer==array)); );

17 Outline Why another aspect system? How to program with Arachne? How does Arachne work? How fast are Arachne aspects?

18 The Arachne aspect system: core features Weaver for x86/Linux/C application Internally rewrites binary code Weaving and deweaving are fully dynamic Weaving and deweaving are directed by the end user No need to “prepare” the base program Compatible with threaded applications

19 Weaving process Arachne rewriting thread code analysis binary code rewriting aspect activation Weaving request compiled aspect loading Arachne injection Base program process

20 Outline Why another aspect system? How to program with Arachne? How does Arachne work? How fast are Arachne aspects?

21 Evaluation on real application: method Goal compare the overhead of using Arachne to editing/recompiling the source code to adapt an application Method Add prefetching to squid by editing/recompiling its source code weaving Arachne aspect Use a well known benchmark (polygraph) Report the performance variations between versions

22 Benchmark 1 Benchmark 2 Results

23 Conclusion Practice suggested need for aspect constructs relating events need for dynamic weaving The Arachne aspect system: language to adapt applications call, variable accesses, cflow, sequences towards a formal semantic weaver for adapting applications dynamic enforcement of continuous service support of legacy C programs without preparation of the base program

Questions?

25 Why another aspect language? Single buffer overflow ● Useful to correct a known published bug ● Pointcut based on the name of the vulnerable buffer ● Action checks the access ● Solution = µDyner ● state of the art aspect language ● a dynamic weaver Any buffer overflow ● Useful when you do not trust the base program program under hacker attacks… ● Pointcuts based on a sequence of events ● Buffer creation ● Then access to the buffer ● Action checks the access Solution = ?

26 The problem: buffer overflow Buggy base program: char* in = malloc(1); gets(in);/*fills in with input typed by the user*/ free(in); Sample naive gets implementation (standard C library): char* gets(char* buffer) { int i=0; do { buffer[i]=getchar(); i++; } while(buffer[i]!='\n'); buffer[i-1]='\0'; return buffer; }

27 The problem: relating events Execution trace when user types “AOP” create in, a one character long buffer [ in=malloc(1) ] call gets, buffer now alias in [ gets(in) ] set i to 0 [ int i=0; ] read A [ getchar() ] put A in in at index 0 [ buffer[i]=... ] Ok set i to 1 [ i++ ] compare with \n [ buffer[i]!='\n' ] put O in in at index 1 [ buffer[i]=... ] Bug

28 Number of matching instances Cycles Cycles Cycles466.3 Cycles seq 577 Cycles Ratio readGlobal Size of variable (bits) Cycles2487 Cycles 2762 Cycles 3363 Cycles 4990 Cycles Ratio cflow 28 Cycles 228 Cycles 327 Cycles 424 Cycles522 Cycles Number of imbricated calls Ratio Arachne language constructs versus the speed of their C equivalent

29 Goal compare the speed of Arachne with C Method ratio= Base program void f() { return; } int main(int argc, char**argv){ startTimer(); f(); /*joinpoint*/ endTimer(); } Aspect call(void f())then f(); Arachne language constructs versus the speed of their C equivalents runtime with the aspect runtime without aspect

30 Results Ratio Pointcut

31 Mapping protocols

32 Another aspect example seq( call(int socket(…)) && args(…) && return(fd) then socket(…); call(int connect(int,…)) && args(fd1,…) && if(fd1 == fd) then returnZero(); ( call(size_t read(int,…)) && args(fd2…) && if(fd2 == fd) then recvfrom(fd,…); || call(size_t write(int,…)) && args(fd3…) && if(fd3 == fd) then sendTo(fd,…);) (*) call(int close(int)) && args(fd4) && if(fd4 == fd) )

33 Arachne architecture

34 Implementation model shadow: rewriting site replaced by a x86 instruction execution flow jump Binary code of the compiled base program and/or advices Residue (dynamic tests) Entry hook save registersReturn hook Restore registers instruction(s) Relocated tailored updating registers Base program process Hooks generated at weaving time Legacy base binary code Aspect DLL generated at aspect compile time

35 The future Continue the exploration of efficient language constructs to relate events together Extend Arachne to C++ in progress, already using an application to medical imaging to the linux kernel