Dynamic Analysis of Malware
Sareena K P
Secure Systems Engineering (CS6570)
IIT Madras
Mar 10, 2022
Static Analysis: What can go Wrong?
To Infer maliciousness
2
Polymorphic Malware!!
Dynamic Analysis
3
1
Dynamic Analysis
4
Executing Malware - Challenges
5
2
#1 Isolation and Containment
6
#2 Sensitive Nature of Malware
7
Is this an analysis environment?
#4 State Reset
8
#4 Active Nature of Malware
9
Analysis Frameworks
10
2
Analysis Framework
11
Requirements
12
#1 Bare Metal (Real-World)
13
Virtualizations – In Guest Analysis
Virtual Machines
14
Outside Guest Analysis
15
Secures the analysis tool
Limits the guest OS's access to hardware resources
Challenges Summary
Real World Testbed
Virtualized Analysis Environments
16
Complete State Reset
(e.g. Rootkits)
Precise
Low
Containment
High
Containment
Safe but can be evaded
Precise but risky
Sophistication
Analysis Techniques
17
3
Analysis Techniques
Passive (Tracing)
Active
18
Passive Techniques (Tracing)
19
A
Network Behaviour
20
Network
Hardware
OS
Operating System
21
Network
OS
Hardware
Hardware - Counters
22
Network
OS
Hardware
Hardware - Volatile Memory Acquisition
23
Network
OS
Hardware
Hardware - Volatile Memory Acquisition
24
Network
OS
Hardware
Active Techniques
25
B
Function Call Analysis
26
Target Function
Injected
Hook
Analysis Function
Access process stack, paramters
Can explore only one control path that was executed!
Execution Control
27
#1 Debugging
28
#2 Binary Instrumentation
29
#3 Forward Symbolic Execution
30
Path1
αi < 10
Path2
αi >= 10
If i < 10
Input i
Eg – For Query timestamp, replace with symbols
Flow Tracking – Data Tainting
31
x = input ( )
…
y = x + 42
…
goto y
Flow Tracking – Data Tainting
32
x = input ( )
…
y = x + 42
…
goto y
Input is tainted
Flow Tracking – Data Tainting
33
x = input ( )
…
y = x + 42
…
goto y
Input is tainted
X
Flow Tracking – Data Tainting
34
x = input ( )
…
y = x + 42
…
goto y
Input is tainted
X
X
42
Flow Tracking – Data Tainting
35
x = input ( )
…
y = x + 42
…
goto y
Input is tainted
X
X
y
42
Flow Tracking – Data Tainting
36
x = input ( )
…
y = x + 42
…
goto y
Input is tainted
X
X
y
y
42
Techniques versus Frameworks
37
4
Mapping Layout and Techniques
38
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Mapping Layout and Techniques
39
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Analysis instruments the malware binary
Mapping Layout and Techniques
40
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Analysis tool is a different process
Analysis instruments the malware binary
Mapping Layout and Techniques
41
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Analysis tool is a different process
Analysis instruments the malware binary
Mapping Layout and Techniques
42
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Analysis tool is a different process
Analysis instruments the malware binary
Mapping Layout and Techniques
43
Frameworks | Function call Analysis | Execution Control | Flow Tracking | Volatile Memory Analysis | Tracing OS, Hardware | Tracing- Network, |
In-Guest Analysis (VM/emulators) | | | | | | |
Bare metal | | | | | | |
Analysis tool outside the VM | | | | | | |
Cannot be detected by malware
Easily detected by malware
Malware may detect
Analysis tool is a different process
Analysis instruments the malware binary
Limitations
44
Virtualizations
Virtual Machines
Emulation
45
Emulator – hardware level implementation of a system
Does not execute malware on hardware.