SESSION ID:
#RSAC
Xiaoning Li
ENHANCE VIRTUALIZATION STACK WITH
INTEL CET AND MPX
HTA-F01
Chief Security Architect
Alibaba Cloud
Ravi Sahita
Principal Engineer
Intel CorporaLon
#RSAC
Agenda
2
Full VirtualizaLon Stack
QEMU VulnerabiliLes
Intel CET
Intel MPX and PKU
VM Escape Case Study
MiLgaLon with CET/MPX
Other MiLgaLons
#RSAC
Full VirtualizaLon Stack
3
CPU (VT-x)
Hypervisor
Dom0/Host OS Guest OS
Device EmulaLon
Frontend Driver/VirtIODevice Driver
CPU (VT-x)
Hypervisor
Dom0/Host OS Guest OS
Device Driver Pass-through Device
Driver
HVM Guest OS with Device Pass-through HVM Guest OS Without Device Pass-through
#RSAC
Why Device EmulaLon?
4
Supports more guest devices with virtual devices
If physical devices number are not enough - limited GPU resource
If physical devices don’t support device virtualizaLon – Not every device
support SRIOV
If physical devices don’t exist – some outdated devices
Popular usage in cloud environment to support many VMs
QEMU can provide device emulaLon for KVM/XEN, but it brings new
a]ack surface on virtualizaLon stack
#RSAC
QEMU VULNERABILITIES
#RSAC
QEMU VulnerabiliLes by 2018 Jan
6
#RSAC
CVE-2015-5165 – InformaLon Leak
7
#RSAC
CVE-2015-7504 – Heap Overflow
8
#RSAC
INTEL CET
#RSAC
Intel® Control-flow Enforcement Technology
10
Intel
CET
Indirect
Branch
Tracking
Shadow
Stack
#RSAC
Shadow Stack
11
Return Address 1
Return Address 2
Parameter
Return Address 4
Parameter
Parameter
Return Address 3
Return Address 1
Return Address 3
Return Address 2
Return Address 4
RET
Return Address 4 Return Address 4
#RSAC
Shadow Stack Control ProtecLon ExcepLon
12
Return Address 1
Return Address 2
Parameter
Return Address 4
Parameter
Parameter
Return Address 3
Return Address 1
Return Address 3
Return Address 2.1
Return Address 4
RET
#CP
#RSAC
Indirect Branch Tracking
13
RET
Indirect Branch
InstrucLon2
ENDBR32/ENDBR64
InstrucLon…
InstrucLon…
InstrucLon1
IND JMP
IND CALL
#RSAC
Indirect Branch Tracking
14
RET
Indirect Branch
InstrucLon2
ENDBR32/ENDBR64
InstrucLon…
InstrucLon…
InstrucLon1
RET
ENDBR32/ENDBR64
InstrucLon…
IND JMP
IND CALL
#RSAC
Indirect Branch Tracking #CP
15
RET
Indirect Branch
InstrucLon2
ENDBR32/ENDBR64
InstrucLon…
InstrucLon…
InstrucLon1
RET
Push Eax
InstrucLon…
IND JMP
IND CALL
#CP
#RSAC
Cross Mode Indirect Branch Tracking
16
InstrucLon2 32
ENDBR32
InstrucLon1 32
IND JMP
IND CALL
InstrucLon2 64
ENDBR32
InstrucLon1 64
32bit Mode 64bit Mode
Same binary built by compiler
#RSAC
INTEL MPX
#RSAC
Intel® Memory ProtecLon Extensions
18
MPX
Bound
Check
ISA
Bound
Table
#RSAC
Bound Table
19
#RSAC
Bound InstrucLons
20
#RSAC
QEMU VM ESCAPE CASE STUDY
#RSAC
CVE-2015-5165 and CVE-2015-7504 Exploit
22
#HITB2016AMS D1T1 - Escape From The Docker KVM QEMU Machine - Shengping Wang and Xu Liu
#RSAC
CVE-2015-5165 Memory Disclosure
23
Malformed Package
Malformed Package
Host Guest OS
QEMU
Vulnerable Code
Host Memory Data
Host Memory Data
QEMU Memory Address
Guest OS Memory Address
#RSAC
CVE-2015-7504 Code ExecuLon
24
Malformed Package
Host Guest OS
QEMU
Vulnerable Code
CriLcal Pointer
#RSAC
CVE-2015-7504 Code ExecuLon
25
#RSAC
CVE-2015-7504 Code ExecuLon
26
#RSAC
CVE-2015-7504 Exploit in HITB
27
xchg rax,rsp;
ret
#RSAC
CVE-2015-7504 Exploit in Phrack
28
qemu_set_irq
Mprotect
shellcode
#RSAC
MITIGATION WITH CET/MPX
#RSAC
CVE-2015-5165 – Out of Bound Access
Defense with MPX
30
Enable MPX on packet memory access
#RSAC
CVE-2015-7504 – Out of Bound Read Defense
with MPX
31
Enable MPX on buffer[4096] memory access
#RSAC
CVE-2015-7504 Exploit Defense with CET
32
xchg rax,rsp;
ret
Shadow Stack can stop “xchg rax,rsp;ret”
#RSAC
CVE-2015-7504 Exploit Defense with CET
33
qemu_set_irq
Mprotect
shellcode
Indirect Branch Tracking can stop irq->handler calling qemu_set_irq without valid tag
#RSAC
OTHER MITIGATIONS
#RSAC
Other MiLgaLon - PKU
35
#RSAC
Other MiLgaLon - PMI
36
ENDBR32/ENDBR64
IND JMP
IND CALL
PMI Handler with Target Tag Check
LBR_FROM LBR_TO
#RSAC
Summary
37
VM escape is pracLcal and impacts cloud foundaLon security
Intel CET/MPX can enhance miLgaLon on ROP/JOP/COP and buffer
overflow, specifically on cloud virtualizaLon stack
#RSAC
Call For AcLons
38
Apply new CPU mechanisms such as CET/MPX/PMU/PKU on exploit
defense
#RSAC
THANK YOU! QUESTIONS?
XIAONING.LI@ALIBABA-INC.COM

Enhance Virtualization Stack with Intel CET and MPX