
Moat: Verifying Confidentiality of Enclave Programs Rohit Sinha Sriram Rajamani UC Berkeley Microsoft Research [email protected] [email protected] Sanjit A. Seshia Kapil Vaswani UC Berkeley Microsoft Research [email protected] [email protected] ABSTRACT 1. INTRODUCTION Security-critical applications constantly face threats from Building applications that do not leak secrets, i.e., pro- exploits in lower computing layers such as the operating vide confidentiality guarantees, is a non-trivial task. There system, virtual machine monitors, or even attacks from ma- are at least three kinds of attacks a developer must guard licious administrators. To help protect application secrets against. The first kind of attack, which we call protocol at- from such attacks, there is increasing interest in hardware tack, is relevant for distributed applications involving client implementations of primitives for trusted computing, such nodes and cloud-based services, and can arise from vulnera- as Intel's Software Guard Extensions (SGX) instructions. bilities in the cryptographic protocol used to establish trust These primitives enable hardware protection of memory re- between various distributed components. Examples of pro- gions containing code and data, and provide a root of trust tocol attacks include man-in-the-middle or replay attacks. for measurement, remote attestation, and cryptographic seal- The second kind of attack, which we call application attack, ing. However, vulnerabilities in the application itself, such is due to errors or vulnerabilities in the application code it- as the incorrect use of SGX instructions or memory safety self which can be exploited to leak confidential information errors, can be exploited to divulge secrets. In this paper, we from the application (e.g., the Heartbleed bug [18]). The introduce a new approach to formally model these primitives third kind of attack, which we call infrastructure attack, is and formally verify properties of so-called enclave programs due to exploits in the software stack (e.g. operating system that use them. More specifically, we create formal models (OS), hypervisor) that the application relies upon, where of relevant aspects of SGX, develop several adversary mod- the privileged malware has full control of the CPU, mem- els, and present a sound verification methodology (based on ory, I/O devices, etc. Infrastructure attacks can result in an automated theorem proving and information flow analysis) attacker gaining control of any application's memory and for proving that an enclave program running on SGX does reading secrets at will. not contain a vulnerability that causes it to reveal secrets Several mitigation strategies have been proposed for each to the adversary. We introduce Moat, a tool which formally of these kinds of attacks. In order to guard against proto- verifies confidentiality properties of applications running on col attacks, we can use protocol verifiers (e.g., ProVerif [11], SGX. We evaluate Moat on several applications, including a CryptoVerif [12]) to check for protocol errors. In order to one time password scheme, off-the-record messaging, notary guard against application attacks, the application can be service, and secure query processing. developed in a memory-safe language with information flow control, such as Jif [28]. Infrastructure attacks are the hard- Categories and Subject Descriptors est to protect against, since the attack can happen even if the application is error free (i.e., without application vulner- D.4.6 [Operating Systems]: Security and Protection | abilities or protocol vulnerabilities). While some efforts are Information flow controls, Verification; D.2.4 [Software En- under way to build a fully verified software stack ground-up gineering]: Software/Program Verification | Formal meth- (e.g. [21, 25]), this approach is unlikely to scale to real-world ods, Model checking OS and system software. An alternative approach to guarding against infrastruc- Keywords ture attack is by hardware features that enable a user-level application to be protected from privileged malware. For Enclave Programs; Secure Computation; Confidentiality; For- instance, Intel SGX [23, 24] is an extension to the x86 in- mal Verification struction set architecture, which provides any application Permission to make digital or hard copies of all or part of this work for personal or the ability to create protected execution contexts called en- classroom use is granted without fee provided that copies are not made or distributed claves containing code and data. SGX features include 1) for profit or commercial advantage and that copies bear this notice and the full citation hardware-assisted isolation from privileged malware for en- on the first page. Copyrights for components of this work owned by others than the clave code and data, 2) measurement and attestation prim- author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or itives for detecting attacks on the enclave during creation, republish, to post on servers or to redistribute to lists, requires prior specific permission and 3) sealing primitives for storing secrets onto untrusted and/or a fee. Request permissions from [email protected]. CCS’15, October 12–16, 2015, Denver, Colorado, USA. persistent storage. Using these extensions it is possible to Copyright is held by the owner/author(s). Publication rights licensed to ACM. write applications with a small trusted computing base, which ACM 978-1-4503-3832-5/15/10 ...$15.00. includes only the enclave code and the SGX processor. All DOI: http://dx.doi.org/10.1145/2810103.2813608 . other layers in the software stack including the operating malware attacks. Furthermore, extending traditional type system and the hypervisor can be excluded from the trusted systems to enclave programs is non-trivial because the anal- computing base. However, establishing such a guarantee ysis must faithfully model the semantics of SGX instruc- requires precise understanding of the contract between the tions and infer information flows to individual addresses hardware and software. In particular, it requires specify- within enclave memory. Therefore, we develop a static ver- ing a formal API-level semantics of SGX instructions, an ifier called Moat that analyzes the instruction-level behav- adversary model, and a verification methodology (with tool ior of the enclave binary program. Moat employs a flow- support) to detect insecure use of SGX instructions. Our and path-sensitive type checking algorithm (based on auto- work addresses each of these aspects, as we describe below. mated theorem proving using satisfiability modulo theories solving [8]) for automatically verifying whether an enclave Semantics of SGX instructions. SGX provides instruc- program (in the presence of an active adversary) provides tions which enable applications to create enclaves, transfer confidentiality guarantees. For ill-typed programs, Moat re- control to and from enclaves, perform remote attestation, turns an exploit demonstrating a potential leak of secret to and seal and unseal secrets so that they can persist on the non-enclave memory. By analyzing the binary, we remove platform. We give a formal semantic model of the interface the compiler from our trusted computing base, and relax between the programmer and the implementation of SGX, several memory safety assumptions that are common in tra- with an eye towards automatic formal verification of the en- ditional information flow type systems. clave code's security. Our approach is similar in spirit to Although we do not focus on protocol attacks in this previous work on finding API-level exploits [20] using the paper, we briefly describe how one can compose protocol- UCLID modeling and verification system [15]. level analysis (performed by a verifier such as ProVerif [11]) Adversary model. We consider a powerful adversary who with Moat to achieve end-to-end confidentiality guarantees can compromise the infrastructure code (OS, hypervisor, against infrastructure, application, and protocol attacks. etc.) and perform both passive and active attacks by access- ing any non-enclave memory (i.e. memory not protected by In summary, the goal of this paper is to explore the con- SGX), modifying page tables, generating interrupts, control- tract between the SGX hardware and the enclave developer ling I/O interaction, etc. It is non-trivial to reason about and provide a methodology and tool support for the pro- enclave behaviors (and potential vulnerabilities) in the pres- grammer to write secure enclaves. We make the following ence of such an adversary. As a first step, using our formal specific contributions: ISA-level semantics of the SGX instructions, we prove that • We develop the first semantic API model of the SGX plat- (if the application follows certain guidelines during enclave form and its new instruction set, working from publicly- creation) any combination of the above adversarial actions available documentation [24]. can be simply modeled as an arbitrary update of non-enclave memory. This simplifies our reasoning of enclave execution • We formally study active and passive adversaries for SGX in the presence of privileged adversaries. In particular, we enclaves, and show that a havocing adversary who observes show that a so-called havocing adversary who symbolically and havocs non-enclave memory after every instruction in modifies all of the non-enclave memory after every instruc- the enclave is both powerful enough to model all such ad- tion of the
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages16 Page
-
File Size-