Skip to main content

Rapid malware execution investigation via velociraptor, excel

 We will be using velociraptor and excel to find out malware execution on the system by differential analysis. 

Context = Any true positive alert you get or you were targeted by a sophisticated advanced persistent threat. We need actionable intelligence to pivot more.

Workflow:

Following the below two links, collect the build the collector and collect the artifacts first from the fresh system and the infected system. 

https://mahimfiroj.blogspot.com/2026/09/windows-rapid-triage-with-velociraptor.html

https://github.com/secure-cake/win-mal-investigations (Preferred) 

Reference file: SLIDES_Windows-Malware-Investigations-02082024.pdf (Saved on my ovi.it88 google drive)

Here we also have some important script that will be helpful during IR.

https://github.com/secure-cake/win-mal-investigations/tree/main/misc-powershell

Once collection is done, now we need to follow the following workflow again from the 4th point:


In this case the artifacts does not require parsing. Here we will use excel to combine baseline and infected system data into a single workbook then we will use some excel conditional formatting to find the malicious thing that is not present on the baseline. We need to stage our data on the analysis system and make sure the folder naming hierarchy matches with this script - WinMal_Target_Baseline_Excel.ps1

Follow this. Need to do this on analysis system.
  • A "baseline" folder (copy your baseline ZIP file here): "c:\cases\demo\baseline"
  • A "target" folder (copy your target ZIP file here): "c:\cases\demo\target"
  • Output directory for combined output and the Excel Workbook: "c:\cases\demo\output" (this is AUTO-CREATED by the script)
Now run the script. It will generate the excel - target-with-baseline-output.xlsx in the output folder. 

Now we need to perform the Differential Analysis:

Now open this file target-with-baseline-output.xlsx

You may see like excel is unable to show you the view properly. So do this. 


You need to first select all the sheets. 


Now click here (red arrow) to select all cells. Now right click and select Row Height and set the value as 16. Now select all the columns in each sheet and double click to any column to expand as per your need. 

https://www.youtube.com/watch?v=TsTBnAo07ks

From the Automate tab, click New Script > Create in Code Editor > Write a Script

Click on the default Script name and change it as for example: dns-diff:

And paste this on the editor section.

function main(workbook: ExcelScript.Workbook) {

    let conditionalFormatting: ExcelScript.ConditionalFormat;

    let selectedSheet = workbook.getActiveWorksheet();

    // Create custom from range A:A on selectedSheet

    conditionalFormatting = selectedSheet.getRange("A:A").addConditionalFormat(ExcelScript.ConditionalFormatType.custom);

    conditionalFormatting.getCustom().getRule().setFormula("=COUNTIF('baseline-dns'!$A$1:$A$100,A1)=0");

    conditionalFormatting.getCustom().getFormat().getFill().setColor("#ffe699");

    conditionalFormatting.setStopIfTrue(false);

    conditionalFormatting.setPriority(0);

  // Set height of row(s) at all cells on selectedSheet to 15

  selectedSheet.getRange().getFormat().setRowHeight(15);

}

https://github.com/secure-cake/win-mal-investigations

In the above link, you will get all the scripts. 

Now do the same steps 5 times more for the other 5 scripts.

Now you can select a "target" worksheet, eg "target-netstat," click "run" to execute the "netstat-diff" code (you need to see which sheet you are currently in and that corresponding script you need to run), and all items that are UNIQUE to the "target-netstat" NAME will be highlighted "yellow" for your review! Repeat this for each worksheet: select the "target" worksheet, then click the associated "worksheet-diff" automation function.

This is how it look like for target-dns sheet:






Avi

Comments

Popular posts from this blog

API hacking lab setup

 Follow the commands to install and configure API hacking lab: 1. Install kali linux and update all the packages.  apt update -y apt upgrade -y or apt dist-upgrade -y or apt full-upgrade -y If you face any problem regarding update, install cloud flare warp in the host machine, then again start updating packages in your kali vm.  2. Install and configure burpsuite professional.  After that open burpsuite and go to Extensions tab. Click on BAppStore. Search for Autorize extension, It will help us to automate authorization testing. Click on Download Jython from the right side. From Jython website click on Jython standalone JAR and save it. Go to Extensios > Extensions settings >  under Core extension settings find out Python environment on the right pane. Select the jython jar file that you just downloaded. Now again go to BAppStore and re-search for Autorize extension. You will see Install option this time after selecting Autorize extension. Install it. You ...

Disk acquisition and access for IR

 Goal for this lab is after we acquire the disk in .E01 format then how can we mount this to linux system for analysis.  দুইটা scenario cover করছি: (A) simple E01 + LVM (single disk), (B) E01 + Software RAID + LVM (multi-disk, যেমন disk1/disk2) From the linux analysis vm like sansforensic vm, you need to run the following commands.  We need to first create the working directories : mkdir -p /mnt/case/img /mnt/case/data E01 + LVM (single disk) - First case. Step 1 — E01 mount: ewfmount Webserver.E01 /mnt/case/img ls -lh  /mnt/case/img total 0  -r--r--r-- 1 root root 32G Feb 16 18:21 ewf1 Ewf1 is a raw disk image. It's size and main disk size are same. This is in read-only mode. See the permission. Step 2 — See the partition layout : mmls /mnt/case/img/ewf1 কোন offset-এ কোন partition আছে (boot, lvm ইত্যাদি) note করুন। RAID sign ( 0xfd ) আছে কিনা খেয়াল করুন — থাকলে Scenario B তে যান। lvscan | grep VulnOSv2-vg mount -o ro,noexec /dev/VulnOSv2-vg/root /mnt/case/dat...

How to use vim efficiently

  Here every command works in command mode . And if you need to write something then you need to go to Insert mode . Pressing i will take you to the insert mode.  1. Let's say you want to search something. For example you want to find avi keyword. Then first you need to go to the command mode by typing Esc . Now type /avi  (at the bottom) and hit enter. Press small n to forward this search pattern and press Shift N to go reverse.  2. Substitute something: :%s/old string/new string/g    (g for affecting globally) 3. If you want to pick the 1st letter of word then press w and last letter of word then press e .  4. yy means copy a single line. 2yy means copy double lines.  5. Shift P is for paste.  6. Shift D to delete a line or cut a line.  7. Press o to go a new line.  8. Press Home to go to the 1st letter of a line and End to go to the last letter of a line.  9. If you want to save the file then press wq! . 10. If ...