SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Pitfalls of virtual machine 
introspection on modern hardware 
Tamas K. Lengyel 
@tklengyel 
tamas@tklengyel.com
Agenda 
1. VMI intro 
2. Software attacks 
● Direct Kernel Structure Manipulation 
● Direct Kernel Object Manipulation 
3. Hardware attacks 
● Translation Lookaside Buffer poisoning 
● Extended Page Tables limitations 
● System Management mode 
4. Conclusion
Virtual Machine Introspection (VMI) 
Interpret virtual hardware state 
● Network, Disk, vCPU & Memory 
● The semantic gap problem: 
Reconstruct high-level state information from low-level 
data-sources.
Bridging the semantic gap 
● The guest OS is in charge of managing the virtual 
hardware 
– How to get the info from it? 
● Install in-guest agent to query using standard 
interfaces 
– If OS is compromised in-guest agent can be disabled 
/ tampered with 
– Just as vulnerable as your AntiVirus
Bridging the semantic gap 
● Replicate guest OS functions externally 
– In-guest code-hooks are avoided 
– Requires expert knowledge on OS and hardware 
behavior 
– Requires debug data to understand in-memory data-structures 
● This is where the problems begin 
– The weak and the strong semantic gap
Direct Kernel Object Manipulation 
2004: DKOM - Mangle in-memory data-structures to hide 
elements 
LibVMI example: 
size_t vmi_read_va( 
vmi_instance_t vmi, 
addr_t vaddr, 
vmi_pid_t pid, // This is interpreted by 
// walking the list 
void *buf, 
size_t count);
Direct Kernel Structure Manipulation 
DKSM: Subverting Virtual Machine Introspection for Fun 
and Profit (2010) 
● Patch in-guest system to interpret structures 
differently 
Ex ternal interp retation Interna l interpreta tion 
typedef struct _FOO 
{ 
void* my_pointer; 
unsigned long my_value; 
} FOO; 
typedef struct _NEWFOO 
{ 
unsigned long my_value; 
void* my_pointer; 
} NEWFOO;
Translation lookaside buffer (TLB) poisoning 
● Virtual to physical address 
translation is expensive 
● Hardware managed transparent 
cache of the results 
● Separate cache for read/write and 
instruction fetch (Harvard-style 
architecture)! 
● Opportunity to whack it out of sync! 
● Shadow Walker / FU rootkit
TLB poisoning 
Original algorithm: 
Input: Splitting Page Address (addr) 
Pagetable Entry for addr (pte) 
invalidate_instr_tlb (pte); // flush TLB 
pte = the_shadow_code_page (addr); // replace PTE in memory 
mark_global (pte); // disable auto-flush 
reload_instr_tlb (pte); // load it into TLB 
pte = the_orig_code_page (addr); // put original entry back
TLB poisoning and virtualization 
Automatically flush of the TLB on 
every VMEXIT/VMENTRY 
● TLB (poisoning) is impossible 
● Performance hit 
Introduction of TLB tagging (VPID) in Intel Nehalem (2008) 
● 16-bit field specified in the VMCS for each vCPU 
● Performance boost! 
● VM TLB entries invisible to the VMM 
● The problem is not (just) the split TLB
TLB poisoning with Windows / Linux 
TLB poisoning uses global pages 
● CR4.PGE (bit 7) 
● Makes PTE’s marked as global survive context-switches 
(MOV-TO-CR3) 
● Great performance boost for kernel pages! 
Windows 7 
● Regularly flushes global pages by disabled & re-enabling 
CR4.PGE 
Linux 
● Doesn’t touch CR4.PGE after boot
The tagged TLB in Xen 
● The TLB tag is assigned to the vCPU from a global 
counter 
asid->asid = data->next_asid++; 
● No flushes, just assign a new tag when needed 
● When 16-bit field is exhausted, flush and start from 1 
● A new tag is assigned on every MOV-TO-CR3 
– The use of global pages disabled in the guest! 
– The TLB needs to be primed on each context-switch
The tagged TLB in KVM 
● Tag is assigned when vCPU structure is created 
– Doesn’t matter if the vCPU is activated or not 
– Ran out of assignable tags? 
● Disable tagging and revert to old 
VMENTRY/VMEXIT TLB flushing 
● Priming the TLB in Linux guests on KVM is a problem 
for VMI 
● However, the split TLB still has issues
The sTLB! 
Intel Nehalem introduced second-level cache: sTLB 
The problem: 
● Split-TLB relies on a custom page-fault handler being 
called to re-split the TLB when it’s evicted 
● With sTLB, the entry is brought back into the 1st level 
cache 
– ..both into the iTLB & the dTLB 
– Split-TLB becomes unsplit! 
● Split-TLB poisoning is unreliable in VMs!
MoRE Shadow Walker 
2014: The evolution of TLB splitting on x86 
● Guests can’t disable the sTLB by themselves 
● However, sTLB doesn’t merge entries with conflicting 
PTE permissions 
– 1st level PTEs can have R, R+W or R+E permissions 
– 2nd level (EPT) PTEs can have R, R+W or E 
permissions! 
● Reliable TLB splitting requires VMM support!
Extended Page Tables (EPT) 
Speed up guest virtual to machine 
physical address translation 
Two sets of tables 
● 1st layer managed by guest OS 
● 2nd layer managed by the VMM 
Permissions can be different in the two 
layers!
Extended Page Tables (EPT) 
Can be used to trace the execution and memory accesses 
made by the guest 
● Transparently 
● 4k Page-level granularity at best 
● Need to filter unrelated events! 
Notable commercial examples:
EPT limitations 
● Only the start address and type 
of the violation is recorded 
● We don't know how much 
memory is involved 
● The operating system by default starts R/W operation 
at the start of a variable 
● But it is not enforced 
● Violations in the vicinity of a watched area need to 
be treated as potential hits
EPT limitations 
Read/Write violation ambiguities 
"An EPT violation that occurs during as a result of execution of a read-modify-write 
operation sets bit 1 (data write). Whether it also sets bit 0 (data read) is 
implementation-specific and, for a given implementation, may differ for different kinds 
of read-modify-write operations." 
Intel SDM 
“Counter question: Why can't the hardware report true characteristics right away?” 
Jan Beulich – SuSE 
“when spec says so, there is a reason but I can't tell here. :-)” 
Kevin Tian – Intel
EPT limitations 
Read/Write violation ambiguities 
"An EPT violation that occurs during as a result of execution of a read-modify-write 
operation sets bit 1 (data write). Whether it also sets bit 0 (data read) is 
implementation-specific and, for a given implementation, may differ for different kinds 
of read-modify-write operations." 
Intel SDM 
It is possible to siphon data using r-m-w operations from a 
page that doesn’t allow reading! 
Fixed in Xen 4.5
EPT limitations 
● Single EPT per guest 
– Not a hardware limitation 
– Could have separate EPT for each vCPU 
● Tracing with multi-vCPUs 
– EPT permissions need to be relaxed while one vCPU 
is advanced 
– Race condition 
– All vCPUs need to be paused while one vCPU is 
singlestepped
System Management Mode (SMM) 
SMM intended for low-level services, such as: 
● thermal (fan) control 
● USB emulation 
● hardware errata workarounds 
Can be used for: 
● VMI 
● Anti-VMI! 
Hard to take control of it on (most) Intel devices as it is 
loaded by the BIOS
SMM 
● Normal mode SMM is 
triggered by interrupts 
(SMI) 
● Can be configured to 
happen periodically 
● Always returns to the 
same execution mode 
afterwards
SMM 
The problem for SMM based VMI systems: 
“A limitation of any SMM-based solution [...] is that a 
malicious hypervisor could block SMI interrupts on every 
CPU in the APIC, effectively starving the introspection tool. 
For VMI, trusting the hypervisor is not a problem, but the 
hardware isolation from the hypervisor is incomplete.” 
Jain et al. “SoK: Introspections on Trust and the Semantic Gap” 2014, IEEE S&P
Intel Dual-monitor mode SMM 
● Available on all CPUs 
with VT-x (?) 
● SMM can become an 
independent 
hypervisor 
● VMCALL in VMX-root!
Intel Dual-mode SMM 
The VMCALL instruction can be used to instrument the 
VMM 
● Same way INT3 can be used to instrument a VM 
● Starvation is impossible via the APIC 
The SMM can enter any execution mode 
● Full control over the execution flow 
● Hidden VMs 
The SMM can temporarily disable SMIs for a VM! 
● Forced execution
Conclusion 
VMI is powerful but has issues 
● The strong semantic gap 
Hardware support is better 
● Tagged TLB is a problem 
● Split-TLB requires VMM support 
● EPT corner-cases need to be taken into consideration 
Dual-mode SMM is un(der)-explored

Weitere ähnliche Inhalte

Was ist angesagt?

BSides Denver: Stealthy, hypervisor-based malware analysis
BSides Denver: Stealthy, hypervisor-based malware analysisBSides Denver: Stealthy, hypervisor-based malware analysis
BSides Denver: Stealthy, hypervisor-based malware analysisTamas K Lengyel
 
VM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with XenVM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with XenTamas K Lengyel
 
VM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzingVM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzingTamas K Lengyel
 
OffensiveCon2022: Case Studies of Fuzzing with Xen
OffensiveCon2022: Case Studies of Fuzzing with XenOffensiveCon2022: Case Studies of Fuzzing with Xen
OffensiveCon2022: Case Studies of Fuzzing with XenTamas K Lengyel
 
Применение виртуализации для динамического анализа
Применение виртуализации для динамического анализаПрименение виртуализации для динамического анализа
Применение виртуализации для динамического анализаPositive Hack Days
 
Troopers15 Lightning talk: VMI & DRAKVUF
Troopers15 Lightning talk: VMI & DRAKVUFTroopers15 Lightning talk: VMI & DRAKVUF
Troopers15 Lightning talk: VMI & DRAKVUFTamas K Lengyel
 
Practical Windows Kernel Exploitation
Practical Windows Kernel ExploitationPractical Windows Kernel Exploitation
Practical Windows Kernel ExploitationzeroSteiner
 
Virtual Machine Introspection in a Hyberid Honeypot Architecture
Virtual Machine Introspection in a Hyberid Honeypot ArchitectureVirtual Machine Introspection in a Hyberid Honeypot Architecture
Virtual Machine Introspection in a Hyberid Honeypot ArchitectureTamas K Lengyel
 
Solnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecSolnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecPacSecJP
 
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)Shota Shinogi
 
Fun With Dr Brown
Fun With Dr BrownFun With Dr Brown
Fun With Dr BrownzeroSteiner
 
Malware Collection and Analysis via Hardware Virtualization
Malware Collection and Analysis via Hardware VirtualizationMalware Collection and Analysis via Hardware Virtualization
Malware Collection and Analysis via Hardware VirtualizationTamas K Lengyel
 
Is That A Penguin In My Windows?
Is That A Penguin In My Windows?Is That A Penguin In My Windows?
Is That A Penguin In My Windows?zeroSteiner
 
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCanSecWest
 
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...DefconRussia
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesPeter Hlavaty
 
Breaking hardware enforced security with hypervisors
Breaking hardware enforced security with hypervisorsBreaking hardware enforced security with hypervisors
Breaking hardware enforced security with hypervisorsPriyanka Aash
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CanSecWest
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Nate Lawson
 

Was ist angesagt? (20)

BSides Denver: Stealthy, hypervisor-based malware analysis
BSides Denver: Stealthy, hypervisor-based malware analysisBSides Denver: Stealthy, hypervisor-based malware analysis
BSides Denver: Stealthy, hypervisor-based malware analysis
 
VM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with XenVM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based Fuzzing with Xen
 
VM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzingVM Forking and Hypervisor-based fuzzing
VM Forking and Hypervisor-based fuzzing
 
OffensiveCon2022: Case Studies of Fuzzing with Xen
OffensiveCon2022: Case Studies of Fuzzing with XenOffensiveCon2022: Case Studies of Fuzzing with Xen
OffensiveCon2022: Case Studies of Fuzzing with Xen
 
Применение виртуализации для динамического анализа
Применение виртуализации для динамического анализаПрименение виртуализации для динамического анализа
Применение виртуализации для динамического анализа
 
Troopers15 Lightning talk: VMI & DRAKVUF
Troopers15 Lightning talk: VMI & DRAKVUFTroopers15 Lightning talk: VMI & DRAKVUF
Troopers15 Lightning talk: VMI & DRAKVUF
 
Practical Windows Kernel Exploitation
Practical Windows Kernel ExploitationPractical Windows Kernel Exploitation
Practical Windows Kernel Exploitation
 
Virtual Machine Introspection in a Hyberid Honeypot Architecture
Virtual Machine Introspection in a Hyberid Honeypot ArchitectureVirtual Machine Introspection in a Hyberid Honeypot Architecture
Virtual Machine Introspection in a Hyberid Honeypot Architecture
 
ShinoBOT Suite
ShinoBOT SuiteShinoBOT Suite
ShinoBOT Suite
 
Solnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsecSolnik secure enclaveprocessor-pacsec
Solnik secure enclaveprocessor-pacsec
 
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
 
Fun With Dr Brown
Fun With Dr BrownFun With Dr Brown
Fun With Dr Brown
 
Malware Collection and Analysis via Hardware Virtualization
Malware Collection and Analysis via Hardware VirtualizationMalware Collection and Analysis via Hardware Virtualization
Malware Collection and Analysis via Hardware Virtualization
 
Is That A Penguin In My Windows?
Is That A Penguin In My Windows?Is That A Penguin In My Windows?
Is That A Penguin In My Windows?
 
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updatedCsw2017 bazhaniuk exploring_yoursystemdeeper_updated
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
 
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
Mateusz 'j00ru' Jurczyk - Windows Kernel Trap Handler and NTVDM Vulnerabiliti...
 
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytesWindows Kernel Exploitation : This Time Font hunt you down in 4 bytes
Windows Kernel Exploitation : This Time Font hunt you down in 4 bytes
 
Breaking hardware enforced security with hypervisors
Breaking hardware enforced security with hypervisorsBreaking hardware enforced security with hypervisors
Breaking hardware enforced security with hypervisors
 
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
CSW2017Richard Johnson_harnessing intel processor trace on windows for vulner...
 
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
Don't Tell Joanna the Virtualized Rootkit is Dead (Blackhat 2007)
 

Ähnlich wie Pitfalls of virtual machine introspection on modern hardware

Core Scheduling for Virtualization: Where are We? (If we Want it!)
Core Scheduling for Virtualization: Where are We? (If we Want it!)Core Scheduling for Virtualization: Where are We? (If we Want it!)
Core Scheduling for Virtualization: Where are We? (If we Want it!)Dario Faggioli
 
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMUSFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMULinaro
 
Buiding a better Userspace - The current and future state of QEMU and KVM int...
Buiding a better Userspace - The current and future state of QEMU and KVM int...Buiding a better Userspace - The current and future state of QEMU and KVM int...
Buiding a better Userspace - The current and future state of QEMU and KVM int...aliguori
 
Owasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF SessionOwasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF SessionBart Leppens
 
Slide used at ACM-SAC 2014 by Suzaki
Slide used at ACM-SAC 2014 by SuzakiSlide used at ACM-SAC 2014 by Suzaki
Slide used at ACM-SAC 2014 by SuzakiKuniyasu Suzaki
 
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...PROIDEA
 
Detecting hardware virtualization rootkits
Detecting hardware virtualization rootkitsDetecting hardware virtualization rootkits
Detecting hardware virtualization rootkitsEdgar Barbosa
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogicAleem Shariff
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterTim Ellison
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overviewLinaro
 
ZertoCON_Support_Toolz.pdf
ZertoCON_Support_Toolz.pdfZertoCON_Support_Toolz.pdf
ZertoCON_Support_Toolz.pdftestslebew
 
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSDEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSFelipe Prado
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesAlexander Penev
 

Ähnlich wie Pitfalls of virtual machine introspection on modern hardware (20)

Core Scheduling for Virtualization: Where are We? (If we Want it!)
Core Scheduling for Virtualization: Where are We? (If we Want it!)Core Scheduling for Virtualization: Where are We? (If we Want it!)
Core Scheduling for Virtualization: Where are We? (If we Want it!)
 
VXCON 2017
VXCON 2017VXCON 2017
VXCON 2017
 
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMUSFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
SFO15-202: Towards Multi-Threaded Tiny Code Generator (TCG) in QEMU
 
Buiding a better Userspace - The current and future state of QEMU and KVM int...
Buiding a better Userspace - The current and future state of QEMU and KVM int...Buiding a better Userspace - The current and future state of QEMU and KVM int...
Buiding a better Userspace - The current and future state of QEMU and KVM int...
 
Owasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF SessionOwasp AppSecEU 2015 - BeEF Session
Owasp AppSecEU 2015 - BeEF Session
 
Slide used at ACM-SAC 2014 by Suzaki
Slide used at ACM-SAC 2014 by SuzakiSlide used at ACM-SAC 2014 by Suzaki
Slide used at ACM-SAC 2014 by Suzaki
 
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
CONFidence 2017: Escaping the (sand)box: The promises and pitfalls of modern ...
 
Fuzzing_with_Xen.pdf
Fuzzing_with_Xen.pdfFuzzing_with_Xen.pdf
Fuzzing_with_Xen.pdf
 
Detecting hardware virtualization rootkits
Detecting hardware virtualization rootkitsDetecting hardware virtualization rootkits
Detecting hardware virtualization rootkits
 
Attack on the Core
Attack on the CoreAttack on the Core
Attack on the Core
 
Intel update
Intel updateIntel update
Intel update
 
003-vmm.pptx
003-vmm.pptx003-vmm.pptx
003-vmm.pptx
 
Armboot process zeelogic
Armboot process zeelogicArmboot process zeelogic
Armboot process zeelogic
 
Five cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark fasterFive cool ways the JVM can run Apache Spark faster
Five cool ways the JVM can run Apache Spark faster
 
Lcu14 101- coresight overview
Lcu14 101- coresight overviewLcu14 101- coresight overview
Lcu14 101- coresight overview
 
SR-IOV Introduce
SR-IOV IntroduceSR-IOV Introduce
SR-IOV Introduce
 
ZertoCON_Support_Toolz.pdf
ZertoCON_Support_Toolz.pdfZertoCON_Support_Toolz.pdf
ZertoCON_Support_Toolz.pdf
 
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORSDEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
DEF CON 27 - ALI ISLAM and DAN REGALADO WEAPONIZING HYPERVISORS
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
 
Hypervisors
HypervisorsHypervisors
Hypervisors
 

Mehr von Tamas K Lengyel

Estimating Security Risk Through Repository Mining
Estimating Security Risk Through Repository MiningEstimating Security Risk Through Repository Mining
Estimating Security Risk Through Repository MiningTamas K Lengyel
 
Hacktivity 2016: Stealthy, hypervisor based malware analysis
Hacktivity 2016: Stealthy, hypervisor based malware analysisHacktivity 2016: Stealthy, hypervisor based malware analysis
Hacktivity 2016: Stealthy, hypervisor based malware analysisTamas K Lengyel
 
Anti-evil maid with UEFI and Xen
Anti-evil maid with UEFI and XenAnti-evil maid with UEFI and Xen
Anti-evil maid with UEFI and XenTamas K Lengyel
 
Stealthy, Hypervisor-based Malware Analysis
Stealthy, Hypervisor-based Malware AnalysisStealthy, Hypervisor-based Malware Analysis
Stealthy, Hypervisor-based Malware AnalysisTamas K Lengyel
 
CyberSEED: Virtual Machine Introspection to Detect and Protect
CyberSEED: Virtual Machine Introspection to Detect and ProtectCyberSEED: Virtual Machine Introspection to Detect and Protect
CyberSEED: Virtual Machine Introspection to Detect and ProtectTamas K Lengyel
 
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and CloningNSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and CloningTamas K Lengyel
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopTamas K Lengyel
 

Mehr von Tamas K Lengyel (7)

Estimating Security Risk Through Repository Mining
Estimating Security Risk Through Repository MiningEstimating Security Risk Through Repository Mining
Estimating Security Risk Through Repository Mining
 
Hacktivity 2016: Stealthy, hypervisor based malware analysis
Hacktivity 2016: Stealthy, hypervisor based malware analysisHacktivity 2016: Stealthy, hypervisor based malware analysis
Hacktivity 2016: Stealthy, hypervisor based malware analysis
 
Anti-evil maid with UEFI and Xen
Anti-evil maid with UEFI and XenAnti-evil maid with UEFI and Xen
Anti-evil maid with UEFI and Xen
 
Stealthy, Hypervisor-based Malware Analysis
Stealthy, Hypervisor-based Malware AnalysisStealthy, Hypervisor-based Malware Analysis
Stealthy, Hypervisor-based Malware Analysis
 
CyberSEED: Virtual Machine Introspection to Detect and Protect
CyberSEED: Virtual Machine Introspection to Detect and ProtectCyberSEED: Virtual Machine Introspection to Detect and Protect
CyberSEED: Virtual Machine Introspection to Detect and Protect
 
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and CloningNSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
 
Dfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshopDfrws eu 2014 rekall workshop
Dfrws eu 2014 rekall workshop
 

Kürzlich hochgeladen

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditSkynet Technologies
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsYoss Cohen
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneUiPathCommunity
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Nikki Chapple
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfROWELL MARQUINA
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...BookNet Canada
 

Kürzlich hochgeladen (20)

React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Manual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance AuditManual 508 Accessibility Compliance Audit
Manual 508 Accessibility Compliance Audit
 
Infrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platformsInfrared simulation and processing on Nvidia platforms
Infrared simulation and processing on Nvidia platforms
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
WomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyoneWomenInAutomation2024: AI and Automation for eveyone
WomenInAutomation2024: AI and Automation for eveyone
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
Microsoft 365 Copilot: How to boost your productivity with AI – Part two: Dat...
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
QMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdfQMMS Lesson 2 - Using MS Excel Formula.pdf
QMMS Lesson 2 - Using MS Excel Formula.pdf
 
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
Transcript: New from BookNet Canada for 2024: BNC SalesData and LibraryData -...
 

Pitfalls of virtual machine introspection on modern hardware

  • 1. Pitfalls of virtual machine introspection on modern hardware Tamas K. Lengyel @tklengyel tamas@tklengyel.com
  • 2. Agenda 1. VMI intro 2. Software attacks ● Direct Kernel Structure Manipulation ● Direct Kernel Object Manipulation 3. Hardware attacks ● Translation Lookaside Buffer poisoning ● Extended Page Tables limitations ● System Management mode 4. Conclusion
  • 3. Virtual Machine Introspection (VMI) Interpret virtual hardware state ● Network, Disk, vCPU & Memory ● The semantic gap problem: Reconstruct high-level state information from low-level data-sources.
  • 4. Bridging the semantic gap ● The guest OS is in charge of managing the virtual hardware – How to get the info from it? ● Install in-guest agent to query using standard interfaces – If OS is compromised in-guest agent can be disabled / tampered with – Just as vulnerable as your AntiVirus
  • 5. Bridging the semantic gap ● Replicate guest OS functions externally – In-guest code-hooks are avoided – Requires expert knowledge on OS and hardware behavior – Requires debug data to understand in-memory data-structures ● This is where the problems begin – The weak and the strong semantic gap
  • 6. Direct Kernel Object Manipulation 2004: DKOM - Mangle in-memory data-structures to hide elements LibVMI example: size_t vmi_read_va( vmi_instance_t vmi, addr_t vaddr, vmi_pid_t pid, // This is interpreted by // walking the list void *buf, size_t count);
  • 7. Direct Kernel Structure Manipulation DKSM: Subverting Virtual Machine Introspection for Fun and Profit (2010) ● Patch in-guest system to interpret structures differently Ex ternal interp retation Interna l interpreta tion typedef struct _FOO { void* my_pointer; unsigned long my_value; } FOO; typedef struct _NEWFOO { unsigned long my_value; void* my_pointer; } NEWFOO;
  • 8. Translation lookaside buffer (TLB) poisoning ● Virtual to physical address translation is expensive ● Hardware managed transparent cache of the results ● Separate cache for read/write and instruction fetch (Harvard-style architecture)! ● Opportunity to whack it out of sync! ● Shadow Walker / FU rootkit
  • 9. TLB poisoning Original algorithm: Input: Splitting Page Address (addr) Pagetable Entry for addr (pte) invalidate_instr_tlb (pte); // flush TLB pte = the_shadow_code_page (addr); // replace PTE in memory mark_global (pte); // disable auto-flush reload_instr_tlb (pte); // load it into TLB pte = the_orig_code_page (addr); // put original entry back
  • 10. TLB poisoning and virtualization Automatically flush of the TLB on every VMEXIT/VMENTRY ● TLB (poisoning) is impossible ● Performance hit Introduction of TLB tagging (VPID) in Intel Nehalem (2008) ● 16-bit field specified in the VMCS for each vCPU ● Performance boost! ● VM TLB entries invisible to the VMM ● The problem is not (just) the split TLB
  • 11. TLB poisoning with Windows / Linux TLB poisoning uses global pages ● CR4.PGE (bit 7) ● Makes PTE’s marked as global survive context-switches (MOV-TO-CR3) ● Great performance boost for kernel pages! Windows 7 ● Regularly flushes global pages by disabled & re-enabling CR4.PGE Linux ● Doesn’t touch CR4.PGE after boot
  • 12. The tagged TLB in Xen ● The TLB tag is assigned to the vCPU from a global counter asid->asid = data->next_asid++; ● No flushes, just assign a new tag when needed ● When 16-bit field is exhausted, flush and start from 1 ● A new tag is assigned on every MOV-TO-CR3 – The use of global pages disabled in the guest! – The TLB needs to be primed on each context-switch
  • 13. The tagged TLB in KVM ● Tag is assigned when vCPU structure is created – Doesn’t matter if the vCPU is activated or not – Ran out of assignable tags? ● Disable tagging and revert to old VMENTRY/VMEXIT TLB flushing ● Priming the TLB in Linux guests on KVM is a problem for VMI ● However, the split TLB still has issues
  • 14. The sTLB! Intel Nehalem introduced second-level cache: sTLB The problem: ● Split-TLB relies on a custom page-fault handler being called to re-split the TLB when it’s evicted ● With sTLB, the entry is brought back into the 1st level cache – ..both into the iTLB & the dTLB – Split-TLB becomes unsplit! ● Split-TLB poisoning is unreliable in VMs!
  • 15. MoRE Shadow Walker 2014: The evolution of TLB splitting on x86 ● Guests can’t disable the sTLB by themselves ● However, sTLB doesn’t merge entries with conflicting PTE permissions – 1st level PTEs can have R, R+W or R+E permissions – 2nd level (EPT) PTEs can have R, R+W or E permissions! ● Reliable TLB splitting requires VMM support!
  • 16. Extended Page Tables (EPT) Speed up guest virtual to machine physical address translation Two sets of tables ● 1st layer managed by guest OS ● 2nd layer managed by the VMM Permissions can be different in the two layers!
  • 17. Extended Page Tables (EPT) Can be used to trace the execution and memory accesses made by the guest ● Transparently ● 4k Page-level granularity at best ● Need to filter unrelated events! Notable commercial examples:
  • 18. EPT limitations ● Only the start address and type of the violation is recorded ● We don't know how much memory is involved ● The operating system by default starts R/W operation at the start of a variable ● But it is not enforced ● Violations in the vicinity of a watched area need to be treated as potential hits
  • 19. EPT limitations Read/Write violation ambiguities "An EPT violation that occurs during as a result of execution of a read-modify-write operation sets bit 1 (data write). Whether it also sets bit 0 (data read) is implementation-specific and, for a given implementation, may differ for different kinds of read-modify-write operations." Intel SDM “Counter question: Why can't the hardware report true characteristics right away?” Jan Beulich – SuSE “when spec says so, there is a reason but I can't tell here. :-)” Kevin Tian – Intel
  • 20. EPT limitations Read/Write violation ambiguities "An EPT violation that occurs during as a result of execution of a read-modify-write operation sets bit 1 (data write). Whether it also sets bit 0 (data read) is implementation-specific and, for a given implementation, may differ for different kinds of read-modify-write operations." Intel SDM It is possible to siphon data using r-m-w operations from a page that doesn’t allow reading! Fixed in Xen 4.5
  • 21. EPT limitations ● Single EPT per guest – Not a hardware limitation – Could have separate EPT for each vCPU ● Tracing with multi-vCPUs – EPT permissions need to be relaxed while one vCPU is advanced – Race condition – All vCPUs need to be paused while one vCPU is singlestepped
  • 22. System Management Mode (SMM) SMM intended for low-level services, such as: ● thermal (fan) control ● USB emulation ● hardware errata workarounds Can be used for: ● VMI ● Anti-VMI! Hard to take control of it on (most) Intel devices as it is loaded by the BIOS
  • 23. SMM ● Normal mode SMM is triggered by interrupts (SMI) ● Can be configured to happen periodically ● Always returns to the same execution mode afterwards
  • 24. SMM The problem for SMM based VMI systems: “A limitation of any SMM-based solution [...] is that a malicious hypervisor could block SMI interrupts on every CPU in the APIC, effectively starving the introspection tool. For VMI, trusting the hypervisor is not a problem, but the hardware isolation from the hypervisor is incomplete.” Jain et al. “SoK: Introspections on Trust and the Semantic Gap” 2014, IEEE S&P
  • 25. Intel Dual-monitor mode SMM ● Available on all CPUs with VT-x (?) ● SMM can become an independent hypervisor ● VMCALL in VMX-root!
  • 26. Intel Dual-mode SMM The VMCALL instruction can be used to instrument the VMM ● Same way INT3 can be used to instrument a VM ● Starvation is impossible via the APIC The SMM can enter any execution mode ● Full control over the execution flow ● Hidden VMs The SMM can temporarily disable SMIs for a VM! ● Forced execution
  • 27. Conclusion VMI is powerful but has issues ● The strong semantic gap Hardware support is better ● Tagged TLB is a problem ● Split-TLB requires VMM support ● EPT corner-cases need to be taken into consideration Dual-mode SMM is un(der)-explored