Protecting Applications Using Trusted Execution Environments
Total Page:16
File Type:pdf, Size:1020Kb
Protecting Applications Using Trusted Execution Environments Christian Priebe Department of Computing Imperial College London Submitted in part fulfilment of the requirements for the degree of Doctor of Philosophy in Computing of Imperial College London and the Diploma of Imperial College London October 2020 I dedicate this thesis to my parents Maren and Peter, my brothers Stefan and Thorsten, and my sister Kerstin. DECLARATION OF ORIGINALITY This thesis presents my work in the Department of Computing at Imperial College London during the time of my PhD studies. Parts of the work were done in collaboration with other researchers. The chapters 1, 2, and 6 were exclusively composed and written by me. The chapters 3, 4, and 5 present collaborative work: • Chapter 3. All work discussed in Chapter 3 is mine except for (i) the TEE host interface analyses in Section 3.2 which were done in collaboration with Shujie Cui and Joshua Lind; and (ii) a number of implementation aspects such as the initial integration of the musl c library and the Linux Kernel Library, the futex implementation, and in-enclave signal handling support, that were done in collaboration with other members of the LSDS research group. • Chapter 4. The GLAMDRING partitioning framework is an extension of my MRes project on dynamic binary profiling and ILP-based partitioning for TEE applications [265]. My contri- butions are the overall framework design, the dynamic binary analysis and partitioning phase implementations, and the evaluation. GLAMDRING’s static analysis component was imple- mented by Joshua Lind, and the code generation and hardening was developed in collaboration with Joshua Lind and Divya Muthukumaran. • Chapter 5. ENCLAVEDB was developed in collaboration with Kapil Vaswani and Manuel Costa, Microsoft Research Cambridge. My main contribution is the logging and recovery pro- tocol for providing confidentiality, integrity, and freshness of persisted data and its integration. I declare that the work presented in this thesis is my own, except where acknowledged above. Christian Priebe October 2020 COPYRIGHT The copyright of this thesis rests with the author. Unless otherwise indicated, its contents are licensed under a Creative Commons Attribution-Non Commercial 4.0 International Licence (CC BY-NC). Under this licence, you may copy and redistribute the material in any medium or format. You may also create and distribute modified versions of the work. This is on the condition that: you creditthe author and do not use it, or any derivative works, for a commercial purpose. When reusing or sharing this work, ensure you make the licence terms clear to others by naming the licence and linking to the licence text. Where a work has been adapted, you should indicate that the work has been changed and describe those changes. Please seek permission from the copyright holder for uses of this work that are not included in this licence or permitted under UK Copyright Law. RELATED PUBLICATIONS The following authored or co-authored publications have directly contributed to this thesis and are discussed in detail: • Christian Priebe, Divya Muthukumaran, Joshua Lind, Huanzhou Zhu, Shujie Cui, Vasily A. Sar- takov, Peter Pietzuch. SGX-LKL: Securing the Host OS Interface for Trusted Execution. Currently under submission, 2020 [267]. • Christian Priebe, Kapil Vaswani, Manuel Costa. EnclaveDB: A Secure Database using SGX. In Proceedings of the IEEE Symposium on Security and Privacy (S&P), 2018 [266]. • Joshua Lind, Christian Priebe, Divya Muthukumaran, Dan O’Keeffe, Pierre-Louis Aublin, Florian Kelbert, Tobias Reiher, David Goltzsche, David Eyers, Ruediger Kapitza, Christof Fetzer, and Peter Pietzuch. Glamdring: Automatic Application Partitioning for Intel SGX. In Proceedings of the 2017 USENIX Annual Technical Conference (ATC), 2017 [206]. The following authored or co-authored publications have not directly contributed but impacted this thesis in one way or another: • Pierre-Louis Aublin, Florian Kelbert, Dan O’Keeffe, Divya Muthukumaran, Christian Priebe, Joshua Lind, Robert Krahn, Christof Fetzer, David Eyers, and Peter Pietzuch. LibSEAL: Revealing Service Integrity Violations Using Trusted Execution. In Proceedings of the 13th European Conference on Computer Systems (EuroSys), 2018 [17]. • Sergei Arnautov, Bohdan Trach, Franz Gregor, Thomas Knauth, Andre Martin, Christian Priebe, Joshua Lind, Divya Muthukumaran, Daniel O’Keeffe, Mark L. Stillwell, David Goltzsche, Dave Eyers, Rüdiger Kapitza, Peter Pietzuch, and Christof Fetzer. SCONE: Secure Linux Containers with Intel SGX. In Proceedings of the 12th USENIX Symposium on Operating Systems Design and Implementation (OSDI), 2016 [15]. • Divya Muthukumaran, Dan O’Keeffe, Christian Priebe, David Eyers, Brian Shand, and Peter Pietzuch. FlowWatcher: Defending against Data Disclosure Vulnerabilities in Web Appli- cations. In Proceedings of the 22nd edition of the ACM SIGSAC Conference on Computer and Communications Security (CCS). ACM, 2015 [230]. ACKNOWLEDGEMENTS First of all, I would like to thank Prof. Peter Pietzuch for his supervision, guidance, and encouragement throughout the last few years. Without his support, this thesis would not exist. I also want to thank my friends and colleagues who accompanied and worked with me as part of the Large-Scale Distributed Systems/Large-Scale Data and Systems (LSDS) Group, the HiPEDS pro- gramme, and the Department of Computing: Alexandros, Andreas, April, Dan, Divya, Dom, Florian, George, Holger, Jana, Josh, Lukas, Luo, Marcel, Panos, Pierre-Louis, Pijika, Raul, Shujie, Simon, Victoria, and Will. Your company and support throughout the years made this time unforgettable for me. I would also like to thank Dr. Krysia Broda and Dr. Amani El-Kholy for always being there to help with any administrative question or problem I had. Thank you to Kapil and Manuel and the systems and networking group at Microsoft Research Cambridge as well as the Cloud Security team at Google in Kirkland for the opportunities to intern with them and making the internships I did during my PhD inspirational and memorable experiences. I also want to thank all the friends I made at Wood Lane and elsewhere in London that made moving to London so much easier and such an incredible experience: Antoine, Astrid, Dilan, Federico, Giorgia, Isaac, Inês, Kate, Marc, Nadesh, Paula, Sami, Sascha, Sergio, Stas, Stavros, Tina, and everyone else I have met in my time here. Thank you Cheng, for your patience, your understanding, for keeping me sane, and for being there for me whenever I needed it. Lastly, I would like to thank my parents, Maren and Peter, and my siblings, Stefan, Thorsten, and Kerstin for being the best family I could wish for and for always supporting and believing in me. ABSTRACT While cloud computing has been broadly adopted, companies that deal with sensitive data are still reluctant to do so due to privacy concerns or legal restrictions. Vulnerabilities in complex cloud infrastructures, resource sharing among tenants, and malicious insiders pose a real threat to the confidentiality and integrity of sensitive customer data. In recent years trusted execution environments (TEEs), hardware-enforced isolated regions that can protect code and data from the rest of the system, have become available as part of commodity CPUs. However, designing applications for the execution within TEEs requires careful consideration of the elevated threats that come with running in a fully untrusted environment. Interaction with the environment should be minimised, but some cooperation with the untrusted host is required, e.g. for disk and network I/O, via a host interface. Implementing this interface while maintaining the security of sensitive application code and data is a fundamental challenge. This thesis addresses this challenge and discusses how TEEs can be leveraged to secure existing applications efficiently and effectively in untrusted environments. We explore this in the context of three systems that deal with the protection of TEE applications and their host interfaces: SGX-LKL is a library operating system that can run full unmodified applications within TEEs with a minimal general-purpose host interface. By providing broad system support inside the TEE, the reliance on the untrusted host can be reduced to a minimal set of low-level operations that cannot be performed inside the enclave. SGX-LKL provides transparent protection of the host interface and for both disk and network I/O. GLAMDRING is a framework for the semi-automated partitioning of TEE applications into an untrusted and a trusted compartment. Based on source-level annotations, it uses either dynamic or static code analysis to identify sensitive parts of an application. Taking into account the objectives of a small TCB size and low host interface complexity, it defines an application-specific host interface and generates partitioned application code. ENCLAVEDB is a secure database using Intel SGX based on a partitioned in-memory database engine. The core of ENCLAVEDB is its logging and recovery protocol for transaction durability. For this, it relies on the database log managed and persisted by the untrusted database server. ENCLAVEDB protects against advanced host interface attacks and ensures the confidentiality, integrity, and freshness of sensitive data. TABLE OF CONTENTS List of Figures 21 List of Tables 23 List of Algorithms 23 List of Abbreviations 27 1 Introduction 31 1.1 Protecting Data in Use . 32 1.2 Trusted Execution Environments . 34 1.3 Problem Statement . 36 1.4 Contributions . 40 1.4.1 SGX-LKL: Protecting Unmodified Binaries with a Minimal Host Interface . 40 1.4.2 Glamdring: Automated Partitioning for Application-Specific Host Interfaces 41 1.4.3 ENCLAVEDB: A Secure Database with Advanced Host Interface Attack Protection . 42 1.5 Outline . 43 2 Background 45 2.1 The Need for Secure Execution . 46 2.2 Software-Based Secure Execution . 47 2.2.1 Computation on Encrypted Data . 47 2.2.1.1 Advanced Encryption Schemes . 48 2.2.1.2 Garbled Circuits and Functional Encryption . 50 2.2.1.3 Discussion: Insufficiency of Cryptography . 51 2.2.2 Protecting Against an Untrusted OS . 52 2.3 Trusted Computing .