data mining for malware detection

55
Data Mining for Malware Detection Prof. Bhavani Thuraisingham The University of Texas at Dallas October 8, 2010

Upload: taipa

Post on 23-Jan-2016

66 views

Category:

Documents


6 download

DESCRIPTION

Data Mining for Malware Detection. Prof. Bhavani Thuraisingham The University of Texas at Dallas. October 8, 2010. Outline. Data mining overview Intrusion detection and Malicious code detection (worms and virus) Digital forensics and UTD work Algorithms for Digital Forensics. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Data Mining for Malware Detection

Data Mining for Malware Detection

Prof. Bhavani Thuraisingham

The University of Texas at Dallas

October 8, 2010

Page 2: Data Mining for Malware Detection

2

04/21/23 19:40

Outline

0 Data mining overview

0 Intrusion detection and Malicious code detection (worms and virus)

0 Digital forensics and UTD work

0 Algorithms for Digital Forensics

Page 3: Data Mining for Malware Detection

3

04/21/23 19:40

What is Data Mining?

Data MiningKnowledge Mining

Knowledge Discoveryin Databases

Data Archaeology

Data Dredging

Database MiningKnowledge Extraction

Data Pattern Processing

Information Harvesting

Siftware

The process of discovering meaningful new correlations, patterns, and trends by sifting through large amounts of data, often previously unknown, using pattern recognition technologies and statistical and mathematical techniques(Thuraisingham, Data Mining, CRC Press 1998)

Page 4: Data Mining for Malware Detection

4

04/21/23 19:40

What’s going on in data mining?

0 What are the technologies for data mining?

- Database management, data warehousing, machine learning, statistics, pattern recognition, visualization, parallel processing

0 What can data mining do for you?

- Data mining outcomes: Classification, Clustering, Association, Anomaly detection, Prediction, Estimation, . . .

0 How do you carry out data mining?

- Data mining techniques: Decision trees, Neural networks, Market-basket analysis, Link analysis, Genetic algorithms, . . .

0 What is the current status?

- Many commercial products mine relational databases

0 What are some of the challenges?

- Mining unstructured data, extracting useful patterns, web mining, Data mining, security and privacy

Page 5: Data Mining for Malware Detection

5

04/21/23 19:40

Data Mining for Intrusion Detection: Problem

0 An intrusion can be defined as “any set of actions that attempt to compromise the integrity, confidentiality, or availability of a resource”.

0 Attacks are:

- Host-based attacks

- Network-based attacks

0 Intrusion detection systems are split into two groups:

- Anomaly detection systems

- Misuse detection systems

0 Use audit logs

- Capture all activities in network and hosts.

- But the amount of data is huge!

Page 6: Data Mining for Malware Detection

6

04/21/23 19:40

Misuse Detection

0 Misuse Detection

Page 7: Data Mining for Malware Detection

7

04/21/23 19:40

Problem: Anomaly Detection

0 Anomaly Detection

Page 8: Data Mining for Malware Detection

8

04/21/23 19:40

Our Approach: Overview

TrainingData

Class

Hierarchical Clustering (DGSOT)

Testing

Testing Data

SVM Class Training

DGSOT: Dynamically growing self organizing tree

Page 9: Data Mining for Malware Detection

9

04/21/23 19:40

Hierarchical clustering with SVM flow chart

Our Approach

Our Approach: Hierarchical Clustering

Page 10: Data Mining for Malware Detection

10

04/21/23 19:40

Results

Training Time, FP and FN Rates of Various Methods

 

MethodsAverage

Accuracy

Total Training

Time

Average FP

Rate (%)

Average FN

Rate (%)

Random Selection

52% 0.44 hours 40 47

Pure SVM 57.6% 17.34 hours 35.5 42

SVM+Rocchio Bundling

51.6% 26.7 hours 44.2 48

SVM + DGSOT 69.8% 13.18 hours 37.8 29.8

Page 11: Data Mining for Malware Detection

11

04/21/23 19:40

Introduction: Detecting Malicious Executables using Data Mining

0 What are malicious executables?- Harm computer systems- Virus, Exploit, Denial of Service (DoS), Flooder, Sniffer, Spoofer,

Trojan etc.- Exploits software vulnerability on a victim - May remotely infect other victims- Incurs great loss. Example: Code Red epidemic cost $2.6

Billion

0 Malicious code detection: Traditional approach- Signature based- Requires signatures to be generated by human experts- So, not effective against “zero day” attacks

Page 12: Data Mining for Malware Detection

12

04/21/23 19:40

State of the Art in Automated Detection

OAutomated detection approaches:0Behavioural: analyse behaviours like source, destination address, attachment type, statistical anomaly etc.

0Content-based: analyse the content of the malicious executable- Autograph (H. Ah-Kim – CMU): Based on automated

signature generation process- N-gram analysis (Maloof, M.A. et .al.): Based on mining

features and using machine learning.

Page 13: Data Mining for Malware Detection

13

04/21/23 19:40

Our New Ideas (Khan, Masud and Thuraisingham)

✗Content -based approaches consider only machine-codes (byte-codes).

✗Is it possible to consider higher-level source codes for malicious code detection?

✗Yes: Diassemble the binary executable and retrieve the assembly program

✗Extract important features from the assembly program

✗Combine with machine-code features

Page 14: Data Mining for Malware Detection

14

04/21/23 19:40

Feature Extraction

✗Binary n-gram features- Sequence of n consecutive bytes of binary

executable

✗Assembly n-gram features- Sequence of n consecutive assembly

instructions

✗System API call features- DLL function call information

Page 15: Data Mining for Malware Detection

15

04/21/23 19:40

The Hybrid Feature Retrieval Model

0 Collect training samples of normal and malicious executables.

0 Extract features

0 Train a Classifier and build a model

0 Test the model against test samples

Page 16: Data Mining for Malware Detection

16

04/21/23 19:40

Hybrid Feature Retrieval (HFR)

0 Training

Page 17: Data Mining for Malware Detection

17

04/21/23 19:40

Hybrid Feature Retrieval (HFR)

0 Testing

Page 18: Data Mining for Malware Detection

18

04/21/23 19:40

Binary n-gram features- Features are extracted from the byte codes in the form of n-

grams, where n = 2,4,6,8,10 and so on.

Example: Given a 11-byte sequence: 0123456789abcdef012345,

The 2-grams (2-byte sequences) are: 0123, 2345, 4567, 6789, 89ab, abcd, cdef, ef01, 0123, 2345

The 4-grams (4-byte sequences) are: 01234567, 23456789, 456789ab,...,ef012345 and so on....

Problem: - Large dataset. Too many features (millions!).

Solution: - Use secondary memory, efficient data structures - Apply feature selection

Feature Extraction

Page 19: Data Mining for Malware Detection

19

04/21/23 19:40

Assembly n-gram features- Features are extracted from the assembly programs in the form

of n-grams, where n = 2,4,6,8,10 and so on.

Example:

three instructions “push eax”; “mov eax, dword[0f34]” ; “add ecx, eax”;

2-grams

(1) “push eax”; “mov eax, dword[0f34]”; (2) “mov eax, dword[0f34]”; “add ecx, eax”;

Problem: - Same problem as binary

Solution: - Same solution

Feature Extraction

Page 20: Data Mining for Malware Detection

20

04/21/23 19:40

0 Select Best K features

0 Selection Criteria: Information Gain

0 Gain of an attribute A on a collection of examples S is given by

Feature Selection

)(

)(||

||)(),(

AValuesVv

v SEn tropyS

SSEn tropyASG a in

Page 21: Data Mining for Malware Detection

21

04/21/23 19:40

Experiments

0 Dataset- Dataset1: 838 Malicious and 597 Benign executables- Dataset2: 1082 Malicious and 1370 Benign executables- Collected Malicious code from VX Heavens (http://vx.netlux.org)

0 Disassembly - Pedisassem ( http://www.geocities.com/~sangcho/index.html )

0 Training, Testing- Support Vector Machine (SVM)- C-Support Vector Classifiers with an RBF kernel

Page 22: Data Mining for Malware Detection

22

04/21/23 19:40

Results

0 HFS = Hybrid Feature Set0 BFS = Binary Feature Set0 AFS = Assembly Feature Set

Page 23: Data Mining for Malware Detection

23

04/21/23 19:40

Results

0 HFS = Hybrid Feature Set0 BFS = Binary Feature Set0 AFS = Assembly Feature Set

Page 24: Data Mining for Malware Detection

24

04/21/23 19:40

Results

0 HFS = Hybrid Feature Set0 BFS = Binary Feature Set0 AFS = Assembly Feature Set

Page 25: Data Mining for Malware Detection

25

04/21/23 19:40

Future Plans

0 System call: - seems to be very useful. - Need to Consider Frequency of call- Call sequence pattern (following program path) - Actions immediately preceding or after call

0 Detect Malicious code by program slicing- requires analysis

Page 26: Data Mining for Malware Detection

26

04/21/23 19:40

Data Mining for Buffer Overflow Introduction

0 Goal- Intrusion detection. - e.g.: worm attack, buffer overflow attack.

0 Main Contribution- 'Worm' code detection by data mining coupled with

'reverse engineering'.- Buffer overflow detection by combining data mining with

static analysis of assembly code.

Page 27: Data Mining for Malware Detection

27

04/21/23 19:40

Background

0 What is 'buffer overflow'?- A situation when a fixed sized buffer is overflown by a

larger sized input.

0 How does it happen?- example:

........char buff[100];gets(buff);........

buff Stackmemory

Input string

Page 28: Data Mining for Malware Detection

28

04/21/23 19:40

Background (cont...)

0 Then what?

........char buff[100];gets(buff);........

buff Stackmemory

Stack

Return address overwritten

buff Stackmemory

New return address points to this memory location

Attacker's code

buff

Page 29: Data Mining for Malware Detection

29

04/21/23 19:40

Background (cont...)

0 So what?- Program may crash or- The attacker can execute his arbitrary code

0 It can now- Execute any system function- Communicate with some host and download some 'worm'

code and install it!- Open a backdoor to take full control of the victim

0 How to stop it?

Page 30: Data Mining for Malware Detection

30

04/21/23 19:40

Background (cont...)

0 Stopping buffer overflow- Preventive approaches- Detection approaches

0 Preventive approaches- Finding bugs in source code. Problem: can only work

when source code is available.- Compiler extension. Same problem.- OS/HW modification

0 Detection approaches- Capture code running symptoms. Problem: may require

long running time.- Automatically generating signatures of buffer overflow

attacks.

Page 31: Data Mining for Malware Detection

31

04/21/23 19:40

CodeBlocker (Our approach)

0 A detection approach

0 Based on the Observation:- Attack messages usually contain code while normal

messages contain data.

0 Main Idea- Check whether message contains code

0 Problem to solve:- Distinguishing code from data

Page 32: Data Mining for Malware Detection

33

04/21/23 19:40

Severity of the problem

0 It is not easy to detect actual instruction sequence from a given string of bits

Page 33: Data Mining for Malware Detection

34

04/21/23 19:40

Our solution

0 Apply data mining.

0 Formulate the problem as a classification problem (code, data)

0 Collect a set of training examples, containing both instances

0 Train the data with a machine learning algorithm, get the model

0 Test this model against a new message

Page 34: Data Mining for Malware Detection

35

04/21/23 19:40

CodeBlocker Model

Page 35: Data Mining for Malware Detection

36

04/21/23 19:40

Feature Extraction

Page 36: Data Mining for Malware Detection

37

04/21/23 19:40

Disassembly

0 We apply SigFree tool - implemented by Xinran Wang et al. (PennState)

Page 37: Data Mining for Malware Detection

38

04/21/23 19:40

Feature extraction

0 Features are extracted using- N-gram analysis- Control flow analysis

0 N-gram analysis

Assembly program Corresponding IFG

What is an n-gram? -Sequence of n instructions

Traditional approach: -Flow of control is ignored

2-grams are: 02, 24, 46,...,CE

Page 38: Data Mining for Malware Detection

39

04/21/23 19:40

Feature extraction (cont...)

0 Control-flow Based N-gram analysis

Assembly program Corresponding IFG

What is an n-gram? -Sequence of n instructions

Proposed Control-flow based approach -Flow of control is considered

2-grams are: 02, 24, 46,...,CE, E6

Page 39: Data Mining for Malware Detection

40

04/21/23 19:40

Feature extraction (cont...)

0 Control Flow analysis. Generated features- Invalid Memory Reference (IMR)- Undefined Register (UR)- Invalid Jump Target (IJT)

0 Checking IMR- A memory is referenced using register addressing and

the register value is undefined- e.g.: mov ax, [dx + 5]

0 Checking UR- Check if the register value is set properly

0 Checking IJT- Check whether jump target does not violate instruction

boundary

Page 40: Data Mining for Malware Detection

41

04/21/23 19:40

Putting it together

0 Why n-gram analysis?- Intuition: in general,

disassembled executables should have a different pattern of instruction usage than disassembled data.

0 Why control flow analysis?- Intuition: there should be no invalid memory references or

invalid jump targets.

0 Approach- Compute all possible n-grams- Select best k of them- Compute feature vector (binary vector) for each training

example- Supply these vectors to the training algorithm

Page 41: Data Mining for Malware Detection

42

04/21/23 19:40

Experiments

0 Dataset- Real traces of normal messages- Real attack messages - Polymorphic shellcodes

0 Training, Testing- Support Vector Machine (SVM)

Page 42: Data Mining for Malware Detection

43

04/21/23 19:40

Results

0 CFBn: Control-Flow Based n-gram feature0 CFF: Control-flow feature

Page 43: Data Mining for Malware Detection

44

04/21/23 19:40

Novelty, Advantages, Limitations, Future

0 Novelty- We introduce the notion of control flow based n-gram- We combine control flow analysis with data mining to

detect code / data- Significant improvement over other methods (e.g. SigFree)

0 Advantages- Fast testing- Signature free operation - Low overhead - Robust against many obfuscations

0 Limitations- Need samples of attack and normal messages.- May not be able to detect a completely new type of attack.

0 Future- Find more features- Apply dynamic analysis techniques- Semantic analysis

Page 44: Data Mining for Malware Detection

45

04/21/23 19:40

Analysis of Firewall Policy Rules Using Data Mining Techniques

•Firewall is the de facto core technology of today’s network security•First line of defense against external network attacks and threats

•Firewall controls or governs network access by allowing or denying the incoming or outgoing network traffic according to firewall policy rules.

•Manual definition of rules often result in in anomalies in the policy

•Detecting and resolving these anomalies manually is a tedious and an error prone task

•Solutions:•Anomaly detection:

•Theoretical Framework for the resolution of anomaly; A new algorithm will simultaneously detect and

resolve any anomaly that is present in the policy rules

•Traffic Mining: Mine the traffic and detect anomalies

Page 45: Data Mining for Malware Detection

46

04/21/23 19:40

Traffic Mining

0 To bridge the gap between what is written in the firewall policy rules and what is being observed in the network is to analyze traffic and log of the packets– traffic mining

=Network traffic trend may show that some rules are out-dated or not used recently

FirewallFirewallLog FileLog File

Mining Log File Mining Log File Using FrequencyUsing Frequency

FilteringFilteringRule Rule

GeneralizationGeneralization

Generic RulesGeneric Rules

Identify Decaying Identify Decaying &&

Dominant RulesDominant Rules

EditEditFirewall RulesFirewall Rules

FirewallPolicy Rule

Page 46: Data Mining for Malware Detection

47

04/21/23 19:40

Traffic Mining Results

Anomaly Discovery ResultAnomaly Discovery Result

Rule 1, Rule 2: ==> GENRERALIZATIONRule 1, Rule 16: ==> CORRELATEDRule 2, Rule 12: ==> SHADOWEDRule 4, Rule 5: ==> GENRERALIZATIONRule 4, Rule 15: ==> CORRELATEDRule 5, Rule 11: ==> SHADOWED

1: TCP,INPUT,129.110.96.117,ANY,*.*.*.*,80,DENY2: TCP,INPUT,*.*.*.*,ANY,*.*.*.*,80,ACCEPT3: TCP,INPUT,*.*.*.*,ANY,*.*.*.*,443,DENY4: TCP,INPUT,129.110.96.117,ANY,*.*.*.*,22,DENY5: TCP,INPUT,*.*.*.*,ANY,*.*.*.*,22,ACCEPT6: TCP,OUTPUT,129.110.96.80,ANY,*.*.*.*,22,DENY7: UDP,OUTPUT,*.*.*.*,ANY,*.*.*.*,53,ACCEPT8: UDP,INPUT,*.*.*.*,53,*.*.*.*,ANY,ACCEPT9: UDP,OUTPUT,*.*.*.*,ANY,*.*.*.*,ANY,DENY10: UDP,INPUT,*.*.*.*,ANY,*.*.*.*,ANY,DENY11: TCP,INPUT,129.110.96.117,ANY,129.110.96.80,22,DENY12: TCP,INPUT,129.110.96.117,ANY,129.110.96.80,80,DENY13: UDP,INPUT,*.*.*.*,ANY,129.110.96.80,ANY,DENY14: UDP,OUTPUT,129.110.96.80,ANY,129.110.10.*,ANY,DENY15: TCP,INPUT,*.*.*.*,ANY,129.110.96.80,22,ACCEPT16: TCP,INPUT,*.*.*.*,ANY,129.110.96.80,80,ACCEPT17: UDP,INPUT,129.110.*.*,53,129.110.96.80,ANY,ACCEPT18: UDP,OUTPUT,129.110.96.80,ANY,129.110.*.*,53,ACCEPT

Page 47: Data Mining for Malware Detection

48

04/21/23 19:40

Worm Detection: Introduction

0 What are worms?

- Self-replicating program; Exploits software vulnerability on a victim; Remotely infects other victims

0 Evil worms

- Severe effect; Code Red epidemic cost $2.6 Billion

0 Goals of worm detection

- Real-time detection

0 Issues

- Substantial Volume of Identical Traffic, Random Probing

0 Methods for worm detection

- Count number of sources/destinations; Count number of failed connection attempts

0 Worm Types

- Email worms, Instant Messaging worms, Internet worms, IRC worms, File-sharing Networks worms

0 Automatic signature generation possible

- EarlyBird System (S. Singh -UCSD); Autograph (H. Ah-Kim - CMU)

Page 48: Data Mining for Malware Detection

49

04/21/23 19:40

Email Worm Detection using Data Mining

Training data

Feature extraction

Clean or Infected ?

Outgoing Emails

ClassifierMachine Learning

Test data

The Model

Task: given some training instances of both “normal” and “viral” emails, induce a hypothesis to detect “viral” emails.

We used:Naïve BayesSVM

Page 49: Data Mining for Malware Detection

50

04/21/23 19:40

Assumptions

0 Features are based on outgoing emails.

0 Different users have different “normal” behaviour.

0 Analysis should be per-user basis.

0 Two groups of features

- Per email (#of attachments, HTML in body, text/binary attachments)

- Per window (mean words in body, variable words in subject)

0 Total of 24 features identified

0 Goal: Identify “normal” and “viral” emails based on these features

Page 50: Data Mining for Malware Detection

51

04/21/23 19:40

Feature sets

- Per email features= Binary valued Features

Presence of HTML; script tags/attributes; embedded images; hyperlinks;

Presence of binary, text attachments; MIME types of file attachments

= Continuous-valued FeaturesNumber of attachments; Number of words/characters in

the subject and body- Per window features

= Number of emails sent; Number of unique email recipients; Number of unique sender addresses; Average number of words/characters per subject, body; average word length:; Variance in number of words/characters per subject, body; Variance in word length

= Ratio of emails with attachments

Page 51: Data Mining for Malware Detection

52

04/21/23 19:40

Data Mining Approach

Classifier

SVM Naïve Bayesinfected?

Clean?

Clean

Clean/ Infected

Clean/ Infected

Test instance

Test instance

Page 52: Data Mining for Malware Detection

53

04/21/23 19:40

Data set

0 Collected from UC Berkeley.- Contains instances for both normal and viral emails.

0 Six worm types:

- bagle.f, bubbleboy, mydoom.m,

- mydoom.u, netsky.d, sobig.f

0 Originally Six sets of data:

- training instances: normal (400) + five worms (5x200)

- testing instances: normal (1200) + the sixth worm (200)0 Problem: Not balanced, no cross validation reported0 Solution: re-arrange the data and apply cross-validation

Page 53: Data Mining for Malware Detection

54

04/21/23 19:40

Our Implementation and Analysis

0 Implementation

- Naïve Bayes: Assume “Normal” distribution of numeric and real data; smoothing applied

- SVM: with the parameter settings: one-class SVM with the radial basis function using “gamma” = 0.015 and “nu” = 0.1.

0 Analysis

- NB alone performs better than other techniques

- SVM alone also performs better if parameters are set correctly- mydoom.m and VBS.Bubbleboy data set are not sufficient (very low detection

accuracy in all classifiers)

- The feature-based approach seems to be useful only when we have

identified the relevant features

gathered enough training data

Implement classifiers with best parameter settings

Page 54: Data Mining for Malware Detection

55

04/21/23 19:40

Digital Forensics and UTD Work

0 Machines are infected through unauthorized intrusions, worms and viruses

0 Therefore data has to be acquired from the machine, we skip this step as we get the data from open source web sites

0 We then apply our analysis tools based on data mining

0 Our current research at UTD is focusing mainly on “Botnets” and also to some extent “Honeypots”.

0 We are also conducting research on “Active Defense” – trying to find out the adversary is upto.

Page 55: Data Mining for Malware Detection

56

04/21/23 19:40

Algorithms for Digital Forensics

0 http://www.dfrws.org/2007/proceedings/p49-beebe.pdf

0 http://portal.acm.org/citation.cfm?id=1113034.1113074&coll=GUIDE&dl=GUIDE&idx=J79&part=periodical&WantType=periodical&title=Communications%20of%20the%20ACM