Binary Obfuscation from the Top Down. How to make your compiler do your dirty work.
|
|
|
- Brendan Phelps
- 10 years ago
- Views:
Transcription
1 from the Top Down How to make your compiler do your dirty work.
2 Why Top Down? Assembly, while simple, is tedious. It s easier for us to write higher-level code. Some of us. Why do it by hand when you can be lazy?
3 What s the purpose of obfuscation? To waste time. To intimidate. To be a total jerk.
4 What tools will be used? C and C++ MSVC++ for compilation (sorry)
5 What will not be covered? Anti-debug Source obfuscation where it does not relate to binary transformations Obfuscation effectiveness Post-compilation obfuscation
6 Important Basics Hopefully we can get through this really quickly.
7 Fun With Pointers car cdr cadr cdar cdadr cdddr caar caaar caaaar caaaaaar
8 Function Pointers Like string-format vulnerabilities, function pointers are ancient Voodoo. I honestly don t know who thought these were a good idea, but I freakin love em. See src/funcptr.c
9 Function Pointers int foo (void) { return 949; } int bar (void) { int (*fooptr)(void); fooptr = foo; return fooptr(); }
10 Method Pointers Abuse of method pointers would probably make Bjarne Stroustrup really angry. There is also one thing uglier than function pointers. That s method pointers. See src/methodptr.cpp
11 Method Pointers int MyClass::foo(void) { return 310; } int bar (void) { MyClass baz; int (MyClass::*fooPtr)(void); fooptr = &MyClass::foo; return (MyClass.*baz)fooPtr(); }
12 Calling Conventions I really want to write a clever pun about payphones and DEFCON, but I just can t.
13 Calling Conventions When making a function call, there are a few ways to do it: stdcall cdecl fastcall thiscall
14 Calling Conventions stdcall Push arguments onto stack Called function pops from stack Cleans up its own mess.
15 Calling Conventions cdecl Push arguments onto stack Called function pops from stack Called function cleans up the mess
16 Calling Conventions fastcall First two arguments less than a DWORD moved into ecx and edx respectively Rest are pushed onto the stack Called function pops from the stack Called function cleans up the mess
17 Calling Conventions thiscall Used when a function within a class object is called this pointer moved into ecx Function arguments pushed onto stack Called function pops from stack Cleans up its own mess
18 Compiler Optimizations The Dragon Book: Not Just for Furries Anymore
19 Compiler Optimizations Control-flow analysis Variable analysis Reach-of-use The volatile keyword
20 Compiler Optimizations At compile time, your code is separated into multiple blocks. A block consists of code separated by conditional (e.g. JLE, JNE, etc.) and unconditional jumps (e.g. CALL and JMP). How this code is organized and how the jumps occur affects the optimization of the program.
21 Compiler Optimizations MOV EAX,949 XOR EAX,310 CMP EAX,0 JNE z0r z0r: XOR EAX,310 PUSH EAX XOR EAX,949 LEAVE RETN
22 Compiler Optimizations MOV EAX,949 XOR EAX,310 CMP EAX,0 lol lemme fix this JNE z0r z0r: XOR EAX,310 PUSH EAX XOR EAX,949 LEAVE RETN
23 Compiler Optimizations MOV EAX,949 XOR EAX,310 XOR EAX,310 PUSH EAX
24 Compiler Optimizations The compiler also looks at your variables to make sure you re not doing anything repetitive or inconsequential. Algorithms like the directed acyclic graph (DAG) algorithm and static variable analysis make sure memory and math are fully optimized.
25 Compiler Optimizations MOV EAX,949 XOR EAX,310 XOR EAX,310 PUSH EAX
26 Compiler Optimizations MOV EAX,949 XOR EAX,310 XOR EAX,310 PUSH EAX lol seriously?
27 Compiler Optimizations MOV EAX,949 PUSH EAX
28 Compiler Optimizations MOV EAX,949 XOR EAX,310 CMP EAX,0 JNE z0r MOV EAX,949 PUSH EAX z0r: XOR EAX,310 PUSH EAX XOR EAX,949 LEAVE RETN
29 Compiler Optimizations Your compiler is a neat-freak. If the compiler notices it doesn t need a variable anymore, it s just going to get rid of it, no matter what else you do to it.
30 Compiler Optimizations MOV EAX,949 MOV EBX,310 MOV ECX,213 XOR EAX,EBX ADD EBX,EAX SUB EAX,EAX PUSH EBX PUSH EAX
31 Compiler Optimizations MOV EAX,949 MOV EBX,310 MOV ECX,213 XOR EAX,EBX ADD EBX,EAX SUB EAX,EAX PUSH EBX PUSH EAX
32 Compiler Optimizations MOV EAX,949 MOV EBX,310 XOR EAX,EBX ADD EBX,EAX SUB EAX,EAX PUSH EBX PUSH EAX
33 Compiler Optimizations There exist cases (mostly in hardware development) where you do NOT want your compiler to optimize your variable. This is where the volatile keyword comes in. Making your variable volatile tells the compiler not to do any optimizations to it.
34 Compiler Optimizations volatile int foo; volatile char bar; volatile uint32_t baz;
35 Compiler Optimizations int x; x = 7; x <<= 2; x *= 2; x -= 12; x += (x*x)<<2; printf("%d\n", x);
36 Compiler Optimizations int x; x = 7; x <<= 2; x *= 2; x -= 12; x += (x*x)<<2; printf("%d\n", x); PUSH 1E6C PUSH %d\n CALL $PRINTF
37 Compiler Optimizations volatile int x; x = 7; x <<= 2; x *= 2; x -= 12; x += (x*x)<<2; printf("%d\n", x);
38 Compiler Optimizations volatile int x; x = 7; x <<= 2; x *= 2; x -= 12; x += (x*x)<<2; printf("%d\n", x); MOV [ESP],7 SHL [ESP],2 MOV EAX,[ESP] ADD EAX,EAX MOV [ESP],EAX ADD [ESP],-0C MOV ECX,[ESP] MOV EDX,[ESP] MOV EAX,[ESP] IMUL ECX,EDX...
39 Binary Formats Everything is a file.
40 Binary Formats The most common formats you ll likely come across are the PE file format (Windows) and the ELF format (Linux). Both of these formats have a table they use for external library calls such as printf, execv, etc. For Windows it s called the IAT. For Linux it s the PLT.
41 Binary Formats If you obfuscate function pointers, they will likely not show up in those lists and therefore cause your library calls to fail. Circumventing this issue will be covered later.
42 Methods of Analysis Know your opponent!
43 Methods of Analysis Someone can easily figure out the gist of what your program is doing by analyzing any of the API calls you make. There exist a few programs out there that already do this for you: VirusTotal and ZeroWine.
44 Methods of Analysis VirusTotal (virustotal.com) is a website that allows you to upload suspected malware files and analyze them against over thirty different scanners. At the end of the analysis is a list of all recognized Windows API calls made by the program, as well as various data sections within.
45 Methods of Analysis ZeroWine (zerowine.sourceforge.net) is a malware analysis tool that executes a program in a controlled environment and collects data. This, too, collects and reports on API calls made by the program, as well as any possible servers it may have contacted or files it may have written.
46 Methods of Analysis When analyzing a binary, there are two schools of analysis: live-code and deadcode. Dead-code is exactly how it sounds: you look at the binary, as-is, without executing. Live-code is the opposite: you run the program and watch what it does.
47 Methods of Analysis VirusTotal employs dead-code analysis. It simply reads the binaries uploaded to it, scans it with various virus scanners and reports. ZeroWine, however, employs live-code analysis. It runs the suspected program in a controlled environment and watches what happens.
48 Methods of Analysis Dead-code analysis can be frustrated through polymorphism. Live-code analysis can be frustrated through hiding, obfuscating and redirecting data and control-flow under the eyes of the reverser.
49 Obfuscation We re almost at the fun part, I promise!
50 Obfuscation There are three separate classes of obfuscation. Layout Control-flow Data
51 Obfuscation Layout obfuscation essentially means scrambling the program around at the source-level. The International Obfuscated C Contest (ioccc.org) is a perfect example of this.
52 Obfuscation Anders Gavare, X=1024; Y=768; A=3; J=0;K=-10;L=-7;M=1296;N=36;O=255;P=9;_=1<<15;E;S;C;D;F(b){E="1""111886:6:??AAF" "31/531/53"[b ]-64;S=b<22?9:0;D=2;}I(x,Y,X){Y?(X^=Y,X*X>x?(X^=Y):0, I (x,y/2,x )):(E=X); }H(x){I(x, _,0);}p;q( c,x,y,z,k,l,m,a, b){f(c );x-=e*m ;y-=s*m ;z-=c*m ;b=x* x/m+ y*y/m+z *z/m-d*d *M;a=-x *k/m -y*l/m-z *m/m; p=((b=a*a/mb)>=0?(i (b*m,_,0),b =E, a+(a>b?-b:b)): -1.0);}Z;W;o (c,x,y, z,k,l, m,a){z=! c? -1:Z;c <44?(q(c,x,y,z,k, l,m,0,0 ),(p> 0&&c!= a&& (p<w Z<0) )?(W= p,z=c): 0,o(c+ 1, x,y,z, k,l, m,a)):0 ;}Q;T; U;u;v;w ;n(e,f,g, h,i,j,d,a, b,v){o(0,e,f,g,h,i,j,a);d>0 &&Z>=0? (e+=h*w/m,f+=i*w/m,g+=j*w/m,f(z),u=e-e*m,v=f-s*m,w=g-c*m,b=(-2*u-2*v+w) /3,H(u*u+v*v+w*w),b/=D,b*=b,b*=200,b/=(M*M),V=Z,E!=0?(u=-u*M/E,v=-v*M/E,w=-w*M/ E):0,E=(h*u+i*v+j*w)/M,h-=u*E/(M/2),i-=v*E/(M/2),j-=w*E/(M/2),n(e,f,g,h,i,j,d-1,Z,0,0),Q/=2,T/=2, U/=2,V=V<22?7: (V<30?1:(V<38?2:(V<44?4:(V==44?6:3)))),Q+=V&1?b:0,T +=V&2?b :0,U+=V &4?b:0) :(d==p?(g+=2,j=g>0?g/8:g/ 20):0,j >0?(U= j *j/m,q = *U/M,T= *U/M,U= *U/M):(U =j*j /M,U<M /5?(Q= *U /M,T= *U /M,U= * U/M):(U -=M/5,Q= *U /M,T= *U / M,U=111-85*U/M) ),d!=p?(q/=2,t/=2,u/=2):0);q=q< 0?0: Q>O? O: Q;T=T<0? 0:T>O?O:T;U=U<0?0: U>O?O:U;}R;G;B ;t(x,y,a, b){n(m*j+m *40*(A*x +a)/x/a-m*20,m*k,m *L-M*30*(A*y+b)/Y/A+M*15,0,M,0,P, -1,0,0);R+=Q ;G+=T;B +=U;++a<A?t(x,y,a, b):(++b<a?t(x,y,0,b):0);}r(x,y){r=g=b=0;t(x,y,0,0);x<x?(printf("%c%c%c",r/a/a,g /A/A,B/A/A),r(x+1,y)):0;}s(y){r(0,--y?s(y),y:y);}main(){printf("P6\n%i %i\n255" "\n",x,y);s(y);}
53 Obfuscation Control-flow obfuscation involves twisting the typical downward-flow of a program to into spaghetti code. It has the added benefit of obfuscating source while simultaneously upsetting the normal flow a reverse-engineer is used to.
54 Obfuscation Data obfuscation involves masking whatever data you have in your program by any means. Strings, numbers, even functions within your program can be masked, obfuscated, interwoven or encrypted without handwriting any assembly.
55 Obfuscation Techniques Now the fun begins.
56 Obfuscation Techniques The goal is to obfuscate the binary without doing binary transformations. We know how the compiler optimizes, what it does to our data and how it stores some information important for programmatic logic. With this in mind, we can now leverage our code against the compiler.
57 Obfuscation Techniques Layout obfuscation is essentially useless. Renaming variables, removing whitespace and using #define routines for functions typically has very little impact on the underlying program. Sure you can do layout obfuscation on your code, and some of it MAY translate to obfuscated code, but the signal-to-noise ratio is much too low for to be useful.
58 Control-Flow Obfuscation Turn that boring linear NOP sled into something worthy of Raging Waters.
59 Control-Flow Obfuscation With function pointers, method pointers, the volatile keyword and the goto keyword on our side, we can do some really fun stuff.
60 Control-Flow Obfuscation Opaque predicates are tautological IF statements. An opaque predicate cannot be optimized because the compiler cannot determine the outcome. You see this frequently in obfuscated JavaScript.
61 Control-Flow Obfuscation int a=7,b=2,c=8,d=9; if (a+b+c*d > 0) { puts( yes ); exit(0); } puts( no );
62 Control-Flow Obfuscation int a=7,b=2,c=8,d=9; if (a+b+c*d > 0) { puts( yes ); exit(0); } puts( no ); PUSH yes CALL $PUTS PUSH 0 CALL $EXIT
63 Control-Flow Obfuscation int a,b,c,d; srand(time(0)); a=rand()+1;b=rand()+1; c=rand()+1;d=rand()+1; if (a+b+c*d > 0) { puts( yes ); exit(0); } puts( no );
64 Control-Flow Obfuscation int a,b,c,d; srand(time(0)); a=rand()+1;b=rand()+1; c=rand()+1;d=rand()+1; if (a+b+c*d > 0) { puts( yes ); exit(0); } puts( no );... TEST EAX,EAX JLE SHORT :NO PUSH yes CALL $PUTS PUSH 0 CALL $EXIT NO: PUSH no CALL $PUTS
65 Control-Flow Obfuscation Control-flow flattening involves, quite literally, flattening the graphical representation of your program. Typically you have a top-down flow with program graphs. With flattening, you cause a central piece of code to control the flow of the program. Control-flow obfuscation is employed by bin/crackmes/leetkey.exe
66 Control-Flow Obfuscation Flattened: Normal:
67 Control-Flow Obfuscation
68 Control-Flow Obfuscation dothis(); dothat(); domore(); int x=2; sw: switch(x) { case 0: dothat(); x = 1; goto sw; case 1: domore(); break; case 2: dothis(); x = 0; goto sw; }
69 Control-Flow Obfuscation This technique of obfuscation can be applied very creatively. See src/cflow-flatlist.c and src/cflow-flattree.c
70 Control-Flow Obfuscation Most programs are reducible-- meaning they can easily be optimized. If a program is irreducible, then it cannot be optimized, thus translating spaghetti code into spaghetti assembly. A good example by Madou et. al. is making a loop irreducible. See src/cflow-irreducible.c
71 Control-Flow Obfuscation Raising bogus exceptions is a common way for malware to obfuscate and frustrate reverse engineering. This is easily accomplished by setting up a try block, intentionally triggering the exception, then resuming at the caught section. For Linux, you can do the same with signals. See src/cflow-exceptions.cpp
72 Control-Flow Obfuscation try { volatile int trigger=20; dothis(); dothat(); /* trigger divide-by-zero exception */ trigger=trigger/(trigger-trigger); neverexecutes(); } catch (...) { domore(); dotonsmore(); }
73 Data Obfuscation
74 Data Obfuscation Data obfuscation takes a little more care than control-flow obfuscation. The data must be obfuscated before the compilation process, then de-obfuscated at run-time. If the data is not obfuscated before runtime, dead-code analysis is made trivial and your obfuscation is useless.
75 Data Obfuscation One of the more obvious techniques is to encrypt your strings. Even though strings don t technically lead to knowledge of the program, it can help aide in reverse-engineering more often than you think.
76 Data Obfuscation Recall the explanation of volatile: volatile int x; x = 7; x <<= 2; x *= 2; x -= 12; x += (x*x)<<2; printf("%d\n", x); With enough annoyances, this can be used to frustrate analysis.
77 Data Obfuscation Data aggregation can be used to make dead-code analysis confusing. char aggr[7] = fboaor ; char foo[3], bar[3]; int i; for (i=0;i<3;++i) { } foo[i]=aggr[i*2]; bar[i]=aggr[i*2+1]; /* foo = foo / bar = bar */
78 Data Obfuscation Functions in the PLT/IAT are certainly considered data. To prevent dead-code analysis from discovering our library calls, we can easily create functions at run-time by using system calls such as LoadLibrary and GetProcAddress (Windows) and dlopen and dlsym (Linux). See src/data-loadlib.c, src/data-dlopen.c and src/mdl.cpp
79 Poor Man s Packer How to simulate a packer in a humorous manner.
80 Poor Man s Packer Combines control-flow and data obfuscation to cause all sorts of headaches. Revolves around compiling, copying data and applying function pointers to obfuscated or encrypted data. See bin/crackmes/manifest.exe If you have problems with this binary, ask a DC949 member what the group motto is.
81 Poor Man s Packer Compile Disassemble Copy bytes of function, make an array Apply encryption, aggregation, etc. Recompile Decipher at run-time Cast as function-pointer Execute See src/pmp-concept.c
82 Poor Man s Packer Problems Functions are broken because they are no longer in the PLT/IAT. Data offsets are completely messed up. Functions in C++ objects cause segmentation faults (due to broken thiscall). Compiler might change calling conventions. void pointers are scary.
83 Poor Man s Packer If you pass a data structure containing data required by the function (function offsets, strings, etc.), you can circumvent the issue caused by relative jumps and offsets. This also applies to method pointers and C++ objects. This gives you the opportunity to dynamically add and remove necessary program data as you see fit.
84 Poor Man s Packer Be sure your calling conventions match after each step of compilation and bytecopying! cdecl is the calling convention used by vararg functions such as printf. fastcall and stdcall should be fine for all other functions. Mismatched calling conventions will cause headaches and segmentation faults.
85 Poor Man s Packer Why is this beneficial? Ultimate control of all data Code is still portable and executable Adds a bizarre layer of obfuscation When done enough, severely obfuscates source
86 Poor Man s Packer Why does this suck? Makes binaries huge if you don t compress your functions due to enlarged data-sections Takes a lot of work to accomplish It can be extremely frustrating to craft the write code with the right keywords with full optimization
87 Additional Info Some stuff to help you out with obfuscation
88 Tools Code transformers TXL (txl.ca) SUIF (suif.standford.edu) TXL and SUIF are used to transform source-code by a certain set of given rules (such as regular expressions).
89 Sources M. Madou, B. Anckaert, B. De Bus, K. De Bosschere, J. Cappaert, and B. Preneel, "On the Effectiveness of Source Code Transformations for Binary Obfuscation" B. M. Prasad, T. Chiueh, "A Binary Rewriting Defense against Stack based Buffer Overflows" C. I. Popov, S. Debray, G. Andrews, "Binary Obfuscation Using Signals"
90 The End
TitanMist: Your First Step to Reversing Nirvana TitanMist. mist.reversinglabs.com
TitanMist: Your First Step to Reversing Nirvana TitanMist mist.reversinglabs.com Contents Introduction to TitanEngine.. 3 Introduction to TitanMist 4 Creating an unpacker for TitanMist.. 5 References and
Hacking Techniques & Intrusion Detection. Ali Al-Shemery arabnix [at] gmail
Hacking Techniques & Intrusion Detection Ali Al-Shemery arabnix [at] gmail All materials is licensed under a Creative Commons Share Alike license http://creativecommonsorg/licenses/by-sa/30/ # whoami Ali
CS412/CS413. Introduction to Compilers Tim Teitelbaum. Lecture 20: Stack Frames 7 March 08
CS412/CS413 Introduction to Compilers Tim Teitelbaum Lecture 20: Stack Frames 7 March 08 CS 412/413 Spring 2008 Introduction to Compilers 1 Where We Are Source code if (b == 0) a = b; Low-level IR code
Self Protection Techniques in Malware
DSIE 10 5 th Doctoral lsymposium on Informatics Engineering i January 28 29, 2010 Porto, Portugal Self Protection Techniques in Malware Tiago Santos Overview Introduction Malware Types Why Self Protection?
Return-oriented programming without returns
Faculty of Computer Science Institute for System Architecture, Operating Systems Group Return-oriented programming without urns S. Checkoway, L. Davi, A. Dmitrienko, A. Sadeghi, H. Shacham, M. Winandy
Introduction. Application Security. Reasons For Reverse Engineering. This lecture. Java Byte Code
Introduction Application Security Tom Chothia Computer Security, Lecture 16 Compiled code is really just data which can be edit and inspected. By examining low level code protections can be removed and
REpsych. : psycholigical warfare in reverse engineering. def con 2015 // domas
REpsych : psycholigical warfare in reverse engineering { def con 2015 // domas Warning This serves no purpose Taking something apart to figure out how it works With software Interfacing Documentation Obsolescence
Attacking Obfuscated Code with IDA Pro. Chris Eagle
Attacking Obfuscated Code with IDA Pro Chris Eagle Outline Introduction Operation Demos Summary 2 First Order Of Business MOVE UP AND IN! There is plenty of room up front I can't increase the font size
Software Fingerprinting for Automated Malicious Code Analysis
Software Fingerprinting for Automated Malicious Code Analysis Philippe Charland Mission Critical Cyber Security Section October 25, 2012 Terms of Release: This document is approved for release to Defence
Introduction to Reverse Engineering
Introduction to Reverse Engineering Inbar Raz Malware Research Lab Manager December 2011 What is Reverse Engineering? Reverse engineering is the process of discovering the technological principles of a
Format string exploitation on windows Using Immunity Debugger / Python. By Abysssec Inc WwW.Abysssec.Com
Format string exploitation on windows Using Immunity Debugger / Python By Abysssec Inc WwW.Abysssec.Com For real beneficiary this post you should have few assembly knowledge and you should know about classic
X86-64 Architecture Guide
X86-64 Architecture Guide For the code-generation project, we shall expose you to a simplified version of the x86-64 platform. Example Consider the following Decaf program: class Program { int foo(int
Identification and Removal of
RIVERSIDE RESEARCH INSTITUTE Deobfuscator: An Automated Approach to the Identification and Removal of Code Obfuscation Ei Eric Laspe, Reverse Engineer Jason Raber, Lead Reverse Engineer Overview The Problem:
For a 64-bit system. I - Presentation Of The Shellcode
#How To Create Your Own Shellcode On Arch Linux? #Author : N3td3v!l #Contact-mail : [email protected] #Website : Nopotm.ir #Spcial tnx to : C0nn3ct0r And All Honest Hackerz and Security Managers I - Presentation
Obfuscation: know your enemy
Obfuscation: know your enemy Ninon EYROLLES [email protected] Serge GUELTON [email protected] Prelude Prelude Plan 1 Introduction What is obfuscation? 2 Control flow obfuscation 3 Data flow
Lecture 26: Obfuscation
Lecture 26: Obfuscation 15411: Compiler Design Robbie Harwood and Maxime Serrano 21 November 2013 1 Introduction We have previously (lecture 20) considered the problem of doing compilation backwards (i.e.,
Software Vulnerabilities
Software Vulnerabilities -- stack overflow Code based security Code based security discusses typical vulnerabilities made by programmers that can be exploited by miscreants Implementing safe software in
Off-by-One exploitation tutorial
Off-by-One exploitation tutorial By Saif El-Sherei www.elsherei.com Introduction: I decided to get a bit more into Linux exploitation, so I thought it would be nice if I document this as a good friend
64-Bit NASM Notes. Invoking 64-Bit NASM
64-Bit NASM Notes The transition from 32- to 64-bit architectures is no joke, as anyone who has wrestled with 32/64 bit incompatibilities will attest We note here some key differences between 32- and 64-bit
esrever gnireenigne tfosorcim seiranib
esrever gnireenigne tfosorcim seiranib Alexander Sotirov [email protected] CanSecWest / core06 Reverse Engineering Microsoft Binaries Alexander Sotirov [email protected] CanSecWest / core06 Overview
A Tiny Guide to Programming in 32-bit x86 Assembly Language
CS308, Spring 1999 A Tiny Guide to Programming in 32-bit x86 Assembly Language by Adam Ferrari, [email protected] (with changes by Alan Batson, [email protected] and Mike Lack, [email protected])
Abysssec Research. 1) Advisory information. 2) Vulnerable version
Abysssec Research 1) Advisory information Title Version Discovery Vendor Impact Contact Twitter CVE : Apple QuickTime FlashPix NumberOfTiles Remote Code Execution Vulnerability : QuickTime player 7.6.5
1. General function and functionality of the malware
1. General function and functionality of the malware The malware executes in a command shell, it begins by checking to see if the executing file contains the MZP file extension, and then continues to access
The Beast is Resting in Your Memory On Return-Oriented Programming Attacks and Mitigation Techniques To appear at USENIX Security & BlackHat USA, 2014
Intelligent Things, Vehicles and Factories: Intel Workshop on Cyberphysical and Mobile Security 2014, Darmstadt, June 11 The Beast is Resting in Your Memory On Return-Oriented Programming Attacks and Mitigation
Software Code Protection Through Software Obfuscation
Software Code Protection Through Software Obfuscation Presented by: Sabu Emmanuel, PhD School of Computer Engineering Nanyang Technological University, Singapore E-mail: [email protected] 20, Mar,
Code Obfuscation Literature Survey
Code Obfuscation Literature Survey Arini Balakrishnan, Chloe Schulze CS701 Construction of Compilers, Instructor: Charles Fischer Computer Sciences Department University of Wisconsin, Madison December
MPLAB TM C30 Managed PSV Pointers. Beta support included with MPLAB C30 V3.00
MPLAB TM C30 Managed PSV Pointers Beta support included with MPLAB C30 V3.00 Contents 1 Overview 2 1.1 Why Beta?.............................. 2 1.2 Other Sources of Reference..................... 2 2
Assembly Language: Function Calls" Jennifer Rexford!
Assembly Language: Function Calls" Jennifer Rexford! 1 Goals of this Lecture" Function call problems:! Calling and returning! Passing parameters! Storing local variables! Handling registers without interference!
Compiler Construction
Compiler Construction Lecture 1 - An Overview 2003 Robert M. Siegfried All rights reserved A few basic definitions Translate - v, a.to turn into one s own language or another. b. to transform or turn from
Buffer Overflows. Security 2011
Buffer Overflows Security 2011 Memory Organiza;on Topics Kernel organizes memory in pages Typically 4k bytes Processes operate in a Virtual Memory Space Mapped to real 4k pages Could live in RAM or be
How Compilers Work. by Walter Bright. Digital Mars
How Compilers Work by Walter Bright Digital Mars Compilers I've Built D programming language C++ C Javascript Java A.B.E.L Compiler Compilers Regex Lex Yacc Spirit Do only the easiest part Not very customizable
Violating Database - Enforced Security Mechanisms
Violating Database - Enforced Security Mechanisms Runtime Patching Exploits in SQL Server 2000: a case study Chris Anley [[email protected]] 18/06/2002 An NGSSoftware Insight Security Research (NISR)
Binary Code Extraction and Interface Identification for Security Applications
Binary Code Extraction and Interface Identification for Security Applications Juan Caballero Noah M. Johnson Stephen McCamant Dawn Song UC Berkeley Carnegie Mellon University Abstract Binary code reuse
INTRODUCTION TO MALWARE & MALWARE ANALYSIS
INTRODUCTION TO MALWARE & MALWARE ANALYSIS by Quick Heal R&D lab Security Simplified INTRODUCTION Very often people call everything that corrupts their system a virus without being aware about what it
Parasitics: The Next Generation. Vitaly Zaytsev Abhishek Karnik Joshua Phillips
Parasitics: The Next Generation. Vitaly Zaytsev Abhishek Karnik Joshua Phillips Agenda Overview W32/Xpaj analysis Overview of a virtual machine Software protection trends W32/Winemmem analysis W32/Induc
Hotpatching and the Rise of Third-Party Patches
Hotpatching and the Rise of Third-Party Patches Alexander Sotirov [email protected] BlackHat USA 2006 Overview In the next one hour, we will cover: Third-party security patches _ recent developments
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Instruction Set Architecture
CS:APP Chapter 4 Computer Architecture Instruction Set Architecture Randal E. Bryant adapted by Jason Fritts http://csapp.cs.cmu.edu CS:APP2e Hardware Architecture - using Y86 ISA For learning aspects
Habanero Extreme Scale Software Research Project
Habanero Extreme Scale Software Research Project Comp215: Java Method Dispatch Zoran Budimlić (Rice University) Always remember that you are absolutely unique. Just like everyone else. - Margaret Mead
Last Class: OS and Computer Architecture. Last Class: OS and Computer Architecture
Last Class: OS and Computer Architecture System bus Network card CPU, memory, I/O devices, network card, system bus Lecture 3, page 1 Last Class: OS and Computer Architecture OS Service Protection Interrupts
Removing Sentinel SuperPro dongle from Applications and details on dongle way of cracking Shub-Nigurrath of ARTeam Version 1.
Removing Sentinel SuperPro dongle from Applications Shub-Nigurrath of ARTeam Version 1.0 September 2006 1. Abstract... 2 2. Possible approaches: emulations vs simulation... 3 2.1. How a dongle works...
An Iteration Obfuscation Based on Instruction Fragment Diversification and Control Flow Randomization
An Iteration Obfuscation Based on Instruction Fragment Diversification and Control Flow Randomization Xin Xie, Fenlin Liu, Bin Lu, and Fei Xiang Abstract As the control flow graph can reflect the logic
Test Driven Development in Assembler a little story about growing software from nothing
Test Driven Development in Assembler a little story about growing software from nothing Olve Maudal During the last decade Test-Driven Development has become an established practice for developing software
Stitching the Gadgets On the Ineffectiveness of Coarse-Grained Control-Flow Integrity Protection
USENIX Security Symposium 2014, San Diego, CA, USA Stitching the Gadgets On the Ineffectiveness of Coarse-Grained Control-Flow Integrity Protection Lucas Davi Intel Collaborative Research Institute for
Sandy. The Malicious Exploit Analysis. http://exploit-analysis.com/ Static Analysis and Dynamic exploit analysis. Garage4Hackers
Sandy The Malicious Exploit Analysis. http://exploit-analysis.com/ Static Analysis and Dynamic exploit analysis About Me! I work as a Researcher for a Global Threat Research firm.! Spoke at the few security
Computer Organization and Architecture
Computer Organization and Architecture Chapter 11 Instruction Sets: Addressing Modes and Formats Instruction Set Design One goal of instruction set design is to minimize instruction length Another goal
Jorix kernel: real-time scheduling
Jorix kernel: real-time scheduling Joris Huizer Kwie Min Wong May 16, 2007 1 Introduction As a specialized part of the kernel, we implemented two real-time scheduling algorithms: RM (rate monotonic) and
Jonathan Worthington Scarborough Linux User Group
Jonathan Worthington Scarborough Linux User Group Introduction What does a Virtual Machine do? Hides away the details of the hardware platform and operating system. Defines a common set of instructions.
Stack Overflows. Mitchell Adair
Stack Overflows Mitchell Adair Outline Why? What? There once was a VM Virtual Memory Registers Stack stack1, stack2, stack3 Resources Why? Real problem Real money Real recognition Still prevalent Very
Reversing C++ Paul Vincent Sabanal. Mark Vincent Yason
As recent as a couple of years ago, reverse engineers can get by with just knowledge of C and assembly to reverse most applications. Now, due to the increasing use of C++ in malware as well as most moderns
GDB Tutorial. A Walkthrough with Examples. CMSC 212 - Spring 2009. Last modified March 22, 2009. GDB Tutorial
A Walkthrough with Examples CMSC 212 - Spring 2009 Last modified March 22, 2009 What is gdb? GNU Debugger A debugger for several languages, including C and C++ It allows you to inspect what the program
W4118 Operating Systems. Junfeng Yang
W4118 Operating Systems Junfeng Yang Outline Linux overview Interrupt in Linux System call in Linux What is Linux A modern, open-source OS, based on UNIX standards 1991, 0.1 MLOC, single developer Linus
Administration. Instruction scheduling. Modern processors. Examples. Simplified architecture model. CS 412 Introduction to Compilers
CS 4 Introduction to Compilers ndrew Myers Cornell University dministration Prelim tomorrow evening No class Wednesday P due in days Optional reading: Muchnick 7 Lecture : Instruction scheduling pr 0 Modern
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages. Nicki Dell Spring 2014
CSE 373: Data Structure & Algorithms Lecture 25: Programming Languages Nicki Dell Spring 2014 What is a Programming Language? A set of symbols and associated tools that translate (if necessary) collections
Hydra. Advanced x86 polymorphic engine. Incorporates existing techniques and introduces new ones in one package. All but one feature OS-independent
Hydra Advanced x86 polymorphic engine Incorporates existing techniques and introduces new ones in one package All but one feature OS-independent Random register operations Different synonymous instructions
CS61: Systems Programing and Machine Organization
CS61: Systems Programing and Machine Organization Fall 2009 Section Notes for Week 2 (September 14 th - 18 th ) Topics to be covered: I. Binary Basics II. Signed Numbers III. Architecture Overview IV.
CSC 2405: Computer Systems II
CSC 2405: Computer Systems II Spring 2013 (TR 8:30-9:45 in G86) Mirela Damian http://www.csc.villanova.edu/~mdamian/csc2405/ Introductions Mirela Damian Room 167A in the Mendel Science Building [email protected]
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
Harnessing Intelligence from Malware Repositories
Harnessing Intelligence from Malware Repositories Arun Lakhotia and Vivek Notani Software Research Lab University of Louisiana at Lafayette [email protected], [email protected] 7/22/2015 (C) 2015
The Plan Today... System Calls and API's Basics of OS design Virtual Machines
System Calls + The Plan Today... System Calls and API's Basics of OS design Virtual Machines System Calls System programs interact with the OS (and ultimately hardware) through system calls. Called when
Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives
Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,
Syscall Proxying - Simulating remote execution Maximiliano Caceres <[email protected]> Copyright 2002 CORE SECURITY TECHNOLOGIES
Syscall Proxying - Simulating remote execution Maximiliano Caceres Copyright 2002 CORE SECURITY TECHNOLOGIES Table of Contents Abstract.........................................................................................
Magento & Zend Benchmarks Version 1.2, 1.3 (with & without Flat Catalogs)
Magento & Zend Benchmarks Version 1.2, 1.3 (with & without Flat Catalogs) 1. Foreword Magento is a PHP/Zend application which intensively uses the CPU. Since version 1.1.6, each new version includes some
Title: Bugger The Debugger - Pre Interaction Debugger Code Execution
White Paper Title: Bugger The Debugger Pre Interaction Debugger Code Execution Prepared by: Brett Moore Network Intrusion Specialist, CTO SecurityAssessment.com Date: April 2005 Abstract The use of debuggers
Code Injection From the Hypervisor: Removing the need for in-guest agents. Matt Conover & Tzi-cker Chiueh Core Research Group, Symantec Research Labs
Code Injection From the Hypervisor: Removing the need for in-guest agents Matt Conover & Tzi-cker Chiueh Core Research Group, Symantec Research Labs SADE: SteAlthy Deployment and Execution Introduction
From Georgia, with Love Win32/Georbot. Is someone trying to spy on Georgians?
From Georgia, with Love Win32/Georbot Is someone trying to spy on Georgians? At the beginning of the year, a curious piece of malware came to our attention. An analyst in our virus laboratory noticed that
DATA OBFUSCATION. What is data obfuscation?
DATA OBFUSCATION What data obfuscation? Data obfuscations break the data structures used in the program and encrypt literals. Th method includes modifying inheritance relations, restructuring arrays, etc.
Platform-independent static binary code analysis using a metaassembly
Platform-independent static binary code analysis using a metaassembly language Thomas Dullien, Sebastian Porst zynamics GmbH CanSecWest 2009 Overview The REIL Language Abstract Interpretation MonoREIL
Automating Mimicry Attacks Using Static Binary Analysis
Automating Mimicry Attacks Using Static Binary Analysis Christopher Kruegel and Engin Kirda Technical University Vienna [email protected], [email protected] Darren Mutz, William Robertson,
Storm Worm & Botnet Analysis
Storm Worm & Botnet Analysis Jun Zhang Security Researcher, Websense Security Labs June 2008 Introduction This month, we caught a new Worm/Trojan sample on ours labs. This worm uses email and various phishing
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
C++FA 5.1 PRACTICE MID-TERM EXAM
C++FA 5.1 PRACTICE MID-TERM EXAM This practicemid-term exam covers sections C++FA 1.1 through C++FA 1.4 of C++ with Financial Applications by Ben Van Vliet, available at www.benvanvliet.net. 1.) A pointer
Unix Security Technologies. Pete Markowsky <peterm[at] ccs.neu.edu>
Unix Security Technologies Pete Markowsky What is this about? The goal of this CPU/SWS are: Introduce you to classic vulnerabilities Get you to understand security advisories Make
Lecture 27 C and Assembly
Ananda Gunawardena Lecture 27 C and Assembly This is a quick introduction to working with x86 assembly. Some of the instructions and register names must be check for latest commands and register names.
Heap-based Buffer Overflow Vulnerability in Adobe Flash Player
Analysis of Zero-Day Exploit_Issue 03 Heap-based Buffer Overflow Vulnerability in Adobe Flash Player CVE-2014-0556 20 December 2014 Table of Content Overview... 3 1. CVE-2014-0556 Vulnerability... 3 2.
Bypassing Anti- Virus Scanners
Bypassing Anti- Virus Scanners Abstract Anti-Virus manufacturers nowadays implements more and more complex functions and algorithms in order to detect the latest and newest viruses along with their variants.
language 1 (source) compiler language 2 (target) Figure 1: Compiling a program
CS 2112 Lecture 27 Interpreters, compilers, and the Java Virtual Machine 1 May 2012 Lecturer: Andrew Myers 1 Interpreters vs. compilers There are two strategies for obtaining runnable code from a program
UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming
UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything
COMPARISON OF OBJECT-ORIENTED AND PROCEDURE-BASED COMPUTER LANGUAGES: CASE STUDY OF C++ PROGRAMMING
COMPARISON OF OBJECT-ORIENTED AND PROCEDURE-BASED COMPUTER LANGUAGES: CASE STUDY OF C++ PROGRAMMING Kuan C. Chen, Ph.D. Assistant Professor Management Information Systems School of Management Purdue University
Fighting malware on your own
Fighting malware on your own Vitaliy Kamlyuk Senior Virus Analyst Kaspersky Lab [email protected] Why fight malware on your own? 5 reasons: 1. Touch 100% of protection yourself 2. Be prepared
5. Calling conventions for different C++ compilers and operating systems
5. Calling conventions for different C++ compilers and operating systems By Agner Fog. Technical University of Denmark. Copyright 2004-2014. Last updated 2014-08-07. Contents 1 Introduction... 3 2 The
Software security. Buffer overflow attacks SQL injections. Lecture 11 EIT060 Computer Security
Software security Buffer overflow attacks SQL injections Lecture 11 EIT060 Computer Security Buffer overflow attacks Buffer overrun is another common term Definition A condition at an interface under which
02 B The Java Virtual Machine
02 B The Java Virtual Machine CS1102S: Data Structures and Algorithms Martin Henz January 22, 2010 Generated on Friday 22 nd January, 2010, 09:46 CS1102S: Data Structures and Algorithms 02 B The Java Virtual
TO APPEAR IN: IEEE TRANSACTIONS ON DEPENDABLE AND SECURE COMPUTING 1. Proactive Detection of Computer Worms Using Model Checking
TO APPEAR IN: IEEE TRANSACTIONS ON DEPENDABLE AND SECURE COMPUTING 1 Proactive Detection of Computer Worms Using Model Checking Johannes Kinder, Stefan Katzenbeisser, Member, IEEE, Christian Schallhart,
風 水. Heap Feng Shui in JavaScript. Alexander Sotirov. [email protected]
風 水 Heap Feng Shui in JavaScript Alexander Sotirov [email protected] Black Hat Europe 2007 Introduction What is Heap Feng Shui? the ancient art of arranging heap blocks in order to redirect the program
A Museum of API Obfuscation on Win32
A Museum of API Obfuscation on Win32 Masaki Suenaga Senior Software Engineer Contents Abstract... 1 File Image vs. Memory Image... 2 API Analysis... 4 Generating Memory Dumps... 5 Runtime API Address Resolution...
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
Instruction Set Architecture
Instruction Set Architecture Consider x := y+z. (x, y, z are memory variables) 1-address instructions 2-address instructions LOAD y (r :=y) ADD y,z (y := y+z) ADD z (r:=r+z) MOVE x,y (x := y) STORE x (x:=r)
http://www.nologin.org Bypassing Windows Hardware-enforced Data Execution Prevention
http://www.nologin.org Bypassing Windows Hardware-enforced Data Execution Prevention Oct 2, 2005 skape [email protected] Skywing [email protected] One of the big changes that Microsoft introduced
Fine-grained covert debugging using hypervisors and analysis via visualization
Reverse Engineering by Crayon: Game Changing Hypervisor and Visualization Analysis Fine-grained covert debugging using hypervisors and analysis via visualization Daniel A. Quist Lorie M. Liebrock Offensive
Cost Model: Work, Span and Parallelism. 1 The RAM model for sequential computation:
CSE341T 08/31/2015 Lecture 3 Cost Model: Work, Span and Parallelism In this lecture, we will look at how one analyze a parallel program written using Cilk Plus. When we analyze the cost of an algorithm
Where s the FEEB? The Effectiveness of Instruction Set Randomization
Where s the FEEB? The Effectiveness of Instruction Set Randomization Ana Nora Sovarel David Evans Nathanael Paul University of Virginia, Department of Computer Science http://www.cs.virginia.edu/feeb Abstract
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
x64 Cheat Sheet Fall 2015
CS 33 Intro Computer Systems Doeppner x64 Cheat Sheet Fall 2015 1 x64 Registers x64 assembly code uses sixteen 64-bit registers. Additionally, the lower bytes of some of these registers may be accessed
