Safe Interacting Enclaves for Heterogeneous Protected Module - - PowerPoint PPT Presentation

safe interacting enclaves for heterogeneous protected
SMART_READER_LITE
LIVE PREVIEW

Safe Interacting Enclaves for Heterogeneous Protected Module - - PowerPoint PPT Presentation

Safe Interacting Enclaves for Heterogeneous Protected Module Architectures Sten Verbois 29 June 2018 Content 1. Motivation 2. Research Goals 3. Aspects of Using Rust 4. Case Study: Attestation server for VulCAN 5. Demo 1 Motivation


slide-1
SLIDE 1

Safe Interacting Enclaves for Heterogeneous Protected Module Architectures

Sten Verbois 29 June 2018

slide-2
SLIDE 2

Content

  • 1. Motivation
  • 2. Research Goals
  • 3. Aspects of Using Rust
  • 4. Case Study: Attestation server for VulCAN
  • 5. Demo

1

slide-3
SLIDE 3

Motivation

  • When deploying software, you have to trust the platform
  • Isolation on OS level (e.g. LXC, Docker) is not enough

2

slide-4
SLIDE 4

Motivation

  • Protected Module Architectures provide isolation even from

privileged software

  • Guarantees integrity and confidentiality
  • Two relevant implementations:

– Intel Software Guard Extensions – Sancus

  • Guarantees only hold when source code does not contain

memory corruption bugs

– e.g. buffer overflow, use-after-free, ...

  • Guidelines and best practices are available

3

slide-5
SLIDE 5

But...

4

slide-6
SLIDE 6

Solutions

  • Formal verification [1]
  • Static analysis [2, 3]
  • Program transformations / Runtime checks [4, 5, 6]
  • Safe programming language

– Good candidate: Rust

5

slide-7
SLIDE 7

Motivation (cont.)

  • Modules require interaction with

– untrusted context – other protected modules – other I/O (input devices, actuators)

  • Interaction with secure components should be secure as well
  • Case study: securing vehicular communication with VulCAN

6

slide-8
SLIDE 8

Research Goals

  • Specify requirements for setting up secure communication

channels between protected modules

  • Advance the VulCAN design by proposing an attestation server

enclave implementation

  • Use Rust to develop such enclaves with a small TCB while

efficiently eliminating memory corruption vulnerabilities

7

slide-9
SLIDE 9

Why Rust?

  • Systems programming language
  • Zero-cost abstractions
  • Guarantees memory and thread safety
  • Optional standard library
  • Helpful error reporting

https://www.rust-lang.org

8

slide-10
SLIDE 10

Ownership and Borrowing

1

fn main() {

2

let mut v = Vec::new();

3

v.push(1);

4

borrow(&v); // OK, v borrowed

5

v.push(2);

6

take(v);

7

//

  • value moved here

8

v.push(3); // ERROR

9

// ^ value used here after move

10

} fn borrow(v: &Vec<i32>) { // ... } // Borrow ends here fn take(v: Vec<i32>) { // ... }

Listing 1: Code snippet demonstrating the compiler-enforced ownership mechanism of Rust.

9

slide-11
SLIDE 11

Rust enclaves

Figure: Developing SGX enclaves in C (left) and Rust (right).

10

slide-12
SLIDE 12

Rust enclaves

  • No Rust Standard Library available
  • Baidu Rust-SGX SDK implements most of std in Intel SGX

SDK

– e.g. collections (String, Vector, HashMap), Rust-like file handling for SGX protected fs and Random number generation

  • Other solutions: Graphene and Haven (Library OS), SCONE

(Docker in Intel SGX)

11

slide-13
SLIDE 13

Rust enclaves

  • Near C performance for Spongent/SpongeWrap

cryptographic functions C++ Rust Input length 256-bit 1024-bit 256-bit 1024-bit

  • Avg. cycles

54,368,526 201,213,242 50,396,303 184,812,155

  • Std. dev.

336,584 9,694,415 504,136 2,175,737

Table: Runtime performance comparison between C++ and Rust.

12

slide-14
SLIDE 14

Rust enclaves

  • Minimal programmer effort

– Alternatives: formal verification or exhaustive testing – Porting code from C/C++) to Rust is relatively easy

1

char* input = ...;

2

int inputLeft = inputLength;

3

while (inputLeft) {

4

// Use RATE bytes of input

5

...

6 7

input += RATE;

8

inputLeft -= RATE;

9

} let input: &[u8] = ...; for block in input.chunks(RATE) { // Use ‘block‘ ... }

Listing 2: Comparison between C (left) and Rust(right) of a common code pattern.

13

slide-15
SLIDE 15

VulCAN Case Study: CAN

  • CAN: Controller Area Network

– Broadcast message bus used in vehicular control systems – 1991: First production vehicle from Mercedes-Benz [7]

  • LeiA [8] & VatiCAN [9]

– Authentication between Electronic Control Units (ECUs) – Prevents unauthorised ECUs from performing actions

  • VulCAN [10]:

– Protects against arbitrary code execution on ECUs – Put authentication protocol implementation in PMA

14

slide-16
SLIDE 16

VulCAN Case Study

Figure: Picture of VulCAN hardware demo from [?].

15

slide-17
SLIDE 17

VulCAN Case Study: Simplified

CAN Sancus MCU

SGX enabled system

Sancus MCU

Attestation & Key Distribution Attestation & Key Distribution Ping-Pong

Figure: Schematic representation of hardware setup.

16

slide-18
SLIDE 18

VulCAN Case Study: Logging Server

  • Passive logging module
  • If the log indicates an authenticated message, then it must

have been produced by a trusted component in the network

  • Non-repudiation but no availability
  • Limited usability

17

slide-19
SLIDE 19

VulCAN Case Study: Attestation Server

Attestation

  • Goals

– Expected module content ... – ... running on expected platform ... – ... with expected memory layout

  • Challenge-response
  • Utilizing module-specific key KPM

18

slide-20
SLIDE 20

VulCAN Case Study: Attestation Server

Attestation

AS enclave PM

Compute

{; n}KPM

n

Randomly generate

n

{; n}T

KPM Compare computed with received value

{; n}T

KPM

∀PM Compute {;n}KPM

Figure: Attestation protocol between AS and each PM.

19

slide-21
SLIDE 21

VulCAN Case Study: Attestation Server

Key distribution

  • Goals

– Securely deliver connection keys KC to PMs – Proof received ⇒ key successfully installed

  • Again, encrypt payload with module-specific key KPM

20

slide-22
SLIDE 22

VulCAN Case Study: Attestation Server

Key distribution

PM

Decrypt

I , DC KC

Compute

{; M}KC

Mark initialized

C

AS enclave ∀PM Randomly generate all connection keys KC {I , ; DC KC }KPM ∀ : PM ∈ C KC Install KC Compare computed with received value

{; M}T

KC

Compute

{; M}KC {; M}T

KC

If uninitialized

C

Figure: Key distribution protocol* between AS and each PM.

21

slide-23
SLIDE 23

Questions

Thank you for your attention! Questions?

22

slide-24
SLIDE 24

References I

  • B. Jacobs, J. Smans, and F. Piessens, “The Verifast program

verifier: A tutorial,” Tech. Rep., 2014.

  • M. Das, S. Lerner, and M. Seigle, “ESP: Path-sensitive

program verification in polynomial time,” in ACM Sigplan Notices, vol. 37, pp. 57–68, ACM, 2002.

  • J. Berdine, B. Cook, and S. Ishtiaq, “SLAyer: Memory safety

for systems-level code,” in International Conference on Computer Aided Verification, pp. 178–183, Springer, 2011.

23

slide-25
SLIDE 25

References II

  • S. Nagarakatte, J. Zhao, M. M. Martin, and S. Zdancewic,

“Softbound: Highly compatible and complete spatial memory safety for C,” ACM Sigplan Notices, vol. 44, no. 6,

  • pp. 245–258, 2009.
  • P. Akritidis, M. Costa, M. Castro, and S. Hand, “Baggy

Bounds Checking: An Efficient and Backwards-Compatible Defense against Out-of-Bounds Errors.,” in USENIX Security Symposium, pp. 51–66, 2009.

  • K. Serebryany, D. Bruening, A. Potapenko, and D. Vyukov,

“Addresssanitizer: A Fast Address Sanity Checker.,” in USENIX Annual Technical Conference, pp. 309–318, 2012.

24

slide-26
SLIDE 26

References III

Wikipedia, “Can bus — Wikipedia, the free encyclopedia,” 2017. [Online; accessed 09-December-2017]. A.-I. Radu and F. D. Garcia, “Leia: a lightweight authentication protocol for can,” in European Symposium on Research in Computer Security, pp. 283–300, Springer, 2016.

  • S. Nürnberger and C. Rossow, “–vatiCAN–Vetted,

Authenticated CAN Bus,” in International Conference on Cryptographic Hardware and Embedded Systems,

  • pp. 106–124, Springer, 2016.

25

slide-27
SLIDE 27

References IV

  • J. Van Bulck, J. T. Mühlberg, and F. Piessens, “VulCAN:

Efficient component authentication and software isolation for automotive control networks,” in Proceedings of the 33th Annual Computer Security Applications Conference (ACSAC’17), ACM, 2017.

26