+ All Categories
Home > Documents > Static Analysis of Executables to ... - Cornell University

Static Analysis of Executables to ... - Cornell University

Date post: 01-Jan-2022
Category:
Upload: others
View: 6 times
Download: 0 times
Share this document with a friend
30
Static Analysis of Executables to Detect Malicious Patterns Mihai Christodorescu Somesh Jha CS @ University of Wisconsin, Madison [12 th USENIX Security Symposium, 2003] Presented by K. Vikram Cornell University
Transcript
Page 1: Static Analysis of Executables to ... - Cornell University

Static Analysis of Executablesto Detect Malicious Patterns

Mihai ChristodorescuSomesh Jha

CS @ University of Wisconsin, Madison

[12th USENIX Security Symposium, 2003]

Presented by K. VikramCornell University

Page 2: Static Analysis of Executables to ... - Cornell University

Problem & Motivation…

�Malicious code is … malicious�Categorize: Propagation Method & Goal�Viruses, worms, trojan horses, spyware, etc.

�Detect Malicious Code�In executables

Page 3: Static Analysis of Executables to ... - Cornell University

The Classical Stuff

�Focus mostly on Viruses�Code to replicate itself + Malicious payload�Inserted into executables

�Look for signatures�Not always enough�Obfuscation-Deobfuscation Game

Page 4: Static Analysis of Executables to ... - Cornell University

Common Obfuscation Techniques

�Encryption�Dead Code insertion*�Code transposition*� Instruction Substitution*�Register reassignment*�Code Integration�Entry Point Obscuring

Page 5: Static Analysis of Executables to ... - Cornell University

Common Deobfuscation Techniques

�Regular Expressions�Heuristic Analyses�Emulation

Mostly Syntactic…

Page 6: Static Analysis of Executables to ... - Cornell University

The Game

�Signatures�Regex Signatures�Emulation/Heuristics�?�?

�Vanilla Virus�Register Renaming�Packing/Encryption�Code Reordering�Code Integration

Page 7: Static Analysis of Executables to ... - Cornell University

Current Technology

�Antivirus Software�Norton, McAfee, Command

�Brittle�Cannot detect simple obfuscations�nop-insertion, code transposition

�Chernobyl, z0mbie-6.b, f0sf0r0, Hare

Page 8: Static Analysis of Executables to ... - Cornell University

Theoretical Limits

�Virus Detection is undecidable�Some Static Analyses are undecidable�But, Obfuscation is also hard

Page 9: Static Analysis of Executables to ... - Cornell University

The SAFE* Methodology

Page 10: Static Analysis of Executables to ... - Cornell University

Procedure

�Key Ideas:�Analyze program’s semantic structure�Use existing static analyses (extensible)�Use uninterpreted symbols

�Abstract Representation of Malicious Code�Abstract Representation of Executable�Deobfuscation

�Detect presence of malicious code

Page 11: Static Analysis of Executables to ... - Cornell University

The Annotator

� Inputs:�CFG of the executable�Library of Abstraction Patterns

�Outputs:�Annotated CFG

Page 12: Static Analysis of Executables to ... - Cornell University

Some groundwork

� Instruction I : τ1 × … × τk → τ�Program P : 〈 I1, …, IN 〉�Program counter/point�pc : { I1, …, IN } → [1,…,N]�pc(Ij) = j, ∀ 1 � j � N

�Basic Block, Control Flow Graph*�Static Analysis Predicates�Types for data and instructions

Page 13: Static Analysis of Executables to ... - Cornell University

Example Predicates

Page 14: Static Analysis of Executables to ... - Cornell University

Abstraction Patterns

�Abstraction pattern Γ : (V,O,C)�V = { x1 : τ1, …, xk : τk }�O = 〈 I(v1, …, vm) | I : τ1 × … × τm → τ 〉�C = boolean expression involving static analysis

predicates and logical operators

�Represents a deobfuscation�Predicate controls pattern application�Unify patterns with sequence of instructions

Page 15: Static Analysis of Executables to ... - Cornell University

Example of a pattern

Page 16: Static Analysis of Executables to ... - Cornell University

Defeating Garbage Insertion

<instruction A><instruction B>

<instruction A>add ebx, 1sub ebx, 1nop<instruction B>

Pattern:

instr 1…instr NWhereDelta(state pre 1, state post N) = 0

Page 17: Static Analysis of Executables to ... - Cornell University

Defeating Code-reordering

Pattern:jmp TARGETwhereCount (CFGPredecessors(TARGET)) = 1

Page 18: Static Analysis of Executables to ... - Cornell University

The Annotator

�Given set of patterns Σ = { Γ1, …, Γm }�Given a node n for program point p�Matches each pattern in Σ with〈 …, Previous2(Ip), Previous(Ip), Ip 〉�Associates all patterns that match with n�Also stores the bindings from unification

Page 19: Static Analysis of Executables to ... - Cornell University

The Detector

� Inputs:�Annotated CFG for a procedure�Malicious code representation

�Output:�Sequence of instructions exhibiting the

malicious pattern

Page 20: Static Analysis of Executables to ... - Cornell University

Malicious Code Automaton

�Abstraction of the vanilla virus

�6-tuple (V,Σ,S,δ,S0,F)�V = { v1:τ1, …, vk:τk }�Σ = { Γ1, …, Γn }�S = finite set of states�δ : S × Σ → 2S is a transition function�S0 ⊆ S is a non-empty set of initial states�F ⊆ S is a non-empty set of final states

Page 21: Static Analysis of Executables to ... - Cornell University

Malicious Code

Page 22: Static Analysis of Executables to ... - Cornell University
Page 23: Static Analysis of Executables to ... - Cornell University

Detector Operation

� Inputs:�CFG PΣ

� A = (V,Σ,S,δ,S0,F)

�Determines whether the same (malicious) pattern occurs both in A and Σ�More formally, tests the emptiness of

L(PΣ) ∩ (∪B ∈ BAllL(B (A)) )

Page 24: Static Analysis of Executables to ... - Cornell University

Detector Algorithm

�Dataflow-like Algorithm�Maintain a pre and post list at each node

of the CFG PΣ

�List is of [s,Bs], s is a state in A�Join operation is union

Page 25: Static Analysis of Executables to ... - Cornell University

Detector Algorithm

�Transfer Function:

�Return:

Page 26: Static Analysis of Executables to ... - Cornell University

Defenses Against…

�Code Re-ordering�Register Renaming� Insertion of irrelevant code�nops*, code that modifies dead registers�Needs live-range and pointer analyses

Page 27: Static Analysis of Executables to ... - Cornell University

Experimental Results

�False Positive Rate : 0�False Negative Rate : 0�not all obfuscations are detected

Page 28: Static Analysis of Executables to ... - Cornell University

Performance

Page 29: Static Analysis of Executables to ... - Cornell University

Future Directions

�New languages�Scripts – VB, JavaScript, ASP�Multi-language malicious code

�Attack Diversity�worms, trojans too

� Irrelevant sequence detection�Theorem provers

�Use TAL/external type annotations

Page 30: Static Analysis of Executables to ... - Cornell University

Pitfalls/Criticisms?

� Focus on viruses instead of worms� Still fairly Ad-hoc� Treatment of obfuscation is not formal enough� Intractable techniques�Use of theorem provers to find irrelevant code

� Slow� No downloadable code� Not enough experimental evaluation


Recommended