Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

29
Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008

Transcript of Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

Page 1: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

Virtually Secure

Oded HorovitzVMware R&D

CanSecWestMarch, 2008

Page 2: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

2

Talk Overview

Setup• Virtualization 101

• Talk Focus

VM Introspection• Capabilities

• Sample Use Cases (and demos)

Magics• Retrospective Security

Misc & QA

Page 3: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

3

Virtualization 101

Hypervisor / Kernel

Hardware

VirtualMachineMonitor (VMM)

DeviceVirtualization

OS

DeviceVirtualization

App App

...

...

Storage

CPUNetwork

ManagementInterfaces

Key Terms• VMM

• Hypervisor

• Hosted

• Bare Metal

Setup

Page 4: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

4

Talk Focus

Virtualization Based Capabilities• Better than physical

• Hypervisor as a Base of Trust

• Security as an infrastructure service

Also Important But not TodaySecure Virtualization Infrastructure

• Secure & Manageable Platform

Physical Equivalent Security• Support existing tools and agents

• Prevent security coverage loss when P2V

Setup

Page 5: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

5

Security Agent – common agents

File System

AV

Mail Server

Anti Spam

NetworkStack

Firewall

Browser

Anti Phishing

OS

HIPS

Hypervisor

?

Introspection

Page 6: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

6

Physical Security - Shortcomings

Malware

packpacker

Malware

Unpacker

FileSystem

Writefile

AV

LoaderReadfile CPU

Instantiate

Packedmalware

Rewriteself

Malware

execfile

Code Packing• AV see packed file

• Unpacking method is unknown

• No opportunity for detection

Introspection

Page 7: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

7

Physical Security - shortcoming

Buggy code

exploit

CPUexecute

Vulnerabilities• Buggy service is exploited

• New code is injected

• File system never sees the new code (unless it is paged out..)

Existing solutions• Program shepherding

• ASLR

• NX

No good coverage for kernels

Introspection

Page 8: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

8

Physical Security - shortcoming

OS coverage• Agent is depended on its host (instantiated by host)

• A window of opportunity exist to subvert system

• Solution - Boot into alternate OS and scan?

Platform BIOS

Boot Loader

Devicescode

OS drivers

apps

AV

reset

Introspection

Page 9: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

9

CPU events

• Privileged instruction

• Exceptions

• Interrupts

• I/O

• Arbitrary Instruction op-code

• Instruction breakpoint

• Control flow

VM Introspection

HV unfriendly

Page 10: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

10

VM Introspection

Memory event

• Granular CPU read / write

• Granular device read / write

• Linear addressing

• Page granularity

• Physical addressing

Memory

CPUDevice

Read /write

Read /write /“execute”

HV unfriendlyHigh overhead

Page 11: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

11

VM Introspection – VMware initiatives

VM Debugging

• GDB like interface

• Designed for human user

• Agent is on the network

• Capabilities•Examine CPU, memory

•Single step

•invisible breakpoints

•Page table walker

•Some symbol information support

Page 12: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

12

VM Introspection – VMware Initiatives

VProbes

• dtrace like goals

• Designed for human user / analysis tools

• Agent runs within the hypervisor

• Specialized scripting VM

• Capabilities•Dynamic probing point installation

•Inline execution with the hypervisor

•Access to VM state

•Access to hypervisor state

Page 13: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

13

VM Introspection - VMware Initiatives

Security API’s

• Designed for security productization

• Agent runs within a VM

• Capabilities•Memory access events

•Selected CPU events

•VM lifecycle events

•Access to VM memory & CPU state

•Page Table walker

Page 14: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

14

Security APIs (VMsafe)

Goals

• Better than physical• Exploit hypervisor interposition to place new security agent

• Provide security coverage for the VM kernel (and applications)

• Hypervisor as a Base of Trust• Divide responsibilities between the hypervisor and in-VM agent

• The hypervisor covers the VM kernel, the rest is done from within the VM

• Insure in-VM security agent execution and correctness

• Security as an infrastructure service• “Agent less” security services for VMs

• Flexible OS independent solutions

Introspection

Page 15: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

15

Verify-Before-Execute FlowIntrospection

“Hypervisor”

VM

Security Agent

Power On

Page access event

VM Information

CPU State & Memory Pages

Query VM

Install Triggers

Query CPU & Memory state

Install / Remove Triggers

Power Off

Page 16: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

16

Sample Introspection Agents

Verify-Before-ExecuteUtilize memory introspection to validate all executing pages

Flow1. Trace all pages for execution access

1. On execution detection• Trace for page modification

• Verify if page contain malware

• Remove execution trace

1. On modification detection• Trace for execution

• Remove modification trace

NX NX NX NX NX

NX

NX / NW

NX NX NX

Is bad?

NW

NW / NX

NX

NX / NW

Page 17: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

17

Security APIs – Use cases

VM Kernel coverage• Detect infection in early boot process

• Device opt ROM attacks

• Boot loader

• Boot records

• OS image

• Detect code injection due to kernel vulnerabilities

• Detect self modifying code in kernel

• Lock kernel after initialization

Introspection

Page 18: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

18

Case Study - Microsoft Patch Guard

Goal• Prevent patching of (x64 based) kernels

• Force ISV to behave nicely

• Prevent Root-kits ??

Implementation• Obfuscated Invocation

• Obfuscated Persistence

• Evolving (Thanks to the awesome work from uninformed.org)

What's The Problem?• Circumventable

• Complicated

• Only for x64 based Windows Systems

Introspection

Page 19: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

19

Kernel Security Demo

“MyPatchGuard”• Secure & Isolated Agent

• Inline enforcement using memory write triggers.

• Protect Windows XP guest syscalls table

• Simple.

Introspection

Page 20: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

20

Security APIs – Use cases cont’

Watch dog services• Liveness check for in-VM security agent

• Detect agent presence

• Verify agent periodic execution

• Protect agent code and static data

Introspection

Page 21: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

21

TPM vs. Introspection

TPM• Root of trust rely on hardware

• Passive device

• Platform and software stack decide what to measure

• Need software update to change measurement coverage

• Can not detect compromise in software stack since verification

VM Introspection• Root of trust rely on hypervisor

• Introspection agent have the initiative

• Security vendor / policy dictate what to measure

• Coverage is content, and can change independently of VM

• Designed to continuously scan VMs and to detect compromise

Introspection

Page 22: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

22

VMsafe – Network Introspection

Capabilities• Place an inline network agent on any VM virtual nic

• Allow reading, injecting, modifying, and dropping packets.

Benefits• Efficiently monitor inter-VM network communication

• Integrated support for live migration.

Virtualization only applications• Correlate VM internals with network policy. (using CPU/ Memory

inspections one can learn OS version, patch level, configuration etc)

• Build a trusted distributed firewall.

Introspection

Page 23: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

23

Talk Overview

Setup• Virtualization 101

• Talk Focus

VM Introspection• Capabilities

• Sample Use Cases (and demos)

Magics• Retrospective Security

Misc & QA

Page 24: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

24

Retrospective Security

Motivation• Detect whether you have been attacked in the past

• Detect if you might be still compromised by a past attack

Method• VMware Record & Replay allow for a deterministic replay of VM

using recorded logs

• Potentially the recordings have captured an attack

• The security API’s are detached from the recorded VM (unlike in-VM agent) and can attach to a replay session

Magics

Page 25: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

25

Retrospective Security

Demo

What is it good for?• Run more aggressive policies that will not be acceptable in

production environments

• Discover 0days used to exploit your system

• Learn how the malware / attacker have navigated your system

• Use data tainting technique to detect any side effects that still exist on your system

• Possibly clean the finding from last step on your production VM.

• Learn about the scope of the damage done to your system, i.e. what is the extent of data leakage

Magics

Page 26: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

26

Security vs. Hardware Virtualization

1st Generation – SVM, VT-X• VMM no longer need to run the VM kernel under binary translation

• Security Trade off – Code Breakpoint, Guest code patching (while translating), Control flow visibility

2nd Generation – NPT, EPT• VMM no longer need to have software based MMU

• Security Trade off – Tracking LA->PA mapping is becoming expensive, resulting with inability to operate on linear addresses.

3rd Generation – IO MMU, VT-D• VMM can assign physical devices to VMs without worry of VM

escape or hypervisor corruption

• Security Trade off – Interposition on the pass-thru device is eliminated

Misc

Page 27: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

27

Some New Problems To Solve

VM Escape• Though impossible by design, the hypervisor can still have

implementation vulnerabilities *

• As more trust is placed in the hypervisor the more motivation there will be to find VM escapes

• VM escape provide a new “hyper escalation” that never existed before.

Misc

Page 28: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

28

Some New Problems To Solve

New attacks to consider• VMs as malware

• A malicious VM with the proper isolation configuration can exploit the host system using writable shared folder

• In a similar way, a VM that is not firewalled properly can easily access the host network or any device reachable by the host network

• Moral of the story – Handle suspicious VMs with care.

Misc

Page 29: Virtually Secure Oded Horovitz VMware R&D CanSecWest March, 2008.

29

Conclusion

Questions?

Contact

[email protected]