28
Graphene v1.0: Toward A Reliable, Open-Source Library OS for SGX CHIA-CHE TSAI TEXAS A&M / GRAPHENE PROJECT

Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Graphene v1.0: Toward A Reliable, Open-Source Library OS for SGX

CHIA-CHE TSAI

T EXAS A&M /GRAPHENE PROJECT

Page 2: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

This Talk Includes:

1. WHAT’s Graphene, WHY, and HOW

2. Latest updates

3. Our future roadmap

Page 3: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

SGX Is Not For “Dummies”

Developing a SGX application is hard▪ Setup and configuration

▪ Porting legacy code

▪ OS interfaces and libraries

▪ Security implications

▪ Debug and performance tuning

You have to be a:system admin

+ Linux/libc maintainer+ security expert

+ computer architect?

Page 4: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

What IS Graphene?

A system that runs unmodified* Linux apps on platforms like SGX.

* Native binaries, no code change, no recompile

Page 5: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Can We Improve the Dev Cycles?

Design / Adopt Native Program

Testing on Native

Testing on SGX

Deployment

Dev Cyclew/ Graphene

Design OCALL / ECALL

Design Defense

Enclave Impl.

Port Library

Testing OCALL / ECALL

Integration

Testing

Deploy-ment

Dev Cyclew/ SDK

Page 6: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

The LibOS Approach

Enclave

Unmodifiedprogram

Jailed environmentwithout OS and legacy library

routines

Page 7: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

The LibOS Approach

Enclave

Unmodifiedprogram

?

System APIs

Broadly speaking,lots of SGX frameworks qualify

for this definition(Haven, SCONE, SGX-LKL, …)

UntrustedHost OS

Page 8: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

How Are “LibOSes” Generally Built?

Linux/POSIX/Windows APIs

Legacy OS code

Hypervisor-like interface

Haven / SGX-LKL

Untrusted Host OS

Linux/POSIX/Windows APIs

Redirection Layer

SCONE

Untrusted Host OS

Page 9: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

How is Graphene Different?

1. Host interface defined with portability and security in mind

2. Rich functionality for Linux apps

Page 10: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Graphene: A Tailored LibOS

EnclaveStep 1.

Define a host interface

Step 2.Reimplement Linux APIs from scratch

Untrusted Host OS

36 OCalls+ 2 for Debugging

300+ System Calls(140 so far)

Page 11: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Why Host Interface Matters?

Enclave

Unmodifiedprogram

System APIs

UntrustedHost OS

Maliciousreturn values

Page 12: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Iago Attacks [ASPLOS 2013]

Trusted App

Untrusted OS

By SGX / Inktag / Overshadow / Nexus / Virtual Ghost / …

getpid() gettimeofday()App uses malicious results for

sensitive operations:Example:

Seed the RNG with (PID|TIME)

Page 13: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

In A Nutshell

Iago attacks are semantics vulnerabilities caused by mistrusting legacy APIs

Page 14: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

More Examples

Iago attacks are pervasive and often hard to mitigate▪ File system metadata

▪ System time

▪ IPC (signals, message queues, shared memory)

▪ Scheduling

▪ System info (/proc, /sys, getrusage)

▪ Exception handling

Page 15: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Myths About Iago Attacks

1. Only system calls can suffer Iago attacks - wrong

2. Just leave to app developers - wrong

3. Orthogonal to system/runtime design - wrong

Page 16: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Decouple Shielding & Linux APIs

Enclave

LibOS

open read write …

Platform Adaption Layer + Shield

Untrusted Host OS

36 OCalls+ 2 for Debugging

Portability & shielding(Explicit semantics + crypto checks)

Linux functionality

Page 17: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Multi-Process Applications

Distributed OS coordination

Supported:fork/exec

signalsmessage queue

Semaphore

Apache(P1)

OCalls

LibOS

kill

RpcSend()

RpcConnect()

Apache(P2)

OCalls

LibOS

RpcListen()

Attestationby CPU

Attestationby CPU

ExchangeEncryption Key

Page 18: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

More LibOS Features

Graphene LibOS

Virtual File System

ProcFS

RPC

ELFloader Socket

Chroot(Passthru)

FS

Pip

e

Sign

al SYS VIPC

Thre

ad

fork

MigrationNamespace

VMA

exec

140 / 318 system callsImplemented (core features)

63 KLOCSource code

1.4 MBLibrary size

Page 19: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Tested Applications

… and more.

See examples on: https://github.com/oscarlab/graphene

Page 20: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Graphene Project Updates

1. Open-source workgroup

2. Stable release plan (mid-August) ▪ Reliability & Security improvements

▪ New features

Page 21: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Graphene Workgroup

h t t p s : / / g r a p h e n e p r o j e c t . i o /

I N V I S I B L ET H I N G SL A B

Page 22: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Stable Release (Mid-August)

Reliability improvements:▪ 324 pull requests since Nov 2018

▪ Rewritten: memory mgmt., signal handling, IPC, and file system

▪ Data races and deadlock issues

▪ Better OCall interface and enclave initialization

▪ Documentation & UX improvements

Page 23: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Stable Release (Mid-August)

Vulnerability fixes:▪ Received multiple reports from KU Leuven and U. Birmingham

▪ Untrusted argv/envp

▪ Untrusted memory allocation

▪ Untrusted argument copy for OCalls

▪ TOCTOU for untrusted copy

▪ Incorrect pointer validation

▪ All fixed within 5 days

Page 24: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Stable Release (Mid-August)

New features:▪ Support for GLIBC 2.23 / 2.27 and Ubuntu 18.04

▪ Static binary support for Golang support

▪ Simple remote attestation

▪ EXPERIMENTAL:Docker integration (Graphene Secure Container)

▪ EXPERIMENTAL:File system & network shield (RA-TLS) plugins

Page 25: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Remote Attestation

Enclave

GrapheneLibOS

PAL Quoting

EnclaveRetrieve

quote

Intel Attestation

Service

Retrieve

attestation

Only start if successfully attested

Page 26: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Docker Integration (EXPERIMENTAL)

Dockerfile

Docker

Engine

Graphene

Configuration

Generate

Docker container

launch

Enclave

GrapheneLibOS

PAL

Page 27: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Future Roadmap

Periodic stable releases

File system shield and network shield (RA-TLS)

SGX2 (EDMM) support

Exitless enclave interface (optimization)

Support for upstream Linux driver

Page 28: Graphene v1.0: Toward A Reliable, CHIA-CHE TSAI Open ... · VMA exec 140 / 318 system calls Implemented (core features) 63 KLOC Source code 1.4 MB ... launch Enclave Graphene LibOS

Conclusion

Why you should consider Graphene:▪ Open-sourced (LGPL), good for customization and exploration

▪ Actively maintained by workgroup & community

▪ Tailored for small host interface and rich Linux functionality

h t t p s : / / g r a p h e n e p r o j e c t . i o

s u p p o r t@g r a p h e n e - p r o j e c t . i o