NDA: Preventing Speculative Execution Attacks at Their Source

NDA: Preventing Speculative Execution Attacks at Their Source

NDA: Preventing Speculative Execution Attacks at Their Source Ofir Weisse Ian Neal Kevin Loughlin University of Michigan University of Michigan University of Michigan Thomas F. Wenisch Baris Kasikci University of Michigan University of Michigan ABSTRACT a) Control-Steering Attack b) Chosen-Code Attack 1 1 Speculative execution attacks like Meltdown and Spectre work by 2 Steer control 2 Illegal access accessing secret data in wrong-path execution. Secrets are then trans- mitted and recovered by the attacker via a covert channel. Existing - Access secret Mispredicted Speculative load Transmit secret mitigations either require code modifications, address only specific branch - Transmit secret (access secret) exploit techniques, or block only the cache covert channel. Rather 4 4 than battling exploit techniques and covert channels one by one, 3 Squash 3 Squash we seek to close off speculative execution attacks at their source. Wrong-path Fault handler Wrong-path Our key observation is that these attacks require a chain of depen- dent wrong-path instructions to access and transmit secret data. We Figure 1: Control-steering vs. chosen-code attacks. In control- propose NDA, a technique to restrict speculative data propagation. steering, the attacker steers control flow in existing victim code, NDA breaks the attacks’ wrong-path dependence chains while still inducing unwanted access to the victim’s memory space. In allowing speculation and dynamic scheduling. We describe a design chosen-code, the attacker generates code that accesses privi- space of NDA variants that differ in the constraints they place on leged data or data that belongs to another context. dynamic scheduling and the classes of speculative execution attacks they prevent. NDA preserves much of the performance advantage of out-of-order execution: on SPEC CPU 2017, NDA variants close state (such as registers and memory), speculative execution attacks 68-96% of the performance gap between in-order and unconstrained have demonstrated that attackers can retrieve secrets by control- (insecure) out-of-order execution. ling and observing micro-architectural state (e.g., the cache) during speculative wrong-path execution. CCS CONCEPTS Speculative execution attacks can be classified into two main • Security and privacy Hardware security implementa- categories. One class (e.g., Spectre [34], Spectre 1.1 [33], and oth- tion; • Computer systems organization Architectures. ers [8, 13, 35, 38, 55]) allows malicious code to mis-steer a victim program’s control flow (e.g., by carefully mis-training branch predic- KEYWORDS tors) to execute specific instructions on the speculative wrong path. speculative execution, meltdown, spectre, security Although wrong-path instructions are ultimately squashed (with no effect on architectural state), the victim program is coerced into leak- ACM Reference Format: ing its own memory contents through a micro-architectural channel. Ofir Weisse, Ian Neal, Kevin Loughlin, Thomas F. Wenisch, andBaris Kasikci. 2019. NDA: Preventing Speculative Execution Attacks at Their For instance, Chen et al. [13] show how control-flow in an SGX Source. In The 52nd Annual IEEE/ACM International Symposium on Mi- secure enclave [42] can be steered to leak its own protected memory. croarchitecture (MICRO-52), October 12–16, 2019, Columbus, OH, USA. We classify these attacks as control-steering attacks (Fig. 1a). ACM, New York, NY, USA, 15 pages. https://doi.org/10.1145/3352460. Another class of attacks [25, 36, 45, 54, 59, 62, 64, 65] enables 3358306 unprivileged attacker code to access privileged memory that is tem- porarily exposed during wrong-path execution. For instance, Melt- 1 INTRODUCTION down [36] allows reading kernel memory; Foreshadow [25, 62, Speculative execution attacks [8, 13, 25, 27, 33–36, 38, 39, 45, 54, 65] allows reading hypervisor, OS, SMM, or SGX memory; and 55, 59, 62, 64, 65] exploit micro-architectural behavior and side LazyFP [59] allows reading AES keys from AVX registers used by channels to exfiltrate sensitive information from a system. Unlike another process. MDS attacks [45, 54, 64] allow reading recently classical software exploits that modify and observe only architectural accessed memory belonging to other processes. Since the attacker generates the code, they can select arbitrary instruction sequences Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed in both correct-path and wrong-path execution. We classify these for profit or commercial advantage and that copies bear this notice and the full citation attacks as chosen-code attacks (Fig. 1b). These two classes of at- on the first page. Copyrights for components of this work owned by others than ACM tacks are fundamentally different and therefore require different must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a approaches for mitigation. fee. Request permissions from [email protected]. Existing software defenses against speculative execution attacks MICRO-52, October 12–16, 2019, Columbus, OH, USA work by modifying a program’s source code to block attack-specific © 2019 Association for Computing Machinery. ACM ISBN 978-1-4503-6938-1/19/10. $15.00 mechanisms. Current software defenses for control-steering attacks— https://doi.org/10.1145/3352460.3358306 such as Retpoline [21, 28], IBPB [29], and improved lfence [15] MICRO-52, October 12–16, 2019, Columbus, OH, USA Weisse, et al. instructions—focus on preventing the attacker from steering the protected), and (3) the kind of speculation attacks they prevent (e.g., execution of victim code. Unfortunately, these defenses are not control-steering vs. chosen-code). immediately applicable to existing binaries. Specifically, software NDA defeats all 25 documented [8, 12, 45, 54, 64] speculative mitigations against chosen-code attacks involve modifying the OS, execution attacks without the need to modify any existing code. hypervisor, and SMM code [23, 25, 37, 43]. A recent study by Importantly, however, NDA does not preclude all speculation or Google [41] discusses why software approaches aimed at mitigating OoO execution. For example, one NDA policy treats all instructions timing channels by manipulating timers are insufficient. The authors after an unresolved branch as unsafe. These instructions may still show that any optimizations performed by micro-architecture, no execute speculatively OoO, but they are restricted from propagating matter how negligible, can become observable using an amplification their output to dependents until all preceding branches resolve. As technique. Even if code modifications are made, these defenses can our evaluation demonstrates, despite delayed wake-ups, the vast be bypassed. For instance, attackers can redirect control flow to majority of the performance gap between in-order (the only other evade fence instructions (e.g., by mis-training the branch target model known to eliminate all known speculative execution attacks) buffer (BTB) [27, 34] or the return stack buffer (RSB) [33, 35, 38]). and unconstrained OoO execution is recovered. Hardware defenses, on the other hand, have the potential to obvi- We simulate NDA designs on the SPEC CPU 2017 benchmark ate the need to modify existing software [29, 31, 32, 48, 51, 53, 60, suite and compare its performance to InvisiSpec [69] on the same 69]. The first disclosed speculative execution attacks [27, 34, 36] use setup. InvisiSpec blocks data-cache-based attacks and introduces caches as a covert channel to leak data from wrong-path execution. 7.6-32.7% overhead in our setup. In comparison, NDA blocks all Consequently, initial hardware defenses—such as InvisiSpec [69], covert channels. We show that an NDA policy that mitigates control- SafeSpec [31], and others [32, 48, 51, 53, 60]—seek to prevent steering vulnerabilities, which are fundamental to unconstrained wrong-path execution from leaving secrets in the cache that can later OoO execution, slows execution by only 10.7% and is 4:8× faster be recovered. Taram et al. [60] suggests a hardware modification than in-order. If we also preclude Meltdown-like hardware imple- to automatically insert lfence micro-ops where needed. However, mentation flaws, NDA’s strictest policy slows down execution by the authors claim mainly to address Spectre v1 attacks that use the 125% compared to an insecure OoO processor and is 2:4× faster data cache as a covert channel. than in-order execution. While these techniques are effective, a recent study [12] noted In short, we make the following contributions: that closing only the cache covert channel is insufficient to stop • We introduce a speculative-execution-attack taxonomy based speculative execution attacks, since the cache is only one of many on how attacks induce wrong-path execution. potential covert channels. Netspectre [55] and SMoTher Spectre [8] • We design NDA, a new technique to control speculative data have already shown that secrets can be transmitted via the FPU or via propagation in out-of-order processors to defeat speculative port contention [4]. In §3, we further show how to transmit secrets execution attacks. NDA offers multiple variants with differing via the BTB. security/performance tradeoffs. Rather than isolating predictive structures [29] or sealing individ- • We evaluate six NDA variants on SPEC 2017

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    15 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us