rustifying the vm introspection ecosystem
play

Rustifying the VM Introspection Ecosystem FOSDEM 2020 Dorian - PowerPoint PPT Presentation

Rustifying the VM Introspection Ecosystem FOSDEM 2020 Dorian Eikenberg Mathieu Tarral Agenda What is VM Introspection ? VMI ecosystem today Rustifying the VM Introspection ecosystem Future work Virtualization


  1. Rustifying the VM Introspection Ecosystem FOSDEM 2020 Dorian Eikenberg Mathieu Tarral

  2. Agenda What is VM Introspection ? ● VMI ecosystem today ● Rustifying the VM Introspection ecosystem ● Future work ●

  3. Virtualization Rust 2015: ● Rust 1.0 ○ 2016: ● rustyvisor ○ 2017: ● crosvm ○ Firecracker ○ 2019: ● rust-vmm ○ orange_slice ○ cloud-hypervisor ○ Wenzel/awesome-virtualization

  4. VM Introspection

  5. VM Introspection “Deriving the execution context of a virtual machine, from the hypervisor interface, by querying its hardware state, for security purposes”

  6. VM Introspection : Concepts Virtualization layer Intercept hardware events ● memory access (r/w/x) ○ Introspection Virtual interrupts ○ Agent Machine set breakpoints ! ( int 3 ) ■ MSR registers ○ control registers ○ etc... ○ Modify hardware state ● VCPUs registers ○ ○ physical memory VMI API Hypervisor

  7. VM Introspection : Core Strenghts What VMI provides: VM hardware access ● full system view at hypervisor-level privilege ○ Interposition ● control what hardware events to catch ○ manipulate what the OS should see of itself ○

  8. VM Introspection : Scenarios When detectability is an issue ● stealth malware analysis ○ Need a full-system approach ● complex debugging scenarios (nested hypervisor) ○ advanced in-kernel fuzzing ○ Can’t rely on guest OS ● to give you a view of itself ○ assuming compromised kernel ○ Unikernel (!) ○

  9. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation VMI API Hypervisor

  10. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation Setup a breakpoint callback on “ kernel32:WriteFile ” ● Filter on process name for “ cargo.exe ” ● VMI API Hypervisor Callback: log function parameters ●

  11. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation Identify VM context: kernel and libraries ● Load debug symbols ● VMI API Identify current running process on VCPU ● Hypervisor

  12. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation write int3 in memory ● register interrupt callback ● VMI API write original opcode back ● Hypervisor singlestep ●

  13. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation Deliver hardware event to each registered callbacks ● VMI API Hypervisor

  14. VM Introspection : Complexity Introspection Agent Virtualization layer Breakpoint Semantic Manager Engine Virtual Machine Event Virtual Address Dispatcher Translation ● Identify paging Walk paging structures ● VMI API Hypervisor

  15. VMI ecosystem in 2020

  16. VMI API: Hypervisor Support 2007 2011 2017 2019 XenAccess LibVMI Xen Winbagility VirtualBox LiveCloudKd Hyper-V KVM-VMI FireEye rVMI Nitro Bitdefender KVMi KVM PyREBox QEMU Alternate EPT/RVI Community Effort Upstream integration available

  17. VMI Projects : Silos PyREBox icebox LiveCloudKd rVMI LibVMI pyvmidbg DRAKVUF

  18. The Idea : Unifying the ecosystem

  19. Unifying the ecosystem PyREBox icebox LiveCloudKd rVMI LibVMI pyvmidbg DRAKVUF

  20. Unification : Constraints - Speed abstraction layer == cost PyREBox icebox LiveCloudKd rVMI LibVMI pyvmidbg DRAKVUF

  21. Unification : Constraints - Compatibility Provide a C API PyREBox icebox LiveCloudKd rVMI LibVMI pyvmidbg DRAKVUF

  22. Unification : Constraints - Cross-Platform Be easy to maintain on Windows/Linux PyREBox icebox LiveCloudKd rVMI LibVMI pyvmidbg DRAKVUF

  23. Desired Quality - Memory Safety Virtualization layer Introspection Agent VMI API Hypervisor

  24. Desired Quality - Memory Safety Virtualization layer Introspection Agent VMI API Hypervisor Attack Surface

  25. Unifying the ecosystem Speed ● C compatibility ● Cross-platform ● Memory safety ●

  26. libmicrovmi : Playing lego with VMI Emulators https://github.com/Wenzel/libmicrovmi VMI Apps Dynamic Analysis ● pyvmidbg ● icebox ● rVMI ● LiveCloudKd Address Semantic ● DECAF Engine Translation ● PANDA Unified ● PyREBox low-level ● Drakvuf VMI API Breakpoint Event Live-Memory Analysis Manager Dispatcher Volatility ● Rekall ● OS Hardening Custom Monitoring Hypervisor Fuzzing ● ApplePie Hypervisors

  27. libmicrovmi

  28. libmicrovmi : Status read physical memory ● C API ● r/w VCPU registers ● LibVMI integration ● Subscribe on hardware events ● Xen ● registers ○ xenctrl / -sys ○ mov CR0/CR3/CR4 ■ xenstore / -sys ○ mov DRx ■ xenforeignmemory / -sys ○ r/w MSR ■ KVM ● interrupts ○ kvmi / -sys ○ singlestep ○ VirtualBox ● descriptors ○ fdp / -sys ○ hypercalls ○ Hyper-V ● memory ○ vid-sys ○ r/w/x on frame ■ QEMU ● switch on alternate EPT views ■ Utilities ● foreign memory mapping ○ pagefault injection ○

  29. Demo: mem-dump on Xen / KVM / VirtualBox

  30. Demo : Intercepting context switch on KVM (CR3 events) Demo is running in nested virtualization ●

  31. Future - VM Introspection An OS-independent hooking framework ● Hypervisor-based intrusion detection ○ Full-system view for debuggers ○ A new layer of hardening and defense in depth ○ Snapshot-based fuzzing capabilities ○ Make VM Introspection a new commodity ●

  32. One Last Thing : GSoC We will propose libmicrovmi for the GSoC ● Part of the Honeynet organization ● Ideas ● Improve an existing driver ● Xen / KVM / VirtualBox ○ Add support for emulators ● QEMU / Bochs / Unicorn ○ Propose stealth breakpoints implementation based on EPT ● Add libloading support to rust-lang/bindgen #1541 ●

  33. Rustifying the VM Introspection ecosystem https://github.com/Wenzel/libmicrovmi @rageagainsthepc @mtarral FOSDEM 2020 Dorian Eikenberg Mathieu Tarral

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend