Skip to content

Chapter 3

Lab 3-1

Analyze the malware found in the file Lab03-01.exe using basic dynamic analy- sis tools.

Analysis

  • As can be seen at the #Windows 10 Machine, doing dynamic analysis of the sample on a windows10 machine will result in the process werfault.exe to be generated. werfault.exe is a fault reporting mechanism of Windows 10.
  • Tested compatibility mode in two profiles Windows 7 and Windows XP and it will not work as well.
  • Addtionally, with reference to this articleand this too, this sample will not be able to run with Windows 10.
  • It seems like malware will only be able to run when a genuine Windows XP machine is used.
  • So we booted a #Windows XP Machine to detonate the malware and it worked!
  • From the ProcDot results below, we can see that Lab03-01.exe will create a new file vmx32to64.exe in system32 folder and add a new registry in HLKM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\VideoDriver to automatically start vmx32to64.exe on startup.
  • Additionally, Lab03-01.exe will also attempt to connect to www.practicalmalwareanalysis.com

Indicators of Compromise

Indicator Indicator Type Value
Hash (SHA1) Host 0BB491F62B77DF737801B9AB0FD14FA12D43D254
File Created Host Lab03-01.exe
WINDOWS\system32\vmx32to64.exe
Registry Host HLKM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\VideoDriver
URL Strings Network www.practicalmalwareanalysis.com

Screenshots

Lab03-01 Basic Static Analysis

  • Lab03-01.exe & vm32to64.exe
Information Screenshot
Classification Pasted image 20220623020204.png
Identifying Obfuscation & Packing Pasted image 20220623020318.png
Imports Pasted image 20220623020244.pngPasted image 20220623020250.png
Strings Pasted image 20220623020305.pngPasted image 20220623020309.png

Lab03-01 Basic Dynamic Analysis

Windows 10 Machine

Pasted image 20220621132320.png Pasted image 20220621132328.png

Windows XP Machine
  • Lab03-01.exe
Tools Screenshot
ProcDot Pasted image 20220622224826.png
Proc Exp (Strings) Pasted image 20220623105807.pngPasted image 20220623105814.png
Proc Exp Pasted image 20220623110537.png
Wireshark Pasted image 20220624200530.png
  • vmx32to64.exe
Tools Screenshots
ProcDot Pasted image 20220623110512.png
Proc Exp(Strings) Pasted image 20220623110613.png
Proc Exp Pasted image 20220623110601.pngPasted image 20220623110606.png
RegEdit Pasted image 20220623110624.png

Lab 3-2

Analyze the malware found in the file Lab03-02.dll using basic dynamic analysis tools.

Questions

Question 4.

Which filters could you set in order to use procmon to glean information?

Analysis

  • This is a .dll, hence we will need to use rundll32.exe to run it. Based on this [[Windows Internals#run32dll exe|guide]], to run a dll file with rundll32.exe, we will need to know what is exported and call the exported functions.
  • Based on the exports, we find that there are 5 functions Install, installA, ServiceMain, UninstallA, Uninstall.
  • Based on the #Lab 3-2 Reverse Engineering code, we can see that installA will call Install which will install a service IPRIP onto the computer.
  • This is further confirmed by our dynamic analysis where we ran the malicious DLL and observed the changes in the registry.
  • After running the installation we will need to start the malicious service that is created to complete the execution of the malware.
  • This can be done by running the command net start IPRIP.
  • When a service is started, a svchost.exe proces will be started and hence we can look for the malicious service by sifting through all the svchost.exe processes and look for one that loads Lab03-02.dll.
  • With the PID gathered using ProcExp and filter for the particular PID.

Indicators of Compromise

Indicator Indicator Type Value
Hash (SHA1) Host C6FB3B50D946BEC6F391AEFA4E54478CF8607211
Registry Host Various new registry keys in HKLM\System\CurrentControlSet\Services\IPRIP
URL Strings Network www.practicalmalwareanalysis.com
HTTP Traffic Network

Screenshots

Lab 3-2 Basic Static Analysis

Information Screenshot
Classification Pasted image 20220623020904.pngPasted image 20220625221326.png
Identifying Obfuscation & Packing Pasted image 20220623021419.png
Exports Pasted image 20220623020923.png
Imports Pasted image 20220623020932.pngPasted image 20220623020937.pngPasted image 20220623020942.png
Strings Pasted image 20220623021252.pngPasted image 20220623021317.png

Lab 3-2 Reverse Engineering

Description Screenshot
installA Pasted image 20220625223457.png
Install Pasted image 20220626140816.pngPasted image 20220626140857.pngPasted image 20220626140941.png
uninstallA Pasted image 20220625223756.png
UninstallService Pasted image 20220626141020.png

Lab 3-2 Basic Dynamic Analysis

DLL Execution Overview

Pasted image 20220625031359.png

  • Failed Run
Tool Screenshot
ProcDot Pasted image 20220625031251.png
  • Successful Execution
Tool Screenshot
ProcDot Pasted image 20220625031424.png
RegEdit Pasted image 20220625031518.pngPasted image 20220625031525.png
Autoruns Pasted image 20220625032844.pngPasted image 20220625032847.png
Starting Malicious Service
Tool Screenshot
ProcExp
ProcDot
apateDNS
HTTP Traffic

Lab 3-3

Execute the malware found in the file Lab03-03.exe while monitoring it using basic dynamic analysis tools in a safe environment.

Analysis

  • From our analysis, we can conclude that Lab03-03.exe is a loader that creates a svchost.exe process and injecting in memory into the process a keylogger.

Basic Static Analysis

  • From basic static analysis we can see that there is no signs of packing and obfuscation and some function imports and strings i.e SetThreadContext, WriteProcessMemory, NtUnmapViewOfSection that suggests that there is process hollowing going on.
  • We can also see that there is a resource named LOCALIZATION

Dynamic Analysis

  • Doing #Lab 3-3 Basic Dynamic Analysis we notice in ProcDot that Lab03-03.exe opens a svchost.exe process then kills itself. This svchost.exe process then writes into a file practicalmalwareanalysis.log and is still alive. This is a sign of process hollowing.
  • We open the file created to see that it is a keystroke log.
  • From process explorer we can see that there is a difference in strings of the image as compared to the strings of the memory of the svchost.exe process.
  • From the memory strings we can see strings that were not discovered during basic static analysis i.e UnhookWindowsHookEx, SetWindowsHookExA which are all imports that points to key logging.

Reverse Engineering

  • The reverse engineering confirms that there is process hollowing as the code pattern resembles the one explained here
  • Addtionally, we can see that there is a function that loads the resource LOCALIZATION and decodes the resource. As we can see from the decode function, XOR encoding was used.
  • Resource was extracted with resource hacker and decoded with cyberchef and we can see that there is MZ and This program cannot be run in DOS mode. which is the header for executables.
  • We then did some basic static analysis and we can see that there are some function imports that resembles the strings that are captured from memory.
  • Reverse Engineering of LOCALIZATION_decoded.bin we find a keyloggin function.

Indicators of Compromise

Indicator Indicator Type Value
Hash (SHA1) Host DAF263702F11DC0430D30F9BF443E7885CF91FCB
File Created Host practicalmalwareanalysis.log

Screenshots

Lab 3-3 Basic Static Analysis

Lab03-03.exe
Information Screenshot
Classification Pasted image 20220626172053.png
Identifying Obfuscation & Packing Pasted image 20220626172132.png
Imports Pasted image 20220626172231.png
Strings Pasted image 20220626172419.png
Resource Pasted image 20220626174536.png
LOCALIZATION_decoded.bin
Information Screenshot
Classification Pasted image 20220626175913.png
Imports Pasted image 20220626175935.pngPasted image 20220626180003.png
Strings Pasted image 20220626180140.png

Lab 3-3 Reverse Engineering

Lab03-03.exe
Functions Screenshots
Process Hollowing Pasted image 20220626145602.png
Loading Resource Pasted image 20220626174410.png
Decoding Resource Pasted image 20220626174338.png
Decoded Resource Pasted image 20220626175731.png
LOCALIZATION_decoded.bin
Function Screenshots
KeyLogging Pasted image 20220626181613.png

Lab 3-3 Basic Dynamic Analysis

Tool Screenshot
ProcDot Pasted image 20220626151824.png
ProcExp Pasted image 20220626152019.pngPasted image 20220626152106.png
File Created : practicalmalwareanalysis.log Pasted image 20220626152446.png

Lab 3-4

Analyze the malware found in the file Lab03-04.exe using basic dynamic analysis tools. (This program is analyzed further in the Chapter 9 labs.)

Analysis

  • Application quits and deletes itself preventing further analysis. Reverse engineering found that the application checks for several conditions before it executes and if some conditions are available it will terminate it's process and delete itself.
  • Hence we will need to patch the executable by changing the code flow in the debugger so that it bypasses this checking.

Basic Static Analysis

Dynamic Analysis

  • From ProcDot, we can see that the applicatin will run set a few registries in the HKCU and deletes itself.
  • No network connection was made even though there were imports and strings which suggests that this malware has such capabilities.
  • Likely, malware terminates itself after realising that it is in an unfavorable environment.

Reverse Engineering

  • Based on reverse engineering we found a function that will look for the executable file, delete the executable file and terminate the malicious process.
  • We also found that there are 7 instances of the function being called. Pasted image 20220627001254.png
  • These 7 instances are all within one function which does certain checks.
  • This function is then called by the entry function Pasted image 20220627003120.png

Indicators of Compromise

Indicator Indicator Type Value
Hash (SHA1) Host D6356B2C6F8D29F8626062B5AEFB13B7FC744D54
Registry Host Pasted image 20220627005519.png
URL Strings Network www.practicalmalwareanalysis.com

Screenshots

Lab 3-4 Basic Static Analysis

Information Screenshot
Classification Pasted image 20220626183432.png
Identifying Obfuscation & Packing Pasted image 20220626183456.png
Imports Pasted image 20220626185552.pngPasted image 20220626185632.png
Strings Pasted image 20220626185752.pngPasted image 20220626185827.pngPasted image 20220626185944.png

Lab 3-4 Basic Dynamic Analysis

Tool Screenshot
ProcDot Pasted image 20220626222757.png

Lab 3-4 Reverse Engineering

Function Screenshot
delete self and terminate process function Pasted image 20220627000818.pngPasted image 20220627000913.png
call delete and terminate function Pasted image 20220627001734.pngPasted image 20220627001838.pngPasted image 20220627002633.png
entry Pasted image 20220627004629.pngPasted image 20220627004758.png