Skip to main content

DFIR KAPE : Evidence Collection

This post is an introduction on Kroll Artifact Parser and Extractor (KAPE) and how it can be used to collect evidences. 

When a malware is executed, it usually leaves some evidences about its execution. These are important details used for investigation and forensics. KAPE is an evidence acquisition tool and can be used to acquire all the evidence of execution from the victim's system.

The KAPE directory has two main folders. Modules and Targets. 

KAPE DFIR tool

KAPE Modules.

The modules directory contains different directories and inside it, we can see the module files with .mkape file extension. That is how the modules are identified. These modules defines how to process the collected evidence, can use scripts or the installed applications. To view all the available modules, browse the Kape directory or execute from the command line.

KAPE modules

Run kape.exe --mlist . to list all the modules. It is also mentioned in the .mkape file on how to format and store the evidence output. 


The bin folder contains the executable that the modules use in-order to process the collected evidence. When a module is selected to run, it will check the bin folder or the path mentioned in the module. For better understanding, see Example 4.below.

KAPE Targets.

The target defines what information needs to be collected as the evidence. Targets are found in the target folder with .tkape file extension.
To list all the available targets,

Run kape.exe --tlist .

KAPE target list

KAPE target list
As an example, take a look at the target "WindowsFirewall". This is used to define what data has to collect. It defines the log path for the windows firewall logs.

So, Modules define How to process the collected data and Targets defines What data needs to be collected. It is not mandatory to use modules if you don't wanted to process the collected evidences.

Now, let's talk about the KAPE command syntax.

Frequently used options are --tsource,-- tdest, and --target. However, there are a lot of granular options, that you can see just my running kape.exe from the CLI.

KAPE evidence collection

--tsource :  Target source drive to copy files from (C, D:, or F:\ for example)
--target : What configuration to use. Or what to collect? In the following example, i have used the target "RegistryHives", It is possible to specify multiple targets using a comma.
--tdest :  Destination directory to copy files to. Where to save the collected data.

Example 1:

In this first example, I want to collect the Filesystem evidences from a victim machine. 

--tsource , is the victim machine's C: Drive
--target , is the Filesystem evidence.
--tdest , is the thumb-drive i have attached to the victim's machines for collecting evidence.

KAPE example

Once the command is executed, the results will be stored in the attached thumb drive. This evidence can be used for further investigation and analysis.

KAPE example

Example 2: 

In this second example, my objective is to collect the information related to the Filesystem and Eventlogs.

KAPE example

kape.exe --tsource C: --tdest Z:\Ex1\ --tflush --target FileSystem,EventLogs --vss --vhdx Ex1

--tflush : Delete all files in 'tdest' prior to collection.
--vss : Malware could be hidden in shadow copies. This option Process all Volume Shadow Copies .
--vhdx : option to create a VHDX file. The collected evidences will be stored in a virtual volume.

KAPE vhdx tflush
After the command execution, we can see the disk image in the attached thumb-drive.
Example 4: 
In this example, i will use the KAPE GUI to collect an process the evidences. The objective is as follows.
Collect the event logs and parse the security logs. To achieve this, lets take a look at the module information.

Make sure the executable is present in the bin directory. If it's not, the module will not run. So in this example, the FullEventLogView_Security will use the FullEventLogView.exe executable to process the information from the collected evidence.Which mean first the evidence is collected as per the Target configurations and then the module will run.

KAPE module run
The target destination and the module source should be the same, because the module uses the collected evidences. Here i use the target Eventlogs and module FullEventLogView_Security. We can also notice that the command is automatically generated based on the settings.

Click on Execute to run. The command is executed and status will be shown in a terminal window. Notice how the module is using the executable to parse the evidence.

KAPE module run

Once the operation is completed, we can see the final processed data in the specified format.

KAPE module run







Popular posts from this blog

Download Microsoft Office 2019 offline installer.

When you do malware analysis of documents or office files, it is important to have Microsoft Office installed in your Lab machine. I am using flare VM and it doesn't comes with MS Office. Since Microsoft is promoting Microsoft 365 over the offline version, finding the offline installer is not that easy. Here is the list of genuine Microsoft links to download the office .img files.  Download Microsoft Office 2019 Professional Plus : https://officecdn.microsoft.com/db/492350F6-3A01-4F97-B9C0-C7C6DDF67D60/media/en-US/ProPlus2019Retail.img Download Microsoft Office 2019 Professional : https://officecdn.microsoft.com/db/492350F6-3A01-4F97-B9C0-C7C6DDF67D60/media/en-US/Professional2019Retail.img Download Microsoft Office 2019 Home and Business : https://officecdn.microsoft.com/db/492350F6-3A01-4F97-B9C0-C7C6DDF67D60/media/en-US/HomeBusiness2019Retail.img Download Microsoft Office 2019 Home and Student : https://officecdn.microsoft.com/db/492350F6-3A01-4F97-B9C0-C7C6DDF67D60/media/en-U...

RUST error: linker `link.exe` not found

While compiling Rust program in a windows environment, you may encounter the error : linker `link.exe` not found. This is because of the absence of the C++ build tools in your machine. For compiling Rust programs successfully, one of the prerequisites is the installation of the Build Tools for Visual Studio 2019.   Download the Visual Studio 2019 Build tools from the Microsoft website. After the download, while installing the Build tools, make sure that you install the required components (highlighted in Yellow) This will download around 1.2GB of required files. Once everything is successfully installed, reboot and re-run your rust program and it will compile successfully.   Read More on RUST Hello World Rust Program : Code explained RUST Cargo Package Manager Explained Data Representation in Rust.

Cisco ASA: Disable SSLv3 and configure TLSv1.2.

For configuring TLS v1.2, the ASA should run software version 9.3(2) or later. In earlier versions of ASA, TLS 1.2 is not supported.If you are running the old version, it's time to upgrade. But before that i will show you the config prior to the change. I am running ASA version 9.6.1 Now ,set the server-version to tlsv1.2, though ASA supports version tlsv1.1, its always better to configure the connection to more secure. Server here in the sense, the ASA will be act as the server and the client will connect to the ASA.     #ssl server-version tlsv1.2 set the client-version to tlsv1.2, if required.     #ssl client-version tlsv1.2 ssl cipher command in ASA offers 5 predefined security levels and an additional custom level.     #ssl cipher tlsv1.2 high we can see the setting of each cipher levels using #show ssl cipher command. Now set the DH group to 24, which is the strongest offered as of now in the AS...

How to Install Netmiko on Windows?

Netmiko, developed by kirk Byers is an open source python library  based on Paramiko which simplifies SSH management to network devices and is primarily used for network automation tasks. Installing Netmiko in linux is a matter o f one single command but if you need to use Netmiko in your Windows PC, follow this process. 1) Install the latest version of Python. 2) Install Anaconda, which is an opensource distribution platform that you can install in Windows and other OS's (https://www.anaconda.com/download/) 3) From the Anaconda Shell, run “ conda install paramiko ”. 4) From the Anaconda Shell, run “ pip install scp ”. 5) Now Install the Git for Windows. (https://www.git-scm.com/downloads) . Git is required for downloading and cloning all the Netmiko library files from Github. 6) From Git Bash window, Clone Netmiko using the following command git clone https://github.com/ktbyers/netmiko&#8221         7) Onc...

Recovery Procedure: Alcatel-Lucent Omni-Switch not booting AOS: Going to Mini-boot prompt.

Problem: Switch not booting AOS; Going to Mini-boot prompt. Model: Alcatel-Lucent OS6850 [Note:The same procedure might be applicable for different models of Omni-Switches, However, for this illustration, i have used OS-6850 ] Reason: This problem may occurs due to corrupt AOS image files or misconfigured boot parameters. Hence switch cannot boot the images properly and will go to Mini-boot prompt.  Work Around: [Note: This zmodem procedure consumes a lot to time to finish the process.] 1.) Power off your OS6850 2.) When you switched it back on, stop it before the Miniboot (there is some counter counting down from 4). Press Enter to break. 3.) You will have the following prompt " => " 4.) Enter " setenv baudrate 115200 ”. Increasing baudrate helps to increase the data transfer speed using zmodem. 5.) Enter " saveenv " 6.) Enter " boot " 7.) The switch should run now in baud rate 115200 (so you have to change your clients ter...

[FIX] yt_dlp.utils.DownloadError: ERROR: You have requested merging of multiple formats but ffmpeg is not installed

[ISSUE] While running your python code or while executing a job : yt_dlp.utils.DownloadError: ERROR: You have requested merging of multiple formats but ffmpeg is not installed [CAUSE] Your code is unable to find ffmpeg installed in your system. [FIX] Install ffmpeg in your system. 1) Download ffmpeg package from Git or already compiled executable from the official website .  2) Once downloaded, extract the zip file and place it in your desired location. eg: C:\  3) Now add the ffmpeg bin directory location in the user environment variable path.     In the User variables section. Select Path and click on New.  Click on New and add the path. Now compile your code and it should work. For the python code to download YouTube playlist, visit https://github.com/jaacostan/YTDL

[FIX] Can't locate Net/SNMP.pm in @INC (you may need to install the Net::SNMP module)

I was trying to use the snmpenum.pl in my lab and encountered this error. Can't locate Net/SNMP.pm in @INC (you may need to install the Net::SNMP module) I searched over the internet for the fix , but couldn't able to find something direct. However, going through some of the stackoverflow pages, i fixed it and is explained below. 1) First install the required packages related to snmp utilities. sudo apt-get install libsnmp-perl 2) Install the SNMP module for perl. perl -MCPAN -e 'install Net::SNMP' That's it. And i was able to run the script.