static analysis of executables to detect malicious
play

Static Analysis of Executables to Detect Malicious Patterns [12 th - PowerPoint PPT Presentation

Static Analysis of Executables to Detect Malicious Patterns [12 th USENIX Security Symposium, 2003] Mihai Christodorescu Somesh Jha CS @ University of Wisconsin, Madison Presented by K. Vikram Cornell University Problem & Motivation


  1. Static Analysis of Executables to Detect Malicious Patterns [12 th USENIX Security Symposium, 2003] Mihai Christodorescu Somesh Jha CS @ University of Wisconsin, Madison Presented by K. Vikram Cornell University

  2. Problem & Motivation… � Malicious code is … malicious � Categorize: Propagation Method & Goal � Viruses, worms, trojan horses, spyware, etc. � Detect Malicious Code � In executables

  3. 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

  4. Common Obfuscation Techniques � Encryption � Dead Code insertion* � Code transposition* � Instruction Substitution* � Register reassignment* � Code Integration � Entry Point Obscuring

  5. Common Deobfuscation Techniques � Regular Expressions � Heuristic Analyses � Emulation Mostly Syntactic…

  6. The Game � Vanilla Virus � Signatures � Register Renaming � Regex Signatures � Packing/Encryption � Emulation/Heuristics � Code Reordering � ? � Code Integration � ?

  7. Current Technology � Antivirus Software � Norton, McAfee, Command � Brittle � Cannot detect simple obfuscations � nop-insertion, code transposition � Chernobyl, z0mbie-6.b, f0sf0r0, Hare

  8. Theoretical Limits � Virus Detection is undecidable � Some Static Analyses are undecidable � But, Obfuscation is also hard

  9. The SAFE* Methodology

  10. 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

  11. The Annotator � Inputs: � CFG of the executable � Library of Abstraction Patterns � Outputs: � Annotated CFG

  12. Some groundwork � Instruction I : τ 1 × … × τ k → τ � Program P : � I 1 , …, I N � � Program counter/point � pc : { I 1 , …, I N } → [1,…,N] � pc(I j ) = j, ∀ 1 � j � N � Basic Block, Control Flow Graph* � Static Analysis Predicates � Types for data and instructions

  13. Example Predicates

  14. Abstraction Patterns � Abstraction pattern Γ : (V,O,C) � V = { x 1 : τ 1 , …, x k : τ k } � O = � I(v 1 , …, v m ) | 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

  15. Example of a pattern

  16. Defeating Garbage Insertion <instruction A> add ebx, 1 <instruction A> sub ebx, 1 <instruction B> nop <instruction B> instr 1 … Pattern: instr N Where Delta(state pre 1, state post N) = 0

  17. Defeating Code-reordering jmp TARGET Pattern: where Count (CFGPredecessors(TARGET)) = 1

  18. The Annotator � Given set of patterns Σ = { Γ 1 , …, Γ m } � Given a node n for program point p � Matches each pattern in Σ with � …, Previous 2 (I p ), Previous (I p ), I p � � Associates all patterns that match with n � Also stores the bindings from unification

  19. The Detector � Inputs: � Annotated CFG for a procedure � Malicious code representation � Output: � Sequence of instructions exhibiting the malicious pattern

  20. Malicious Code Automaton � Abstraction of the vanilla virus � 6-tuple (V, Σ ,S, δ ,S 0 ,F) � V = { v 1 : τ 1 , …, v k : τ k } � Σ = { Γ 1 , …, Γ n } � S = finite set of states � δ : S × Σ → 2 S is a transition function � S 0 ⊆ S is a non-empty set of initial states � F ⊆ S is a non-empty set of final states

  21. Malicious Code

  22. Detector Operation � Inputs: � CFG P Σ � A = (V, Σ ,S, δ ,S 0 ,F) � Determines whether the same (malicious) pattern occurs both in A and Σ � More formally, tests the emptiness of L(P Σ ) ∩ ( ∪ B ∈ B All L( B ( A )) )

  23. Detector Algorithm � Dataflow-like Algorithm � Maintain a pre and post list at each node of the CFG P Σ � List is of [s, B s ], s is a state in A � Join operation is union

  24. Detector Algorithm � Transfer Function: � Return:

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

  26. Experimental Results � False Positive Rate : 0 � False Negative Rate : 0 � not all obfuscations are detected

  27. Performance

  28. 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

  29. 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

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend