CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom

Page created by Katie Bell
 
CONTINUE READING
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
CacheOut and SGAxe:
            How SGX Fails in Practice

    Stephan van Schaik, Marina Minkin, Andrew Kwong
             Daniel Genkin and Yuval Yarom

1
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2018)

    Disclosed in 2018: speculative- and transient-execution attacks
2
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2018) - Meltdown & Foreshadow

                    Basic cache hierarchy
3
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2018) - Meltdown & Foreshadow

         Meltdown and Foreshadow leak data from caches
4
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2018) - Meltdown & Foreshadow

                 Prompted wide mitigation effort
5
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2018) - Meltdown & Foreshadow

              No longer possible to leak from caches
6
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2019) - MDS Attacks

                Turns out there are more buffers
7
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2019) - MDS Attacks

        Disclosed in 2019: Micro-architectural Data Sampling
8
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Recap (2019) - MDS Attacks

                MDS targets internal CPU buffers
9
CacheOut and SGAxe: How SGX Fails in Practice - Stephan van Schaik, Marina Minkin, Andrew Kwong Daniel Genkin and Yuval Yarom
Micro-architectural Data Sampling
     • Access other people's data through faulting or assisting loads
     • Across processes, VMs and Intel SGX

10
Micro-architectural Data Sampling

          MDS samples data passing through these buffers
11
Micro-architectural Data Sampling

            MDS attacks are like drinking from a fire hose
12
Micro-architectural Data Sampling

                You just get whatever data is in flight!
13
Micro-architectural Data Sampling

         Hence the name: "Micro-architectural Data Sampling"
14
Micro-architectural Data Sampling

                No control over what you are getting
15
Mitigating MDS

          Mitigation: verw to flush the internal CPU buffers
16
Part 2: CacheOut

17
Mitigating MDS
     •   Flush internal CPU buffers
     •   Does not fix the root cause behind MDS!
     •   You can still leak data from those buffers
     •   Is flushing buffers sufficient as a mitigation?
     •   Bonus: can we get some more control?

18
Observations
     "… evicting the previous caches line from the L1d cache … the
     processor has to write them back through the memory hierarchy
                   and will do this through the LFB ..."
                The RIDL paper (https://mdsattacks.com/files/ridl.pdf)

     • Evicting the cache forces data into the fill buffer
     • ZombieLoad reports 0.1 B/s leakage despite mitigations
     • This residual leakage is worrisome

19
New Data Path

                Data path for eviction through the LFB
20
New Data Path

                But the LFB is still leaky!
21
So how do we exploit evictions?

22
Exploiting Evictions

23
Exploiting Evictions

             The victim's data is in the fill buffer and cache
24
Exploiting Evictions

           However, verw flushes that data from the fill buffer
25
Exploiting Evictions

               How do we leak the data from the cache?
26
Exploiting Evictions

                       The cache is divided into sets
27
Exploiting Evictions

            The address determines in which set the data is
28
Exploiting Evictions

        The attacker reads addresses mapping to the same set
29
Exploiting Evictions

                and fills the cache set with its own data
30
Exploiting Evictions

               evicting the victim's data into the fill buffer
31
Exploiting Evictions

               While the data gets written back to DRAM
32
Exploiting Evictions

            The attacker uses a faulty load to leak the data
33
Exploiting Evictions

            The attacker uses a faulty load to leak the data
34
Exploiting Evictions

            The attacker uses a faulty load to leak the data
35
Exploiting CacheOut
     • CacheOut leaks at 2.85 KiB/s (rather than 0.1 B/s)
     • Targets data at rest:
         – Control when we push the data into the LFB
         – Long after the victim accessed the data
     •   Leak AES and RSA keys
     •   Leak neural network weights
     •   Break KASLR and leak kernel data
     •   Even across VMs, including the hypervisor

36
Exploiting CacheOut

                 Dump data from SGX enclaves
37
SGX based Applications

38
Software Guard Extensions (SGX) Security Model

        User Space          Enclave Attestation

                OS Kernel

                  VMM

                  SMM                                 Remote
                                                       Client
        RAM          HW          CPU

39
Software Guard Extensions (SGX) Security Model

                           Enclave
                             quote
                                   Attestation

     Takeaway: trust
     is based on the
     EPID key                                          Remote
                                                        Client
                                  CPU
                              Enhanced Privacy ID
40
AaaS                        Andrew’s

    (Attestation as a Service)
•    @SGAxe_AaaS
  Will attest to anything tweeted at it
• Signed 100+ quotes within 2 hours
     • Blocked by Github
• After the public release of the paper,
  key was still trusted for a whole
  month
• Can’t update TCB quickly because               Andrew’s

  SGX users need to install BIOS
  updates
• Hardcoded MRSIGNER prevents
  abuse
SGX in Signal
• In May, Signal started prompting users to
  add pins

• Secure Value Recovery (SVR)
   • Backup contacts in cloud
   • Non-phone # based addressing

• Isn’t selling point of signal is that they
  don’t store info about users?
   • Data is encrypted under a key derived from
     both the user’s pin and a random seed
   • Designed so that Signal themselves cannot
     decrypt the data
   • Problem: relies on SGX
Secure Value Recovery
                                                           Stored On Signal’s Servers
       likely just a 4-digit
       pin                                                           In Enclave
                                 Argon2                     C2
          User’s Pin
                                                          256-bit
                                                       random seed           Enclave rate limits
                                                                             guessing attempts

             1010                                                 Encrypted
             1100                Encryption                       User’s Data
         User’s Data
• Encryption key derived from both user’s secret pin and a random seed
• User’s data still secure even when the user’s pin is short and memorable
Leaking C2
• Attacker with access to the Signal servers storing
  C2:
    • Use CacheOut can recover C2 from L1-cache
    • Requires some side-channel knowledge
                                                                      C2

• Alternatively: exploit the trust placed in the EPID keys           256-bit
                                                                  random seed
• Values are replicated across a Raft cluster
    • Raft stores C2 and the random seed as a distributed log

• If cluster’s network is compromised (subpoena,
  coercion, hacked machines, etc):
    • Attacker can then use the stolen EPID keys to forge quote
                                                                                  Send me a replica
                                                                   Fake Replica      of the log!
      proving that the malicious replica is running on SGX
        • Even though fake replica is not using SGX
    • request Raft network to replicate the entire log               quote
    • Can then be read in plaintext
Summary
• CacheOut breaches SGX’s confidentiality,
  allowing an attacker to masquerade as a
  legitimate SGX enclave
• Good that Signal is thinking about side-
  channels against SGX
   • insert LFENCE before each branch
   • also use retpolines to defend against speculation
     attacks
   • Doesn’t mitigate CacheOut
• SGX cannot be relied upon to limit guessing
  attempts
   • Signal should still require strong passwords for SVR
• Attack assumes a malicious Signal Server with
  access to the cluster
   • Cannot do this at home
   • Subpoena, insider threat, hacked machines
Countermeasures
 • Dedicated Microcode update
   released on June 20th
     – Patch your machine
 • More details at
   CacheOutAttack.com

     Thank you!
                            (ankwong@umich.edu)   (stephvs@umich.edu)
     Questions?

46
You can also read