deconstructing xen
play

Deconstructing Xen Lei Shi, Yuming Wu, Yubin Xia , Nathan Dautenhahn, - PowerPoint PPT Presentation

NDSS1 7 Deconstructing Xen Lei Shi, Yuming Wu, Yubin Xia , Nathan Dautenhahn, Haibo Chen, Binyu Zang, Haibing Guan, Jinming Li Shanghai Jiao Tong University , University of Pennsylvania, Huawei Inc. / 27 Hypervisors have Bugs Xen is used


  1. NDSS’1 7 Deconstructing Xen Lei Shi, Yuming Wu, Yubin Xia , Nathan Dautenhahn, Haibo Chen, Binyu Zang, Haibing Guan, Jinming Li Shanghai Jiao Tong University , University of Pennsylvania, Huawei Inc. / 27

  2. Hypervisors have Bugs • Xen is used by Amazon EC2 250 200 • Xen’s CVE is growing 150 210 XSA (Xen Security Advisories) 100 Xen’s LoC is growing from 50 45K (v2.0) to 270K (v4.0) 0 • KVM also has 100+ CVEs 2011 2012 2013 2014 2015 2016 2017 Data from https://xenbits.xen.org/xsa/ 2 / 27

  3. Analyze 201 of Xen’s Vulnerabilities (XSA) 191 144 (75% of 191) 47 10 • 144 are in the hypervisor • 47 are not in hypervisor • 10 are ignored E.g., Host DoS, privilege Some are in Domain-0 7 numbers are not used escalation, etc. Some are in Qemu XSA-161 was withdrawn Use hypervisor to attack VM XSA-99 is irrelevant XSA-166 is too vague Focus on this part 3 / 27

  4. 3 Dimensions to Categorize (144 Hypervisor bugs) How to attack? Attack for what? Which component to attack? Hypervisor Hypervisor Hypervisor Attack targets Key steps of attack Results of attack Memory management: 25.7% Memory corruption: 45.1% Host DoS: 61.8% CPU virtualization: 21.5% Misuse of hardware: 22.2% Privilege escalation: 15.3% Code emulation: 13.2% Live lock: 8.3% Info leak: 13.9% ... ... ... 4 / 27

  5. 1. Xen Components with Bugs 25.69 Memory management % 21.53 CPU virtualization % 13.19 Code emulation • Components with bugs % I/O 25.69%: Memory management Exception handling 21.53%: CPU virtualization Grant table 13.19%: Code emulation Global Domain control • Observations: Domain building Some components are more Event channel attractive to attackers XSM Memory management is critical Scheduler and hard to get right Others 0.00% 5.00% 10.00% 15.00% 20.00% 25.00% 30.00% 5 / 27

  6. 2. The Types of Key Step of Attack 45.1 Memory curruption % 22.2 Misuse of hardware % • Memory corruption: 45.14% Live lock Illegal memory read Infinite loop E.g., out-of-boundary False BUG_ON Illegal memory write General fault E.g., write to an invalid pointer Run out of resource Dead lock 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% 6 / 27

  7. 3. The Consequences of Attack 61.8% Host DoS 15.3% Privilege escalation (to host) • Host DoS: more than 60% All DoS: more than 70% 13.9% Information leak • Guest to guest attack Guest DoS (itself) Some guest app leverages hypervisor Guest DoS (other) to DoS its own guest VM Privilege escalation (to guest) 0% 20% 40% 60% 80% 7 / 27

  8. Summary: Observations • Hypervisors have bugs – Some previous studies focused on bugs of dom-0 or host OS – Some systems (e.g., nested virtualization) can solve the problem but may cause performance overhead due to nested levels • Some components have more vulnerabilities (found) – Take consideration on mem management, code emulation, etc. • DoS cannot be ignored – Need to tolerant DoS for availability 8 / 27

  9. Deconstruction for Isolation NEXEN: NESTED XEN It’s a palindrome! 9 / 27

  10. From Observations to Nexen • Hypervisors have bugs – Deconstruct the hypervisor to isolated components – “Nesting” within single hardware privilege for performance • Some components have more vulnerabilities (found) – Isolate vulnerabilities in the boundary of VM • DoS cannot be ignored – Isolate failure in the boundary of VM 10 / 27

  11. Deconstructing Xen Dom-0 Para-VM Full-VM Virtual Machine Hypervisor Shared Xen Slice Xen Slice Xen Slice Service Security Monitor Partition Xen into several internal domains, all the domains run in the same hardware privilege 11 / 27

  12. Xen Slice Dom-0 Para-VM Full-VM Virtual Machine Hypervisor Shared Xen Slice Xen Slice Xen Slice Service Same code, Different instances Security Monitor Each Xen slice serves only one VM, containing the VM’s metadata and handling its VMExits 12 / 27

  13. Shared Service Dom-0 Para-VM Full-VM Virtual Machine Hypervisor Serve all Shared the Xen slices Xen Slice Xen Slice Xen Slice Service Security Monitor Only one shared service. It does not interact directly with VM, just serves Xen slices. 13 / 27

  14. Xen Destruction • Questions – Which parts to put in Xen slices? – Which parts to put in shared service? • Principles – Least privilege – Minimize runtime communication – Separate mechanism from policy 14 / 27

  15. Component Original Xen Vulnerabilities s 15 / 27

  16. Component Shared Service Xen Vulnerabilities s Slice 16 / 27

  17. Security Monitor: Controls the MMU Isolation Dom-0 Para-VM Full-VM Virtual Machine Hypervisor Shared Xen Slice Xen Slice Xen Slice Service Security Monitor The security monitor controls guest page tables and EPTs. It offers interfaces & does security checks. 17 / 27

  18. Protecting the Security Monitor • MMU virtualization – Get higher software privilege in the same hardware privilege – Similar with the nested-kernel architecture [ASPLOS’16] • Only the monitor can modify page tables – Page tables are mapped as read-only to other components – No page table operation instructions out of the monitor – Enforce security policies on each operation of page table – Bootstrap security: through Intel TXT or TPM 18 / 27

  19. Same Memory, Different Views RW RW RW RO RW RW RW RW RW RW RW RO RO RW Shared Security Guest Xen Slice Service Monitor VM 19 / 27

  20. Call Gate: Intercept Switches between Slices Dom-0 Para-VM Full-VM Virtual Machine Hypervisor Shared Xen Slice Xen Slice Xen Slice Service call gate Security Monitor Intercept switches between Xen slices & shared service, as well as VM & its Xen slice 20 / 27

  21. Summary: What Nexen can/cannot Defend? Malicious Steal or tamper with Host DoS Guest DoS VM’s data Component VM (user) N.A. Considered Considered VM (kernel) Not considered Considered N.A. Other VM Considered Considered Considered Xen Slice Considered Considered Not considered Shared Service Considered Not considered Not considered Nexen cannot defend against attacks through legal interfaces (aka., Iago attack) 21 / 27

  22. Security & Performance EVALUATION 22 / 27

  23. Security Evaluation on 144 XSAs 10/144 (7%): attack through interface, depends on semantic 107/144 (74%): Defended 27/144 (19%): target the shared service and can cause host failure 23 / 27

  24. Case Study: XSA-108 VM VM • Type: Out-of-boundary mem access in Xen code emulation causes info leak Xen Slic Slice e • Description Security Monitor – Xen’s code emulation for APIC erroneously emulates read and write permissions for 1024 MSRs where there are actually 256 MSRs. A read operation can go beyond the page set up and potentially get sensitive data from the hypervisor or other VMs - case MSR_IA32_APICBASE_MSR ... MSR_IA32_APICBASE_MSR + 0x3ff: + case MSR_IA32_APICBASE_MSR ... MSR_IA32_APICBASE_MSR 24 / 27 + 0xff: �

  25. SPEC CPU2006 (less than 1%) / 27

  26. IOzone (2.4% on average) / 27

  27. Conclusion • Methodology of deconstruction – Analyze 201 Xen’s vulnerabilities – Derive boundary of isolation from the result – Deconstructing system to internal domains and security monitor • Nexen implementation – Deconstruct Xen to multiple Xen slices and one shared service – Using nested kernel design to protect the security monitor 107 (74% of 144) 144 (75% of 191) 47 10 Thanks! More info: http://ipads.se.sjtu.edu.cn/xsa • 27 / 27

  28. BACKUP SLIDES 28 / 27

  29. Same Memory, Different Views Secure Monitor Memory Space Xen Slice Shared Code Service Code Xen Slice Xen Slice Shared … Data Data Service Data Xen Slice 1 Xen Slice n Shared Service 29 / 27

  30. Event channel Scheduler Others XSM Domain 2% 1% 3% 1% building Memory 4% management Domain control 26% 4% Global 4% Grant table 5% Excep9on handling 6% I/O 9% CPU virtualiza9on 22% Code emula9on 13% 30 / 27

  31. The Control Flow • Gate keeper in the monitor • Switch between memory spaces • Intercept transferring between: • Guest VM & Hypervisor • Xen slice & shared service • Complete mediation • Cannot be bypassed 31 / 27

  32. Case Study: XSA-191 • Type ‒ Misuse of H/W feature in code emulation causes privilege escalation to guest kernel • Description ‒ Intel hardware uses NULL segment selectors to prevent access. Xen code emulator fails to check this condition and may erroneously permit invalid access. An unprivileged guest user program may be able to elevate its privilege to that of the guest operating system 32 / 27

  33. Case Study: XSA-191 • How to trigger? 1. try to set kernel data segment selector to NULL 2. trigger an instruction that requires emulation, the side effect of which changes an entry of kernel page table 3. the instruction emulated, changing the page table entry, giving the user program access to some kernel data 33 / 27

  34. Case Study: XSA-191 • Why cannot defend? ‒ Not harming other VMs: the process completely finish in code emulator of one VM ‒ Iago attack: logic error of code emulator 34 / 27

  35. Performance Evaluation: Negligible Overhead SPEC CPU2006 (less than 1%) IOzone (2.4% on average) 35 / 27

Recommend


More recommend