Understanding Microarchitectural Channels and Using Them for Defense
Total Page:16
File Type:pdf, Size:1020Kb
Understanding Microarchitectural Channels and Using Them for Defense Casen Hunger Mikhail Kazdagli Ankit Rawat Alex Dimakis Sriram Vishwanath Mohit Tiwari UT Austin {casen.h, mikhail.kazdagli, ankitsr}@utexas.edu, {dimakis, sriram, tiwari}@austin.utexas.edu Abstract networks-on-chip [9, 8]; clearing out leftover state in Microarchitectural resources such as caches and pre- caches [10] and branch predictor on a context switch [11]; dictors can be used to leak information across security and even complete systems-on-chip where processes cannot domains. Significant prior work has demonstrated attacks interfere with each other [12, 13, 14]. Alternatively, archi- and defenses for specific types of such microarchitectural tects have also proposed the introduction of random noise side and covert channels. In this paper, we introduce a to hardware counters [15] or cache replacement policies [7]. general mathematical study of microarchitectural channels While these approaches are promising, they either address using information theory. Our conceptual contribution is a only known, specific sources of leaks [7, 8, 9] or require simple mathematical abstraction that captures the common far-reaching changes to the entire microarchitecture [12, 14] characteristics of all microarchitectural channels. We call that hamper adoption. this the Bucket model and it reveals that microarchitectural A complementary software-only approach to protect sen- channels are fundamentally different from side and covert sitive data in the cloud is to rent dedicated physical ma- channels in networking. chines, so that only friendly virtual machines co-reside We then quantify the communication capacity of sev- on a physical machine. The challenge for a cloud tenant eral microarchitectural covert channels (including chan- then is to audit whether an attacker has exploited a vulner- nels that rely on performance counters, AES hardware ability in the cloud provider’s software to co-reside on the and memory buses) and measure bandwidths across both same hardware [1]. HomeAlone [3] introduces one such KVM based heavy-weight virtualization and light-weight audit technique where a tenant uses cache lines like miners operating-system level isolation. We demonstrate channel use canaries – the tenant leaves the canary cache lines un- capacities that are orders of magnitude higher compared to touched and if an attacker process evicts a few such lines, what was previously considered possible. the tenant’s detector process raises an alarm. Avoiding co- Finally, we introduce a novel way of detecting intelligent residency thus addresses all microarchitectural attacks at adversaries that try to hide while running covert channel a cost of scaling in terms of physical machines (v. virtual eavesdropping attacks. Our method generalizes a prior machines), and is used by cloud tenants who work with detection scheme (that modeled static adversaries) by in- financial, military, and sensitive personal data. troducing noise that hides the detection process from an However, considerable work is required to realize the intelligent eavesdropper. promise of dedicated machines as a secure, immediately usable approach. First, HomeAlone’s detector is specific to 1 Introduction caches and an attacker who uses the main memory interface Virtual machine isolation is a fundamental security prim- to leak data [2] using cache bypassing instructions will itive. However, several recent works [1, 2, 3, 4, 5, 6] have avoid triggering cache-line based alarms. HomeAlone also shown that shared hardware can be exploited to leak infor- requires multi-threading and performance counters to be mation from one process to another, negating all isolation turned off to prevent data leaks. Worse, HomeAlone is guarantees offered by operating systems and hypervisors. vulnerable against an intelligent attacker who is aware of For example, a ‘1’ in a secret key induces a square-and- the defense and can adapt to it. For example, HomeAlone multiply operation while a ‘0’ induces only a squaring oper- has to determine whether canary lines are evicted by an ation. Using this information, an attacker that shares CPU attacker or by the hypervisor. An attacker who a) lowers usage with a victim process can measure its own instruction her hardware activity to match the background noise and cache hit rate and use it to determine the secret key [5]. b) models HomeAlone’s detector to pause the attack while Such information leaks have been used to infer secret detection is underway can evade HomeAlone’s detector. keys from cryptographic libraries in commercial clouds In this paper, we introduce the formal study of microar- like Amazon EC2 [1, 5]. When these covert channels are chitectural channels using information theory. Our concep- used deliberately to exfiltrate secret data, rates up to 100 tual contribution is a simple mathematical abstraction that bits per second [2] have been reported on Amazon EC2. captures the common characteristics of all microarchitec- These leaks do more damage than just giving up victims’ tural channels. We call this the Bucket model and it reveals secrets; their threat has led commercial cloud vendors to that microarchitectural covert channels are fundamentally shut down important features such as hardware counters different from previously studied timing channels because and simultaneous multi-threading [3] for all customers. reads are destructive, i.e., reading a bit overwrites the value To combat these information leaks, hardware architects of the bit. We start by developing the noise-free case and have proposed several solutions including partitioning or show that perfect (in the Shannon sense) detection can be time-multiplexing caches [7], memory controllers [8], and obtained against arbitrary co-resident virtual machines. In contrast, provably undetectable covert channels have been Wall clock time shown in networking where attackers encode secret bits into 1 bit time period Issue load the timing or size of network packets. Idle loop. Sender Instructions. Sent 1 Sent 0 We quantify the information theoretic capacity achiev- (Access) (No Access) Issue load Issue load able through microarchitectural channels, including new Instructions; Instructions; ones through AES hardware and cache bypass instructions. Receiver Read counter. Read counter. By optimizing the alignment of clocks between sender and (Prime/Probe) (Prime/Probe) receiver processes, we show high capacities of greater than (a) Cache performance counter covert channel 500 Kbps for both intra-core and inter-core channels. Fur- Idle loop. ther, we show that multiple channels communicating con- Sender Lock memory bus. currently can achieve capacities over 200 Kbps. These high (Contention) (No Contention) capacities, when compared to 100 bps on EC2 today, show Sent 1 Sent 0 that as commercial hypervisors move towards lighter-weight Cache bypass instructions; Cache bypass instructions; isolation techniques such as Docker [16], microarchitectural Receiver Measure latency/instruction. Measure latency/instruction. channels become tremendously more leaky. (Probe) (Probe) Finally, we extend the Bucket model to account for noise (b) Memory interface covert channel from background processes and apply the model to detect- Figure 1: Microarchitecture covert channel examples. ing an intelligent attacker. The intelligent attacker conducts Sender-receiver pairs can execute alternately (a) or in parallel low-bandwidth probes in order to distinguish a detector (b) – both cases rely on contention for shared hardware. from the victim application and goes quiet if she sees a detector. In response, our detector mimics a victim appli- tial data in a tenant VM deliberately leaks the data to a cation’s microarchitectural behavior to prevent the attacker co-resident attacker VM. from going quiet, and listens to the channel for bits that are In particular, we quantify the covert channel attack sur- overwritten by an attacker during eavesdropping attempts. face since they become particularly relevant in systems that In the presence of other processes or system noise, however, include third-party software (as most cloud applications are). our detector simulates an optimized amount of random noise Further, covert channel capacities represent an upper bound to minimize being detected by an intelligent eavesdropper. on side-channel capacities. The Bucket model and detection Section3 describes our design and implementation of a algorithms, however, target co-resident attackers and hence diverse set of microarchitectural channels. We generalize model/detect both covert and side channel attackers. these channels and present the Bucket Model with its de- 2.2 Known microarchitectural channel attacks structive read feature in Section4. Further, we quantify the Microarchitectural channels can be created by a sender communication capacity of each channel (Section5) and and a receiver VM executing alternately or parallel as shown use these channels for detection games against an intelligent in Figure1. adversary in Section6. But first, we begin with a summary One popular alternating communication technique is of the considerable related work that we build upon. termed the Prime-Access-Probe method (Figure1a). Dur- 2 Background and Related Work ing the Prime stage of communication for (say) a cache channel, the channel receiver sets the cache into a known 2.1 Threat Model state by accessing memory locations and bringing its data We minimally assume two principals in the system: ten-