Research August 14, 2023

A technical analysis of the Underground ransomware deployed by Storm-0978

Executive summary

The Underground ransomware is the successor of the Industrial Spy ransomware and was deployed by a threat actor called Storm-0978. The malware stops a target service, deletes the Volume Shadow Copies, and clears all Windows event logs.

The files are encrypted using the 3DES algorithm, with the key and IV being encrypted using an RSA public key. The ransomware deletes itself after the file encryption is complete. The extension of the encrypted files isn’t changed, but four specific bytes are added at the end of them.

Analysis and findings

SHA256: d4a847fa9c4c7130a852a2e197b205493170a8b44426d9ec481fc4b285a92666

The malware retrieves the command line arguments using the GetCommandLineW and CommandLineToArgvW functions:

Underground-Ransomware-Figure-1
Figure 1

The ransomware can run with a single parameter, which represents a single directory to be encrypted.

The GetWindowsDirectoryW API is used to obtain the path of the Windows directory (see Figure 2).

Underground-Ransomware-Figure-2
Figure 2

The malware implements the obfuscation technique called “stack strings”, which splits plaintext strings and constructs them at runtime:

Underground-Ransomware-Figure-3
Figure 3

The malicious process deletes all Volume Shadow Copies using vssadmin.exe tool:

Underground-Ransomware-Figure-4
Figure 4

The time limit for disconnected RDP sessions is modified using the ShellExecuteW method, as highlighted in Figure 5.

Underground-Ransomware-Figure-5
Figure 5

Finally, the binary stops the MSSQLSERVER service:

Underground-Ransomware-Figure-6
Figure 6

The process creates a new thread that executes the StartAddress function:

Underground-Ransomware-Figure-7
Figure 7

Thread activity – StartAddress function

The ransomware embedded an RSA public key that will be used to encrypt the 3DES key and IV:

Underground-Ransomware-Figure-8
Figure 8

The ransom note content can be also identified in the malware’s body:

Underground-Ransomware-Figure-9
Figure 9

The executable computes the MD5 hash of the RSA modulus, which represents the victim’s ID:

Underground-Ransomware-Figure-10
Figure 10
Underground-Ransomware-Figure-11
Figure 11

The ransom note containing a TOR link and credentials is modified to include the above victim’s ID:

Underground-Ransomware-Figure-12
Figure 12

The FindFirstVolumeW API is utilized to begin scanning the volumes on the machine:

Underground-Ransomware-Figure-13
Figure 13

The malicious process obtains a list of drive letters for the specified volume via a function call to GetVolumePathNamesForVolumeNameW:

Underground-Ransomware-Figure-14
Figure 14

GetVolumeInformationW is used to extract information about the file system and volume associated with the drives:

Underground-Ransomware-Figure-15
Figure 15

The ransomware continues the volume search by calling the FindNextVolumeW method:

Underground-Ransomware-Figure-16
Figure 16

For each of the drives to be encrypted, the binary creates a thread that handles the files encryption (Figure 17).

Underground-Ransomware-Figure-17
Figure 17

Thread activity – Files encryption

The process enumerates the files found in a directory using the FindFirstFileW and FindNextFileW functions:

Underground-Ransomware-Figure-18
Figure 18
Underground-Ransomware-Figure-19
Figure 19

The malware doesn’t encrypt a file called “VIPinfo.txt” and the folders containing the following strings:

Windows
Microsoft
google\chrome
mozilla\firefox
\opera\

Underground-Ransomware-Figure-20
Figure 20
Underground-Ransomware-Figure-21
Figure 21

The file’s extension is obtained via a function call to PathFindExtensionW (see Figure 22).

Underground-Ransomware-Figure-22
Figure 22

The following file’s extensions will be skipped by the ransomware:

Underground-Ransomware-Figure-23
Figure 23

The malware also skips the ransom note called “!!readme!!!.txt”:

Underground-Ransomware-Figure-24
Figure 24

A file is opened using the CreateFileW API (0xc0000000 = GENERIC_READ | GENERIC_WRITE, 0x1 = FILE_SHARE_READ, 0x3 = OPEN_EXISTING):

Underground-Ransomware-Figure-25
Figure 25

If any of the target files are opened by another process, the binary uses the Restart Manager APIs to kill that process.

The malware starts a new Restart Manager session using the RmStartSession function:

Underground-Ransomware-Figure-26
Figure 26

The ransomware determines the process that locked the target file using the RmRegisterResources and RmGetList methods:

Underground-Ransomware-Figure-27
Figure 27
Underground-Ransomware-Figure-28
Figure 28

The executable kills the above process using the OpenProcess and TerminateProcess APIs, as shown below:

Underground-Ransomware-Figure-29
Figure 29
Underground-Ransomware-Figure-30
Figure 30

GetSystemTimeAsFileTime is utilized to obtain the system date and time (Figure 31).

Underground-Ransomware-Figure-31
Figure 31

The malicious process retrieves the size of the target file:

Underground-Ransomware-Figure-32
Figure 32

The SetFilePointer API is used to move the file pointer within the target file:

Underground-Ransomware-Figure-33
Figure 33

The last four bytes are extracted and compared with “1AY&”, which corresponds to a file that was previously encrypted by Underground ransomware:

Underground-Ransomware-Figure-34
Figure 34

The malware creates a ransom note called “!!readme!!!.txt” in every traversed directory:

Underground-Ransomware-Figure-35
Figure 35
Underground-Ransomware-Figure-36
Figure 36

The binary extracts the processor time stamp using the rdtsc instruction and generates 24 pseudo-random bytes twice. The second 24 bytes represent the 3DES key and the first eight bytes from the first iteration represent the IV that will be used for file encryption:

Underground-Ransomware-Figure-37
Figure 37
Underground-Ransomware-Figure-38
Figure 38

The 3DES key and IV are encrypted using the hard-coded RSA public key, as displayed below:

Underground-Ransomware-Figure-39
Figure 39
Underground-Ransomware-Figure-40
Figure 40

The malicious binary reads the file content via a function call to ReadFile:

Underground-Ransomware-Figure-41
Figure 41

The content is encrypted using the 3DES algorithm. The implementation of the algorithm is highlighted below:

Underground-Ransomware-Figure-42
Figure 42
Underground-Ransomware-Figure-43
Figure 43

The ransomware writes the encrypted file content, the RSA-encrypted 3DES key and IV, the initial file’s length, and 4 bytes indicating that the file was encrypted:

Underground-Ransomware-Figure-44
Figure 44
Underground-Ransomware-Figure-45
Figure 45

After the encryption is complete, the process creates a CMD file called “temp.cmd” and populates it with the following instructions:

Underground-Ransomware-Figure-46
Figure 46
Underground-Ransomware-Figure-47
Figure 47
Underground-Ransomware-Figure-48
Figure 48

The path of the current executable is obtained using the GetModuleHandleA and GetModuleFileNameA APIs:

Underground-Ransomware-Figure-49
Figure 49
Underground-Ransomware-Figure-50
Figure 50

The purpose of the CMD file is to clear all event logs using wevtutil and to delete the initial executable as well as the file itself afterwards:

Underground-Ransomware-Figure-51
Figure 51

Indicators of Compromise

SHA256

d4a847fa9c4c7130a852a2e197b205493170a8b44426d9ec481fc4b285a92666

Underground Ransom Note

!!readme!!!.txt

Processes spawned

vssadmin.exe delete shadows /all /quiet

reg.exe add HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Terminal Services /v MaxDisconnectionTime /t REG_DWORD /d <Value> /f

net stop MSSQLSERVER /f /m

temp.cmd <Executable path>