Top Banner
VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew Warfield (XenSource/UBC), Jason Franklin (CMU)
26

VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

Jul 11, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

VMM Detection Myths and Realities

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

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

Page 2: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 3: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 4: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

What does the Researcher Ask?

What else could we do with this technology?

Page 5: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

What is a Honeypot?

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

– Stealth– Ease of use (monitoring)

Page 6: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

What is a Rootkit?

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

– Stealth– Ease of use (monitoring and control)

Page 7: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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!

Page 8: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 9: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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.

Page 10: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

Intel will save us (and AMD)

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

• Now we can build perfect rootkits!

Page 11: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 12: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

Undectable Malware is Coming!

Page 13: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 14: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 15: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

OMG, what happened?

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

• What did they miss?

Page 16: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 17: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 18: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

And it gets worse…

Page 19: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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

Page 20: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

And it just gets worse…

Page 21: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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.

Page 22: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

And it just gets worse…

Page 23: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

Remote timing detection

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

• Turns out communication => Covert channels

• Covert Channels => Covert Clocks

Page 24: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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.

Page 25: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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..

Page 26: VMM Detection Myths and Realities · VMM Detection Myths and Realities Tal Garfinkel (Stanford), Keith Adams(VMware), Andrew ... – Optimize for performance in the common case –

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