SlideShare a Scribd company logo
Virtual Machine Introspection 
to Detect and Protect 
Tamas K. Lengyel 
tklengyel@sec.in.tum.de 
tamas.lengyel@zentific.com 
https://github.com/tklengyel
Agenda 
1. Motivation & Cloud security 
2. Xen 
3. Virtual Machine Introspection 
I. Isolation 
II. Interpretation 
III. Interposition 
4. Demo 
5. Public release of new tools
Motivation 
This is my PhD topic 
● Malware collection & analysis 
DARPA Cyber Fast Track 
● Cloud IDS/IPS prototype 
Up-and-coming field
Cloud Security? 
● Virtualization is a magic box of invulnerability 
● Why bother if Cloud instances are short-lived 
and easily wiped? 
● Isn't worth the cost of overhead 
● It's not going to happen to me 
● I'll just use my existing tools and be fine 
Wrong!
Cloud Security 
● In-guest AV / HIDS 
✗ No isolation 
● Network IDS 
✗ Limited or no context 
● Scan VM disk and memory 
✗ No interposition 
Better than nothing
Cloud Security! 
● Move protection out from the VM 
✔ Hypervisor based isolation 
● Full view of the VM state 
✔ Interpret virtual hardware to see processes, 
users, connections, files.. 
● Actively monitor & control 
✔ Interposition
Xen 
Bare-metal VMM 
Runs in VMX root 
Minimal interface 
Everything else is a domain, with one being special 
(dom0)
Isolation 
We could move the security stack to dom0.. 
.. or move it into its own domain! 
Xen allows for advanced disaggregation and role 
delegation 
With some caveats..
Access control in Xen 
Xen Security Modules (XSM) 
– Disabled by default. 
– Only usable starting with 4.3 
In the guest kernel! 
– if (!xen_initial_domain()) 
return -EPERM; 
– We patched that in Linux 3.8 
In XenStore (ignore for now) 
– Domain meta info is only a plus
Access control in Xen 
Security is no longer part 
of the TCB 
Can be 1:1, 1:many or 
many:many 
Designed for multi-tenant cloud deployments 
Security doesn't mean the same thing for everyone
Interpretation 
Interpreting the guest virtual hardware 
– Memory 
– VCPU 
Memory interpretation: 
– Paging, paging, paging 
OS interpretation: 
– Debug symbols!
LibVMI + Rekall 
LibVMI 
– Xen and KVM support 
– Paging support for 
● x86, x86+PAE, x86_64 & ARM 
– OS support 
● Windows, Linux 
Rekall 
– Generates nice debug profiles 
– ..and lots of other fancy stuff
Finding Windows 
Volatility: brute-force search 
● “KDBG” scan 
● Easily hidden + lots of false positives 
LibVMI + Rekall: use hardware info! 
● VCPU0 FS/GS register → KPCR 
● KPCR – relative offset = Windows! 
● It is binding, malware can't touch it
Understanding Windows 
Volatility: use the in-memory KDBG struct. 
– Can be tampered with 
– Heavily encoded in Windows 8 64-bit 
LibVMI + Rekall: use the pre-generated debug 
profiles! 
– Works with Windows 8 64-bit as well 
– Different attacker model
Interposition 
Scanning VM memory gets you a lot 
– Volatility's pooltag scans 
But it's not bulletproof and introduces TOCTOU 
issues 
Interposition: induce & trap VMEXITs 
Forward to security domain
Interposition 
Intel to the rescue: 
CPUID, GETSEC, INVD, XSETBV, INVEPT, INVVPID, VMCALL, VMCLEAR, 
VMLAUNCH, VMPTRLD, VMPTRST, VMRESUME, VMXOFF, VMXON 
And optionally: 
CLTS, HLT, IN, INS/INSB/INSW/INSD, OUT, INVLPG, INVPCID, LGDT, LIDT, 
LLDT, LTR, SGDT, SIDT, SLDT, STR, LMSW, MONITOR, MOV from CR3, MOV 
from CR8, MOV to CR0, MOV to CR3, MOV to CR4, MOV to CR8, MOV DR, 
MWAIT, INT3, INT0, MTF …. 
See the full list in Intel SDM 3c 25.1.3
Interposition with LibVMI 
● MOV-TO-CR0/3/4 
– New process being scheduled, CPU feature 
enabled/disabled, TLB flush, etc. 
● EPT violation 
– Trap R/W/X of any memory page in the guest 
– Invisible to the guest 
– Needs to be reset after hit 
● Singlestepping 
– Intel Monitor Trap Flag (MTF) 
● Debug events (INT3)
Demo time! 
http://goo.gl/XMSJ7y
DKOM no more! 
It's still on the heap!
Demo time! 
http://goo.gl/XMSJ7y
DRAKVUF 
“Scalability, Fidelity and Stealth in the DRAKVUF 
Dynamic Malware Analysis System” - ACSAC 2014 
http://drakvuf.com 
Anyone gets the name reference?
Conclusion 
● Cloud security requires new tools and new 
approaches 
● VMI is rapidly maturing to fill the gap 
● Dealing with rootkits is easier externally 
● Tools are open-source (GPL/LGPL) 
● Patches are welcome ;)
What's ahead 
VMI gets you a lot.. but there are blind-spots 
– Virt-DMA, emulation.. 
● Who watches the watcher? 
– SMM/AMT based VMM integrity check 
● Xen on ARM 
– “Cloud” security for your phone/car!
Shout-out 
Cheers to the Zentific crew 
– Steve, Matt & Russ 
To the Volatility crew 
– MHL, Andrew, Gleeda & Moyix 
To the Rekall crew 
– Scudette 
To Mudge 
– Thanks for the CFT!
Thanks!

More Related Content

PDF
Cloud Security with LibVMI
PDF
CrySys guest-lecture: Virtual machine introspection on modern hardware
PDF
Troopers15 Lightning talk: VMI & DRAKVUF
PDF
31c3 Presentation - Virtual Machine Introspection
PDF
Pitfalls and limits of dynamic malware analysis
ODP
Scalability, Fidelity and Stealth in the DRAKVUF Dynamic Malware Analysis System
PDF
BSides Denver: Stealthy, hypervisor-based malware analysis
PDF
Virtual Machine Introspection with Xen
Cloud Security with LibVMI
CrySys guest-lecture: Virtual machine introspection on modern hardware
Troopers15 Lightning talk: VMI & DRAKVUF
31c3 Presentation - Virtual Machine Introspection
Pitfalls and limits of dynamic malware analysis
Scalability, Fidelity and Stealth in the DRAKVUF Dynamic Malware Analysis System
BSides Denver: Stealthy, hypervisor-based malware analysis
Virtual Machine Introspection with Xen

What's hot (20)

PDF
Hacktivity 2016: Stealthy, hypervisor based malware analysis
PDF
Malware Collection and Analysis via Hardware Virtualization
ODP
Virtual Machine Introspection with Xen on ARM
ODP
Pitfalls of virtual machine introspection on modern hardware
PDF
Virtual Machine Introspection in a Hyberid Honeypot Architecture
PDF
OffensiveCon2022: Case Studies of Fuzzing with Xen
PDF
Применение виртуализации для динамического анализа
PDF
VM Forking and Hypervisor-based Fuzzing with Xen
PPTX
VM Forking and Hypervisor-based fuzzing
PDF
Масштабируемый и эффективный фаззинг Google Chrome
PPTX
Linux Security Overview
PPTX
Practical Windows Kernel Exploitation
PPTX
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
PDF
Linux Kernel Security: Adapting 1960s Technology to Meet 21st Century Threats
PDF
Linux Kernel Security Overview - KCA 2009
PDF
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
PDF
Solnik secure enclaveprocessor-pacsec
PDF
Metasploit - The Exploit Learning Tree
PPTX
ShinoBOT Suite
PDF
Is That A Penguin In My Windows?
Hacktivity 2016: Stealthy, hypervisor based malware analysis
Malware Collection and Analysis via Hardware Virtualization
Virtual Machine Introspection with Xen on ARM
Pitfalls of virtual machine introspection on modern hardware
Virtual Machine Introspection in a Hyberid Honeypot Architecture
OffensiveCon2022: Case Studies of Fuzzing with Xen
Применение виртуализации для динамического анализа
VM Forking and Hypervisor-based Fuzzing with Xen
VM Forking and Hypervisor-based fuzzing
Масштабируемый и эффективный фаззинг Google Chrome
Linux Security Overview
Practical Windows Kernel Exploitation
Introduction of ShinoBOT (Black Hat USA 2013 Arsenal)
Linux Kernel Security: Adapting 1960s Technology to Meet 21st Century Threats
Linux Kernel Security Overview - KCA 2009
Csw2017 bazhaniuk exploring_yoursystemdeeper_updated
Solnik secure enclaveprocessor-pacsec
Metasploit - The Exploit Learning Tree
ShinoBOT Suite
Is That A Penguin In My Windows?

Similar to Hacktivity2014: Virtual Machine Introspection to Detect and Protect (20)

PDF
Fuzzing_with_Xen.pdf
PPTX
Attack on the Core
PDF
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
PDF
How to hide your browser 0-days
PPTX
Shall we play a game?
PDF
Security challenges for IoT
PPTX
GoSF Jan 2016 - Go Write a Plugin for Snap!
PDF
Metasploit Computer security testing tool
PDF
Metasploit: Pwnage and Ponies
PDF
Kernel Mode Threats and Practical Defenses
PDF
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
PDF
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
PPTX
Linux 开源操作系统发展新趋势
PDF
The Future of Security and Productivity in Our Newly Remote World
PPT
Black ops of tcp2005 japan
PDF
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
PDF
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
PDF
Docker, Linux Containers, and Security: Does It Add Up?
PDF
DEF CON 27 - WENXIANG QIAN and YUXIANG LI HUIYU - breaking google home exploi...
PPTX
Security research over Windows #defcon china
Fuzzing_with_Xen.pdf
Attack on the Core
NSC #2 - D3 02 - Peter Hlavaty - Attack on the Core
How to hide your browser 0-days
Shall we play a game?
Security challenges for IoT
GoSF Jan 2016 - Go Write a Plugin for Snap!
Metasploit Computer security testing tool
Metasploit: Pwnage and Ponies
Kernel Mode Threats and Practical Defenses
Hacking Highly Secured Enterprise Environments by Zoltan Balazs
DEFCON 22: Bypass firewalls, application white lists, secure remote desktops ...
Linux 开源操作系统发展新趋势
The Future of Security and Productivity in Our Newly Remote World
Black ops of tcp2005 japan
Lightweight Virtualization with Linux Containers and Docker I YaC 2013
Lightweight Virtualization with Linux Containers and Docker | YaC 2013
Docker, Linux Containers, and Security: Does It Add Up?
DEF CON 27 - WENXIANG QIAN and YUXIANG LI HUIYU - breaking google home exploi...
Security research over Windows #defcon china

More from Tamas K Lengyel (6)

PDF
Estimating Security Risk Through Repository Mining
PDF
Anti-evil maid with UEFI and Xen
ODP
Stealthy, Hypervisor-based Malware Analysis
PDF
CyberSEED: Virtual Machine Introspection to Detect and Protect
PDF
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
PDF
Dfrws eu 2014 rekall workshop
Estimating Security Risk Through Repository Mining
Anti-evil maid with UEFI and Xen
Stealthy, Hypervisor-based Malware Analysis
CyberSEED: Virtual Machine Introspection to Detect and Protect
NSS 2013: Towards Hybrid Honeynets via Virtual Machine Introspection and Cloning
Dfrws eu 2014 rekall workshop

Recently uploaded (20)

PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Construction Project Organization Group 2.pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
Sustainable Sites - Green Building Construction
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
composite construction of structures.pdf
PPTX
OOP with Java - Java Introduction (Basics)
PPT
Mechanical Engineering MATERIALS Selection
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PPTX
bas. eng. economics group 4 presentation 1.pptx
DOCX
573137875-Attendance-Management-System-original
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Construction Project Organization Group 2.pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Lecture Notes Electrical Wiring System Components
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Sustainable Sites - Green Building Construction
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Internet of Things (IOT) - A guide to understanding
composite construction of structures.pdf
OOP with Java - Java Introduction (Basics)
Mechanical Engineering MATERIALS Selection
CYBER-CRIMES AND SECURITY A guide to understanding
Model Code of Practice - Construction Work - 21102022 .pdf
bas. eng. economics group 4 presentation 1.pptx
573137875-Attendance-Management-System-original

Hacktivity2014: Virtual Machine Introspection to Detect and Protect

  • 1. Virtual Machine Introspection to Detect and Protect Tamas K. Lengyel tklengyel@sec.in.tum.de tamas.lengyel@zentific.com https://github.com/tklengyel
  • 2. Agenda 1. Motivation & Cloud security 2. Xen 3. Virtual Machine Introspection I. Isolation II. Interpretation III. Interposition 4. Demo 5. Public release of new tools
  • 3. Motivation This is my PhD topic ● Malware collection & analysis DARPA Cyber Fast Track ● Cloud IDS/IPS prototype Up-and-coming field
  • 4. Cloud Security? ● Virtualization is a magic box of invulnerability ● Why bother if Cloud instances are short-lived and easily wiped? ● Isn't worth the cost of overhead ● It's not going to happen to me ● I'll just use my existing tools and be fine Wrong!
  • 5. Cloud Security ● In-guest AV / HIDS ✗ No isolation ● Network IDS ✗ Limited or no context ● Scan VM disk and memory ✗ No interposition Better than nothing
  • 6. Cloud Security! ● Move protection out from the VM ✔ Hypervisor based isolation ● Full view of the VM state ✔ Interpret virtual hardware to see processes, users, connections, files.. ● Actively monitor & control ✔ Interposition
  • 7. Xen Bare-metal VMM Runs in VMX root Minimal interface Everything else is a domain, with one being special (dom0)
  • 8. Isolation We could move the security stack to dom0.. .. or move it into its own domain! Xen allows for advanced disaggregation and role delegation With some caveats..
  • 9. Access control in Xen Xen Security Modules (XSM) – Disabled by default. – Only usable starting with 4.3 In the guest kernel! – if (!xen_initial_domain()) return -EPERM; – We patched that in Linux 3.8 In XenStore (ignore for now) – Domain meta info is only a plus
  • 10. Access control in Xen Security is no longer part of the TCB Can be 1:1, 1:many or many:many Designed for multi-tenant cloud deployments Security doesn't mean the same thing for everyone
  • 11. Interpretation Interpreting the guest virtual hardware – Memory – VCPU Memory interpretation: – Paging, paging, paging OS interpretation: – Debug symbols!
  • 12. LibVMI + Rekall LibVMI – Xen and KVM support – Paging support for ● x86, x86+PAE, x86_64 & ARM – OS support ● Windows, Linux Rekall – Generates nice debug profiles – ..and lots of other fancy stuff
  • 13. Finding Windows Volatility: brute-force search ● “KDBG” scan ● Easily hidden + lots of false positives LibVMI + Rekall: use hardware info! ● VCPU0 FS/GS register → KPCR ● KPCR – relative offset = Windows! ● It is binding, malware can't touch it
  • 14. Understanding Windows Volatility: use the in-memory KDBG struct. – Can be tampered with – Heavily encoded in Windows 8 64-bit LibVMI + Rekall: use the pre-generated debug profiles! – Works with Windows 8 64-bit as well – Different attacker model
  • 15. Interposition Scanning VM memory gets you a lot – Volatility's pooltag scans But it's not bulletproof and introduces TOCTOU issues Interposition: induce & trap VMEXITs Forward to security domain
  • 16. Interposition Intel to the rescue: CPUID, GETSEC, INVD, XSETBV, INVEPT, INVVPID, VMCALL, VMCLEAR, VMLAUNCH, VMPTRLD, VMPTRST, VMRESUME, VMXOFF, VMXON And optionally: CLTS, HLT, IN, INS/INSB/INSW/INSD, OUT, INVLPG, INVPCID, LGDT, LIDT, LLDT, LTR, SGDT, SIDT, SLDT, STR, LMSW, MONITOR, MOV from CR3, MOV from CR8, MOV to CR0, MOV to CR3, MOV to CR4, MOV to CR8, MOV DR, MWAIT, INT3, INT0, MTF …. See the full list in Intel SDM 3c 25.1.3
  • 17. Interposition with LibVMI ● MOV-TO-CR0/3/4 – New process being scheduled, CPU feature enabled/disabled, TLB flush, etc. ● EPT violation – Trap R/W/X of any memory page in the guest – Invisible to the guest – Needs to be reset after hit ● Singlestepping – Intel Monitor Trap Flag (MTF) ● Debug events (INT3)
  • 19. DKOM no more! It's still on the heap!
  • 21. DRAKVUF “Scalability, Fidelity and Stealth in the DRAKVUF Dynamic Malware Analysis System” - ACSAC 2014 http://drakvuf.com Anyone gets the name reference?
  • 22. Conclusion ● Cloud security requires new tools and new approaches ● VMI is rapidly maturing to fill the gap ● Dealing with rootkits is easier externally ● Tools are open-source (GPL/LGPL) ● Patches are welcome ;)
  • 23. What's ahead VMI gets you a lot.. but there are blind-spots – Virt-DMA, emulation.. ● Who watches the watcher? – SMM/AMT based VMM integrity check ● Xen on ARM – “Cloud” security for your phone/car!
  • 24. Shout-out Cheers to the Zentific crew – Steve, Matt & Russ To the Volatility crew – MHL, Andrew, Gleeda & Moyix To the Rekall crew – Scudette To Mudge – Thanks for the CFT!