VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford),...

Post on 11-Jul-2020

4 views 0 download

Transcript of VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford),...

VMM Detection Myths and Realities

Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew

Warfield (XenSource/UBC), Jason Franklin (CMU)

What is a Virtual Machine Monitor(VMM)?

• Standard Academic Definition: A thin layer of software that sits between the hardware and the operating system,creating the illusion of one or more logical machines.

• Technology from the 70’s used for easing server management

How does a VMM Work• Trap and Emulate

– Remember CPU protection rings?– Make the VMM run at the highest privilege level

(lowest ring (0))– Run OS at lower privilege level (higher ring(3))– Trap and emulate privileged instructions to make

OS think its running at a higher privilege level– Basically keep software copy (shadow) of

privileged state.• What does it give you

– Total control of the hardware– Ease of management

What does the Researcher Ask?

What else could we do with this technology?

What is a Honeypot?

• Standard Good Guy™ tool• A decoy machine• Convincing enough that no one notices• Important properties

– Stealth– Ease of use (monitoring)

What is a Rootkit?

• Standard hacker tool• Used to maintain control of a machine• Important properties

– Stealth– Ease of use (monitoring and control)

What if you could use a VMM to give you a place to hide?

• Sit underneath the OS• You control the hardware• You control the OS

• You do have the lowest ring after all!

Good Idea?

• Ease of use?– Sure, can run our monitoring or evil

software in its own VM• Stealthy?

– Sure? It looks just like a normal OS right?– Of course, you control the hardware, you

have the power… you are the decider?– Build the perfect rootkit

Small Problem Though…

• Little CPU virtualization anomalies– Seems the X86 doesn’t let you trap some

instructions (pesky)• Hardware virtualization support

– Make the hardware compatible and fast!– Doesn’t matter for compatibility, so

VMware (and others) didn’t bother.

Intel will save us (and AMD)

• Now the hardware will look just like a real machine!

• Now we can build perfect rootkits!

The VMM Rootkit!

• Idea presented in paper at major security conference.

• “security researchers” describe prototypes at black hat

• Microsoft warns of potential threat, suggests disabling hardware virtualization in BIOS

Undectable Malware is Coming!

Wait, just kidding…

• Turns out, between 90’s and present VMware and others were up to something… (good job guys!)

• Turns out its pretty hard to make a VMM– High performance– Compatible

Punch Line: Transparency is Not Compatibility

• Doing evil demands Undetectability – Optimize for sameness in every case

• Making money demands running Exchange Server on Windows fast– Optimize for performance in the common

case– Identical only when it matters for

compatibility

OMG, what happened?

• Turns out ``researchers’’ hadn’t ever built a VMM

• What did they miss?

Logical Discrepancies

• Lets look at VMware Hardware– Chip set from the Clinton Administration

i440bx (shout out!)– Custom ``Paravirtualized’’ interfaces plus

specialized device drivers to give good I/O performance (as with Xen and everyone else).

– Emulated devices as well, also either unique or antiquated

Why not provide more devices

• Coding device models is expensive• Devices are incredibly complex and

rapidly changing.• Can’t pass through to the hardware, it

can then just read your memory

And it gets worse…

Consider machine resource

• Weird cache sizes (VMM, VM’s and OS must all share TLB)

• You are running on top of another virtual memory system (hidden page faults)

• Even weirder performance

And it just gets worse…

Timing Looks Nothing Like Real Hardware

• So just interpose on time sources– Rdtsc, APIC timer, PIT, local APIC

• Ooops… problem is relative time of operations– Device registers, CPU registers, cache behavior,

I/O performance, CPU instructions…– All manifest variations.. Relative to each other

• Turns out just getting time right for compatibility is really hard.

And it just gets worse…

Remote timing detection

• Sometimes people like to let their computers communicate (Internet)

• Turns out communication => Covert channels

• Covert Channels => Covert Clocks

With remote timing attacks your done.

• Covert clocks are not just covert channels– Can’t randomize or limit them, you just tip

off the detector.• Trying to simulate to prevent local

timing attacks just makes remote timing attacks worse.

So…

• Even if you have an army of engineers to:– Write and maintain device models– Try to make your performance uniform and

fast (not possible)

Etc. etc. you are still out of luck..

Then again, why bother…

• We don’t know how to detect normal zero day rootkits (already undetectable)

• If you want to lock down virtualization capabilities with software its trivial

• So many machines are running (or will be running VMMs) soon that targeting those without is silly