Vera Manual

Download as pdf or txt
Download as pdf or txt
You are on page 1of 13

VERA Version 0.

31 User Manual and Documentation


Danny Quist, Ph.D. Los Alamos National Laboratory Advanced Computing Solutions February 7, 2011

Contents
1 Introduction 1.1 Recommended Hardware . . . . . . . . . . . . . . . . . . . . . . 1.2 License and Copyright Information . . . . . . . . . . . . . . . . . Installing VERA Ether 3.1 Installation Steps . . . . . . . . . . . 3.2 Setting up a Windows Virtual Machine 3.3 Generating Traces . . . . . . . . . . . 3.4 Generating the Traces . . . . . . . . . 3.5 Trace File Format . . . . . . . . . . . Intel PIN Based VERAtrace VERA GUI and Usage 5.1 Loading a Sample Trace File . . . . . . . 5.2 Interacting with the Graph . . . . . . . . 5.3 Identiying Program Constructs in VERA 5.4 Interacting with IDA Pro . . . . . . . . . 1 1 1 2 2 2 3 3 3 4 5 6 6 7 8 9

2 3

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

. . . . .

4 5

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

INTRODUCTION

Introduction

VERA is a visualization tool for analyzing compiled executables. It is built on an OpenGL framework with the wxWidgets package. The current version is only for use with the Windows XP and higher operating system. This manual will detail the steps that are needed to run and analyze a sample of malware. There are two ways to generate trace data for VERA. The rst is with the Ether hypervisor. Ether is a set of patches made to the Xen hypervisor that allows for covert analysis of running processes. It makes an ideal environment to monitor and trace running programs. More information is available from the Ether website 1 . The next option is to use the VERA Trace Intel PIN module. This is a much simpler way of running traces and can be used inside any virtual machine. When available, choose the Ether system for generating traces. Ether is more resilient to detection over the Intel PIN based Veratrace.

1.1

Recommended Hardware

VERA is implemented using the OpenGL system with the wxWidgets API. In order to get the best results out of VERA, we strongly recommend you run it on a machine with a hardware graphics accelerator. The code was developed using an Nvidia GTX 285 and subsequently tested on a variety of other cards.

1.2

License and Copyright Information

This program was prepared by Los Alamos National Security, LLC at Los Alamos National Laboratory (LANL) under contract No. DE-AC52-06NA25396 with the U.S. Department of Energy (DOE). All rights in the program are reserved by the DOE and Los Alamos National Security, LLC. The U.S. Government retains ownership of all rights in the program and copyright subsisting therein. All rights not granted below are reserved. This program may be used for noncommercial, nonexclusive purposes for internal research, development and evaluation and demonstration purposes only. The right to reproduce, distribute, display publicly, prepare derivative works or compilations thereof is prohibited. NEITHER THE UNITED STATES NOR THE UNITED STATES DEPARTMENT OF ENERGY, NOR THE LOS ALAMOS NATIONAL SECURITY, LLC, NOR ANY OF THEIR EMPLOYEES, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR USEFULNESS OF ANY
1

Ether Website: http://ether.gtisc.gtech.edu

Page 1 of 11

ETHER

INFORMATION, APPARATUS, PRODUCT, OR PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS.

Installing VERA

Installing VERA is very straight forward. Simply download the package from Offensive Computing 2 and double-click on the installation le. The les will be installed into the standard program les directory unless you specify otherwise. To execute VERA either nd the VERA directory in program les and doubleclick the wxvera.exe le, or nd the shortcut that was placed in your start menu.

Ether

Installing the Ether patches to Xen can be an interesting experience. This section will attempt to aide you in this process. As always please consult with the ofcial Georgia Tech Ether website for the most up to date information.

3.1

Installation Steps

There are some general steps to install an Ether system. Most of the problems that many people have are related to trying to compile the source from scratch. To make this process easier we have provided a precompiled Debian package. This alleviates many of the problems that most are having with the installation. Following these steps exactly will get you through much of the difculty. 1. Download and install the Debian AMD64 net installation ISO 3 . Youll need to get the Lenny release of Debian. Also make sure to get the 64-bit version installed. 2. Install the required packages for a working Xen system. A complete list can be found at Offensive Computing 4 . 3. Next install the Ether system. There are two methods for doing this: from source or from a Debian package. We have prepared a Debian package that may alleviate some of the problems of compiling from source 5 .
2 3

http://www.offensivecomputing.net/vera/ http://www.debian.org/CD/netinst/ 4 http://www.offensivecomputing.net/ether install packages.log 5 http://www.offensivecomputing.net/?q=node/1575

Page 2 of 11

ETHER

4. Make sure that the Grub conguration matches your system installation. While the package we have prepared does a decent job of preparing the menu.lst le, there are some problems that may arise. Figure 1 has an example of a working conguration le. 5. Reboot and verify that your new Xen/Ether system is up and running. title Debian GNU/Linux, kernel 2.6.26-2-xen-amd64 root (hd0,0) kernel /boot/xen-3.1.0.gz dom0_mem=1G module /boot/vmlinuz-2.6.26-2-xen-amd64 root=/dev/sda1 ro quiet module /boot/initrd.img-2.6.26-2-xen-amd64 Figure 1: An example GRUB menu.lst le for a working Ether installation

3.2

Setting up a Windows Virtual Machine

Creating a virtual machine after Ether is installed can be problematic. There is a bug that will freeze the installation during the install programs execution. To get around this problem, simply boot into a non-Ether patched system when you are rst conguring a VM. Ensure that you have followed the VM installation instructions from Georgia Tech 6 . Failure to create a proper VM will result in crashes and other problems. Once your system is installed, you can begin taking traces for use inside of VERA.

3.3

Generating Traces

The primary unit of data that VERA operates on is a trace le. The format for the traces is the output from the Ether instrtrace command. The output generally contains a listing of addresses and the associated instruction that is executed. VERA loads this trace le, processes it, then outputs a graph markup language (GML) formatted le. VERA can display GML les without any additional processing.

3.4

Generating the Traces

This section will overview generating traces inside of Ether. The example that will be used is the notepad.exe le. First, start up a virtual machine inside of your Ether
6

http://ether.gtisc.gatech.edu/xen install windows.pdf

Page 3 of 11

ETHER

system. Once the OS is booted, the virtual machine ID will be needed. To nd the ID, simply run the xm list command. This will display a listing of running virtual machines. This ID is necessary to run Ether. Next execute ether using the following command: ether_ctl instrace # notepad.exe > notepad.trace Be sure to substitute the # with the VM ID from the xm list command. This will generate a text listing of some initial Ether boiler plate, and the instruction traces used to build the later GML le. Transfer the notepad.trace le to your analysis machine where VERA is installed. Section 5 details loading the trace les in the GUI.

3.5

Trace File Format

If you would like to generate your own trace les for use in VERA, they must have a specic format matching the Ether instruction traces. The beginning of the le should match the output from Figure 2. After init: shared_page_ptr: 0xffff830000fd9000 shared_page_mfn: 0xfd9 domid_source: 0 event_channel_port: 34 Shared Page va: 0x7fde19b77000 Shared Page test: Page-Sharing is A-OK! Trying to bind to local port... Success, bound to local port: 35 Trying to get first pending notification... Taking off suprious pending notification... Setting filter by name to: notepad.exe Execution of Target detected: Image Base: 0x1000000 Image Size: 0x14000 Entry Point: 0x100739d Figure 2: The starting boilerplate for an instruction trace.

Page 4 of 11

INTEL PIN BASED VERATRACE

Next will be the instruction traces. As shown in Figure 3, the format is a hex virtual address, that should match the contents of the executable, and the ASCII representation of the instruction. 100739d: 100739d: 100739f: 10073a4: 1007568: 100756d: 1007573: push push push call push mov push 0x70 0x70 0x01001898 0x01007568 0x010075BA eax, fs:[0x00000000] eax

Figure 3: The contents of the instruction trace portion. Finally the end of the le should contain the string Handling sigint twice. This denotes the end of a trace. Figure 4 shows an example of this data. Once this is completed the les should be parsable by VERA and will generate graphs. 1007519: 100751b: 100751c: Handling Handling jnz 0x01007522 push esi call [0x1001318] sigint sigint Figure 4: The ending structure of the trace le. A full sample le can be found on the VERA webpage 7 .

Intel PIN Based VERAtrace

VERAtrace is a tracing system based on the Intel PIN monitoring framework. It can be used to generate similar traces as can be found from Ether, but does not require a full Xen/Ether installation. Traces also include an import resolution system, which can be displayed in the VERA GUI. To generate traces, you will need the following les from your VERA installation directory: pin.exe
7

http://www.offensivecomputing.net/vera/notepad.trace.gz

Page 5 of 11

VERA GUI AND USAGE

pinvm.dll taipin.dll veratrace.dll The above les may be copied to any virtual machine as long as it is running in 32-bit mode. To run a trace, simply execute the command listed in Figure 5 pin.exe -t veratrace -- \\windows\\system32\\sol.exe Figure 5: Command line execution of veratrace of the Windows XP Solitaire program The output will be a trace le with the name of the executable (minus the directory) along with the PID used to run the program. The output of the command in Figure 5 was the le named sol.exe-2015.trace. This le can then be copied to where you run VERA and processed normally.

VERA GUI and Usage

The VERA GUI is a front-end to allow you to quickly visualize and explore a programs execution trace. Once you have a trace le generated, VERA can be used to process and generate a graph. This process converts the trace into a GML le that can be loaded and explored in the GUI.

5.1

Loading a Sample Trace File

Included in the VERA executable distribution is a sample trace le that contains a runtime trace of the notepad.exe program from a standard Windows XP service pack 2 installation. To load the program, simply use the open folder in the tool bar or the File Open menus and nd the trace le named notepad.trace. A separate window will open resembling Figure 6. Two pieces of information must be entered in these elds. The rst is the original executable for the le. This le is needed to analyze the running sections of the executable to color the graph. The second piece of information is the name to use to store the GML le. The name you enter here will be the source for the output names based on the type of graph youre looking for. The next options are for processing a graph that has all the addresses rendered as a node in the graph. Rendering all the addresses as vertices is referred to as All Addresses mode. To only render the beginnings and ends of

Page 6 of 11

VERA GUI AND USAGE

Figure 6: The dialog for processing traces within VERA. basic blocks, select the Basic Block check box. Once you are ready to process the trace le click the Finish button. A new thread will be created to show you the results of your graph that you have built. Figure 7 shows the results of parsing the Notepad trace. Depending on the options, two different graphs can be created. The rst will be the all vertices graph. This will have the name of all-yourgraphname.gml. The second is the basic blocks graph. This will have the name of bbl-yourgraphname.gml. The default behavior is for VERA to load the all- le. If you wish to load the basic blocks graph, you will need to load the BBL le using the standard le-open process.

5.2

Interacting with the Graph

Interaction with the generated graphs was designed to emulate many common 2D navigation systems. If you are familiar with the Google Maps interface it is very similar to that. There are two methods for moving a graph: First by panning left,

Page 7 of 11

VERA GUI AND USAGE

Figure 7: The resulting graph from processing the notepad trace. right, up, and down. The second is to zoom in and out. All are accomplished with the mouse key. Table 1 lists each of the controls for interacting with the graph. Action Pan Left Pan Right Zoom In Zoom Out Navigate in IDA Mouse Control Left Mouse, drag left Left Mouse,drag right Mouse wheel up Mouse wheel down Right-click

Table 1: Mouse controls for actions.

5.3

Identiying Program Constructs in VERA

Various features in the graph correlate to features inside of the code. First, any series of addresses that have exactly one entrance, and one exit, that are not part of a loop can be safely considered initialization code. Many of the constructs also show up in multiple areas of the executable. The initialization portion of the Notepad graph in Figure 7 shows an initial series of instructions, followed by a loop prior to entering the main portion of execution. This is a very common shape

Page 8 of 11

VERA GUI AND USAGE

that is created by Microsoft compilers. A section of code that shows a branching operation, such as illustrated in Figure 8 correlate to a decision point in the program. Please note that if the branch always takes a single path, the structure will not be shown in the graph. This is because VERA relies upon traces of execution from the code, and does not note the possible paths of execution available.

Figure 8: A series of branching operations from the Notepad.exe program. Whenever a portion of code is executed multiple times, the edges between the nodes is drawn with a thicker width. This allows for quicker identication of the most commonly used areas of code. For instance, if a messaging processing loop is present in a program, that loop will be highlighted. Figure 9 shows a loop in the Notepad program.

5.4

Interacting with IDA Pro

A new feature in VERA 0.3 is the interaction capability with a program loaded in IDA Pro. This alleviates the need to separately interact with IDA and manually Page 9 of 11

VERA GUI AND USAGE

Figure 9: A loop with multiple branches inside the Notepad.exe program. entering the addresses. To initiate a connection to an IDA system, you will need a couple of things. First, of course, is a copy of IDA Pro. The VERA-IDA plugin will need to be installed so that you can successfully interact with IDA. You can download a copy from Offensive Computing 8 . Precompiled versions of the IDA module are available for version 5.6 and later of IDA Pro. The source code is available for earlier versions of IDA, and youre welcome to try to compile it. They are not, however, ofcially supported. The plugin should be copied into the plugins directory of the IDA Pro installation directory. Once this has been done, you will need to restart IDA. Once the module has been installed and IDA has been restarted, you should see a message in your IDA console that looks very similar to Figure 11. If you do not see the message then you will need to verify that the IDA plugin was installed correctly. To start the IDA Pro server, click on the IDA Pro icon in the toolbar. From here the server should be started. Next, you will need to gure out the IP address
8

http://www.offensivecomputing.net/vera

Page 10 of 11

VERA GUI AND USAGE

VERA Socket Connection

IDA Pro

(Server)

(client)

Windows w/ OpenGL

VM / or Analysis Machine

Figure 10: Architecture of the VERA IDA Plugin

Figure 11: IDA console text showing the IDA Pro module loaded correctly. of your computer that is executing VERA. A TCP/IP connection is made from the IDA Pro system to the VERA system. This allows you to take advantage of virtual machines when analyzing the malware. This architecture was chosen to allow for an IDA Pro instance on a virtual machine talk to VERA running on a machine with a real hardware graphics accelerator.

Page 11 of 11

You might also like