Practical Malware Analysis Chapter 1 Lab 4

After falling down the rabbit hole of unpacking the previous sample, this one will be a bit shorter again.
Questions
- Are there any existing signatures for the sample on virus total ?
- Are there indications that the file was obfuscated or packed ? If the file is packed, unpack it if possible.
- When was the program compiled ?
- Do any imports hint at the programs functionality ? If some which imports are they and what do they tell you ?
- What host- and network-based indicators could be used to identify this malware on infected machines ?
- This file has one resource in the resource section. Use resource hacker to examine that resource, and then use it to extract that resource. What can you learn from the resource ?
Basic static analysis
Online Resources
Hashes
- MD5
625ac05fd47adc3c63700c3b30de79ab
- SHA1
9369d80106dd245938996e245340a3c6f17587fe
- SHA256
9369d80106dd245938996e245340a3c6f17587fe
Strings
|
|
Imports
kernel32.dll
|
|
advapi.dll
|
|
At first glance, the simple does not seem to be packed. The signature shown by Detect it easy
identifies the sample as a 32-Bit Windows PE file.
So far so good.
We can already spot a lot of interesting stuff here.
The imports detected by are also quite interesting. We can see imports from advapi.dll
which can be used to look up and adjust privileges on security token.
We also can see imports from kernel32.dll
for opening processes (OpenProcess
), creating threads in other processes (CreateRemoteThread
), writing (WriteFile
) and moving (MoveFileA
) files as well as functionality which can be used to obtain a handle to a resource in memory (LoadResource
)
The extracted strings contain an URL, http://www.practicalmalwareanalysis.com/updater.exe
, which looks like a link to another executable file.
Also, there are two occurences the known string contained in the DOS header of Microsoft PE files, !This program cannot be run in DOS mode.
Taking a closer look at the output of Detect it easy
we can see that there is a resource contained in the binary which itself is a 32-bit PE file.
This also explains the second occurences of known section names such as .text
.
Extracting the resource
The book mentions Resource Hacker as a possible tool to be used to extract a resource, like icos, from binary files.
As I did’t install it yet, I decided to take a more archaic approach by opening the sample in a Hex Editor, search for the .rscr
section of the file and locate the Magic Bytes MZ
to see where the attached PE File started.
After finding the location I just dumped all the bytes , beginning with MZ
, to another file.
Loading the extracted file into Detect it easy
shows us that this is indeed a 32-bit Windows PE file.
Hashes
- MD5
ee5a2eaddb0050ea8d1c54a7811db9ab
- SHA1
8220bcd7f2850d55234bf633146d997c6d897688
- SHA256
bb1252dab9f573d7517083925db5fc6d8496afb56928cc848ad108c27542c448
Imports
kernel32.dll
|
|
urlmon.dll
|
|
Answers
- There are existing signatures on VT. Most of them hint at a
Win32 Trojan/Download
- There seem to be no indicators that the sample is packed. But
detect it easy
shows us that a Win32 PE File is attached as a resource to the sample. After extracting it we can see that according to PE bear it is an executable. This might obfuscate the full functionality of the sample to people only looking at the.text
section of the sample. - The File Header for the actual sample
Lab01-04.exe
shows a compilation timestamp ofFriday, 30.08.2019 22:26:59 UTC
. The extracted resource shows a timestamp ofSunday, 27.02.2011 00:16:59 UTC
. - The program’s imports from
kernel32.dll
include functions for loading a executable file from memory withLoadResource
, opening a process withOpenProcess
as well as retrieving a handle to the current process withGetCurrentProcess
. This could be used to run code attached to the resource section of the program. The sample also imports functionality for creating and moving Files on the system (CreateFileA
,MoveFileA
) which might be an indicator that the malware tries to persist itself on disk. Taking a look at the code extracted from the sample’s resource we see that it usesurlmon.dll
to importURLDownloadToFileA
. This might be used to download the theupdater.exe
file from the URL found in the strings. - I found an URL in the extracted strings
http://www.practicalmalwareanalysis.com/updater.exe
, communication to this URL and the domain can be used to monitor the network for traffic to them - The extracted resource is a PE file itself, the extracted code contains imports from
urlmon.dll
which can be used to download a file from the internet (URLDownloadToFileA
). The code also imports functions to retrieve the windows and temp directory as well asWinExec
. It looks like the attached PE file from the resources is used to download a file and executing it on the system.