VirtualizaEon ¡ CS642: ¡ ¡ Computer ¡Security ¡ Professor ¡Ristenpart ¡ h9p://www.cs.wisc.edu/~rist/ ¡ rist ¡at ¡cs ¡dot ¡wisc ¡dot ¡edu ¡ University ¡of ¡Wisconsin ¡CS ¡642 ¡
VirtualizaEon ¡and ¡cloud ¡security ¡ VMs ¡ Cloud ¡compuEng ¡paradigms ¡ VM ¡image ¡security ¡issues ¡ VM ¡IntrospecEon ¡ IntrospecEon ¡ University ¡of ¡Wisconsin ¡CS ¡642 ¡
VirtualizaEon ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ OS1 ¡ OS2 ¡ Process ¡1 ¡ Process ¡2 ¡ OS1 ¡ OS2 ¡ ¡ ¡ Drivers ¡ Drivers ¡ ¡ ¡ Hypervisor ¡ OS ¡ Hypervisor ¡ Hardware ¡ Hardware ¡ Hardware ¡ No ¡virtualizaEon ¡ Full ¡virtualizaEon ¡ ParavirtualizaEon ¡ Type-‑1: ¡Hypervisor ¡runs ¡directly ¡on ¡hardware ¡
VirtualizaEon ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ OS1 ¡ OS2 ¡ Process ¡1 ¡ Process ¡2 ¡ OS1 ¡ OS2 ¡ ¡ ¡ Drivers ¡ Drivers ¡ ¡ ¡ Hypervisor ¡ OS ¡ Hypervisor ¡ Host ¡OS ¡ Hardware ¡ Hardware ¡ Hardware ¡ No ¡virtualizaEon ¡ Full ¡virtualizaEon ¡ ParavirtualizaEon ¡ Type-‑1: ¡Hypervisor ¡runs ¡directly ¡on ¡hardware ¡ Type-‑2: ¡Hypervisor ¡runs ¡on ¡host ¡OS ¡
IBM ¡VM/370 ¡ • Released ¡in ¡1972 ¡ – Used ¡with ¡System/370, ¡System/390, ¡zSeries ¡ mainframes ¡ – Full ¡virtualizaEon ¡ • Supported ¡CP/CMS ¡operaEng ¡system ¡ – IniEal ¡applicaEon ¡was ¡to ¡support ¡legacy ¡OS ¡ • z/VM ¡is ¡newer ¡version, ¡most ¡recent ¡version ¡ 2010 ¡ – Be9er ¡use ¡of ¡64-‑bit ¡mainframes ¡
Xen ¡ • 2003: ¡academic ¡paper ¡ ¡ – “Xen ¡and ¡the ¡Art ¡of ¡VirtualizaEon” ¡ • ParavirtualizaEon ¡ – Hypercalls ¡vs ¡system ¡ ¡ Control User User User Plane Software Software Software ¡ ¡ ¡ ¡calls ¡ Software – Modified ¡guest ¡OS ¡ GuestOS GuestOS GuestOS GuestOS (XenoLinux) (XenoLinux) (XenoBSD) (XenoXP) – Each ¡guest ¡given ¡ ¡ Xeno-Aware Xeno-Aware Xeno-Aware Xeno-Aware Device Drivers Device Drivers Device Drivers Device Drivers ¡ ¡ ¡1 ¡or ¡more ¡ ¡VCPUs ¡ X Domain0 virtual virtual virtual virtual E control x86 CPU phy mem network blockdev interface N • Why? ¡ H/W (SMP x86, phy mem, enet, SCSI/IDE)
Other ¡VM ¡soluEons ¡ • VMWare ¡ • Virtual ¡Box ¡ • KVM ¡
Example ¡VM ¡Use ¡Cases ¡ • Legacy ¡support ¡(e.g., ¡VM/370) ¡ • Development ¡ • Server ¡consolidaEon ¡ • Cloud ¡compuEng ¡Infrastructure-‑as-‑a-‑Service ¡ • Sandboxing ¡/ ¡containment ¡
Study ¡of ¡malware ¡ • Researchers ¡use ¡VMs ¡to ¡study ¡ malware ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ • Example ¡of ¡VM ¡sandboxing ¡ OS1 ¡ OS2 ¡ – Hypervisor ¡must ¡contain ¡ malicious ¡code ¡ Hypervisor ¡ • IntrospecEon ¡ Hardware ¡ • How ¡would ¡you ¡evade ¡analysis ¡ as ¡a ¡malware ¡writer? ¡ – split ¡personaliEes ¡
VMM ¡Transparency ¡ A ¡ B ¡ P1 ¡ P2 ¡ Adversary ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ controlled ¡ OS1 ¡ OS1 ¡ OS1 ¡ VMM ¡ Hardware ¡ Is ¡this ¡opEon ¡ ??? ¡ A ¡or ¡B? ¡ Hardware ¡ • Adversary ¡can ¡detect ¡if: ¡ Garfinkel ¡et ¡al. ¡ – ParavirtualizaEon ¡ “CompaEbility ¡ is ¡not ¡transparency: ¡ – Logical ¡discrepancies ¡ ¡ VMM ¡DetecEon ¡ Myths ¡and ¡Reality” ¡ • Expected ¡CPU ¡behavior ¡vs ¡virtualized ¡ ¡ • Red ¡pill ¡(Store ¡Interrupt ¡Descriptor ¡Table ¡instr) ¡ – Timing ¡discrepancies ¡ • Slower ¡use ¡of ¡some ¡resources ¡
DetecEon ¡of ¡VMWare ¡ MOV ¡EAX,564D5868 ¡ <-‑-‑ ¡"VMXh" ¡ ¡ IN ¡instrucEon ¡used ¡by ¡VMWare ¡ MOV ¡EBX,0 ¡ ¡ to ¡facilitate ¡host-‑to-‑guest ¡ ¡ communicaEon ¡ MOV ¡ECX,0A ¡ ¡ MOV ¡EDX,5658 ¡ <-‑-‑ ¡"VX" ¡ VMWare: ¡ IN ¡EAX,DX ¡ <-‑-‑ ¡Check ¡for ¡VMWare ¡ ¡ ¡places ¡VMXh ¡in ¡EBX ¡ CMP ¡EBX,564D5868 ¡ Physical: ¡ ¡processor ¡excepEon ¡ From ¡ ¡ h9p://handlers.sans.org/tliston/ThwarEngVMDetecEon_Liston_Skoudis.pdf ¡
Server ¡consolidaEon ¡ • ConsolidaEon ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ – Use ¡VMs ¡to ¡opEmize ¡use ¡of ¡ OS1 ¡ OS2 ¡ OS2 ¡ hardware ¡ – Pack ¡as ¡many ¡VMs ¡onto ¡each ¡ Hypervisor ¡ server ¡as ¡possible ¡ Hardware ¡ – Turn ¡off ¡other ¡servers ¡ • Threat ¡model? ¡ – Containment ¡ – IsolaEon ¡ – Assume ¡guests ¡are/can ¡be ¡compromised ¡
ViolaEng ¡containment ¡ • Escape-‑from-‑VM ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ – Vulnerability ¡in ¡VMM ¡or ¡host ¡OS ¡ OS1 ¡ OS2 ¡ (e.g., ¡Dom0) ¡ – Seemingly ¡rare, ¡but ¡exist ¡ Hypervisor ¡ Hardware ¡
ViolaEng ¡isolaEon ¡ • Covert ¡channels ¡between ¡VMs ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ circumvent ¡access ¡controls ¡ OS1 ¡ OS2 ¡ – Bugs ¡in ¡VMM ¡ Hypervisor ¡ – Side-‑effects ¡of ¡resource ¡usage ¡ Hardware ¡
Isolation? h9p://handlers.sans.org/tliston/ThwarEngVMDetecEon_Liston_Skoudis.pdf ¡
ViolaEng ¡isolaEon ¡ • Covert ¡channels ¡between ¡VMs ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ circumvent ¡access ¡controls ¡ OS1 ¡ OS2 ¡ – Bugs ¡in ¡VMM ¡ Hypervisor ¡ – Side-‑effects ¡of ¡resource ¡usage ¡ • DegradaEon-‑of-‑Service ¡a9acks ¡ Hardware ¡ – Guests ¡might ¡maliciously ¡contend ¡ for ¡resources ¡ – Xen ¡scheduler ¡vulnerability ¡
¡Measuring ¡Resource ¡ContenEon ¡ • ContenEon ¡for ¡the ¡same ¡resource ¡ 600 ¡ Performance ¡Degrada>on ¡(%) ¡ Local ¡Xen ¡Testbed ¡ 500 ¡ Machine ¡ Intel ¡Xeon ¡E5430, ¡ 2.66 ¡Ghz ¡ 400 ¡ Packages ¡ 2, ¡2 ¡cores ¡per ¡ package ¡ 300 ¡ LLC ¡Size ¡ 6MB ¡per ¡package ¡ 200 ¡ 100 ¡ 0 ¡ CPU ¡ Net ¡ Disk ¡ Memory ¡ Cache ¡ 19 ¡
ViolaEng ¡isolaEon ¡ • Covert ¡channels ¡between ¡VMs ¡ P1 ¡ P2 ¡ P1 ¡ P2 ¡ circumvent ¡access ¡controls ¡ – Bugs ¡in ¡VMM ¡ OS1 ¡ OS2 ¡ – Side-‑effects ¡of ¡resource ¡usage ¡ Hypervisor ¡ • DegradaEon-‑of-‑Service ¡a9acks ¡ Hardware ¡ – Guests ¡might ¡maliciously ¡contend ¡ for ¡resources ¡ – Xen ¡scheduler ¡vulnerability ¡ • Side ¡channels ¡ – Spy ¡on ¡other ¡guest ¡via ¡shared ¡ resources ¡
Square-‑and-‑Mul>ply ¡ /* ¡y ¡= ¡x e ¡mod ¡N ¡, ¡from ¡ libgcrypt */ ¡ Modular ¡Exponen>a>on ¡(x, ¡e, ¡N): ¡ ¡let ¡e n ¡… ¡e 1 ¡be ¡the ¡bits ¡of ¡e ¡ ¡y ¡← ¡1 ¡ e i ¡ = ¡1 ¡→ ¡SRMR ¡ ¡for ¡e i ¡in ¡{e n ¡…e 1 } ¡ e i ¡ = ¡0 ¡→ ¡SR ¡ ¡ ¡y ¡← ¡ Square (y) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ (S) ¡ ¡ ¡y ¡← ¡ Reduce (y, ¡N) ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡ (R) ¡ ¡ ¡if ¡ ¡e i ¡= ¡1 ¡then ¡ ¡ ¡ ¡ ¡y ¡← ¡ Mul> (y, ¡x) ¡ ¡ ¡ ¡ ¡ ¡ ¡ (M) ¡ ¡ ¡ ¡y ¡← ¡ Reduce (y, ¡N) ¡ ¡ ¡ ¡ (R) ¡ ¡ Control ¡flow ¡(sequence ¡of ¡instrucEons ¡used) ¡leaks ¡secret ¡
Xen ¡core ¡scheduling ¡ Xen ¡core ¡scheduler ¡determines ¡ the ¡VCPU ¡to ¡CPU ¡core ¡assignment ¡ VM ¡ VM ¡ ¡ Typical ¡configuraEon: ¡ VCPUs ¡of ¡different ¡VMs ¡will ¡osen ¡ Eme-‑share ¡a ¡core, ¡assignment ¡ AWacker ¡ Vic>m ¡ changes ¡over ¡Eme ¡ Virtualiza>on ¡(Xen) ¡ L1 ¡ L1 ¡ L1 ¡ L1 ¡ I-‑Cache ¡ I-‑Cache ¡ I-‑Cache ¡ I-‑Cache ¡
Time-‑sharing ¡a ¡core ¡ VM/VCPU ¡ VM/VCPU ¡ Idea ¡will ¡be ¡to ¡snoop ¡on ¡ the ¡I-‑cache ¡usage ¡every ¡ ¡ Eme ¡the ¡a9acker ¡gets ¡ to ¡run ¡ AWacker ¡ Vic>m ¡ L1 ¡ I-‑Cache ¡ Time ¡ 30ms ¡ 30ms ¡
Prime-‑Probe ¡Protocol ¡ PRIME ¡ Runs ¡square ¡op ¡ PROBE ¡ Time ¡ Vector ¡of ¡cache ¡set ¡ Emings, ¡biased ¡by ¡ ¡ cache ¡usage ¡of ¡vicEm ¡ 4-‑way ¡set ¡associa>ve ¡ Cache ¡Set ¡ L1 ¡I-‑Cache ¡
Recommend
More recommend