Disentangle Secure-Enclave Hardware from Software Andrew Ferraiuolo, - - PowerPoint PPT Presentation

disentangle secure enclave
SMART_READER_LITE
LIVE PREVIEW

Disentangle Secure-Enclave Hardware from Software Andrew Ferraiuolo, - - PowerPoint PPT Presentation

Komodo: Using Verification to Disentangle Secure-Enclave Hardware from Software Andrew Ferraiuolo, Andrew Baumann, Chris Hawblitzel, Bryan Parno* Microsoft Research, Cornell University, Carnegie Mellon University* 1 Secure Remote


slide-1
SLIDE 1

Komodo: Using Verification to Disentangle Secure-Enclave Hardware from Software

Andrew Ferraiuolo†, Andrew Baumann, Chris Hawblitzel, Bryan Parno* Microsoft Research, Cornell University†, Carnegie Mellon University*

1

slide-2
SLIDE 2

Secure Remote Computation

Application + Secrets OS, Hypervisor, Other SW CPU Memory Application/Data Owner Remote Machine

2

slide-3
SLIDE 3

Intel SGX

Enclave

Secret Data

EnclaveEntry: mov fs:[Tcs],rbx mov fs:[CSSA],eax cmp eax, 0 jne ExceptionEntry mov r10,fs:[ResAdr] cmp r10,0 je @F jmp r10 @@:mov rcx, r8 mov rdx, r9 mov r8, rbx

OS (untrusted) Reference Monitor Memory Memory encryption Remote attestation SGX instructions Implement a reference monitor

3

slide-4
SLIDE 4

SGX Limitations – Slow to Evolve

Software developers must wait for Intel to make changes Change is necessary

  • SGX1 had no support for dynamic memory management
  • SGX2 was announced in 2014. Still no implementation!

SGX instructions are primarily microcode

  • Software at the slow pace of hardware!

4

Software Hardware Development Time

slide-5
SLIDE 5

SGX Limitations – Root of Trust?

SGX is complex

  • Approaching a microkernel in hardware

Hardware is no more trustworthy than software

  • Hardware vulnerabilities: f00f, cache poisoning, VT-D vuln., others
  • Purely axiomatic basis for trust

SGX vulnerabilities have already been found (CVE-2017-569)

5

slide-6
SLIDE 6

Komodo

Enclave management in software Evolve independently of hardware Trust through formal verification

6

slide-7
SLIDE 7

Komodo Architecture

Komodo monitor software:

  • Mimics SGX instructions
  • Minimal hardware requirements
  • Supported by commercial processors

Hardware Requirements:

  • Isolated memory
  • Encryption (Intel/AMD), partitioning (ARM)
  • Key-generation for attestation
  • Trusted Platform Module (many processors)
  • Protection modes for enclave, monitor
  • Machine mode (RISC-V), TrustZone (ARM)

Untrusted OS User proc. Enclave Komodo monitor CPU / HW Mem isolation

  • Attest. key

7

slide-8
SLIDE 8

Prototype on ARM TrustZone

Secure-world memory is isolated from normal world.

Komodo Monitor Untrusted OS Enclaves User apps Privileged modes: User mode: Secure world Normal world

8

slide-9
SLIDE 9

OS Monitor Calls: Creation

INIT_ADDRSPACE() INIT_L2PT() MAP_SECURE() / MAP_INSECURE() INIT_THREAD() FINALISE()

9

Data Context Entry (PC)

PageDB

L1PT: State: Init Final Measurement L2PT

slide-10
SLIDE 10

OS Monitor Calls: Entry

ENTER() / RESUME()

10

L1PT: Context Entry (PC) State: Final

PageDB

PC L1PT GPRs CPU: Interrupt/ Exception

slide-11
SLIDE 11

Enclave Execution

Compute on data in its secure pages Communicate with outside world

  • Read/write insecure pages
  • Register arguments/return values

Komodo enclave API

  • Create/verify attestations
  • Secure source of randomness
  • Map/unmap spare pages
  • Exit thread

11

slide-12
SLIDE 12

Verification

1) Prove Komodo conforms to specification of correct execution

  • Simpler, more abstract

2) Prove that correctness spec enforces security properties

Correctness Specification Security Properties

Implementation

12

slide-13
SLIDE 13

Security Properties

Enclaves are protected from an OS + malicious enclave adversary:

  • Confidentiality – enclave secret state cannot leak to adversary
  • Integrity – adversary cannot tamper with enclave trusted contents

Formalized as noninterference – adversarially-observable outputs are purely determined by adversarially-controlled inputs Declassified to OS: exception type, dynamic allocation, return values, and insecure memory

  • Precisely captures what information is released

13

slide-14
SLIDE 14

Verification Approach

Dafny, Z3 ARMv7 ISA model

(~1.5k LOC)

Komodo implementation (annotated assembly)

code proof

Komodo abstract spec

(~2k LOC)

komodo.S

Trusted Untrusted

Supporting proofs

14

slide-15
SLIDE 15

Microbenchmark results

Prototype on Raspberry Pi 2.

  • Bootloader: loads monitor into secure world memory + sets exception vectors
  • cf. SGX: ~7100 cycles for enter + exit [Eleos, Eurosys’17]
  • In part because RasPi has a slower clock rate (900MHz vs 2GHz+ )

Operation Cycles Null SMC 123 Enter 496 Resume 625 Enter + Exit 738

15

slide-16
SLIDE 16

Performance: Notary Application

10 20 30 40 50 60 70 80 4 8 16 32 64 128 256 512 Time (ms) Input size (kB) Komodo enclave Linux process

16

slide-17
SLIDE 17

Verification Effort

Total verification effort – 2 person-years Source lines of code : Spec Impl Proof Total 4,446 2,710 18,655

17

Security 175 Correctness 795 ARM 1,174 Other 2,302

slide-18
SLIDE 18

Adaptability

Motivation: software can evolve more quickly than hardware SGX2 extends SGX1 with dynamic memory management

  • Specified three years ago. Still no implementation

We extended Komodo with dynamic memory in 6 person-months!

  • Three weeks to re-establish security proofs

18

slide-19
SLIDE 19

Related Work

CertiKOS / seL4

  • Implement fully-featured microkernels
  • Prove correctness, security properties
  • Komodo is a simpler system, supports attestation

Sanctum

  • Proposes RISC-V-based hardware that meets the needs of Komodo

19

slide-20
SLIDE 20

Lessons Learned

A small code base is not a substitute for verification.

  • Verification caught real bugs in our implementation

Trusted components require extra diligence

  • We found bugs in trusted/unverified components

Verification tools can still improve

  • Timeouts / proof instability

20

slide-21
SLIDE 21

Conclusion

SGX defends against a powerful threat-model, but it has limitations:

  • Slow to change
  • Requires axiomatic trust

Komodo improves evolvability and security

  • Implemented in software with minimal hardware requirements
  • First formally-verified implementation of attested enclaves

Verification of software enclaves is tractable, permits evolution

  • 2 person-years worth of total effort
  • 6 person-months to add SGX2-like dynamic memory management

https://github.com/Microsoft/Komodo

21