Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor...

25
Virtually Secure Oded Horovitz VMware R&D

Transcript of Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor...

Page 1: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

Virtually Secure

Oded HorovitzVMware R&D

Page 2: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

2

Talk Overview

SetupVi t li ti 101• Virtualization 101

• Talk Focus

VM Introspection• Capabilities• Sample Use Cases (and demos)

MagicsMagics• Retrospective Security

Misc & QA

Page 3: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

3

Virtualization 101Setup

A A

Key Terms• VMM

H i

OS

App App...

• Hypervisor• Hosted• Bare Metal

VirtualMachineMonitor (VMM)

DeviceVirtualization

DeviceVirtualization

ManagementInterfaces

Hypervisor / Kernel

(VMM)...

HardwareStorage CPUNetwork

Page 4: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

4

Talk FocusSetup

Virtualization Based Capabilities• Better than physical• Better than physical• Hypervisor as a Base of Trust• Security as an infrastructure service

Al I t t B t t T dAlso Important But not TodaySecure Virtualization Infrastructure

• Secure & Manageable PlatformPhysical Equivalent Security

• Support existing tools and agents• Prevent security coverage loss when P2V

Page 5: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

5

Security Agent – common agentsIntrospection

AV Anti Spam Firewall Anti Phishing

File System

Mail Server

NetworkStack Browser

HIPS

OS

?

Hypervisor

Page 6: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

6

Physical Security - ShortcomingsC d P ki

Introspection

Mal

packpacker

R

Code Packing• AV see packed file• Unpacking method is unknown

ware Rewriteself • No opportunity for detection

Malware

Unpacker Packed

malware MalwareWrite

file

AVInstantiate

ware

FileSystem LoaderRead

file CPUexecfile

Page 7: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

7

Physical Security - shortcomingIntrospection

Vulnerabilities• Buggy service is exploited• New code is injected

exploitNew code is injected

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

Buggy code CPU

executeExisting solutions• Program shepherding• ASLR• ASLR• NX

No good coverage for kernels

Page 8: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

8

Physical Security - shortcomingIntrospection

OS coverage• Agent is depended on its host (instantiated by host) • A window of opportunity exist to subvert systemA window of opportunity exist to subvert system• Solution - Boot into alternate OS and scan?

Boot Loader

OS driversreset

Platform BIOS

Devicescode

apps

AV

Page 9: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

9

VM Introspection

CPU events• Privileged instruction• Exceptions• Interrupts• I/O• Arbitrary Instruction op-code• Instruction breakpoint• Control flow

HV unfriendly

Page 10: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

10

VM Introspection

Memory event• Granular CPU read / write

HV f dl• Granular device read / write• Linear addressing

P l it

HV unfriendlyHigh overhead

• Page granularity• Physical addressing CPUDevice

Read /write

Read /write /“execute”

Memory

Page 11: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

11

VM Introspection

Security API’s• Designed for security productization• Agent runs within a VM• Capabilities

•Memory access events•Memory access events•Selected CPU events•VM lifecycle events•Access to VM memory & CPU state•Page Table walker

Page 12: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

12

Security APIs (VMsafe) Introspection

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 TrustHypervisor 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• Insure in-VM security agent execution and correctness

• Security as an infrastructure service• “Agent less” security services for VMs• Flexible OS independent solutions

Page 13: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

13

Verify-Before-Execute FlowIntrospection

VM

P OPower On

VM Information

Query VM

“Hypervisor”Security Agent

Page access event

Install Triggers

ypAgent

CPU State & Memory Pages

Query CPU & Memory state

Install / Remove TriggersInstall / Remove Triggers

Power Off

Page 14: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

14

Sample Introspection Agents

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

FlowFlow1. Trace all pages for execution access

1 O ti d t ti

NX NX NX NX NX

NX NX NX NX1. On execution detection• Trace for page modification• Verify if page contain malware

Remove execution trace

NX

NX / NW

NX NX NX

Is bad?NX / NW• Remove execution trace

1. On modification detectionT f ti

Is bad?NW

NX / NW

• Trace for execution• Remove modification trace

NW / NX

NX

Page 15: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

15

Security APIs – Use casesIntrospection

VM Kernel coverage• Detect infection in early boot process

• Device opt ROM attacksp• Boot loader• Boot records• OS image

• Detect code injection due to kernel vulnerabilities• Detect self modifying code in kernel• Lock kernel after initialization

Page 16: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

16

Case Study - Microsoft Patch GuardIntrospection

Goal• Prevent patching of (x64 based) kernels• Force ISV to behave nicelyForce ISV to behave nicely• Prevent Root-kits ??

ImplementationObf t d I ti• Obfuscated Invocation

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

What's The Problem?• Circumventable• Complicatedp• Only for x64 based Windows Systems

Page 17: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

17

Kernel Security DemoIntrospection

“MyPatchGuard”• Secure & Isolated Agent

I li f i i i• Inline enforcement using memory write triggers.• Protect Windows XP guest syscalls table• Simple.

Page 18: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

18

Security APIs – Use cases cont’Introspection

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

• Detect agent presenceg p• Verify agent periodic execution• Protect agent code and static data

Page 19: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

19

TPM vs. IntrospectionIntrospection

TPM• Root of trust rely on hardware• Passive device

VM Introspection• Root of trust rely on hypervisor• Introspection agent have thePassive device

• Platform and software stack decide what to measure

• Need software update to

Introspection agent have the initiative

• Security vendor / policy dictate what to measurep

change measurement coverage

• Can not detect compromise in software stack since

• Coverage is content, and can change independently of VM

• Designed to continuously scan VMs and to detect compromisein software stack since

verificationVMs and to detect compromise

Page 20: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

20

VMsafe – Network IntrospectionIntrospection

Capabilities• Place an inline network agent on any VM virtual nic• Allow reading injecting modifying and dropping packetsAllow reading, injecting, modifying, and dropping packets.

Benefits• Efficiently monitor inter-VM network communication

I t t d t f li i ti• 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.

Page 21: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

21

Talk Overview

Setup• Virtualization 101• Talk FocusTalk Focus

VM Introspection• Capabilities

S l U C ( d d )• Sample Use Cases (and demos)

Magics• Retrospective Security

Misc & QA

Page 22: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

22

Retrospective SecurityMagics

Motivation• Detect whether you have been attacked in the past• Detect if you might be still compromised by a past attack• Detect if you might be still compromised by a past attack

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

sing recorded logsusing 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 sessionVM agent) and can attach to a replay session

Page 23: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

23

Retrospective SecurityMagics

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

ton 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 leakagewhat is the extent of data leakage

Page 24: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

24

Security vs. Hardware VirtualizationMisc

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. d G O3rd Generation – IO MMU, VT-D• VMM can assign physical devices to VMs without worry of VM

escape or hypervisor corruptionS it T d ff I t iti th th d i i• Security Trade off – Interposition on the pass-thru device is eliminated

Page 25: Virtually Secure - Black Hat Briefings...Introspection agent have the initiative • Security vendor / policy dictate what to measure change measurement coverage • Can not detect

25

Conclusion

Questions?

[email protected]