Practical Malware Analysis - Lab 1

6 minute read

This post is a part of the series of Practical Malware Analysis lab writeups.

Lab 1-1

This lab uses the files Lab01-01.exe and Lab01-01.dll.

Question 1: Upload the files to http://www.VirusTotal.com/ and view the reports. Does either file match any existing antivirus signatures?


fd068635f08cc7a2115d8fdffc088140.png

When uploading Lab01-01.dll to virustotal we can see that 42 out 69 AV engines detected this file.

a5de9d2695530666638498c8f0f205ea.png

For the Lab01-01 EXE file 46 out of 65 engines detected the file.

e9c58880a5dc12985d56043fd337c04c.png


Question 2: When were these files compiled?


We can use PEview to find the compilation date. When we first open the file using the tool we see the file’s raw data.

b4c71111fcff6b6cd4cf336b6d2cfc50.png

To find the compilation time we need click on the plus (+) symbol that is next to IMAGE_NT_HEADERS. After that we need to click on IMAGE_FILE_HEADERS. The Time Date Stamp description will give us our compilation time.

When we go through this process on the EXE file we can see that the compilation date was Sunday 12-19-2010 at 16:16:19 UTC.

6513a2e987dd98f4ffa41264ac9616d5.png

For the DLL file the compilation date was Sunday 12-19-2010 at 16:16:38 UTC.

56784e1585d6b37bb304c29e25ceda17.png


Question 3: Are there any indications that either of these files is packed or obfuscated? If so, what are these indicators?


Using the strings from Sysinternals we are able to see a good amount of strings for both files (EXE is on the left the DLL is on the right.

41373f9d69ddfc75cf9077cfe805ff08.png

We can investigate further by using a tool called PEiD. This tool can help us identify if the two files were packed.

PEiD tells us that neither the DLL file nor the EXE file are packed. (1st image is the DLL 2nd is the EXE)

28daeafe8db836b32d3a9cc9e12efe6e.png

2bef8ca122e3317afda348427c675532.png


Question 4: Do any imports hint at what this malware does? If so, which imports are they?


To the view the imports of the files we can use Dependency Walker.

When we run the tool with the EXE file we can see that the Kernel32.DLL is imported. Upon closer inspection it looks like there are a few functions that are used for creating and finding files.

5de2e05b2c05aab99f8a2293b455c01c.png

When we look at the DLL file we see that it imports the Kernel32.DLL and the WS2_32.DLL. From the Kernel32.DLL the DLL file uses the CreateProcess function. This means that we need to be on the lookout for new processes being spanwed.

4d31cbc98df1d59a5a090e6aeb3202f3.png

As stated earlier the Lab01-01 DLL also uses the WS2_32.DLL. The WS2_32.DLL is often used for networking functions and if the you want your program to connect to another network.

When we first take a look at the functions we are only given the ordinal number. This means that we need to match up the ordinal numbers with all the functions that can be imported. When we do this we see that the DLL file uses functions such as closesocket and connect.

461ef61a2ab46419491d6c5b79a9a6f7.png


Question 5 & 6: Are there any other files or host-based indicators that you could look for on the infected systems? What network-based indicators could be used to find this malware on infected machines?


When we take a closer look at the output from the strings command we ran earlier we can actually find a few host and network based indicators.

41373f9d69ddfc75cf9077cfe805ff08.png

The EXE file contains strings that say kerne132.dll where the L for kernel is replaced by a one. It also contains a path to this DLL C:\Windows\System32\Kernel32.dll. We can use this as an indicator and look for the DLL file after the malware has been ran.

From a network-based indicator perspective the Lab01-1 DLL file contains an IP address of 127.26.152.13 that can be found in the strings output. We can be on the lookout for connections that coming from and go to this address.


Question 7: What would you guess is the purpose of these files?


Based on the information we gathered I think that the malware’s purpose is to act as a remote shell. It reminds me of something that is similar to an exe file that connects a target back to a C2 server.

Lab 1-2

Question 1: Upload the Lab01-02.exe file to http://www.VirusTotal.com/. Does it match any existing antivirus definitions?


When uploading the file to virustotal we can see that 55 out 71 AV engines detected this file.

b14ffd48d15b8df3263f45ee5604db66.png


Question 2: Are there any indications that this file is packed or obfuscated? If so, what are these indicators? If the file is packed, unpack it if possible.


PEiD tells us that this file was packed with UPX v1.25(Delphi) Stub.

853784577e50bab715b7e3d9301275d5.png

We can unpack the file with UPX.

7a48d7376cb2c8fa6888b88ea6560926.png


Question 3: Do any imports hint at this program’s functionality? If so, which imports are they and what do they tell you?


This EXE imports a few DLLs. The DLLs to pay attention to are Kernel32, Advapi32, and Wininet. 6d86d4f9cee01561973dd17eaaf47484.png

Kernel32

Looks like it is used to create a thread and search for some module files.

5bc3d568e035e4fb08563385ac2d2165.png

Advapi32

This DLL is being used to create a service, start the service and to open the service control manager.

fcd01f4851db52764290f8894ac8158f.png

Wininet

This used to run some internet related operations and to open a URL. We may see some http or https traffic coming from this EXE.

cc915225c2700ade50b9018ea7de3978.png


Question 4: What host- or network-based indicators could be used to identify this malware on infected machines?


When we run strings we see a URL http://www.malwareanalysisbook.com. This can be treated as a network-based indicator. We can look for any connections going to and from the URL.

f16d57282131cbe9c3f63c13d1443ea8.png

Lab 1-3

Question 1: Upload the Lab01-03.exe file to http://www.VirusTotal.com/. Does it match any existing antivirus definitions?


When uploading the file to virustotal we can see that 51 out 70 AV engines detected this file.

44697c7510f4fda7be7b92b46c33660a.png


Question 2: Are there any indications that this file is packed or obfuscated? If so, what are these indicators? If the file is packed, unpack it if possible.


PEiD says that this file has been packed with FSG 1.0.

b10185e3896bf50de510cc6564f1f66c.png

Right now we don’t know how to unpack this file (based on the book) so we’ll revist the unpacking part later.


Question 3: Do any imports hint at this program’s functionality? If so, which imports are they and what do they tell you?


We can’t see much since the file is packed but we do know that it is importing the Kernel32.dll and is using the LoadLibrary and GetProcAddress functions.

ad1f0c8f1c871046af60c0dd64952702.png


Question 4: What host- or network-based indicators could be used to identify this malware on infected machines?


Besides the DLL information that we already knew about we don’t get any useful indicators when we run the strings. This due to the fact that the file is still packed.

10979d3173aaf175e71a83f3871c100f.png

Lab 1-4

Question 1: Upload the Lab01-04.exe file to http://www.VirusTotal.com/. Does it match any existing antivirus definitions?


When uploading the file to virustotal we can see that 52 out 66 AV engines detected this file.

32d771c80f9a77f8bddb4f5782e6fdf4.png


Question 2: Are there any indications that this file is packed or obfuscated? If so, what are these indicators? If the file is packed, unpack it if possible.


PEiD shows that the file is not packed.

93d0639549613df6b6b62284d34cc51f.png


Question 3: When was this program compiled?


The program was compiled Friday 8-30-2019 at 22:26:59 UTC

f98f29e8c50828e9c32beb14c04d057d.png

Question 4: Do any imports hint at this program’s functionality? If so, which imports are they and what do they tell you?


There are two imports that are worth noting: Kernel32 and Advapi.

4bbb3142770524e8b00234162c1c9fe2.png

Kernel32

This DLL is used to create a file, write a file, execute a file, load libraries, as well as other potentially malicious things.

eb7ba4098d0da301c0dfa5dafebe4628.png

Advapi

The DLL uses functions that look up privileges and opens process tokens.

60f480fef9e4617c500dbaa734cf96f9.png


Question 5: What host- or network-based indicators could be used to identify this malware on infected machines?


We can use the url http://www.practicalmalwareanalysis.com/updater.exe as a network indicator. We can also see that there is a file path \system32\wupdmgrd.exe and an EXE file \winup.exe that we can use as host based indicators.

a9414d62b178ecacb084ab2796566797.png


Question 6: This file has one resource in the resource section. Use Resource Hacker to examine that resource, and then use it to extract the resource. What can you learn from the resource?


Using Resource Hacker we can see that there is a bin file in the EXE.

89b5bb31ecbdfd477aca8c47b2d5ff60.png

We can save the file as a binary file and use Dependency Walker to view the imports.

When we look at the imports we see that there is a URLMON.DLL. This DLL allows the program to download a URL’s contents to a file.

80ff23a98a07755edc6b148989ff7cf0.png