Intel® Software Guard Extensions(Intel® SGX)

87
Intel® Software Guard Extensions(Intel® SGX) Frank McKeen Intel Labs April 15, 2015 Copyright © 2015 Intel Corporation. All rights reserved.

Transcript of Intel® Software Guard Extensions(Intel® SGX)

Page 1: Intel® Software Guard Extensions(Intel® SGX)

Intel® Software GuardExtensions(Intel® SGX)

Frank McKeen

Intel Labs

April 15, 2015

Copyright © 2015 Intel Corporation. All rights reserved.

Page 2: Intel® Software Guard Extensions(Intel® SGX)

Legal Disclaimers

•The comments and statements are mine and not necessarily Intel’s

• Intel technologies’ features and benefits depend on system configuration and may require enabled hardware, software or service activation. Learn more at intel.com, or from the OEM or retailer.

•No computer system can be absolutely secure.

2

Page 3: Intel® Software Guard Extensions(Intel® SGX)

3

Outline

• Problem Statement

• Attack Surface and Overview

• Programming environment

– System programming view

– Day in the life of an enclave

• SGX Access Control & Off Chip protections

• Attestation and Sealing

• Developing with SGX

• Summary

Page 4: Intel® Software Guard Extensions(Intel® SGX)

3

Outline

• Problem Statement

• Attack Surface and Overview

• Programming environment

– System programming view

– Day in the life of an enclave

• SGX Access Control & Off Chip protections

• Attestation and Sealing

• Developing with SGX

• Summary

Page 5: Intel® Software Guard Extensions(Intel® SGX)

The Basic Issue: Why Aren’t Compute Devices Trustworthy?

Privileged Code

App

Protected Mode (rings) protects OS from apps …

X

OK

4

Page 6: Intel® Software Guard Extensions(Intel® SGX)

App

The Basic Issue: Why Aren’t Compute Devices Trustworthy?

Privileged Code

App

Protected Mode (rings) protects OS from apps …

… and apps from each other …

X

OK

X X

4

Page 7: Intel® Software Guard Extensions(Intel® SGX)

AppMalicious

App

The Basic Issue: Why Aren’t Compute Devices Trustworthy?

Privileged Code

App

Protected Mode (rings) protects OS from apps …

… and apps from each other …

X

X X

… UNTIL a malicious app exploits a flaw to gain full privileges and then tampers with the OS or other apps

Apps not protected from privileged code attacks

attack

4

Bad

Code

Page 8: Intel® Software Guard Extensions(Intel® SGX)

AppMalicious

App

The Basic Issue: Why Aren’t Compute Devices Trustworthy?

Privileged Code

App

Protected Mode (rings) protects OS from apps …

… and apps from each other …

X

X X

… UNTIL a malicious app exploits a flaw to gain full privileges and then tampers with the OS or other apps

Apps not protected from privileged code attacks

attack

4

Bad

Code

Privileged Code

Info Bad

Code

Page 9: Intel® Software Guard Extensions(Intel® SGX)

Proxy Proxy Proxy

Hardware

VMM

OS

App App App

Attack surface today

Reduced attack surface with SGX

Attack Surface

5

Page 10: Intel® Software Guard Extensions(Intel® SGX)

Application gains ability to defend

its own secrets– Smallest attack surface (App + processor)

– Malware that subverts OS/VMM, BIOS, Drivers

etc. cannot steal app secretsProxy Proxy Proxy

Hardware

VMM

OS

App App App

Attack surface with Enclaves

XX

Reduced attack surface with SGX

Attack Surface

5

Page 11: Intel® Software Guard Extensions(Intel® SGX)

Application gains ability to defend

its own secrets– Smallest attack surface (App + processor)

– Malware that subverts OS/VMM, BIOS, Drivers

etc. cannot steal app secrets

Familiar development/debug– Single application environment

– Build on existing ecosystem expertise

Proxy Proxy Proxy

Hardware

VMM

OS

App App App

Attack surface with Enclaves

XX

Reduced attack surface with SGX

Attack Surface

5

Page 12: Intel® Software Guard Extensions(Intel® SGX)

Application gains ability to defend

its own secrets– Smallest attack surface (App + processor)

– Malware that subverts OS/VMM, BIOS, Drivers

etc. cannot steal app secrets

Familiar development/debug– Single application environment

– Build on existing ecosystem expertise

Familiar deployment model– Platform integration not a bottleneck to

deployment of trusted apps

Proxy Proxy Proxy

Hardware

VMM

OS

App App App

Scalable security within mainstream environment

Attack surface with Enclaves

XX

Reduced attack surface with SGX

Attack Surface

5

Page 13: Intel® Software Guard Extensions(Intel® SGX)

SGX Programming Environment

Trusted execution environment embedded in a process

App Code

App Data

OS

User Process

6

Page 14: Intel® Software Guard Extensions(Intel® SGX)

EnclaveEnclave

SGX Programming Environment

Trusted execution environment embedded in a process

App Code

App Data

OS

User Process

6

Page 15: Intel® Software Guard Extensions(Intel® SGX)

Enclave

SGX Programming Environment

Trusted execution environment embedded in a process

App Code

App Data

OSEnclave Code

Enclave Data

With its own code and data

User Process

Provide Confidentiality

Provide integrity

With controlled entry points

Enclave

6

Page 16: Intel® Software Guard Extensions(Intel® SGX)

Enclave

SGX Programming Environment

Trusted execution environment embedded in a process

App Code

App Data

OSEnclave Code

Enclave Data

With its own code and data

User Process

Provide Confidentiality

Provide integrity

With controlled entry points

TCS (*n) Supporting multiple threads

Enclave

6

Page 17: Intel® Software Guard Extensions(Intel® SGX)

Enclave

SGX Programming Environment

Trusted execution environment embedded in a process

App Code

App Data

OSEnclave Code

Enclave Data

With its own code and data

User Process

Provide Confidentiality

Provide integrity

With controlled entry points

With full access to app memory

TCS (*n) Supporting multiple threads

Enclave

6

Page 18: Intel® Software Guard Extensions(Intel® SGX)

Platform

SGX High-level HW/SW Picture

EPCMEPC

SGXModule

SGX UserRuntime

Enclave

InstructionsECREATEEADDEEXTENDEINITEBLOCK

SGX UserRuntime

Enclave

Hdw Data Structure

Hardware

Runtime

Application

OS Data structure

ApplicationEnvironment

PrivilegedEnvironment

ExposedHardware

InstructionsEEXITEGETKEYEREPORTEENTERERESUME

Page tables

ETRACKEWBELDEPAEREMOVE

7

Page 19: Intel® Software Guard Extensions(Intel® SGX)

Life Cycle of An EnclaveBuild

8

Page 20: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

Life Cycle of An EnclaveBuild

8

Page 21: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space

ECREATE (Range)

Physical Addr Space

System Memory

Enclave Page Cache

Life Cycle of An EnclaveBuild

EPCM

Invalid

Invalid

Invalid

8

Invalid

Page 22: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

Load Code/Data

Life Cycle of An EnclaveBuild

ECREATE (Range)

EPCM

Invalid

Invalid

Invalid

8

SECSValid,SECS

MRENCLAVE

Page 23: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

EADD (Copy Page)

Life Cycle of An EnclaveBuild

Plaintext Code/Data

ECREATE (Range)

EPCM

Invalid

Invalid

Invalid

8

SECSValid,SECS

MRENCLAVE

Page 24: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Update PTE

EADD (Copy Page)

Life Cycle of An EnclaveBuild

Plaintext Code/Data

Code/Data

ECREATE (Range)EADD (Copy Page)

EPCM

Valid,ID, LA

Invalid

Invalid

8

SECSValid,SECS

MRENCLAVE

Page 25: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

EADD (Copy Page)

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

PlaintextCode/Data

ECREATE (Range)EADD (Copy Page)

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVE

Plaintext Code/Data

Page 26: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

PlaintextCode/Data

ECREATE (Range)EADD (Copy Page)

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVE

Page 27: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

EINIT

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVE

Page 28: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

EINIT

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVE

Page 29: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

Code/Data

Code/Data

EENTER PlaintextCode/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EINIT

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVEMRENCLAVE

Page 30: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EINIT

EENTER

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVEMRENCLAVE

Page 31: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/DataEEXIT

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EINIT

EENTER

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVEMRENCLAVE

Page 32: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EINIT

EENTEREEXIT

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVEMRENCLAVE

Page 33: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

PlaintextCode/Data

Life Cycle of An EnclaveBuild

Code/Data

Code/Data

Code/Data

Code/Data

PlaintextCode/Data

PlaintextCode/DataPlaintext

Code/Data

ECREATE (Range)EADD (Copy Page)

EINIT

EENTEREEXIT

EEXTEND

EPCM

Valid,ID, LA

Invalid

Valid,ID, LA

8

SECSValid,SECS

MRENCLAVEMRENCLAVE

Page 34: Intel® Software Guard Extensions(Intel® SGX)

Virtual Addr Space Physical Addr Space

System Memory

Enclave Page Cache

Life Cycle of An EnclaveBuild

ECREATE (Range)EADD (Copy Page)

EINIT

EENTEREEXIT

EREMOVE

EEXTEND

EPCM

Invalid

Invalid

Invalid

8

Invalid

MRENCLAVE

Page 35: Intel® Software Guard Extensions(Intel® SGX)

SGX Access Control

9

Traditional

IA Page Table

Checks

LinearAddress

PhysicalAddress

Page 36: Intel® Software Guard Extensions(Intel® SGX)

SGX Access Control

9

Traditional

IA Page Table

Checks

Enclave

Access?

LinearAddress

PhysicalAddress

Page 37: Intel® Software Guard Extensions(Intel® SGX)

SGX Access Control

9

Traditional

IA Page Table

Checks

Enclave

Access?Address

in EPC?

No

AllowMemory

Access

ReplaceAddress

With Abort

Page

Yes

No

LinearAddress

PhysicalAddress

Non-Enclave

Access

Page 38: Intel® Software Guard Extensions(Intel® SGX)

SGX Access Control

9

Traditional

IA Page Table

Checks

Enclave

Access?Address

in EPC?

Address

in EPC?

Check

EPCM

Checks

Pass ?

Yes

Yes

No

AllowMemory

Access

ReplaceAddress

With Abort

Page

Yes

No

Yes

LinearAddress

PhysicalAddress

Non-Enclave

Access

Enclave

Access

Page 39: Intel® Software Guard Extensions(Intel® SGX)

SGX Access Control

9

Traditional

IA Page Table

Checks

Enclave

Access?Address

in EPC?

Address

in EPC?

Check

EPCM

Checks

Pass ?

Signal

Fault

No

Yes

No

Yes

No

AllowMemory

Access

ReplaceAddress

With Abort

Page

Yes

No

Yes

LinearAddress

PhysicalAddress

Non-Enclave

Access

Enclave

Access

Page 40: Intel® Software Guard Extensions(Intel® SGX)

Protection vs. Memory Snooping Attacks

Cores

Cache

System Memory

CPU Package

10

Non-Enclave

Access

Page 41: Intel® Software Guard Extensions(Intel® SGX)

Protection vs. Memory Snooping Attacks

• Security perimeter is the

CPU package boundary

Cores

Cache

System Memory

CPU Package

10

Non-Enclave

Access

Page 42: Intel® Software Guard Extensions(Intel® SGX)

Protection vs. Memory Snooping Attacks

• Security perimeter is the

CPU package boundary

• Data and code unencrypted

inside CPU packageCores

Cache

System Memory

AMEX: 3234-

134584-

26864

CPU Package

10

Non-Enclave

Access

Page 43: Intel® Software Guard Extensions(Intel® SGX)

Protection vs. Memory Snooping Attacks

• Security perimeter is the

CPU package boundary

• Data and code unencrypted

inside CPU package

• Data and code outside CPU

package is encrypted and/or

integrity checked

Cores

Jco3lks937weu0cwejpoi9987v80weCache

System Memory

AMEX: 3234-

134584-

26864

CPU Package

10

Non-Enclave

Access

Page 44: Intel® Software Guard Extensions(Intel® SGX)

Protection vs. Memory Snooping Attacks

• Security perimeter is the

CPU package boundary

• Data and code unencrypted

inside CPU package

• Data and code outside CPU

package is encrypted and/or

integrity checked

• External memory reads and

bus snoops see only

encrypted data

Cores

Jco3lks937weu0cwejpoi9987v80weCache

System Memory

AMEX: 3234-

134584-

26864

CPU Package

Snoop

Snoop

10

Non-Enclave

Access

Page 45: Intel® Software Guard Extensions(Intel® SGX)

Outline

• Problem Statement

• Attack Surface and Overview

• Programming environment

– System programming view

– Day in the life of an enclave

• SGX Access Control & Off Chip protections

• Attestation and Sealing

• Developing with SGX

• Summary

11

Page 46: Intel® Software Guard Extensions(Intel® SGX)

The Challenge –Provisioning Secrets to the Enclave

• An enclave is in the clear before instantiation

– Sections of code and data could be encrypted, but their decryption key can’t be pre-installed

• Secrets come from outside the enclave

– Keys

– Passwords

– Sensitive data

• The enclave must be able to convince a 3rd party that it’s trustworthy and can be provisioned with the secrets

• Subsequent runs should be able to use the secrets that have already been provisioned

12

Page 47: Intel® Software Guard Extensions(Intel® SGX)

Trustworthiness

• A service provider should vet the enclave’s Trusted Computing Base (TCB) before it should trust it and provide secrets to it

– The enclave’s software

– The CPU’s hardware & firmware

• Intel® SGX provides the means for an enclave to securely prove to a 3rd party:

– What software is running inside the enclave

– Which execution environment the enclave is running at

– Which Sealing Identity will be used by the enclave

– What’s the CPU’s security level

13

Page 48: Intel® Software Guard Extensions(Intel® SGX)

Attestation – Software TCB

• When building an enclave, Intel® SGX generates a cryptographic log of all the build activities

– Content: Code, Data, Stack, Heap

– Location of each page within the enclave

– Security flags being used

• MRENCLAVE (“Enclave Identity”) is a 256-bit digest of the log

– Represents the enclave’s software TCB

• A software TCB verifier should:

– Securely obtain the enclave’s software TCB

– Securely obtain the expected enclave’s software TCB

– Compare the two values

14

Page 49: Intel® Software Guard Extensions(Intel® SGX)

Local Attestation

• “Local attestation”: The process by which one enclave attests its TCB to another enclave on the same platform

• Using Intel® SGX’s EREPORT and EGETKEY instructions

– EREPORT generates a cryptographic REPORT that binds MRENCLAVE to the target enclave’s REPORT KEY

– EGETKEY provides the REPORT KEY to verify the REPORT

TCB component Attestation

CPU Firmware & hardware Symmetric - CPU REPORT KEY

Software MRENCLAVE

15

Page 50: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation

• “Remote attestation”: The process by which one enclave attests its TCB to another entity outside of the platform

• Intel® SGX Extends Local attestation by allowing a Quoting Enclave (QE) to use Intel® EPID to create a QUOTE out of a REPORT

– Intel® EPID is a group signature scheme

TCB component Attestation

CPU Firmware & hardware Asymmetric - Intel® EPID

Software MRENCLAVE

16

Page 51: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

Client Application Client Application

17

Page 52: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

1. Verifying enclave sends its MRENCLAVE to reporting enclave

2. Reporting enclave creates a cryptographic REPORT that includes its MRENCLAVE

3. Verifying enclave obtains its REPORT key and verifies the authenticity of the REPORT

Client Application

Enclave

Client Application

Enclave

17

Page 53: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

1. Verifying enclave sends its MRENCLAVE to reporting enclave

2. Reporting enclave creates a cryptographic REPORT that includes its MRENCLAVE

3. Verifying enclave obtains its REPORT key and verifies the authenticity of the REPORT

Client Application

Enclave

Client Application

Enclave

MRENCLAVE

17

Page 54: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

1. Verifying enclave sends its MRENCLAVE to reporting enclave

2. Reporting enclave creates a cryptographic REPORT that includes its MRENCLAVE

3. Verifying enclave obtains its REPORT key and verifies the authenticity of the REPORT

Client Application

Enclave

Client Application

Enclave

MRENCLAVE

REPORT

MAC

17

Page 55: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

1. Verifying enclave sends its MRENCLAVE to reporting enclave

2. Reporting enclave creates a cryptographic REPORT that includes its MRENCLAVE

3. Verifying enclave obtains its REPORT key and verifies the authenticity of the REPORT

Client Application

Enclave

Client Application

Enclave

MRENCLAVE

REPORT

MAC

17

Page 56: Intel® Software Guard Extensions(Intel® SGX)

Processor

Local Attestation - Flow

1. Verifying enclave sends its MRENCLAVE to reporting enclave

2. Reporting enclave creates a cryptographic REPORT that includes its MRENCLAVE

3. Verifying enclave obtains its REPORT key and verifies the authenticity of the REPORT

Client Application

Enclave

Client Application

Enclave

MRENCLAVE

REPORT

MAC

17

Page 57: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation - Flow

Platform

QE

Encla

ve

Remote Platform

VerifyingApplication

REPORT

MACMRENCLAVE

1. Verifying enclave becomes the Quoting Enclave.

2. After verifying the REPORT the, QE signs the REPORT with the EPID private key and converts it into a QUOTE

3. Remote platform verifies the QUOTE with the EPID public key and verifies MRENCLAVE against the expected value

18

Page 58: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation - Flow

Platform

QE

Encla

ve

Remote Platform

VerifyingApplication

MRENCLAVE

EPID

QUOTE

1. Verifying enclave becomes the Quoting Enclave.

2. After verifying the REPORT the, QE signs the REPORT with the EPID private key and converts it into a QUOTE

3. Remote platform verifies the QUOTE with the EPID public key and verifies MRENCLAVE against the expected value

18

Page 59: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation - Flow

Platform

QE

Encla

ve

Remote Platform

VerifyingApplication

MRENCLAVEEPID

QUOTE

1. Verifying enclave becomes the Quoting Enclave.

2. After verifying the REPORT the, QE signs the REPORT with the EPID private key and converts it into a QUOTE

3. Remote platform verifies the QUOTE with the EPID public key and verifies MRENCLAVE against the expected value

18

Page 60: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation - Flow

Platform

QE

Encla

ve

Remote Platform

VerifyingApplication

MRENCLAVEEPID

QUOTE

1. Verifying enclave becomes the Quoting Enclave.

2. After verifying the REPORT the, QE signs the REPORT with the EPID private key and converts it into a QUOTE

3. Remote platform verifies the QUOTE with the EPID public key and verifies MRENCLAVE against the expected value

18

Page 61: Intel® Software Guard Extensions(Intel® SGX)

Remote Attestation - Flow

Platform

QE

Encla

ve

Remote Platform

VerifyingApplication

MRENCLAVE

1. Verifying enclave becomes the Quoting Enclave.

2. After verifying the REPORT the, QE signs the REPORT with the EPID private key and converts it into a QUOTE

3. Remote platform verifies the QUOTE with the EPID public key and verifies MRENCLAVE against the expected value

18

Page 62: Intel® Software Guard Extensions(Intel® SGX)

Sealing Authority

• Every enclave has an Enclave Certificate (SIGSTRUCT) which is signed by a Sealing Authority

– Typically the enclave writer

– SIGSTRUCT includes:

– Enclave’s Identity (represented by MRENCLAVE)

– Sealing Authority’s public key (represented by MRSIGNER)

• EINIT verifies the signature over SIGSTRUCT prior to enclave initialization

19

Page 63: Intel® Software Guard Extensions(Intel® SGX)

Sealing

• “Sealing”: Cryptographically protecting data when it leaves the enclave.

• Enclaves use EGETKEY to retrieve an enclave, platform persistent key and encrypts the data

• EGETKEY uses a combination of enclave attributes and platform unique key to generate keys

– Enclave Sealing Authority

– Enclave Product ID

– Enclave Product Security Version Number (SVN)

20

Page 64: Intel® Software Guard Extensions(Intel® SGX)

Client Application

Enclave

Example: Secure Transaction

Remote Platform

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

1

21

Page 65: Intel® Software Guard Extensions(Intel® SGX)

Client Application

Enclave

Example: Secure Transaction

Remote Platform

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

1

2

21

Page 66: Intel® Software Guard Extensions(Intel® SGX)

Client Application

Enclave

Example: Secure Transaction

Remote Platform

QE

EPID

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

1

2 3

21

Page 67: Intel® Software Guard Extensions(Intel® SGX)

Client Application

Enclave

Example: Secure Transaction

Remote Platform

QE

EPID

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

1

2 3 4

21

Page 68: Intel® Software Guard Extensions(Intel® SGX)

Client Application

Enclave

Example: Secure Transaction

Remote Platform

QE

Authenticated Channel

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

1

2 4

5

22

3

Page 69: Intel® Software Guard Extensions(Intel® SGX)

Remote Platform

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

4

5

Client Application

Enclave

Authenticated Channel

1

2

5

Example: Secure Transaction

6

23

3

Page 70: Intel® Software Guard Extensions(Intel® SGX)

Remote Platform

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

3

4

5

Client Application

Enclave

Authenticated Channel

1

2

5

Example: Secure Transaction

7

24

6

Page 71: Intel® Software Guard Extensions(Intel® SGX)

Remote Platform

1. Enclave built & measured against ISV’s signed certificate

2. Enclave calls EREPORT to obtain a REPORT that includes

enclave specific data (ephemeral key)

3. REPORT & user data sent to Quoting Enclave who signs the

REPORT with an EPID private key

4. QUOTE sent to server & verified

5. Ephemeral key used to create a trusted channel between

enclave and remote server6. Secret provisioned to enclave

7. Enclave calls EGETKEY to obtain the SEAL KEY

8. Secret is encrypted using SEAL KEY & stored for future use

3

4

5

Client Application

Enclave

Authenticated Channel

1

2

5

Example: Secure Transaction

7

8

24

6

Page 72: Intel® Software Guard Extensions(Intel® SGX)

25

Intel® SGX Software Development

App Code

Application

Processing

Component

Intel SGX enabled CPU

Processing

Component

Page 73: Intel® Software Guard Extensions(Intel® SGX)

25

Intel® SGX Software Development

Windows DLL /

Enclave

App Code

Trusted Application

Processing

Component

Intel SGX enabled CPU

• Software Developer decides which components should execute within an enclave

Processing

Component

Page 74: Intel® Software Guard Extensions(Intel® SGX)

25

Intel® SGX Software Development

Windows DLL /

Enclave

App Code

Trusted Application

Processing

Component

SGX SDKTools

Intel SGX enabled CPU

• Software Developer decides which components should execute within an enclave

• Development Environment allows the Developer to quickly develop enclave enabled binaries

Processing

Component

Page 75: Intel® Software Guard Extensions(Intel® SGX)

25

Intel® SGX Software Development

Windows DLL /

Enclave

App Code

Trusted Application

Processing

Component

Glue Code Glue CodeSGX SDK

Libraries

SGX SDK

Libraries

SGX SDKTools

Intel SGX enabled CPU

Architectural EnclavesArchitectural EnclavesArchitectural Enclaves

• Software Developer decides which components should execute within an enclave

• Development Environment allows the Developer to quickly develop enclave enabled binaries

• Including support for common software libraries, exporting interfaces, and support for provisioning

Processing

Component

Page 76: Intel® Software Guard Extensions(Intel® SGX)

SGX Technical Summary

•Provides any application the ability to keep a secret

• Provide capability using new processor instructions

• Application can support multiple enclaves

•Provides integrity and confidentiality

• Resists hardware attacks

• Prevent software access, including privileged software and SMM

•Applications run within OS environment

• Low learning curve for application developers

• Open to all developers

•Resources managed by system software

26

Page 77: Intel® Software Guard Extensions(Intel® SGX)

27

Links

Joint research poster session: http://sigops.org/sosp/sosp13/

Public Cloud Paper using SGX2:

https://www.usenix.org/sites/default/files/osdi14_full_proceedings.pdf

Programming Reference for SGX1 & SGX2: http://www.intel.com/software/isa

HASP Workshop: https://sites.google.com/site/haspworkshop2013/workshop-program

Page 78: Intel® Software Guard Extensions(Intel® SGX)

Thank You

28

Page 79: Intel® Software Guard Extensions(Intel® SGX)

Backup

29

Page 80: Intel® Software Guard Extensions(Intel® SGX)

SGX Paging Introduction

Requirement:

• Remove an EPC page and place into unprotected memory. Later restore it.

• Page must maintain same security properties (confidentiality, anti-replay, and integrity) when restored

Instructions:

• EWB: Evict EPC page to main memory with cryptographic protections

• ELDB/ELDU: Load page from main memory to EPC with cryptographic protections

• EPA: Allocate an EPC page for holding versions

• EBLOCK: Declare an EPC page ready for eviction

• ETRACK: Ensure address translations have been cleared

30

Page 81: Intel® Software Guard Extensions(Intel® SGX)

Page-out Example

SECS

Enclave

Page

EnclavePage

Enclave

Page

EWB

BUILD

EPCSystem

Memory

31

VA Page

Page 82: Intel® Software Guard Extensions(Intel® SGX)

Page-out Example

SECS

Enclave

Page

EnclavePage

Enclave

Page

EWB

EncryptedPage

EWB Parameters:

• Pointer to EPC page that needs to

be paged out

• Pointer to empty version slot

• Pointers outside EPC location

BUILD

EPCSystem

Memory

PCMD

31

Page 83: Intel® Software Guard Extensions(Intel® SGX)

Page-out Example

SECS

Enclave

Page

Enclave

Page

EWB

VER

EncryptedPage

EWB Parameters:

• Pointer to EPC page that needs to

be paged out

• Pointer to empty version slot

• Pointers outside EPC location

EWB Operation

• Remove page from the EPC

• Populate version slot

• Write encrypted version to outside

• Write meta-data, PCMD

BUILD

EPCSystem

Memory

PCMD

31

Page 84: Intel® Software Guard Extensions(Intel® SGX)

Page-out Example

SECS

Enclave

Page

Enclave

Page

EWB

VER

EncryptedPage

EWB Parameters:

• Pointer to EPC page that needs to

be paged out

• Pointer to empty version slot

• Pointers outside EPC location

EWB Operation

• Remove page from the EPC

• Populate version slot

• Write encrypted version to outside

• Write meta-data, PCMD

All pages, including SECS and

Version Array can be paged out

BUILD

EPCSystem

Memory

PCMD

31

Page 85: Intel® Software Guard Extensions(Intel® SGX)

Page-in Example

SECS

Enclave

Page

EnclavePage

ELD

VER

EncryptedPage

BUILD

EPCSystem

Memory

MD

32

Free EnclavePage

Page 86: Intel® Software Guard Extensions(Intel® SGX)

Page-in Example

ELD Parameters:

• Encrypted page

• Free EPC page

• SECS (for an enclave page)

• Populated version slot

SECS

Enclave

Page

EnclavePage

ELD

VER

EncryptedPage

BUILD

EPCSystem

Memory

MD

32

Free EnclavePage

Page 87: Intel® Software Guard Extensions(Intel® SGX)

Page-in Example

ELD Parameters:

• Encrypted page

• Free EPC page

• SECS (for an enclave page)

• Populated version slot

ELD Operation

• Verify and decrypt the page

using version

• Populate the EPC slot

• Make back-pointer

connection (if applicable)

• Free-up version slot

SECS

Enclave

Page

EnclavePage

EnclavePage

ELD

EncryptedPage

BUILD

EPCSystem

Memory

MD

32

VA Page

Free EnclavePage