Using Evolutionary Algorithms to obfuscate code



Similar documents
SOURCE CODE OBFUSCATION BY MEAN OF EVOLUTIONARY ALGORITHMS

Code Obfuscation. Mayur Kamat Nishant Kumar

Implementation of an Obfuscation Tool for C/C++ Source Code Protection on the XScale Architecture *

Applications of obfuscation to software and hardware systems

Introduction to Program Obfuscation

Software Protection through Code Obfuscation

It has a parameter list Account(String n, double b) in the creation of an instance of this class.

Informatica e Sistemi in Tempo Reale

Obfuscation of Abstract Data-Types

CS 241 Data Organization Coding Standards

Definitions. Software Metrics. Why Measure Software? Example Metrics. Software Engineering. Determine quality of the current product or process

Static Analysis of Virtualization- Obfuscated Binaries

Output: struct treenode{ int data; struct treenode *left, *right; } struct treenode *tree_ptr;

Obfuscation: know your enemy

CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013

Software Code Protection Through Software Obfuscation

The programming language C. sws1 1

Code Obfuscation Literature Survey

Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C

EVALUATING METRICS AT CLASS AND METHOD LEVEL FOR JAVA PROGRAMS USING KNOWLEDGE BASED SYSTEMS

GPGPU Parallel Merge Sort Algorithm

Keil C51 Cross Compiler

Automated Virtual Cloud Management: The need of future

CS106A, Stanford Handout #38. Strings and Chars

C++FA 5.1 PRACTICE MID-TERM EXAM

An Introduction to Assembly Programming with the ARM 32-bit Processor Family

Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.

CS 111 Classes I 1. Software Organization View to this point:

PHP Tutorial From beginner to master

DATA OBFUSCATION. What is data obfuscation?

Semantic Analysis: Types and Type Checking

CSC Yearly Team Meeting

Moving from CS 61A Scheme to CS 61B Java

APPROACHES TO SOFTWARE TESTING PROGRAM VERIFICATION AND VALIDATION

MarshallSoft AES. (Advanced Encryption Standard) Reference Manual

5 Arrays and Pointers

Konzepte objektorientierter Programmierung

Platform Independent Code Obfuscation

Phys4051: C Lecture 2 & 3. Comment Statements. C Data Types. Functions (Review) Comment Statements Variables & Operators Branching Instructions

VB.NET Programming Fundamentals

Statements and Control Flow


High-Level Programming Languages. Nell Dale & John Lewis (adaptation by Michael Goldwasser)

Thomas Jefferson High School for Science and Technology Program of Studies Foundations of Computer Science. Unit of Study / Textbook Correlation

Lecture 22: C Programming 4 Embedded Systems

Chapter 7D The Java Virtual Machine

HTSQL is a comprehensive navigational query language for relational databases.

ASCII Encoding. The char Type. Manipulating Characters. Manipulating Characters

The Elective Part of the NSS ICT Curriculum D. Software Development

Quality Analysis with Metrics

Rake Task Management Essentials

Objects for lexical analysis

Part I. Multiple Choice Questions (2 points each):

A Test Suite for Basic CWE Effectiveness. Paul E. Black.

Bachelors of Computer Application Programming Principle & Algorithm (BCA-S102T)

An Incomplete C++ Primer. University of Wyoming MA 5310

Ch 7-1. Object-Oriented Programming and Classes

How To Manage A Network Infrastructure

CHAPTER 5. Obfuscation is a process of converting original data into unintelligible data. It

VIRTUAL LABORATORY: MULTI-STYLE CODE EDITOR

INTERNATIONAL JOURNAL OF PURE AND APPLIED RESEARCH IN ENGINEERING AND TECHNOLOGY

Chapter 9: Building Bigger Programs

Sources: On the Web: Slides will be available on:

Positional Numbering System

Introduction to Data Structures

Parallelization: Binary Tree Traversal

Computer Programming I

J a v a Quiz (Unit 3, Test 0 Practice)

Research Paper. (Received 25 August 2009; Accepted 31 December 2009) 1. Introduction

Parsing Technology and its role in Legacy Modernization. A Metaware White Paper

Compiling Object Oriented Languages. What is an Object-Oriented Programming Language? Implementation: Dynamic Binding

C Compiler Targeting the Java Virtual Machine

Tufts University. Department of Computer Science. COMP 116 Introduction to Computer Security Fall 2014 Final Project. Guocui Gao

Channel Access Client Programming. Andrew Johnson Computer Scientist, AES-SSG

Compiler Construction

Help on the Embedded Software Block

WORKFLOW ENGINE FOR CLOUDS

Basic Programming and PC Skills: Basic Programming and PC Skills:

Copyright 2001, Bill Trudell. Permission is granted to copy for the PLoP 2001 conference. All other rights reserved.

GCE. Computing. Mark Scheme for January Advanced Subsidiary GCE Unit F452: Programming Techniques and Logical Methods

Semantic Description of Distributed Business Processes

Java Application Developer Certificate Program Competencies

Security and Privacy in Cloud Computing

Obfuscation by Partial Evaluation of Distorted Interpreters

CSC Software II: Principles of Programming Languages

Software Reverse Engineering

Transcription:

Using Evolutionary Algorithms to obfuscate code Benoît Bertholon 1, Sébastien Varrette 2 et Pascal Bouvry 2 1 Security and Trust (SnT) interdisciplinary center, 2 Computer Science and Communication (CSC) Research Unit University of Luxembourg, Luxembourg 1 / 23

Outline 1 Context et Motivations 2 Obfuscation 3 Evolutionary algorithms to obfuscate code 2 / 23

Outline 1 Context et Motivations 2 Obfuscation 3 Evolutionary algorithms to obfuscate code 2 / 23

Context: Cloud Computing paradigm Basic idea of the Cloud Computing paradigm to outsource computing services, to use a service without knowing the infrastructure, different types of Cloud: SaaS, PaaS, IaaS. 3 / 23

Context: Cloud Computing paradigm Security issues in Cloud Computing Confidentiality of the user s data... Potential disclosure of the user algorithms. How to hide information in the software Obfuscation 4 / 23

Outline 1 Context et Motivations 2 Obfuscation 3 Evolutionary algorithms to obfuscate code 4 / 23

Obfuscation Before #i n c l u d e <s t d i o. h> #i n c l u d e <s t d l i b. h> i n t main ( i n t argc, char a r g v [ ] ) { p r i n t f ( " Hello world \n" ) ; } 5 / 23

After Obfuscation #i n c l u d e <s t d i o. h> #i n c l u d e <s t d l i b. h> #i n c l u d e <unistd. h> #i n c l u d e <s y s / time. h> #i n c l u d e <s i g n a l. h> #d e f i n e m( b ) a=b ; z= a ; w h i l e( ++a ){ y= a ; a=z ; z=y ;} #d e f i n e h ( u )G=u<<3; p r i n t f ( "\e[% uq", l [ u ] ) #d e f i n e c ( n, s ) case n : s ; c o n t i n u e char x []= " (((((((((((((((((((((( ",w[]= "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b" ; char r []={92,124,47}, l []={2,3,1, 0 } ; char T[]={ " ", " ", " %\\ /% ", " %%% ", "" }; char d=1,p=40,o=40,k=0, a, y, z, g= 1,G, X, P=&T [ 4 ], f =0; unsigned i n t s =0; v o i d u ( i n t i ){ i n t n ; p r i n t f ( " \233;% uh \233 L%c \233;% uh%c \233;% uh%s \23322;% uh@ \23323;% uh \n", x w, r [ d ], x+ w, r [ d ], X, P, p+=k, o ) ; i f ( abs ( p x [21]) >=w [ 2 1 ] ) e x i t ( 0 ) ; i f ( g!=g){ s t r u c t i t i m e r v a l t= { 0, 0, 0, 0 } ; g+=((g<g)<<1) 1; t. i t i n t e r v a l. t v u s e c=t. i t v a l u e. t v u s e c =72000/(( g>> 3)+1); s e t i t i m e r (0,& t, 0 ) ; f&&p r i n t f ( "\e [10;% u]", g +24);} f&&p u t c h a r ( 7 ) ; s+=(9 w [ 2 1 ] ) ( ( g>>3)+1);o=p ;m( x ) ;m(w ) ; ( n=rand ())&255 w ++ w ; i f (!( P&&P++ n&7936)){ w h i l e ( abs ( (X=rand ()%76) x+2) w<6);++x ; P=T; } ( n=rand ()&31)<3&&(d=n ) ;! d&& x<= w&&(++ x,++d ) d==2&&++ x+ w>79&&( x, d ) ; s i g n a l ( i, u ) ; } v o i d e (){ s i g n a l ( 1 4, SIG IGN ) ; p r i n t f ( "\e[0q\ ecscore : %u\n", s ) ; system ( " stty echo -cbreak " ) ; } i n t main ( i n t C, char V){ a t e x i t ( e ) ; ( C<2 V[1]!=113)&&( f =(C= ( i n t ) g e t e n v ( " TERM "))==( i n t )0 x756e696c C==( i n t )0 x6c696e75 ) ; s r a n d ( g e t p i d ( ) ) ; system ( " stty -echo cbreak " ) ; h ( 0 ) ; u ( 1 4 ) ; f o r ( ; ; ) s w i t c h ( g e t c h a r ( ) ) { case 1 1 3 : r e t u r n 0 ; case 9 1 : case 9 8 : c ( 4 4, k = 1); case 3 2 : case 1 1 0 : c ( 4 6, k =0); case 9 3 : case 1 0 9 : c ( 4 7, k =1); c ( 4 9, h ( 0 ) ) ; c ( 5 0, h (1 ) ) ; c ( 5 1, h ( 2 ) ) ; c ( 5 2, h ( 3 ) ) ; } } 6 / 23

BrainFuck Hello World ++++++++++[>+++++++>++++++++++>+++>+<<<< ] >++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++...>+.>. Syntax < pointer move left > pointer move right + add 1 to the data at the position of the pointer - sub 1 to the data at the position of the pointer [ begin of the while statement ] end of the while statement. output the value of the pointer, input the value of the pointer 7 / 23

Definitions Definition (Obfuscation) Transformation of a program P into a obfuscated program P with the following attributes: 2 Levels P has the same behavior that P. P should be harder to understand. Source to Source Obfuscation binary Obfuscation 8 / 23

Definitions Definition (Resilience) The Transformation Resilience is the addition of the two measures: the programmer effort. deobfuscator effort. Definition (Cost) The Transformation Cost is the extra execution time and space of P compared to P 9 / 23

Obfuscation is impossible Barak et al. [Barak01] Obfuscation proven impossible Virtual Black-box impossible. End of the story? Time limited Black-Box [Hohl98] Guarantee the black box property for a limited time. Same as in RSA or ECC 10 / 23

Metrics 1/2 Metrics 1 Program Length: number of operators & operands in P[Halstead77]. 2 Cyclomatic Complexity: number of predicates in F [McCabe76]. 3 Nesting Complexity: nesting level of conditionals in F [Harrison81]. 4 Data Flow Complexity: number of inter-basic block variable references in P [Oviedo80]. 5 Fan-in/out Complexity: number of formal parameters to F, and number of global data structures read or updated by F [Henry81]. 11 / 23

Metrics 2/2 Metrics 6 Data Structure Complexity: number of dimension and type in an array [Munson93]. 7 OO (Object Oriented) Metric: number of methods in C the distance from the root of C the number of direct subclasses of C the number of other classes to which C is couple the number of methods that can be executed in response to a message sent to an object of C [Chidamber94]. 12 / 23

Some transformation s examples Some transformation s examples µ 1 Program Length Insert Dead code µ 2 Cyclomatic Complexity Parallelize code µ 3 Nesting Complexity Extend loop condition µ 4 Data Flow Complexity Change variable lifttime µ 5 Fan-in/out Complexity Interleaving methodes µ 6 Data Structure Complexity Split Array µ 7 OO (Object Oriented) Insert Bogus Classes 13 / 23

Some examples µ 3 Nesting Complexity Extend loop condition i =1; w h i l e ( i <100){... i ++; } i =1; j =100 w h i l e ( ( i <100) && ( j j ( j +1) ( j +1) %4 == 0)){... i ++; } µ 4 Data Flow Complexity Change variable lifetime v o i d f (... ) { i n t i ;.... i.... ; } v o i d g (... ) { i n t k ;.... k.... ; } i n t C : v o i d f (... ) {.... C.... ; } v o i d g (... ) {.... C.... ; } 14 / 23

Some examples µ 5 Fan-in/out Complexity Interleaving methodes v o i d f 1 ( i n t a, i n t b ) {S1 ;} v o i d f 2 ( i n t a, i n t b ) {S2 ;} i n t main (){ i n t a, b, c ;.. f 1 ( a, b ) ; f 2 ( a, c ) ; } v o i d f 1 ( i n t a, i n t b, i n t v ) { i f ( v == p ) {S1 ;} e l s e {S2 ;} } i n t main (){ i n t a, b, c ;.. f ( a, b, v=p ) ; f ( a, c, v=q ) ; } 15 / 23

Some examples µ 6 Data Structure Complexity Split Array i n t i ;... A [ i ] i n t i ;... i f ( ( i %2) ) A2 [ i / 2 ] ; e l s e A1 [ i / 2 ] ; 16 / 23

Low Level Obfuscation [Linn03] Idea Assembler instruction doesn t have the same length. 17 / 23

Collberg Obfuscation Algorithm Main Obfuscation Algorithm[Collberg97] While not done(program): Select Code Select transformation Apply the transformation to the selected code. End While 18 / 23

Outline 1 Context et Motivations 2 Obfuscation 3 Evolutionary algorithms to obfuscate code 18 / 23

Using Evolutionary Algorithm for Obfuscation purposes Idea 19 / 23

PIPS: Automatic Parallelizer and Code Transformation Framework [http://cri.ensmp.fr/pips/] PIPS as a source2source compiler 20 / 23

PIPS: Automatic Parallelizer and Code Transformation Framework [http://cri.ensmp.fr/pips/] PIPS as a source2source compiler Transformation of C code, Using Existing Transformation and evaluate them. PYPS: Python binding. Issues Implementation of the transformations. Definition of a valid metric. 21 / 23

Work in Progress Work in Progress Definition of a representative metric. Extend Collberg s work. EA as a tool to obfuscate code. Multi-objective Optimizations based on µ 1...µ 7 22 / 23

Merci pour votre attention... Questions? 23 / 23