Securing Intel Sgx Against Side-Channel Attacks Via Load-Time Synthesis
Total Page:16
File Type:pdf, Size:1020Kb
SECURING INTEL SGX AGAINST SIDE-CHANNEL ATTACKS VIA LOAD-TIME SYNTHESIS A Dissertation Presented to The Academic Faculty By Ming-Wei Shih In Partial Fulfillment of the Requirements for the Degree Doctor of Philosophy in the School of Georgia Institute of Technology Georgia Institute of Technology December 2019 Copyright © Ming-Wei Shih 2019 SECURING INTEL SGX AGAINST SIDE-CHANNEL ATTACKS VIA LOAD-TIME SYNTHESIS Approved by: Dr. Taesoo Kim, Advisor Dr. Michael Steiner School of Computer Science Security and Privacy Research Georgia Institute of Technology Group Intel Labs Dr. Wenke Lee School of Computer Science Dr. Brendan Saltaformaggio Georgia Institute of Technology School of Computer Science Georgia Institute of Technology Dr. Marcus Peinado Cloud and Infrastructure Security Date Approved: Octobor 23, 2019 Group Microsoft Research To my dear wife, Tiffany, and my family. ACKNOWLEDGEMENTS Foremost, I would like to express my sincere gratitude to my advisor Dr. Taesoo Kim for all the support and guidance he provided to me throughout my Ph.D. study. He has taught me how to conduct research in system security since my first year—when I literally know nothing about how to do so. His solid technical background and logical, critical thinking have always inspired me. I would also like to thank Dr. Marcus Peinado for always providing constructive comments when we collaborated on T-SGX and SGX-Armor. I have learned a lot from working with him. Besides, I would like to thank the rest of my thesis committee: Dr. Wenke Lee, Dr. Michael Steiner, and Dr. Brendan Saltaformaggio for their insightful comments that helped me improve this thesis. I would like to express my special thanks to Dr. Sangho Lee for the fruitful discussions and the help when we collaborated on T-SGX and PRIDWEN. Additionally, I would like to thank my colleagues at SSLab: Sanidhya, Meng, Insu, Ren, Wen, Jinho, Soyeon, Fan, Seulbae, Hanqing, and former members, Steffen and Mohan for all the discussions and the good time spent together. Last but not least, I would like to thank my family: my wife, Tiffany, my parents, and my brothers for supporting me spiritually throughout writing this thesis and my life in general. Finally, I thank my God for letting me through all the difficulties. I have experienced Your guidance day by day. You are the one who brought me here and let me finish my degree. I will keep on trusting You for my future. iv TABLE OF CONTENTS Acknowledgments . iv List of Tables . x List of Figures . xii Chapter 1: Introduction . 1 1.1 Research Objectives . 2 1.1.1 Retrofitting Existing Side-Channel Defenses . .3 1.1.2 Designing New Side-Channel Defenses . 3 1.1.3 Developing a General Side-Channel Defense Framework . 4 1.2 Thesis Contributions . 5 1.3 Outline of the Thesis . 6 Chapter 2: Background . 7 2.1 Intel Software Guard Extensions (SGX) . 7 2.2 Exceptions in Software Guard Extensions (SGX) . 8 2.3 Side-Channel Attacks (Side-Channel Attacks (SCAs)) . 9 2.4 Address Space Layout Randomization (ASLR) . 10 2.5 Intel Transactional Synchronization Extension (TSX) . 11 v 2.6 WebAssembly (Wasm) . 13 Chapter 3: Securing ASLR on SGX against Multifaceted Side-channel Attacks . 15 3.1 Introduction . 15 3.2 Threat Model . 19 3.2.1 System Model . 19 3.2.2 ASLR Model . 20 3.2.3 Adversary Model . 22 3.3 New Attacks against ASLR . 24 3.3.1 Attacks on Randomized Layout Generation . 24 3.3.2 Attack on ASLR at Runtime . 26 3.4 Mitigation against Attacks on Layout Generation . 31 3.4.1 Secure Layout Generation . 31 3.5 Implementation . 36 3.5.1 Automated Attack Analysis Framework . 36 3.5.2 Attacks against SGX-Shield . 37 3.5.3 SGX-Armor Prototype . 40 3.6 Evaluation . 41 3.6.1 Attacking Layout Generation . 42 3.6.2 Attacking Runtime Randomization . 44 3.6.3 Overhead of SGX-Armor . 46 3.7 Discussion: Mitigation against Runtime Attacks . 47 3.8 Related Work . 49 vi Chapter 4: Eradicating Controlled-Channel Attacks against Enclave Programs . 52 4.1 Introduction . 52 4.2 Controlled-channel Attack Revisited . 56 4.2.1 Threat Model . 56 4.2.2 Controlled-channel Attack . 57 4.2.3 Known Countermeasures . 58 4.2.4 Overwriting Exit Reason . 58 4.3 System Model . 59 4.4 Design . 61 4.4.1 Overview of the TSX-based Design . 61 4.4.2 The Springboard . 62 4.4.3 Execution Blocks . 65 4.4.4 Transaction Constraints . 65 4.4.5 Optimization Techniques . 67 4.4.6 Abort Sequence . 69 4.4.7 Preventing Reruns . 70 4.4.8 External calls . 71 4.4.9 Illegal instructions . 71 4.5 Implementation . 71 4.6 Security Analysis . 72 4.7 Evaluation . 74 4.7.1 Application Binaries . 75 vii 4.7.2 Run-time Performance . 77 4.8 Discussion . 81 4.8.1 Limitations . 81 4.8.2 Other Side-channel Attacks . 82 4.9 Related Work . 83 Chapter 5: Securing SGX Programs against Side-Channel Attacks via Load-Time Synthesis . 86 5.1 Introduction . 86 5.2 Threat Model . 90 5.3 PRIDWEN Design . 91 5.3.1 Goals . 91 5.3.2 Overview . 92 5.3.3 User-mode Hardware Probing . 93 5.3.4 Pass Manager . 94 5.3.5 Load-time Synthesis . 96 5.3.6 Post-synthesis Validation . 100 5.4 Case Study . 100 5.4.1 Fine-grained ASLR . 101 5.4.2 T-SGX . 102 5.4.3 Varys . 103 5.4.4 QSpectre . 105 5.4.5 Pass Integration . 106 5.4.6 Security Analysis . 107 viii 5.5 Implementation . 108 5.6 Evaluation . 109 5.6.1 Performance Characteristics of the PRIDWEN Loader . 110 5.6.2 Faithfulness of Execution . 113 5.6.3 Performance of Synthesized Binaries . 114 5.7 Discussion . 118 5.8 Related Work . 119 Chapter 6: Conclusion and Future Work . 121 References . 141 ix LIST OF TABLES 3.1 The summary of published fine-grained ASLR systems. Level represents the granularity of the randomization. A: base address. F: function. P: page. B: basic block. I: instruction. 20 3.2 The results of initial layout attacks on target applications. 43 3.3 The entropy averaged on the three target applications under different ASLR schemes. base: baseline entropy. loading, relocation, runtime: entropy left after each of the corresponding attack. 43 3.4 The results of the runtime attack on target applications. 44 3.5 The load-time performance of SGX-Armor. 46 3.6 The results of running nbench SGX-Armor. 46 4.1 Benchmark programs (top) and applications (bottom) used to evaluate T-SGX. 75 4.2 Run-time overhead of TSX-basic and T-SGX over baseline. 78 4.3 Rate and type of transaction aborts for the nbench applications for T-SGX. 79 4.4 Distribution of the number of times a transaction aborts before it succeeds. 80 5.1 Side-channel attacks against SGX and countermeasures. Hyper-Threading Technology (HT), L1 Terminal Fault (L1TF), and Microarchitectural Data Sampling (MDS). 87 5.2 The APIs for the instrumentation (top) and validation (bottom) support. CCTX: CompilerContext. MI: MachineInstr. MCTX: MachineContext. MB: MachineBasicBlock. ............................. 95 x 5.3 Attack surfaces and software-only or hardware-assisted mitigation schemes PRIDWEN implements. Central Processing Units (CPUs) with recent mi- crocode update do not have some of the attack surfaces. 101 5.4 Comparison of lines of code and binary size between PRIDWEN and LLVM backends. ..