Security through Multi-Layer Diversity
Meng Xu (Qualifying Examination Presentation)
1
Security through Multi-Layer Diversity Meng Xu (Qualifying - - PowerPoint PPT Presentation
Security through Multi-Layer Diversity Meng Xu (Qualifying Examination Presentation) 1 Bringing Diversity to Computing Monoculture Current computing monoculture leaves our infrastructure vulnerable to massive and rapid attacks. Knowing
1
2
3
4
5
6
7
8
9
Software Stack Input Output
10
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
11
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input (benign) Output (consensus) Variant 1 Variant 2 Variant 3
12
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input (malicious) No output (divergence) Variant 1 Variant 2 Variant 3
13
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input (malicious) No output (divergence) Variant 1 Variant 2 Variant 3
14
Software Stack Input Output
15
Zend Linux
Platform Implementation Process
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
16
Zend Linux
Process
Linux Linux Linux Zend Zend Zend
ASan MSan UBSan
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
17
Zend Linux
Implementation
Linux Linux Linux Zend HHVM JPHP
ASan MSan UBSan
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
18
Zend Linux
Platform
Linux Windows MacOS Zend HHVM JPHP
ASan MSan UBSan
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
19
Zend Linux Linux Windows MacOS Zend HHVM JPHP
ASan MSan UBSan
Bunshin (ATC’17) PlatPal (Security’17) Future work
20
Presented at the 2017 USENIX Annual Technical Conference (ATC’17)
21
void foo(T *a) { *a = 0x1234; } void foo(T *a) { if(!is_valid_address(a) { report_and_abort(); } *a = 0x1234; } Sanitize
22
Memory Error Main Causes Defenses Out-of-bound read/write Lack of length check Softbound AddressSanitizer Integer overflow Format string bug Bad type casting Use-after-free Dangling pointer CETS AddressSanitizer Double free Uninitialized read Lack of initialization MemorySanitizer Data structure alignment Subword copying Undefined behaviors Divide-by-zero UndefinedBehaviorSanitizer Pointer misalignment Null-pointer dereference
23
24
25
26
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3 Program Input Output
Partition 1 Partition 2 Partition 3 Partition 1 Partition 2 Partition 3
27
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3 Program Input Output
A D D R E S S M E M O R Y U N D E F A D D R E S S M E M O R Y U N D E F
void foo(T *a) { timing_start(); if(!is_valid_address(a) { report_and_abort(); } *a = 0x1234; timing_end(); } void foo(T *a) { timing_start(); *a = 0x1234; timing_end(); }
28
29
17% 28% 35% 20%
Foo Bar Baz Qux
17% 35%
Foo Baz
28% 20%
Bar Qux Variant 1 (52% overhead) Variant 2 (48% overhead)
30
Costs profiling Security mechanisms Variant compiling Variant generator Source code Variants Overhead distribution
(e.g., ASan, MSan, UBSan)
w/ ASan w/ UBSan w/ MSan w/ ASan
...
full selective
...
31
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
sync slot
Syscall number Arguments Execution result
32
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
Syscall number Arguments Execution result
sync slot
① Leader enters syscall
33
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
Syscall number Arguments Execution result
sync slot
② Followers enter syscall
34
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
Syscall number Arguments Execution result
sync slot
③ Kernel execute the syscall
35
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
Syscall number Arguments Execution result
sync slot
④ Leader fetches syscall result ④ Followers fetch syscall result
36
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
sync ring buffer
Leader writes at the next available slot Followers read at their own speed
37
Userspace Kernel Leader Follower 1 Follower 2
Partition 1 Partition 2 Partition 3
sync ring buffer Always strictly synchronized for “write” related system calls
38
Before fork After fork Leader Follower 1 Follower 2
Original Execution group New Execution group New ring buffer
39
Before fork After fork Leader Follower 1 Follower 2
Original Execution group New Execution group New ring buffer
40
Leader Follower 1 Follower 2 Userspace Kernel Total order of lock acquisition and releases Record Enforce Enforce
41
Leader Follower 1 Follower 2 Userspace Kernel Total order of lock acquisition and releases Record Enforce Enforce
42
43
Benchmark Single/Multi-thread Featuer Pass ? SPEC CPU2006 Single CPU Intensive SPLASH-2x Multi PARSEC Multi 6 out of 13 lighttpd Single I/O Intensive nginx Multi python, php Single Interpreter
44
Config Succeed Probabilistic Failed Not possible Default 114 16 720 2990 AddressSanitizer 8 842 2990 Bunshin 8 842 2990 Config CVE Exploits Sanitizer Detect nginx-1.4.0 2013-2028 Blind ROP AddressSanitizer cpython-2.7.10 2016-5636 Integer overflow AddressSanitizer php-5.6.6 2015-4602 Type confusion AddressSanitizer
2014-0160 Heartbleed AddressSanitizer httpd-2.4.10 2014-3581 Null dereference UndefinedBehaviorSanitizer
Benchmark Items Strict-Lockstep Selective-Lockstep SPEC CPU2006 (19 Programs) Max 17.5% 14.7% Min 1.6% 1.0% Ave 8.6% 5.6% SPLASH-2X / PARSEC (19 Programs) Max 21.4% 18.9% Min 10.7% 6.6% Ave 16.6% 14.5% lighttpd 1MB File Request Ave 1.44% 1.21% nginx 1MB File Request Ave 1.71% 1.41%
45
46
47
Sync Overhead (%) Number of variants 2 4 6 8
0.5 6.6 11.4 1.7 11.2 17.2 37.6 0.6 4.4 10.5 20.9
Ave Max Min
48
Sync Overhead (%) Number of variants 2 4 6 8
0.5 6.6 11.4 1.7 11.2 17.2 37.6 0.6 4.4 10.5 20.9
Ave Max Min
49
Sync Overhead (%) Number of variants 2% 50% 99%
0.2 0.8 1.9 6.4 9.7 13 2.2 4.8 6.6
Ave Max Min
50
Sync Overhead (%) Number of variants 2% 50% 99%
0.2 0.8 1.9 6.4 9.7 13 2.2 4.8 6.6
Ave Max Min
51
Overhead (%) Whole V1 V2 V3 Bunshin
43.1 37.2 34.9 34.8 107
Overhead (%) Whole V1 V2 Bunshin
65.6 63 57.4 107
52
Overhead (%) Whole V1 V2 V3 Bunshin
94.5 88 78.7 77.2 228
Overhead (%) Whole V1 V2 Bunshin
129 125 124 228
53
Overhead (%) gobmk povray h264ref average
177 208 248 165 172 207 189 141 148 191 246 158 98.9 112 205 116
ASan MSan UBSan Bunshin
Overhead (%) gobmk povray h264ref average
177 208 248 165 172 207 189 141 148 191 246 158 98.9 112 205 116
ASan MSan UBSan Bunshin
54
55
56
Software Stack Input Output
Virtualization Synchronize Execution & Consolidate Outputs
Input Output Variant 1 Variant 2 Variant 3
57
Zend Linux Linux Windows MacOS Zend HHVM JPHP
ASan MSan UBSan
Bunshin (ATC’17) PlatPal (Security’17) Future work
58
Presented at the 2017 USENIX Security Symposium (Security’17)
59
60
61
62
63
64
Category Focus Work Year Detection Static JavaScript PJScan 2011 Lexical analysis JavaScript Vatamanu et al. 2012 Token clustering JavaScript Lux0r 2014 API reference classification JavaScript MPScan 2013 Shellcode and opcode sig Metadata PDF Malware Slayer 2012 Linearized object path Metadata Srndic et al. 2013 Hierarchical structure Metadata PDFrate 2012 Content meta-features Both Maiorca et al. 2016 Many heuristics combined Dynamic JavaScript MDScan 2011 Shellcode and opcode sig JavaScript PDF Scrutinizer 2012 Known attack patterns JavaScript ShellOS 2011 Memory access patterns JavaScript Liu et al. 2014 Common attack behaviors Memory CWXDetector 2012 Violation of invariants
65
Category Focus Work Year Detection External Parser ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig Yes JavaScript PDF Scrutinizer 2012 Known attack patterns Yes JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors No Memory CWXDetector 2012 Violation of invariants No
Category Focus Work Year Detection External Parser ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig Yes JavaScript PDF Scrutinizer 2012 Known attack patterns Yes JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors No Memory CWXDetector 2012 Violation of invariants No
66
(Carmony et al., NDSS’16)
67
Category Focus Work Year Detection Machine Learning ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig No JavaScript PDF Scrutinizer 2012 Known attack patterns No JavaScript ShellOS 2011 Memory access patterns No JavaScript Liu et al. 2014 Common attack behaviors No Memory CWXDetector 2012 Violation of invariants No
68
Category Focus Work Year Detection Machine Learning ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig No JavaScript PDF Scrutinizer 2012 Known attack patterns No JavaScript ShellOS 2011 Memory access patterns No JavaScript Liu et al. 2014 Common attack behaviors No Memory CWXDetector 2012 Violation of invariants No
(Xu et al., NDSS’16)
69
Category Focus Work Year Detection Known Attacks ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig Yes Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig Yes JavaScript PDF Scrutinizer 2012 Known attack patterns Yes JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors Yes Memory CWXDetector 2012 Violation of invariants No
70
Category Focus Work Year Detection Known Attacks ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig Yes Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig Yes JavaScript PDF Scrutinizer 2012 Known attack patterns Yes JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors Yes Memory CWXDetector 2012 Violation of invariants No
71
Category Focus Work Year Detection Discrepancy ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig No JavaScript PDF Scrutinizer 2012 Known attack patterns No JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors Yes Memory CWXDetector 2012 Violation of invariants No
72
Category Focus Work Year Detection Discrepancy ? Static JavaScript PJScan 2011 Lexical analysis Yes JavaScript Vatamanu et al. 2012 Token clustering Yes JavaScript Lux0r 2014 API reference classification Yes JavaScript MPScan 2013 Shellcode and opcode sig No Metadata PDF Malware Slayer 2012 Linearized object path Yes Metadata Srndic et al. 2013 Hierarchical structure Yes Metadata PDFrate 2012 Content meta-features Yes Both Maiorca et al. 2016 Many heuristics combined Yes Dynamic JavaScript MDScan 2011 Shellcode and opcode sig No JavaScript PDF Scrutinizer 2012 Known attack patterns No JavaScript ShellOS 2011 Memory access patterns Yes JavaScript Liu et al. 2014 Common attack behaviors Yes Memory CWXDetector 2012 Violation of invariants No
(Srndic et al., Oakland’14 and Maiorca et al, AsiaCCS’13)
73
74
75
76
77
78
79
SHA-1: 74543610d9908698cb0b4bfcc73fc007bfeb6d84
80
81
82
83
84
85
Adobe Reader
Adobe Reader
86
Adobe Reader Internal Tracer
Adobe Reader Internal Tracer
87
Adobe Reader Internal Tracer Syscalls External Tracer
Adobe Reader Internal Tracer Syscalls External Tracer
88
Adobe Reader Internal Tracer COS object parsing PD tree construction Script execution Other actions Element rendering
89
Adobe Reader Syscalls External Tracer
Filesystem Operations Network Activities Program Executions Normal Exit
90
Windows VM
Restore Clean Snapshot Launch Adobe Reader Attach External Tracer Open PDF Drive PDF by Internal Tracer Dump Traces Restore Clean Snapshot Launch Adobe Reader Attach External Tracer Open PDF Drive PDF by Internal Tracer Dump Traces
MacOS VM
Compare Traces
PlatPal <file-to-check>
91
92
Sample Type Number of Samples Divergence Detected ? (i.e., False Positive) Plain PDF 966 No Embedded fonts 34 No JavaScript code 32 No AcroForm 17 No 3D objects 2 No
93
Analysis Results of 320 Maldoc Samples 65% 11% 24% No Divergence Both Crash Divergence
94
Analysis Results of 320 Maldoc Samples 65% 11% 24% No Divergence Breakdown of 77 potentially false positives 26% 3% 25% 47% Targets old versions Mis-classified by AV vendor No malicious activity trigerred Unknown
95
Average Analysis Time Breakdown (unit. Seconds)
Item Windows MacOS Snapshot restore 9.7 12.6 Document parsing 0.5 0.6 Script execution 10.5 5.1 Element rendering 7.3 6.2 Total 23.7 22.1
96
97
98
99
Category Factor Windows MacOS Shellcode Creation Memory Management Platform Features
100
Category Factor Windows MacOS Shellcode Creation Syscall semantics Both the syscall number and the register set used to hold syscall arguments are different Calling convention rcx, rdx, r8 for first 3 args rdi, rsi, rdx for first 3 args Library dependencies e.g., LoadLibraryA e.g. dlopen Memory Management Platform Features
101
Category Factor Windows MacOS Shellcode Creation Syscall semantics Both the syscall number and the register set used to hold syscall arguments are different Calling convention rcx, rdx, r8 for first 3 args rdi, rsi, rdx for first 3 args Library dependencies e.g., LoadLibraryA e.g. dlopen Memory Management Memory layout Offset from attack point (e.g., overflowed buffer) to target address (e.g., vtable entries) are different Heap management Segment heap Magazine malloc Platform Features
102
Category Factor Windows MacOS Shellcode Creation Syscall semantics Both the syscall number and the register set used to hold syscall arguments are different Calling convention rcx, rdx, r8 for first 3 args rdi, rsi, rdx for first 3 args Library dependencies e.g., LoadLibraryA e.g. dlopen Memory Management Memory layout Offset from attack point (e.g., overflowed buffer) to target address (e.g., vtable entries) are different Heap management Segment heap Magazine malloc Platform Features Executable format COM, PE, NE Mach-O Filesystem semantics \ as separator, prefixed drive letter C:\ / as separator, no prefixed drive letter Config and info hub registry proc Expected programs MS Office, IE, etc Safari, etc
103
freed is slot 9
slot 9, which is attacker controlled
104
CVE-2014-0521 PoC Example
105
106
107
108
109
110
111
Ruian Duan, Ashish Bijlani, Meng Xu, Taesoo Kim, and Wenke Lee In Proceedings of the 24th ACM Conference on Computer and Communications Security (CCS'17)
Meng Xu, and Taesoo Kim In Proceedings of the 26th USENIX Security Symposium (Security'17)
Meng Xu, Kangjie Lu, Taesoo Kim, and Wenke Lee In Proceedings of the 2017 USENIX Annual Technical Conference (ATC'17)
Meng Xu, Chengyu Song, Yang ji, Ming-Wei Shih, Kangjie Lu, Cong Zheng, Ruian Duan, Yeongjin Jang, Byoungyoung Lee, Chenxiong Qian, Sangho Lee, and Taesoo Kim In ACM Computing Surveys (CSUR) Volume 49, Issue 2, August 2016
Meng Xu, Yeongjin Jang, Xinyu Xing, Taesoo Kim, and Wenke Lee. In Proceedings of the 22nd ACM Conference on Computer and Communications Security (CCS'15)
112