11
DIGITAL FORENSIC RESEARCH CONFERENCE VMI-PL: A Monitoring Language for Virtual Platforms Using Virtual Machine Introspection By Florian Westphal, Stefan Axelsson, Christian Neuhaus and Andreas Polze From the proceedings of The Digital Forensic Research Conference DFRWS 2014 USA Denver, CO (Aug 3 rd - 6 th ) DFRWS is dedicated to the sharing of knowledge and ideas about digital forensics research. Ever since it organized the first open workshop devoted to digital forensics in 2001, DFRWS continues to bring academics and practitioners together in an informal environment. As a non-profit, volunteer organization, DFRWS sponsors technical working groups, annual conferences and challenges to help drive the direction of research and development. http:/dfrws.org

VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

DIGITAL FORENSIC RESEARCH CONFERENCE

VMI-PL: A Monitoring Language for Virtual Platforms

Using Virtual Machine Introspection

By

Florian Westphal, Stefan Axelsson,

Christian Neuhaus and Andreas Polze

From the proceedings of

The Digital Forensic Research Conference

DFRWS 2014 USA

Denver, CO (Aug 3rd - 6th)

DFRWS is dedicated to the sharing of knowledge and ideas about digital forensics

research. Ever since it organized the first open workshop devoted to digital forensics

in 2001, DFRWS continues to bring academics and practitioners together in an

informal environment.

As a non-profit, volunteer organization, DFRWS sponsors technical working groups,

annual conferences and challenges to help drive the direction of research and

development.

http:/dfrws.org

Page 2: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

VMI-PL: A monitoring language for virtual platforms usingvirtual machine introspection

Florian Westphal a, b, *, Stefan Axelsson a, Christian Neuhaus b, Andreas Polze b

a Blekinge Institute of Technology, Swedenb Hasso-Plattner-Institute, University of Potsdam, Germany

Keywords:VirtualizationSecurityMonitoring languageLive forensicsIntrospectionClassification

a b s t r a c t

With the growth of virtualization and cloud computing, more and more forensic in-vestigations rely on being able to perform live forensics on a virtual machine using virtualmachine introspection (VMI). Inspecting a virtual machine through its hypervisor enablesinvestigation without risking contamination of the evidence, crashing the computer, etc.To further access to these techniques for the investigator/researcher we have developed anew VMI monitoring language. This language is based on a review of the most commonlyused VMI-techniques to date, and it enables the user to monitor the virtual machine'smemory, events and data streams. A prototype implementation of our monitoring systemwas implemented in KVM, though implementation on any hypervisor that uses thecommon x86 virtualization hardware assistance support should be straightforward. Ourprototype outperforms the proprietary VMWare VProbes in many cases, with a maximumperformance loss of 18% for a realistic test case, which we consider acceptable. Ourimplementation is freely available under a liberal software distribution license.© 2014 Digital Forensics Research Workshop. Published by Elsevier Ltd. All rights reserved.

Introduction

More and more computing services are being providedremotely in the form of so called “cloud based services” inthe form of virtual machines, as it is done by WindowsAzure, or Amazon EC2, etc. Thus virtualization is becomingan evermore important tool for providing computing ser-vices to customers, especially when it comes to providinge.g. web servers, data base servers etc. so called infra-structure as a service (IaaS). This market segment is growingfast, at present.

Hence, the probability that forensic investigations willhave to be performed on virtual machines will continue toincrease. Whereas virtual machines can be treated and

analyzed as normal computers (Flores Cruz and Atkison,2011), their use in cloud settings poses several challenges,and also opportunities for the investigation. These chal-lenges include legal issues, such as cross-border legislationproblems (Biggs and Vidalis, 2009), as well as trust issues(Dykstra and Sherman, 2012).

Despite these challenges, virtual machines also have anadvantage over real computers when it comes to live fo-rensics. Whereas live forensics on a real machine alwayscauses state changes, possibly contaminating the evidence(Adelstein, 2006), live forensics on a virtual machine can bedone with minimal interference with its state, by usingvirtual machine introspection (VMI) (Cruz and Atkison,2012). Several VMI techniques have been developed andimplemented, in recent years.

To this end we have developed a domain specific lan-guage (DSL) named VMI-PL, that can be used to define andapply common VMI techniques for the monitoring of vir-tual machines. This DSL provides a simple way for the user

* Corresponding author. Hasso-Plattner-Institute, University of Pots-dam, Germany.

E-mail address: [email protected] (F.Westphal).

Contents lists available at ScienceDirect

Digital Investigation

journal homepage: www.elsevier .com/locate/d i in

http://dx.doi.org/10.1016/j.diin.2014.05.0161742-2876/© 2014 Digital Forensics Research Workshop. Published by Elsevier Ltd. All rights reserved.

Digital Investigation 11 (2014) S85eS94

Page 3: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

to specify virtual machine events which should be inter-cepted, registers and virtual memory, which should be reador written to, and data streams from and to the virtualmachine, which should be logged. In addition to data aboutthe hardware level, the language provides means to obtainoperating system level information by interpreting the dataavailable to the hypervisor. This combination of ease of useand capabilities it provides makes it, in our opinion, avaluable tool for live forensic investigations.

In connection with the language design, we propose anew classification for VMI techniques, which is based onthe respective key mechanism of the VMI technique. Thesekey mechanisms can be data accesses, hardware events, ordata transfers across the border between virtual machineand hypervisor. In addition to these theoretical contribu-tions, we also developed a prototype, implementing ourlanguage design in the Kernel-based Virtual Machine(KVM) hypervisor, which is freely available under an opensource license.

Related work

As VMI-PL allows the implementation of new moni-toring strategies without modifying the hypervisor furtherbeyond that which was necessary to implement support forVMI-PL. We limit the related work section to thoseapproaches that share this characteristic. This excludesapproaches such as HyperDbg (Fattori et al., 2010) (which isnot a true hypervisor based system), and VMST (Fu and Lin,2012) (that while their approach has much to commend it,is limited to just the one read-only strategy of memoryintrospection). We have only found two other publiclyavailable solutions for which this is true: LibVMI,1 andVMware VProbes (VMware and Inc, 2011).

LibVMI is an introspection library for Xen and KVM,which was derived from the XenAccess project (Payneet al., 2007). While Xen is fully supported by this library,the support for KVM is more limited, due to missing hooksin the KVM code. With LibVMI, it is possible to read andwrite virtual memory, as well as to register handlers forcertain events occurring within a virtual machine. Theseevents can be memory accesses, register writes, or in-struction execution, where instruction execution can betracked either in single stepping mode or by specifying aparticular virtual address.

VProbes, on the other hand, is a monitoring solution forVMware Workstation and VMware Fusion, which providesthe possibility to specify probes, which are executed oncertain events. The specification of these probes is done inVMware's own language called Emmett. While the initialidea of VProbes was to support external debugging of vir-tual machines (Adams, 2007), it has also been shown to beuseful in the context of e.g. intrusion detection (Dehnert,2012). It should be noted that Emmett only allows thereading of information from the monitored host.

In contrast to VProbes, our monitoring language sup-ports writing to effect the manipulation of the internalstate of the virtual machine.

Our monitoring language differs from both these solu-tions in that it provides access to operating system levelinformation and events. This simplifies investigations,since the interpretation of the hardware state is doneautomatically. Another benefit from our approach is that itmonitors data streams from and to the virtual machine,which cannot be monitored using the other solutions. Thisfeature enables an investigator to monitor network traffic,as well as the keyboard input of a user. Finally, our moni-toring language has a simple syntax, which enables a userto obtain data from a virtual machine without the need tohave an extensive background in low level programming.

Virtual machine introspection

Virtual machine introspection (VMI) was coined byGarfinkel and Rosenblum (Garfinkel and Rosenblum, 2003)and was defined by Pfoh et al. as a “method of monitoringand analyzing the state of a virtual machine from the hyper-visor level.” (Pfoh et al., 2009). Since VMI obtains this stateinformation directly from the hypervisor, the semanticknowledge of the guest operating system's abstractions islost. Hence, it is difficult to interpret the data. This was firstdescribed by Chen and Noble as the semantic gap problem(Chen and Noble, 2001). In order to overcome the semanticgap, there are different strategies, which were categorizedby Pfoh et al. (Pfoh et al., 2009) as out-of-band deliveryd-where the needed semantic knowledge is supplied exter-nally, in-band deliverydthat pass the needed data alongwith the semantic information directly from inside theguest operating system to the hypervisor, and derivation-dthat derives the needed information from how the guestoperating system is using the given hardware interface.

These approaches have different advantages and dis-advantages when it comes to the amount of informationthey can easily provide and how difficult it is for an attackerto deceive them. Additionally, it should be noted that in-band delivery techniques are less suitable for live forensics,since they require the running of software inside the virtualmachine, potentially manipulating its state to a consider-able extent, and therefore neglecting the advantage VMInormally provides for live forensics.

VMI techniques

For reasons that will become clear we decided to furtherrefine this classification of VMI techniques.

While all techniques described in the following sectionscan be categorized as out-of-band delivery or derivationtechniques, we will divide them further into data-based,event-based, and stream-based techniques. This categori-zation has been useful in the specification of our moni-toring language, since it takes into account the underlyingmechanisms of the particular VMI technique.

Data-based techniques

Data-based VMI techniques focus on the virtual storageof a virtual machine, such as registers, main memory, andthe virtual hard disk. These techniques obtain informationfrom the virtual machine by reading that storage and1 https://code.google.com/p/vmitools/.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94S86

Page 4: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

require external knowledge to interpret the information.Therefore, these techniques belong to the out-of-band de-livery techniques and can be defined as follows:

Definition 1. Data-Based Techniques are out-of-band de-livery techniques, which analyze data from virtual storage, inorder to gain knowledge about information processed withinthe guest operating system of a virtual machine.

Based on this definition, VMI techniques in this categoryare register introspection, main memory introspection, andvirtual disk introspection. While disk introspection can bedone during a “dead” analysis, register and memoryintrospection can only be performed during a live analysison a running virtual machine, due to their volatility.

In general, memory introspection can provide the sameinformation as a forensic memory analysis (FMA) per-formed on a dump of physical memory, but also faces thesame challenge, namely the semantic gap (Dolan-Gavittet al., 2011). Information, which can be obtained include,for instance, a list of running processes, loaded kernelmodules, or open sockets (Hay and Nance, 2008), as well asprogram specific information, such as open files orencryption keys (Hargreaves and Chivers, 2008). The latterare of course a common target in a majority of criminalinvestigations that target suspects using a laptop, orsimilar, in a home or small business setting. However, weventure to guess that for the virtual target, in-memory rootkits, viruses/worms and the like are more often of moreinterest, as the relative proportion of encrypted storage islower in a server setting.

Even though both approaches can obtain the same in-formation, memory introspection has an advantage overFMA, in that it is in general easier and less intrusive toeither dump the whole virtual memory or just read out theneeded parts, since the hypervisor can provide direct accessto the virtual memory. In contrast, dumping the mainmemory of a physical machine usually requires the instal-lation of specialized programs to perform this task. Thischanges the state of the computer, and also runs the realrisk of freezing the computer or not successfully acquiringall of the memory. This is especially true on a compromisedtarget, as the compromise may make the returned infor-mation unreliable.

Event-based techniques

Event-based techniques intercept transitions from thevirtual machine to the hypervisor, in order to gain knowl-edge about the actions of the operating system. Thesetransitions occur when the guest operating system exe-cutes certain sensitive instructions. Since these instructionsaffect the whole system state, they have an impact on thehost machine as well, as they compromise the isolationbetween virtual machine and host. For this reason, all ofthese sensitive instructions have to cause a transition to thehypervisor, so that the hypervisor can emulate themwithout influencing the host system. This sufficient con-dition for virtualization was first formalized by Popek andGoldberg in 1974 (Popek and Goldberg, 1974).

Since the sensitive instructions have to be emulated bythe hypervisor, they can be easily intercepted and certain

information can be derived from their occurrence. Due tothe fact that information is obtained by monitoring howthe guest operating system uses the provided hardwareinterface, these techniques are derivation techniques,defined as follows:

Definition 2. Event-Based Techniques are derivation tech-niques, which make use of transitions from the virtual ma-chine to the hypervisor, in order to obtain knowledge aboutthe actions of a virtualized operating system by interpretingthe cause of those transitions.

One commonly used event-based technique is tomonitor writes to the CR3 register (Jones et al., 2006). (For avery nice in-depth overview of how to derive VMI stateinformation on the x86 architecture, see Pfoh et al. (Pfohet al., 2010).) Due to the fact that this write changes thevirtual address space mapping, it is a sensitive instructionwhen hardware support for memory virtualization, knownas extended page tables (EPT) or nested paging, is not used,due to the hypervisor having to do the memory manage-ment for the virtual machine then. Monitoring the changeof virtual address spaces is instructive, due to the fact that itindicates that either a new user mode process was startedor that a context switch from one user mode process toanother occurred.

In addition to sensitive instructions, interrupts can alsocause a transition to the hypervisor and can therefore beintercepted. The interrupts which are most often moni-tored, are the user defined interrupt used for issuing sys-tem calls, page faults, debug exceptions, and invalid opcodeexceptions.

Monitoring page faults, on the other hand, provides thepossibility to monitor data as soon as it is loaded in mainmemory or to detect access violations (Krishnan et al.,2010). Furthermore, it is also possible to introduce a writeor execution protection for certain memory pages bysetting them not writable or not executable in the corre-sponding page table entries. Using these types of protec-tion, it is possible to detect code injection (Litty et al., 2008)or stack overflow exploits as they happen.

Stream-based techniques

Another way to obtain information from a virtual ma-chine is to monitor the data streams flowing in and out ofthe virtual machine. Since the interpretation of the data inthose streams requires external information, stream-basedtechniques belong to the category of out-of-band deliverytechniques:

Definition 3. Stream-Based Techniques are out-of-banddelivery techniques, that process input and output data to/from a virtual machine. This data is intercepted as it crossesthe border between virtual machine and hypervisor by pass-ing through a virtualized device.

The most commonly used stream-based technique isnetwork introspection. This can be done by interceptingthe network traffic to and from the virtual machinedirectly at the virtual network interface (Srivastava andGiffin, 2008). By monitoring the network traffic at thispoint, it is impossible for potential rootkits to conceal

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94 S87

Page 5: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

open network connections. Furthermore, by coupling thistechnique with other VMI techniques, it is possible tocorrelate network traffic with running processes, forexample identifying a process behind known maliciousnetwork traffic. This correlation can be done by identifyingwhich process was executing while certain network trafficwas sent. Which user mode process was running can bedetermined by monitoring the CR3 register, as describedbefore.

In addition to network introspection, it is also possibleto log the keyboard input by intercepting input at the vir-tual keyboard controller (King and Chen, 2006; Fattoriet al., 2010). This provides the possibility to closelymonitor the actions of a user on the monitored virtualmachine.

VMI-PL specification

The purpose of the proposed Virtual Machine Intro-spection Probe Language (VMI-PL) is to provide a simpleway to obtain the relevant information from a virtual ma-chine without having to implement the details of thenecessary VMI techniques. With VMI-PL, a user can writescripts to specify probes to obtain the needed data. Theseprobes represent common VMI techniques and are definedas follows:

Definition 4. A probe is a specific action, which is executedwhen certain preconditions are met. This action can be usedeither to gather information from a virtual machine or tomanipulate its state.

Since VMI-PL probes represent certain VMI techniques,there are three different probe types each corresponding tothe three different technique categories.

In keeping with our definitions above, three types ofprobes are implemented in VMI-PL. These probe types aredata probes, event probes, and stream probes. As mentionedin the probe definition, specified probes are executed whentheir preconditions are met. While the precondition forevent type probes is the occurrence of the correspondingtransition to the hypervisor. Data probes need a specifictrigger to determine when data should be read from thevirtual machine. In VMI-PL, such a trigger would either bethe execution of an event probe or when a filter conditionis met. The different triggers for data probes are mirroredin the VMI-PL syntax, as shown in Listing 1. Here, one cansee that filter conditions are expressed by special in-structions, which are described later. Data probes andevent probes are closely coupled, since data probes needevent probes as triggers, and event probes need dataprobes to generate output. This it not the case for streamprobes, which can be used alone, as the trigger for a streamprobe, as well as its output, is defined by the correspondingdata stream.

It is possible to place any number of data probes withinan event probe or filter. Other probe types cannot be nes-ted, since that wouldn't make sense semantically. Forexample, is it impossible for an event to occur whileanother event is already handled, since the monitoredoperating system is already stopped and not executingwhen the first even has triggered.

Listing 1. VMI-PL Script Structure.

Since the data exchanged via monitored streams have astandardized format, stream probes do not face the se-mantic gap problem. Data and event probes, on the otherhand do, since they obtain data directly from the virtual-ized hardware. Therefore, external knowledge about eitherthe monitored guest operating system or about the hard-ware interface used is required to interpret the retrieveddata. Since the needed external knowledge is different foreach probe, we will describe it along with the probes. InVMI-PL, this interpretation can be done either by the user,by retrieving the raw data available to the virtual hardware,or directly by means provided by VMI-PL.

Due to these two different possibilities, the availableprobes can be divided into two different categories: hard-ware-level probes and operating-system-level probes.Hardware-level probes gather data as seen by the hardwarewithout any semantic information, and operating-system-level probes gather information by using external knowl-edge about the operating system.While there is at least oneapproach which free users from the need to provide suchexternal knowledge themselves, instead automating theprocess (Fu and Lin, 2012), we prefer our approach since itleads to better performance. Also, our method does notrequire the running of additional virtual machines with acopies of each monitored operating system, in addition thesystems that are already being monitored. Therefore, theexternal knowledge which is necessary for those probeshas to be provided by the user as configuration items in theconfiguration section of a VMI-PL script. This configurationmakes it easy to support new operating systems and kernelversions, as long as their implementation is similar to othercommonly used operating systems, such as MicrosoftWindows or Linux.

In addition to the three mentioned probe types, VMI-PLalso provides filters to define when data should be read,and reconfiguration instructions to adjust the way inwhicha specific virtual machine is monitored. Apart from theselanguage constructs, VMI-PL does not provide any otherconstructs, such as variables or loops. VMI-PL is only meantto provide the possibility to apply VMI techniques to ac-quire data from a virtual machine, the processing of thatdata can then be handled by any suitable software. Theadvantage of a specification language that doesn't containloops, recursion etc. to support general computation anddata processing, is that the execution of the probes willalways terminate in a finite amount of time. The one probetype that traverses lists supports a configurable uppertransition bound, to stop execution when faced with e.g.loops in the list structure. This means we can guaranteethat the virtual machine execution does not get stuck in thehypervisor.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94S88

Page 6: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

The following sections describe the language constructsin more detail. Due to a lack of space, not all probes arepresented here. Only a few representative probes areshown. The complete list, and description, of all probes canbe found in Westphal (2014).

Data probes

VMI-PL's data probes make it possible to retrieve datafrom a virtual machine, as well as manipulate data insideit. Whenever a data probe obtains data from the virtualmachine, the last parameter to this probe is used tospecify where data should be sent. It is possible tospecify two different output targets, either a file or adata stream, which can be read by another program. Inorder to direct the output of a data probe to a file, thefull path to the file has to be provided. To use datastreams, a stream identifier has to be provided, whichhas to start with a “#”. This identifier is used to providethe connection information, when the VMI-PL script isexecuted.

The VMI-PL specification contains several hardware-level data probes to read out registers or main memory,or write to them. The difference between these probes ishow the particular part of memory is specified. TheReadMemory data probe, for instance, takes a virtualaddress and the amount of bytes to be read as parameters.When the probe is evaluated, it reads from the given virtualaddress as determined by the mapping that is valid whenthe probe triggers, and sends the result to the specifiedoutput target. One example of amemorymanipulating dataprobe is WriteToMemoryAt. This probe takes a registername, an offset value, and the value which should bewritten to memory, as parameters. On evaluation, the vir-tual address, which the value should be written to, isdetermined based on the content of the specified registerand the offset.

An example of an operating-system-level data probe isthe ProcessList probe. This probe uses externalknowledge, provided in the configuration section, to readout the operating system's data structures containing in-formation about currently running processes. This probecan be configured to output the process identifier (PID),the process' name (NAME), the path to the correspondingexecutable (PATH), and the address of the process' pageglobal directory (PGDP) of each process by providing therespective field names as parameters. As mentionedbefore, since this probe is an operating-system-levelprobe, it requires external knowledge to bridge the se-mantic gap. This knowledge includes the location of thefirst process list element in main memory, as well as thenecessary offsets within this element to read out therequested information and iterate over the process listwhich we assume to be a linked list. This is the case in allmajor operating systems that are typically run under anx86 hypervisor, such as Microsoft Windows and Linux. (Ifthe process list is a table, normal data probing can beused).

We are currently working on generalising this probetype to support recursion over more general list struct-ures.

Event probes

As one can see from Listing 1, event probe definitionscontain data probes and filters, which are evaluated whenthe event specified by the probe takes place. Like dataprobes, event probes can be divided into the two categorieshardware-level probes and operating-system-level probes.Examples of hardware-level probes are the CRWrite, andExecuteAt probes. The CRWrite event probe expects thenumber of one of the control registers as a parameter. Itsattached data probes and filters are then evaluated as soonas a write to the specified control register takes place. Thiscan be used, for instance, to determine which process wasscheduled for execution, when the CR3 register is moni-tored with this probe. The ExecuteAt event probe, on theother hand, takes a virtual address as a parameter and istriggered when the code at this address is executed.

As mentioned before, the VMI-PL specification alsocontains operating-system-level probes, such as theProcessStart and Syscall probe. The ProcessStartevent probe is executed when either one specific process oran arbitrary process is started. A process can be specified byname or executable path. Due to the fact that this specifi-cation requires the same information as the ProcessListdata probe provides, the external knowledge needed is thesame. In addition to the starting of processes it is alsopossible to monitor when a process is scheduled forexecution and when a process is terminated. The Syscall

probe is triggered when the guest operating system issueseither a specific system call or an arbitrary system call,depending on the parameter passed to the probe. Normally,it should be enough to provide this probe with knowledgeabout which user defined interrupt is used to issue systemcalls and which register is supposed to contain the systemcall number. Nevertheless, under certain circumstances,which are described in Implementation, it is also necessaryto specify the virtual address of the system call dispatcherin the configuration section.

Stream probes

Similar to data probes, all stream probes take an outputspecification, containing either a file path or a data streamidentifier as the last parameter. The captured stream data isthen directed to this output. As mentioned before, streamprobes are not divided into the same two categories thatdata and event probes are. Here, wewill exemplify with theCaptureNetwork and CaptureKeyboardInput streamprobes.

The CaptureNetwork probe saves captured networktraffic to its output target. In order to specify from whichvirtual network interface the network traffic should beintercepted, this probe takes the interface's MAC address asa parameter. The CaptureKeyboardInput probe does nottake any other parameters and outputs the observed key-strokes to the specified output.

Filters

Filters can be used within an event probe to add addi-tional preconditions to the evaluation of data probes. As

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94 S89

Page 7: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

described before, data probes which are placed within afilter, are only executed when the filter condition is met.Filter conditions can for example be the presence of acertain value in a specific register or a specific memoryaddress. Hence, the defined filters are: Regis-

terHasValue, ValueAtAddressIs, andValueAtRegisterIs.

While the RegisterHasValue filter takes a registername and a value to compare the register's content withthe given value, the ValueAtAddressIs filter does thesame for a given virtual address. Lastly, the ValueA-

tRegisterIs filter calculates the virtual address based onthe value read from the given register and the given offsetfirst, before comparing the value at this address with thegiven one.

Reconfiguration instructions

The reconfiguration option of VMI-PL makes it possibleto adjust how the virtual machine is monitored. By usingthis option, an external program can analyze the data froma virtual machine and change the way it is monitored. Inorder to achieve this, a new VMI-PL script can be given tothe VMI-PL execution environment at any time, as long asthe monitored virtual machine is running. Such a script cancontain new probe definitions as well as reconfigurationinstructions to modify already existing ones. The in-structions, which were introduced to support reconfigu-ration are Pause, Reconfigure, and Deregister.

Similar to a data probe, the Pause instruction can beused within an event probe or within a filter to cause thevirtual machine to suspend, as soon as the correspondingevent has taken place or the respective filter condition ismet. This can be used to gain sufficient time to analyze themonitored information and reconfigure accordingly.

Event probes that are already defined can be reconfig-ured using the Reconfigure instruction. This instructiontakes as parameter the event probe identifier, which isassigned to every event probe by the VMI-PL executionenvironment.With this instruction, one can redefinewhichdata probes and filters should be executed, when the cor-responding event occurs. The general syntax of this in-struction is shown in Listing 2.

Additionally, it is also possible to deregister previouslydefined event and stream probes by providing theirrespective identifier to the Deregister instruction.

Examples

An example application of VMI-PL is process life cyclemonitoring, as shown in Listing 3. This VMI-PL applicationlogs the currently running process by intercepting writes to

the CR3 register and logs when a process is terminated. Theprocess termination is determined bymonitoring when theLinux's kernel do_exit function at the specified virtualaddress is executed. This monitoring application can beused, for instance, to uncover hidden processes. Even if aprocess is not contained in the operating system's processlist, for example due to direct kernel object manipulation(DKOM), its virtual address space has to be set up before itcan be executed and hence will be detected by us.

Another example VMI-PL application is process execu-tion monitoring. This logs invoked system calls using theSyscall event probe, as shown in Listing 4. As describedbefore, the Syscall event probe requires externalknowledge, such as the address of the system calldispatcher, which can be provided in the configurationsection of the VMI-PL script.

Listing 4. VMI-PL Script for Process Execution Monitoring.

Implementation

We implemented a prototype VMI-PL by patching theKVM hypervisor. Our architecture consists of two parts, asshown in Fig. 1: the VMI-PL execution environment whichconsists of roughly 1500 lines of Python, and the modifiedversion of the KVM kernel module which weighs in at circa1500 lines of C (most of which is additions with only a fewlines of hooking into existing code required).

Execution environment

The execution environment is a user mode programcreating the bridge between the user and the hypervisor. Itparses the provided VMI-PL script and transfers theconfiguration to the hypervisor. During the parsing of theVMI-PL script, the execution environment assigns identi-fiers to the different event and stream probes and returnsthese identifiers to the user. They can later be used forreconfiguring the virtual machine monitoring.

The execution environment also maps the specifiedoutput targets, i.e., files or data streams, to correspondingconnection information, which are returned to the user, incase the specified target was a data stream. In case of a filetarget, the execution environment sets up a listener withthe necessary connection information to receive the datasent from the hypervisor and store it in the specified file. In

Listing 2. VMI-PL Reconfigure.

Listing 3. VMI-PL Script for Process Life Cycle Monitoring.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94S90

Page 8: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

addition, the execution environment takes care of thereconfiguration of probes by parsing the updated VMI-PLscript and transferring the updated information to thehypervisor.

KVM

The KVM kernel module was modified to provide acommunication interface to the execution environment toreceive the probe configurations. Additionally, the creationof virtual processors was extended, in order to attach theseconfigurations to the newly created processor. Such aconfiguration contains external knowledge for operating-system-level probes, as well as information about activeevent probes, their parameters, and attached data probesand filters. This configuration is consulted by the addedmonitoring hooks every time a transition to the hypervisoroccurs. When an event probe corresponding to the moni-tored transition is found to be active, all its attached dataprobes and filters are evaluated and the data obtained bythe data probes is broadcast to all listeners. Since the cor-responding configuration is attached to each created virtualprocessor, VMI-PL makes it possible to monitor severalvirtual machines, running different operating systems, atthe same time.

Communication

The communication between the KVM kernel moduleand the execution environment, and other user modeprograms, is implemented using Linux's netlink sockets.While the execution environment sends the respectiveconfiguration to the hypervisor using unicast messages, thehypervisor sends all received data as broadcast messages.This makes it possible for any user mode program toreceive and analyze the logged data, as long as it hasknowledge of the corresponding connection information.This connection information include the protocol type and

the group identifier. While the protocol type is unique pervirtual machine, the broadcast group identifier is used todirect the obtained data to different output targets.

Data probes

The VMI-PL data probes are implemented as functionsin the KVM kernel module, which are executed as soon asan event probe or filter with the corresponding dataprobe is evaluated. In order to access registers, translatevirtual memory addresses, and read and write the virtualmemory, those functions in turn make use of KVM's in-ternal address translation functions. Hence, addresstranslation is always performed in the context of thecurrent running process in the monitored OS. While thisis no problem when kernel data is accessed, since thekernel address space is normally mapped in every processaddress space, process specific data has to be handleddifferently. To retrieve data from one specific process, onecould use a filter based on the contents of the CR3 reg-ister. This makes it possible to configure memory readsfor a specific process. Since a process' PGD address canonly be determined at runtime, these filters have to beregistered using the reconfiguration capabilities of VMI-PL. After obtaining the requested data, our implementa-tion broadcasts it using the virtual processor's netlinksocket and the group identifier, which was configured forthis data probe.

Event probes

As mentioned earlier, event probes are implemented byhooks placed in the KVM transition handling code, whichcheck on every transition if the corresponding probe wasconfigured. For instance, writes to the CR3 register areintercepted in KVM's handler for writes to the controlregisters. If the corresponding hook finds the event probeconfigured, the attached data probes and filters areevaluated.

While event probes, such as CRWrite do not require anymanipulation of the guest operating system, the eventprobe implementation has to perform certain alterations ofthe guest for other probe types, for instance, the Execu-teAt event probe. When this probe is configured, the VMI-PL implementation has to set up one of the guest's debugregisters to cause a debug exception, when the code at thespecified address is executed. The hook for this probe islocated in the corresponding KVM handler and evaluatesthe data probes and filters, if the transition was caused bythe correct debug register.

The last event probe implementation, described here, isthe implementation of the Syscall probe. Since our pro-totype was developed for Intel processors, our imple-mentation has to deal with the fact that Intel processors donot make it possible to transition to the hypervisor on userdefined interrupts. Therefore, we determine the virtualaddress of the system call dispatcher and replace its firstinstructions with the undefined instruction ud2. This cau-ses a transition to the hypervisor whenever a system call isissued, due to an invalid opcode exception. The exception isthen intercepted by the corresponding hook, and the

Fig. 1. Interaction between different elements of the VMI-PLimplementation.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94 S91

Page 9: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

respective event probe can be evaluated. Afterward, thereplaced instructions have to be emulated in the hyper-visor, before the execution of the virtual machine cancontinue.

Normally, the address for the system call dispatcher canbe determined by reading out either the IDT or theIA32_SYSENTER_EIP model specific register (MSR),depending on how system calls are issued by the guestoperating system. While writes to the IA32_SYSENTER_EIPMSR can cause a transition to the hypervisor, writes to theIDTR, which would indicate when the IDT was initialized,only cause transitions on newer Intel processors. Thismakes it necessary to provide the address to the system calldispatcher directly for older processors.

It should be noted that the ud2 instruction that wewritecould be detected by malware, which could then takeevasive action. This is difficult to counter with OSes thatuses interrupt table based system calls (like Linux int 0x80),but for SYSENTER based system calls there are ways tomake such monitoring invisible (Dinaburg et al., 2008),which we plan to implement.

Stream probes

Even though the implementation of the stream probesis straightforward, due to a lack of space we refer to thepreviously cited source for their description. The onlycomplication is that a different communication structurebetween these probes and the VMI-PL execution environ-ment is needed. The reason is that the data for these probesare intercepted at the virtualized devices and not, in theKVM kernel module as for data or event probes.

Filters & reconfiguration instructions

Filters are simply implemented as functions within theKVM kernel module, which are executed whenever anevent probe is triggered to which a filter is attached. Thesefunctions read out registers or virtual memory in the sameway as data probes and compare the obtained data withtheir configured values. If the values match, the data probesattached to this filter are evaluated.

The Reconfigure and Deregister instructions aremainly implemented in the execution environment, whichparses these instructions and transmits the configurationchanges to the respective virtual processor. The Pause in-struction, on the other hand, is implemented in the kernelmodule. Whenever an event probe or filter is evaluated,which has the Pause instruction active, the kernel sends amessage to the execution environment with the request tosuspend the virtual machine. This is done, as soon as thecorresponding listener receives this message.

Performance evaluation

We evaluated the performance of our VMI-PL imple-mentation and compared the results with VMware VProbesas these are directly comparable. The following resultswere obtained on a host with 4 GB of RAM and an Intel Core2 Duo processor running at 2.53 GHz. The processor sup-ports Intel's hardware-assistance for virtualization (VT-x),

but not the extended page table feature. The host operatingsystem was Linux Mint Debian Edition with a 32-bit Linuxkernel version 3.2.0. As the hypervisor, we used the KVMexternal module kit, kvm-kmod-3.10.1, for our VMI-PLimplementation and VMware Workstation 10.0.1 for thecomparison with VProbes. Under both hypervisors, we setup a virtual machinewith one virtual processor and 256MBof RAM. In both cases, this virtual machine ran Ubuntu12.04 with a 32-bit Linux kernel version 3.2.0.

For our performance evaluation, we used the UnixBenchbenchmark suite version 5.1.3. This benchmark suite wasexecuted on the guest operating system in four differentscenarios. In the first scenario there was no support forVMI-PL or VProbes configured (KVM/WS). This support wasactivated in the second scenario (VMI-PL/VProbes). Thethird measurement was run with process life cycle moni-toring (LC) enabled. This monitoring was performed usingthe VMI-PL script shown in Listing 3. Finally the lastexperiment was run with process execution monitoring(Exec) enabled. The VMI-PL script for this last case is shownin Listing 4. Due to the fact that VProbes do not supportmonitoring system calls directly, we used dynamic probesto intercept the execution of the Linux system calldispatcher. It should also be noted that VProbes' logstrand logint functions were used to log the retrieved data.

Our benchmark results for VMI-PL, as well as forVProbes, are shown in Figs. 2 and 3. These figures show therelative change in index value, calculated by UnixBench(each test produces an index value, with higher valuesmeaning higher performance), for each test of the scenariowithout VMI support. Based on these results, one can seethat the performance impact of our VMI-PL implementa-tion, as well as that of VMware VProbes is negligible if nomonitoring is active. It is also clear that the performancedrops when monitoring is used. As expected, the perfor-mance of the virtual machine in tests, such as ContextSwitching, Process Creation, and Shell Scripts is lower on bothsystems, if process life cycle monitoring is active. This isbecause those tests cause a high number of writes to theCR3 register, due to the large number of context switchesand process creations. The reason for the resulting perfor-mance loss is the continued intercept and collection of dataat each of these writes. This performance loss is even moresevere when process execution monitoring is used. Whencomparing the worst VMI-PL test results for each of these

Fig. 2. Relative performance impact of VMI-PL on the UnixBenchbenchmarks.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94S92

Page 10: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

two cases, we see that the performance loss, caused byprocess life cycle monitoring, is around 21.3% in the ContextSwitching test. The worst test result, caused by processexecutionmonitoring, in the System Call test, is 92.2% lowerthan the result without any monitoring in place. Thisdecrease in performance comes from the fact that ourmonitoring intercepts every system call issued during thesetests, which naturally slows execution. Since the System Calltest measures the system's performance with regard tosystem calls, the highest impact of our monitoring can beseen here.

Fig. 4, illustrates the performance of our prototypecompared directly with VMware VProbes. This figure isbased on the overall system index value, calculated byUnixBench with respect to all performed tests. The per-centages show the deviations from the respective systemindex value, when no monitoring was enabled. The com-parison shows that even if our prototype's performance isslightly worse when monitoring support is enabled, as wellas when process life cycle monitoring is performed, it issignificantly better when monitoring the system calls is-sued. Due to the fact that VProbes is closed source, wecannot be completely sure about the cause of this perfor-mance difference. Nevertheless, from the measurementresults, it appears that the use of VProbes' dynamic probehas a higher performance impact than our strategy formonitoring system calls.

Even though the performance impact of the appliedmonitoring appears to be rather severe, based on the

conducted benchmark, it should be noted that thisbenchmark strives to evaluate the complete capacity of asystem. Since real applications rarely make use of a sys-tem's capacity to this extent, the performance loss in a realscenario is expected to be lower. In order to evaluate this,wemeasured the performance impact of ourmonitoring onthe build time of the Apache http server, and the requestrate handled by this server. In both cases we used Apacheversion 2.4.4. Due to a lack of space, we present only part ofour results here. The complete listing of our results isavailable in Westphal (2014). The monitoring with thehighest performance impact in both cases was the processexecution monitoring. This monitoring slowed down thebuild time for the Apache http server by 6.7%, in the case ofVMI-PL, and 12.9%, in the case of VProbes. The amount ofhandled requests per second, which was measured fromthe host system for a total of 100,000 requests, dropped by18.2%, in case of VMI-PL, and 57.4%, in case of VProbes. Thus,it appears that using VMI-PL for monitoring a virtual ma-chine does not have a too severe performance impact, andfurthermore our performance seems better than VProbe's.

Conclusion

In this paper, we presented VMI-PL, a monitoring lan-guage for virtual machines. This language provides aforensic investigator with a simple tool with which tospecify which information should be obtained from inside aguest operating system using VMI. Our approach does notrequire the user to manipulate or even know the detailsabout the hypervisor. Additionally, the presented languagemakes it possible to modify the guest's internal state, ifnecessary. This enables the user to implement moreadvanced VMI techniques. In contrast to the similar ap-proaches taken by libVMI and VProbes, VMI-PL providesnot only access to hardware level data and events, such asmemory content or writes to a specific register, but also tooperating system level information and events such as in-formation about currently running processes and other OSevents such as the start or termination of a process.(Though similar functionality has been implemented bysoftware using libVMI). Furthermore, VMI-PL provides thepossibility to monitor data streams to and from the virtualmachine, something the other approaches do not. This canbe used, for instance to monitor the virtual machine'snetwork traffic or user input/output.

In addition to the specification of the monitoring lan-guage, we also presented an implementation of this lan-guage in KVM, evaluated its performance, and compared itto VMware VProbes. This performance evaluation showedthat the monitoring can have a high impact on the virtualmachine's overall performance, depending on what ismonitored. Nevertheless, the comparison with VProbesshow that the performance decrease imposed by VMI-PL issimilar to, or in many cases lower than, the one imposed byVProbes. Further evaluation on real applications showedthat the performance impact in a realistic case is under 20%and therefore probably acceptable in an investigation sce-nario. Even though the presented prototype implementa-tion of VMI-PL targets KVM, it is also possible to implementsupport for this language in other hypervisors, which make

Fig. 3. Relative performance impact of VProbes on the UnixBenchbenchmarks.

Fig. 4. Comparison between VMI-PL and VMware VProbes.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94 S93

Page 11: VMI-PL: A monitoring language for virtual platforms using ... · VMI-PL: A monitoring language for virtual platforms using virtual machine introspection Florian Westphal a, b, *,

use of x86 hardware-assistance for virtualization. The KVMprototype implementation is freely available under a liberalsoftware license.

Last, another result of our work is a new classificationscheme for VMI techniques. This classification schemeproved to be useful for the specification of our monitoringlanguage, due to the fact that it classifies VMI techniquesbased on their underlying mechanism of operation.

Acknowledgments

We would like to thank the anonymous reviewers fortheir helpful comments, and in particular Brendan Dolan-Gavitt, for his many helpful comments and suggestions inpreparing this paper and improving VMI-PL.

References

Adams K. Presenting VProbes http://x86vmm.blogspot.se/2007/09/presenting-vprobes.html; 2007.

Adelstein F. Live forensics: diagnosing your system without killing it first.Commun ACM 2006;49(2):63e6.

Biggs S, Vidalis S. Cloud computing: the impact on digital forensic in-vestigations. In: Internet Technology and Secured Transactions, 2009.ICITST 2009. International Conference for, IEEE; 2009. pp. 1e6.

Chen PM, Noble BD. When virtual is better than real [operating systemrelocation to virtual machines]. In: Hot Topics in Operating Systems,2001. Proceedings of the Eighth Workshop on, IEEE; 2001. pp. 133e8.

Cruz JCF, Atkison T. Evolution of traditional digital forensics in virtuali-zation. In: Proceedings of the 50th Annual Southeast Regional Con-ference. ACM; 2012. pp. 18e23.

Dehnert A. Intrusion detection using vprobes [Tech. rep]. VMware, Inc;2012.

Dinaburg A, Royal P, Sharif M, Lee W. Ether: malware analysis via hard-ware virtualization extensions. In: Proceedings of the 15th ACMConference on Computer and Communications Security, CCS '08. NewYork, NY, USA: ACM; 2008. pp. 51e62.

Dolan-Gavitt B, Payne B, Lee W. Leveraging forensic tools for virtualmachine introspection. Technical Report GT-CS-11e05. GeorgiaInstitute of Technology; 2011.

Dykstra J, Sherman AT. Acquiring forensic evidence from infrastructure-as-a-service cloud computing: exploring and evaluating tools, trust,and techniques. Digit Investig 2012;9:S90e8.

Fattori A, Paleari R, Martignoni L, Monga M. Dynamic and transparentanalysis of commodity production systems. In: Proceedings of theIEEE/ACM international conference on Automated software engi-neering. ACM; 2010. pp. 417e26.

Flores Cruz JC, Atkison T. Digital forensics on a virtual machine. In: Pro-ceedings of the 49th Annual Southeast Regional Conference. ACM;2011. pp. 326e7.

Fu Y, Lin Z. Space traveling across vm: automatically bridging the se-mantic gap in virtual machine introspection via online kernel dataredirection. In: Security and Privacy (SP), 2012 IEEE Symposium on,IEEE; 2012. pp. 586e600.

Garfinkel T, Rosenblum M. A virtual machine introspection based archi-tecture for intrusion detection. In: Proc. Network and DistributedSystems Security Symposium; 2003. pp. 191e206.

Hargreaves C, Chivers H. Recovery of encryption keys from memory usinga linear scan. In: Availability, Reliability and Security, 2008. ARES 08.Third International Conference on, IEEE; 2008. pp. 1369e76.

Hay B, Nance K. Forensics examination of volatile system data usingvirtual introspection. ACM SIGOPS Oper Syst Rev 2008;42(3):74e82.

Jones ST, Arpaci-Dusseau AC, Arpaci-Dusseau RH. Antfarm: trackingprocesses in a virtual machine environment. In: USENIX AnnualTechnical Conference, General Track; 2006. pp. 1e14.

King ST, Chen PM. Subvirt: implementing malware with virtual machines.In: Security and Privacy, 2006 IEEE Symposium on, IEEE; 2006. 14pp.

Krishnan S, Snow KZ, Monrose F. Trail of bytes: efficient support forforensic analysis. In: Proceedings of the 17th ACM conference onComputer and communications security. ACM; 2010. pp. 50e60.

Litty L, Lagar-Cavilla HA, Lie D. Hypervisor support for identifying covertlyexecuting binaries. In: USENIX Security Symposium; 2008.pp. 243e58.

Payne BD, de Carbone M, Lee W. Secure and flexible monitoring of virtualmachines. In: Computer Security Applications Conference, 2007.ACSAC 2007. Twenty-Third Annual, IEEE; 2007. pp. 385e97.

Pfoh J, Schneider C, Eckert C. A formal model for virtual machine intro-spection. In: Proceedings of the 1st ACM workshop on Virtual ma-chine security. ACM; 2009. pp. 1e10.

Pfoh J, Schneider C, Eckert C. Exploiting the x86 architecture to derivevirtual machine state information. In: Emerging Security InformationSystems and Technologies (SECURWARE), 2010 Fourth InternationalConference on, IEEE; 2010. pp. 166e75.

Popek GJ, Goldberg RP. Formal requirements for virtualizable third gen-eration architectures. Commun ACM 1974;17(7):412e21.

Srivastava A, Giffin J. Tamper-resistant, application-aware blocking ofmalicious network connections. In: Recent Advances in IntrusionDetection. Springer; 2008. pp. 39e58.

VMware, Inc. VProbes programming reference; 2011.Westphal F. Vmi-pl: a monitoring language for infrastructure-as-a-service

platforms [Master's thesis]. Hasso-Plattner-Institute, University ofPotsdam; 2014.

F. Westphal et al. / Digital Investigation 11 (2014) S85eS94S94