Speed Siqi Zhao *, Xuhua Ding*, Wen Xu , Dawu Gu * Singapore - - PowerPoint PPT Presentation

speed
SMART_READER_LITE
LIVE PREVIEW

Speed Siqi Zhao *, Xuhua Ding*, Wen Xu , Dawu Gu * Singapore - - PowerPoint PPT Presentation

Seeing Through the Same Lens: s: Introsp spect cting Guest Address ss Space ce at Na Native Speed Siqi Zhao *, Xuhua Ding*, Wen Xu , Dawu Gu * Singapore Management University Georgia Institute of Technology Shanghai JiaoTong


slide-1
SLIDE 1

Seeing Through the Same Lens: s: Introsp spect cting Guest Address ss Space ce at Na Native Speed

Siqi Zhao*, Xuhua Ding*, Wen Xu◆, Dawu Gu◇ * Singapore Management University

◆ Georgia Institute of Technology ◇ Shanghai JiaoTong University 1

slide-2
SLIDE 2

Out utline

  • Problem
  • Design
  • Implementation
  • Evaluations

2

slide-3
SLIDE 3

Prob

  • blem
  • Considering introspecting kernel
  • bjects
  • Untrusted live VM
  • VMI tool running outside of the VM
  • The VMI tool and the target
  • bjects are in different address

spaces.

  • The VMI tool needs to perform a

sequence of operations for every kernel object access.

3

slide-4
SLIDE 4

Live Target VM

Prob

  • blem
  • Considering introspecting kernel
  • bjects
  • Untrusted live VM
  • VMI tool running outside of the VM
  • The VMI tool and the target
  • bjects are in different address

spaces.

  • The VMI tool needs to perform a

sequence of operations for every kernel object access.

4

GPT EPT Physical Memory task_struct at 0xC0001000 VMI Tool

VA: 0xC0001000 GPA: 0x1000 HPA: 0xFE000 ptr = 0xFE000

task_struct at 0xFE000 Goal: res = task_struct

slide-5
SLIDE 5

Inad nadequacy of

  • f Page Table

ble Walk

  • Page table walk lies at the heart of VMI
  • Slow, compared to native address translation by MMU
  • A number of loads from memory
  • An experiment to evaluate the slowness of software based page table walk
  • Periodically modifies one task->cred pointer
  • Closely monitor the value of the pointer by repeatedly reading it from outside
  • Cannot catch up with frequent transient guest state changes

5

slide-6
SLIDE 6

Live Target VM

Inad nadequacy of

  • f Page Table

ble Walk

  • Mapping consistency with the

target is not maintained

  • Uses any mappings: ample room for

the guest to present false mappings

  • The target VM may also make

transient changes to the page table

  • Caching techniques that aim to

enhance efficiency further deteriorate the situation, giving up consistency for efficiency.

6

GPT EPT Physical Memory VMI Tool

VA: 0xC0001000

task_struct at 0xFE000

GPA: 0x1000

GPA Space task_struct at 0x1000 task_struct at 0x2000 task_struct at 0xC0001000

slide-7
SLIDE 7

Immersi sive Execution Environment t (ImEE EE) ) Architecture

  • ImEE is essentially a special VM created on-

demand by VMI applications.

  • Scheduled by the hypervisor
  • Consists of only a vCPU and a small

amount of memory: code and data

  • ImEE hosts a piece of code called ImEE

agent that actually performs introspection

  • ImEE acts as a memory access engine for

VMI applications

  • Only perform memory read
  • Native speed read
  • Page table is consistent with target at any

moment

7

slide-8
SLIDE 8

Basi sic Idea dea

  • An environment with a twisted

address mappings

  • Cloned CR3 content
  • Cloned EPT, with mappings from

target EPT and restricted permission

  • The result: a VA is translated to the

same HPA by the MMU in both environments

8

CR3 Target frames

RO NX

GPT EPT CR3 Target VM ImEE memory memory Cloned EPT

VA: 0xC0001000 VA: 0xC0001000 GPA: 0x1000 GPA: 0x1000 HPA: 0xFE000

slide-9
SLIDE 9

Makin king it it work

  • rk
  • Implementation issues:
  • Need room in the virtual address

space for

  • our own code
  • exchanging data with VMI tool
  • We want to avoid touching GPT
  • What about the number of

redirected pages?

9

CR3 Target frames

RO NX

GPT EPT CR3 Target VM ImEE memory memory EPTT EPTc data code Cloned EPT

slide-10
SLIDE 10

Immersi sive Execution Environment (ImEE EE)

  • Two address spaces in the ImEE
  • Local address space is for the

ImEE agent to interact with the VMI application

  • The idea ‘incarnates’ as the target

address space in ImEE.

  • Introspection is only performed in

the target address space

10

CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory

slide-11
SLIDE 11

CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory

Target Add ddress Sp Space

  • GPA space is split by the EPT
  • All address mappings are the same

as in the target VM, with read-only permission

  • One page is redirected by EPT to

the agent’s code page, with execute-only permission

  • Two possible kinds of translation

in the target address space:

  • Instruction fetch
  • Memory read

11

slide-12
SLIDE 12

Target Add ddress Sp Space

  • Example:

12

CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory

mov (0x1000), %eax 0xBFF0:

slide-13
SLIDE 13

Lo Local Add ddress Sp Space

  • Minimizes the number of

redirected page in the target address space

  • Only two pages are mapped
  • All pages except one are mapped to

code

  • The remaining one is mapped to

data

  • Allowing the agent to be executed

almost anywhere, because we do not know the load address beforehand

13

CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory

slide-14
SLIDE 14

Lo Local Add ddress s Sp Spaces

  • Example:

14

CR3 Target frames

RO NX

GPT Local GPT data code EPT EPTT EPTC EPT CR3 CR3 Target address space Local address space Target VM ImEE memory memory

mov %eax, (0x2000) 0xBFFA:

slide-15
SLIDE 15

The he ImEE EE Agent

  • The ImEE agent is the only code that runs inside ImEE
  • Reside within one page, self-contained
  • Position independent
  • Granted ring 0 privilege
  • Initially, the agent is loaded at a page whose VA is mapped as executable in

the guest page tables.

  • The hypervisor uses the page that the current IP points to

15

slide-16
SLIDE 16

The he ImEE EE Agent

  • The agent’s execution straddles between the two address spaces.
  • Simplified pseudo-code:

1. eax = data[request] 2. cr3 = target_cr3 /* switch to target address space */ 3. xmm0 = *eax 4. cr3 = imee_cr3 /* switch to local address space */ 5. data[result] = xmm0

16

slide-17
SLIDE 17

Other Issu sues

  • Blind spot
  • The code page in the target GPA

space is redirected

  • Any virtual address mapped to this

GPA cannot be read

  • Cannot be eliminated
  • Only detected when introspection

is on the blind spot

  • Relying on EPT mappings
  • Relocate agent once detected

17

CR3 Target frames GPT code EPT EPTT EPTC CR3 Target VM ImEE memory

VA: 0xC0001000 GPA: 0x1000 HPA: 0xBFF0 HPA: 0xFE000

slide-18
SLIDE 18

Adv dvantages

  • Native speed
  • Address translation is performed at native speed by hardware.
  • Consistency
  • Page table used is kept consistent with the current one in the target.
  • CR3 is synchronized

18

slide-19
SLIDE 19

Implementation

  • We implemented a prototype of ImEE
  • Hypervisor changes: modified KVM module
  • Consists of around 1400 SLOC
  • Two new IOCTLs as interface to user space
  • Optimized code path that handles ImEE specific VM exit
  • Agent: specially crafted assembly code
  • Within one page, a few tens of instructions
  • Position independent
  • One data page for exchange data with VMI tool

19

slide-20
SLIDE 20

Evaluati tion

  • We use LibVMI as the base line.
  • LibVMI: the only open source tool
  • Serves as building block for various other tools such as Volatility
  • Experiment setup:
  • Hardware: Intel Core i7-2600, 4GB DDR3 RAM
  • Guest VM: 1GB RAM and one vCPU

20

slide-21
SLIDE 21

Evaluati tion

  • ImEE Overhead
  • Launch time: time taken for the hypervisor to prepare relevant data such as the EPT
  • Activation time: time for a launched, but not running, ImEE to begin execute the agent

code

21

ImEE LibVMI Speedup Launch time 97 μs 100 ms 1031 times Activation time 3.2 μs

slide-22
SLIDE 22

Evaluati tion

  • Guest access speed
  • We measure the time take to read a number of bytes from the target
  • LibVMI’s translation cache is on, data cache off

22

# of Bytes ImEE LibVMI (μs) Speedup 4 0.353 18.4 52 times 64 0.358 18.5 52 times 128 0.389 18.4 47 times 512 1.643 18.9 11 times 1024 1.715 38.1 22 times

slide-23
SLIDE 23

Too

  • ols
  • syscalldmp: dumps totally 351 entries of the guest’s system call table
  • pidlist: lists all process identifiers in the guest.
  • pslist: lists all tasks’ identifiers and task names stored in task struct.
  • credlist: lists all tasks’ credential structures referenced by the task struct’s

cred pointer.

23

slide-24
SLIDE 24

Evaluati tion

  • We ran our four tools in four setups: ImEE, kernel, LibVMI on KVM and LibVMI
  • n Xen
  • Measure time taken to complete the task
  • Results:
  • Comparable to kernel
  • Significant speedup compared to LibVMI

24

Kernel (μs) LibVMI / KVM (μs) LibVMI / Xen (μs) ImEE (μs) Speedup (KVM) Speedup (Xen)

syscalldmp 0.2 28.2 43 2.9 9 times 15 times pidlist 10 5887 2180 31.6 186 times 68 times pslist 10.4 8319 1477 38.6 215 times 38 times credlist 25.3 8234 2274 25.6 321 times 88 times

slide-25
SLIDE 25

Evaluati tion

  • Scanning multiple VMs
  • We setup four VMs and measure:
  • Time to scan every VM
  • Time to switch scan target
  • Results:

25

LibVMI ImEE Speedup Scanning all VMs 561 ms 377 μs 1400 times Switching target VM 19 ms 4.4 μs 4300 times

slide-26
SLIDE 26

Con

  • nclusion
  • ImEE is a novel memory access engine for out-of-VM introspeciton

applications for live VM.

  • Based on hardware virtualization, ImEE shows remarkable speed up compared

to existing approaches.

  • ImEE maintains mapping consistency during introspection. Complemented by

its high speed, ImEE is suitable for security sensitive VMI applications.

26

slide-27
SLIDE 27

Questions?

27