MPTEE: Bringing Flexible and Efficient Memory Protection to Intel SGX
Wenjia Zhao1,2, Kangjie Lu2, Yong Qi1, Sqiyu Qi3
1Xi’an Jiaotong University, China 2University of Minnesota, USA 3Xidian University, China
EuroSys'20, April 27–30, 2020
MPTEE: Bringing Flexible and Efficient Memory Protection to Intel - - PowerPoint PPT Presentation
MPTEE: Bringing Flexible and Efficient Memory Protection to Intel SGX Wenjia Zhao 1,2 , Kangjie Lu 2 , Yong Qi 1 , Sqiyu Qi 3 1 Xian Jiaotong University, China 2 University of Minnesota, USA 3 Xidian University, China EuroSys'20, April 2730,
Wenjia Zhao1,2, Kangjie Lu2, Yong Qi1, Sqiyu Qi3
1Xi’an Jiaotong University, China 2University of Minnesota, USA 3Xidian University, China
EuroSys'20, April 27–30, 2020
Digital Wallet Blockchain Edge Computing Secure Cloud Services
Applications (to protect data/code)
Protection/attack to SGX itself
SGXCrypter protects code by unpacking the packed code in enclave.
SGX-Shield protects SGX code itself through randomization
Applications (to protect data/code)
Protection/attack to SGX itself
flexibly and securely enforcing memory-page permissions
Strong adversary Limited hardware support
Strong adversary Limited hardware support
A software-based solution, significant performance overhead
Strong adversary Limited hardware support
The privileged software (e.g., OS, hypervisor) is untrusted and SGX programs themselves might be vulnerable
Strong adversary Limited hardware support
A hardware-assisted solution
Strong adversary Limited hardware support
A hardware-assisted solution low overhead
Strong adversary Limited hardware support
A hardware-assisted solution low overhead
Region Attack Enforcement integrity Code Permission enforcement R/W/X
Flexible, efficient, and isolated memory permission enforcement for SGX.
Region Attack Enforcement integrity Code Permission enforcement R/W/X
Flexible, efficient, and isolated memory permission enforcement for SGX.
Region Attack Enforcement integrity Code Permission enforcement R/W/X
Flexible, efficient, and isolated memory permission enforcement for SGX.
bnd0.lb bnd0.ub
fun: : ……
Memory Protection Extension(MPX)
Memory Protection Extension(MPX)
Significant performance overhead (over 60%)
OS kernel env,argv,argc Heap .data .bss .text RW X Stack .data .bss .text X RW program dynamic libraries ...
region1 region4 region5 region3 region2 region0
OS kernel env,argv,argc Heap .data .bss .text RW X Stack .data .bss .text X RW program dynamic libraries ...
region1 region4 region5 region3 region2 region0
Bound Directory Bound Table0 Bound Table1 UBound LBound
bnd regs
Bound tables impose high
Because All required libraries must be statically linked in the target enclave program
Permission change Continuous à Non-continuous
.text,.rodata,... .got,.bss,.data,...
...
Heap R W X
Enclave memory layout
Thread context
Exceeded the number of MPX registers
.text,.rodata,... .got,.bss,.data,...
...
Heap R W X
Enclave memory layout
Thread context
Unpack code/randomize code
Remove W
.text,.rodata,... .got,.bss,.data,...
...
Heap W X
Enclave memory layout
Thread context
Unpack code/randomize code
X W R
Remove W
.text,.rodata,... .got,.bss,.data,...
...
Heap W X
Enclave memory layout
Thread context
Unpack code/randomize code
X W R
Remove W
4 MPX registers are not enough
.text,.rodata,... .got,.bss,.data,...
...
Heap W X
Enclave memory layout
Thread context
Unpack code/randomize code
X W R
Remove W
.text,.rodata,... .got,.bss,.data,...
...
Heap R W X
Enclave memory layout
Thread context
.text,.rodata,… (RX) .got,.bss,.data,heap (RW) R X non-permission
New memory layout with CRBC
W
.text,.rodata,... .got,.bss,.data,...
...
Heap R W X
Enclave memory layout
Thread context
.text,.rodata,… (RX) .got,.bss,.data,heap (RW) R X non-permission
New memory layout with CRBC
W
.text,.rodata,… (RX) .got,.bss,.data,heap (RW)
R(BND2) X(BND0)
non-permission
New memory layout with CRBC
W(BND1)
Non-perm. (ImageBase, BND0.LB) X (BND0.LB, BND2.LB) RX (BND2.LB, BND1.LB) RWX (BND1.LB, BND0.UB) RW (BND0.UB, BND1.UB) R (BND1.UB, BND2.UB)
.text,.rodata,… (RX) .got,.bss,.data,heap (RW)
R(BND2) X(BND0)
non-permission
New memory layout with CRBC
W(BND1)
Non-perm. (ImageBase, BND0.LB) X (BND0.LB, BND2.LB) RX (BND2.LB, BND1.LB) RWX (BND1.LB, BND0.UB) RW (BND0.UB, BND1.UB) R (BND1.UB, BND2.UB)
Only three registers to offer six regions Continuous after permission change
Remove W
R X non-permission W
Generated code fragment0
JIT code generator
R X non-permission W
Reserved area
R X non-permission W
Generated code fragment0
JIT code generator
R X non-permission W
Generated code fragment0 Generated code fragment1
Remove W Remove W
R X non-permission W
R X non-permission W
Generated code fragment0
JIT code generator
Generated code fragment0 Generated code fragment1
Remove W Remove W
different boundary registers.
memory regions at runtime
different boundary registers
memory regions at runtime Without using MPX bound table to avoid the high performance overhead
Check-skipping attacks
control Unaligned call without check
Bound-manipulating attacks
Bndmk is called maliciously
Trampolines table Function A_Addr Function B_Addr Function A Function B ptr = IndexA; check ptr < table size; Call *(base+ptr*8);
Trampolines table Function A_Addr Function B_Addr Function A Function B ptr = IndexA; check ptr < table size; Call *(base+ptr*8);
ret addr Trampoline table
X(BND0)
Indirect calls
Non-permission *ptrA = *ptrB + V modify_bndregisters(*ptrA) ptrA/ptrB No additional
MPTEE provides a flexible, isolated, and efficient memory permission protection mechanism