- 31.03.2020 02:57:57 (main dropper migwiz.exe)
- c36aabe2828b84a1221a8855b984187b89c24b44 (first-stage dropper in the form of the SFX RAR archive dlhost.exe)
- 632f6737f5308b49cc198fea88338a3403732274 (main dropper migwiz.exe)
A trojan dropper designed to spread and install other malicious applications onto the targeted computers. The malware is written in C and supports 32-bit and 64-bit Microsoft Windows operating systems. The analyzed sample was used to spread the BackDoor.Whitebird.23 trojan.
The sample in question was distributed inside the SFX RAR archive containing the following files:
- migwiz.exe – the main dropper
- migwiz3.DAT – an encrypted shellcode with the payload for 32-bit Microsoft Windows operating systems
- migwiz6.DAT – an encrypted shellcode with the payload for 64-bit Microsoft Windows operating systems
Main dropper migwiz.exe
Upon launching, it enables the following system privileges for its own process:
Next, depending on the bitness of the operating system, it reads the migwiz3.DAT or migwiz6.DAT file located in the same directory from where the trojan was launched. If it has administrator rights, it saves the contents of the corresponding file into the [HKLM\Software\Microsoft\MigWlz\Options] registry key with the Setup value. If it doesn’t have appropriate rights, it saves the file contents into [HKCU\Software\Microsoft\MigWlz\Options] registry key with the Setup value.
These keys store the payload that the trojan will extract and launch later (see the “The payload” section below).
If the dropper was launched with administrator rights, it sets an autorun option for the IKEEXT service. It then checks if the %WINDIR%\System32\wlbsctrl.dll file exists. If the file exists, the trojan fills it with random data, deletes the file and replaces it with the new one, which is encrypted and packed through the RtlCompressBuffer and stored in its body. To decrypt the file, it uses the following script:
def decrypt(data): a = b = c = d = struct.unpack('<I', data[:4]) s = bytearray() for i in range(len(data)): a = (a + (a >> 3) - 0x3C6312B6) & 0xffffffff b = (b + (b >> 5) - 0x62B652F6) & 0xffffffff c = (c + 0x6251F3E2 - (c << 9)) & 0xffffffff d = (d + (0xCD56823E - (d << 7))) & 0xffffffff s.append(data[i] ^ ((a + b + c + d) & 0xff)) return s
With that, the trojan writes a large block of the random data into the end of the extracted file. This block starts with the 0xcc90 signature and has the size of 0x8FF1B6 bytes for the 64-bit library and the size of 0x8FF437 bytes for the 32-bit library.
The trojan sets the same date of creation, access and modification for the extracted library as the %WINDIR%\System32\rundll32.exe system file has. After that, it launches the IKEEXT service, which loads the malicious library into the memory.
If the trojan was launched without administrator rights, it checks if the %ProgramData%\migwiz directory exists. If it exists, the trojan fills every file in it with the random data and deletes these files. Next, it deletes the directory itself.
After that, the trojan recreates this directory and places the migwiz.exe and migwiz.dll files, which it extracts from its body, into this catalogue. Herewith, the library migwiz.dll represents the same library that is saved into the %WINDIR%\System32\wlbsctrl.dll directory if the trojan has the appropriate administrative rights.
The trojan then adds the migwiz.exe file to the autorun list, creating the [HKCU\Software\Microsoft\Windows\CurrentVersion\run] registry key with the migwiz parameter.
For the migwiz.exe and migwiz.dll files, as well as for the directory where they are located, the trojan sets the same date of creation, access and modification as the rundll32.exe system file has. It then launches the migwiz.exe file.
Searches for the dll libraries that are located in the same directory with it and loads them into the memory.
Uses the mutex to ensure only one copy of the trojan is running at the same time. If the trojan is launched as a service, the mutex has the Global/Configer name. In other cases, the mutex has the LocalConfiger name.
Depending on how the trojan is launched, the loader reads the payload from the [HKLM\Software\Microsoft\MigWlz\Options] 'Setup' or [HKCU\Software\Microsoft\MigWlz\Options] 'Setup' registry keys.
If the reading was successful, the payload is decrypted with the XOR operation and the 0x90.
Next, if the trojan was launched as a service, it injects the payload into the running explorer.exe process. Otherwise, it injects the payload into its own process.
The payload is stored in the Windows registry, where it is placed at the initial stage of infection after it was read from the migwiz3.DAT and migwiz6.DAT files. It contains the shellcode that obtains the addresses of the minimum number of functions required by the trojan and loads it from its own body as an MZPE file. This file represents a dll library detected by Dr.Web as BackDoor.Whitebird.23.