Technical analysis of WarZoneRAT malware By Muhammad Hasan Ali Published: 2023-08-15 · Archived: 2026-04-05 19:36:41 UTC بسم الله الرحمن الرحيم FreePalestine IntroductionPermalink We will start analyzing Ave Maria known as WARZONE RAT. Ave Maria is a Remote Access Trojan (RAT) which provides some capabilities, such as stealing Cookies stealing passwords, Keylogging (online and offline), Windows Defender Bypass, and Remote WebCam. We can take a look at what this threat actor provides to its customers from its site warzone[.]ws. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 1 of 27 Figure Screenshot of the RAT capabilities from warzone[.]ws https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 2 of 27 Figure Screenshot of the RAT capabilities from warzone[.]ws And special thanks for Abdallah Elshinbary for his continuous help and support. Technical summaryPermalink When the attaker wants to start a command, it will send to the RAT a hex number. Every hex number has a specific action to be done. Password and Cookies Recovery: When it comes to RATs, then it has something with browsers and Email clients. The malware will harvist the cookies, passwords, history, and configurations of browsers. And steal passords and configruations of Email clients. Keylogging: Any RAT has the capability to log any keystrokes, but Warzone RAT has the two types of Keylogging which are the live keylogger and the offline keylogger. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 3 of 27 Recording audio: The RAT has the capability to record audio and save it to .wav file and send it to the C2 server. HRDP: This allows the attacter to connect and control the victim’s device without knowing or alerting the victim using Hidden RDP. Enumerate processes, disks, and files: The malware can enumerate the currently running processes, disks and their types, and files inside a specific directory. File Manager: The RAT gives its customers the ability to download and upload files from the victim’s computer, execute a file, and delete files. And compress any directory or folder inside the victim’s computer using a command and send it to the C2 server. Other features: The malware can terminate any process the attacker wants, uninstall itself by terminating its thread and delete itself from registries, restart the device using commands and create a process to check connectivity, and take screen shots from the victim’s device. Password and Cookies RecoveryPermalink Once the attacker sends the command to the RAT which will be 0x20 in hex, the malware will create a thread to start Password Recovery action. The RAT will start stealing the saved passwords, configurations, cookies, and history from browsers and extract profiles and passwords from some email services. Then encrypt the data and send it to the C2 server then terminate the thread. First, the malware will steal the Cookies from Chromium-based browsers such as Google chrome and Microsoft edge by quering select host_key, path, name, encrypted_value, expires_utc, is_httponly, samesite, is_secure from cookies from the cookies table in Cookies database and steal Cookies from Mozilla firefox browser by quering SELECT host, path, name, value, expiry, isHttpOnly, isSecure FROM moz_cookies from the moz_cookies table. The w_query_get_chrome_based_cookies ( sub_40C5FA ) function uses SHGetSpecialFolderPathW to get the AppData path, than append the the cookies path \Google\Chrome\User Data\Default\Network\Cookies to Appdata path C:\Users\user\AppData\Local\ .It will be like this C:\Users\user\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies The malware uses the same way to get the all sensitive databases that contain sensitive data such as Login Data , History of browsers. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 4 of 27 Figure Steal Cookies from browsers - sub_40DC9D Next, the malware will go after the History of the user’s browsers the same as stealing the cookies. For Chromium-based, quering SELECT url, title, visit_count, last_visit_time FROM urls and Mozzilla quering SELECT url, title, visit_count, last_visit_date FROM moz_places . Figure Steal History from browsers - sub_40DC9D In the next figure, the malware will steal the passwords and configurations of specific browsers. By quering select signon_realm, origin_url, username_value, password_value from logins from logins table of Login Data db. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 5 of 27 Figure Steal password and configurations from browsers - sub_40DC9D For Email serivices, the malware will go after outlook ( sub_4104A0 ), Foxmail ( sub_410981 ), Thunderbird ( sub_40FA23 ) Email clients. As we can see in the next figure, the malware will steal the configurations and login data from Thunderbird email client. Figure Steal Configurations from Thunderbird - sub_40FA23 https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 6 of 27 After stealing the sensitive data from browsers and Email clients, the malware will encrypt the stolen data using customized RC4 encryption algorithm then send it to the C2 server. The malware uses nevergonnagiveyouup as encryption key to customized RC4 algorithm. After encryption, the malware will send it using sockets. Figure Customized RC4 encryption algorithm - sub_406244 The list of targeted browsers Expand to see more  Mozilla Firefox  Google Chrome  Epic Privacy Browser  Microsoft Edge The list of the targeted Email clients: Outlook Thunderbird Foxmail KeyloggingPermalink The RAT has the two types of keylogging which are the live keylogger and the offline keylogger. The offline keylogger is run when the victim is offline. When the attaker sends the command 0x24 in hex, the RAT will start a thread of Live keylogger function. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 7 of 27 Figure Live and offline keylogging - sub_40A78D The malware will create a directory Microsoft Vision in the AppData directory then create a file with a timestamp-based name. The malware will try to get the Keyboard input messages such as WM_KEYDOWN or WM_KEYUP which are generated by the OS when the victim interacts with the keyboard by using GetMessageA API. Figure How keylogging is working - sub_40A86E Inside the w_mw_get_clipboard_data_keyboard_in ( sub_40ADCA ) function, we will know that the malware will try to grab the clipboard data inside the mw_get_clipboard_data ( sub_4174BA ). Then encrypte the data and send to the C2 server if it’s the live keylogger or write the grabbed data to a file then encrypted it and send to the C2 server if it’s offline keylogger. Figure clipboard grabber - sub_40ADCA https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 8 of 27 Figure How malware grab clipboard data - sub_4174BA After grabbing the clipboard data, the malware will start keylogging by getting the windows name and check the keyboad input state using w_GetKeyboardState ( sub_40AAFD ) function and check if is Shift or Caps Lock pushed. And if Shift or Caps Lock were pushed, the w_ToLowerCase ( sub_401098 ) function will convert the uppercase to lowercase. Then encrypte the logs and send to the C2 server if it’s the live keylogger or write the grabbed logs to a file then encrypted it and send to the C2 server if it’s offline keylogger. The logs are #Window Name: , is Shift or Caps Lock pushed, keystrokes. Figure The RAT keylogging the victim - sub_40ADCA When the malware receives the command 0x26 in hex, the malware terminate the thread which runs the keylogging function. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 9 of 27 Figure Terminate the thread which runs the keylogging function - sub_40528D Recording AudioPermalink The RAT has two functions for recording audio mw_record_audio ( sub_40B46F ) and mw_record_audio_0 ( sub_040BB1C ). The command is 0x54 in hex to start one function in a thread. Figure Two recording function - sub_40528D Inside The first function mw_record_audio ( sub_40B46F ), we see that waveInOpen API Opens the audio input device for recording with the configuration parameters from the pwfx structure. And save the record in a time-based .wav file. And even it can prepare for a new recording audio. This function only records audio and save the .wav file. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 10 of 27 Figure mw_record_audio function - sub_40B46F And inside the second function mw_record_audio_0 ( sub_040BB1C ), it does what this mw_record_audio function is doing. But after recording audio and save the .wav file, it encrypt and send it to the C2 server before starting a new record. Figure Sending the audio file to the C2 server - sub_040BB1C waveInUnprepareHeader function is called after the audio was recorded and captured in the buffer which is a cleanup process. To terminate recording audio, the RAT get the command 0x5A in hex. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 11 of 27 HRDPPermalink The RAT provides a remote access to victim’s device using Hidden RDP ( HRDP ) to remotely connect to and control the device without knowing or alerting the victim. The malware first get value of ServiceDll registry inside the SYSTEM\\CurrentControlSet\\Services\\TermService\\Parameters which will be the path %SystemRoot%\System32\termsrv.dll to termsrv.dll . termsrv.dll is The DLL which handles the functionality and settings of the Remote Desktop Protocol (RDP). FigureGet the path to termsrv.dll - sub_412446 After that, the malware will add a new user account special properties or behaviors such as hiding the user account from login screen. First, the malware will create this key SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon\\SpecialAccounts\\UserList and set the value of UserList registry to 0 to hide the user account from login screen. inside the mw_add_user_account ( sub_41313D ), it adds a new user account using NetUserAdd API and adds the user to a local group using NetLocalGroupAddMembers API. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 12 of 27 Figure Hide the user acount from login screen - sub_411BC1 Then the malware will create a thread to start start_RDP ( sub_412003 ). This function open a registry key SYSTEM\\CurrentControlSet\\Services\\TermService to get the entry value of ImagePath which is %SystemRoot%\System32\svchost.exe -k NetworkService and get svchost.exe -k NetworkService which is used to run an instance of svchost.exe under the context of the NetworkService . And get the entry value of ServiceDll which is %SystemRoot%\System32\termsrv.dll . This is because The malware will invoke an instance of svchost.exe using svchost.exe -k NetworkService command and load the termsrv.dll DLL file into svchost.exe . Figure Load termsrv.dll into svchost.exe - sub_41263D Inside sub_412B16 function, the malware continues changing the registry values to enable RDP. Change the registry fDenyTSConnections inside SYSTEM\\CurrentControlSet\\Control\\Terminal Server and set to its value to false ( 0 ) to enable RDP connetions. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 13 of 27 Change the registry EnableConcurrentSessions inside SYSTEM\\CurrentControlSet\\Control\\Terminal Server\\Licensing Core and set to its value to false ( 0 ) to prevent opening two sessions at the same time. Change the registry AllowMultipleTSSessions inside SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon and set to its value to false ( 0 ) to prevent opening two sessions at the same time. Change the registry Name value to RDPClip and change Type registry its value to 3 inside SYSTEM\\CurrentControlSet\\ControlTerminal Server\\AddIns\\Clip Redirector to enable copy and paste from attacker device to victim device. Figure Change some registry keys - sub_412B16 After the malware changed the settings needed, it uses RDP_check which connect to 127.0.0.1:3389 to check if the it’s working and send the return to the C2 server. Figure RDP check - sub_412510 https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 14 of 27 Enumerate processes, disks, and filesPermalink The RAT has the ability to get more information about victim’s device by enumerating processes, disks, and files of the victim’s device. And send a spicific file to the C2 server. Figure Enumerate processes, disks, and files - sub_40528D The malware has the ability to enumerate currently running processes using CreateToolhelp32Snapshot API and get the full path of the associated executable file using K32GetModuleFileNameExW API. The command is 2 . Figure Get running processes and path of the associated executable file - sub_415C5D When the malware get the command 4 , it starts enumerating logical disks of the victim’s device using GetLogicalDriveStringsW API and gets its type if it’s removable , disk , or network drive by using https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 15 of 27 GetDriveTypeW API. Figure Get list of logical disks and its type - sub_414E4E The RAT can enumerate files inside a directory and collect info about each file then collect these info to be sent to the C2 server. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 16 of 27 Figure Enumerate files inside a directory - sub_414F8B File ManagerPermalink The RAT gives its customers the ability to download and upload files from the victim’s computer, execute a file, and delete files. And even will try to compress any directory or folder inside the victim’s computer using a command and send it to the C2 server. The malware has the ability to send a file to the attacker. Inside the mw_send_file_to_c2 function, the malware will create a thread to send a file to the C2 server. Figure send a file to the attacker - sub_40929F And download files from the attacker side to the victim’s machine and execute it. Figure How the RAT Download and Execute a file - sub_40205E And execute any dropped files on the victim’s computer. The dropped file will be in the temp directory. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 17 of 27 Figure Find path of dropped file and execute it - sub_40205E And execute any specific file on the victim’s computer. Figure execute a file - sub_40528D The malware will try to compress one directory or more than one directory using powershell to a .zip file while hiding the PowerShell window using the command powershell.exe -windowstyle hidden -Command "Compress-Archive -Path 'C:\Path\To\Your\Directory' -DestinationPath 'C:\Path\To\Your\Archive.zip'" https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 18 of 27 Figure Compress directories - sub_41731E Other featuresPermalink Terminate a processPermalink The malware will get the currently running processes, and terminate any process the attacker wants. Figure Terminate any process - sub_401BA7 Uninstall the RATPermalink The malware has the ability to uninstall itself by terminating its thread and delete itself from registries. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 19 of 27 Figure Terminate its thread and delete reg - sub_4166D0 Restart the system and check connectivityPermalink The RAT can restart the device using commands and create a process to check connectivity. there is two methods to restart the device: 1. using command shutdown.exe /r /t 00 to restart the computer or force the restart using shutdown.exe /r /f /t 00 command while hiding the execution window using WinExec function. 2. The malware will attempt to elevate privileges to perform a hard system shutdown. It first loads ntdll.dll , retrieves the function pointers for RtlAdjustPrivilege and NtRaiseHardError , adjusts the privilege level, and then raises a hard system error with the status code STATUS_FLOAT_MULTIPLE_FAULTS . Figure Restart the system - sub_4022D8 Take screenshotPermalink The malware can start a thread and run the function to take screen shots. The malware checks for recent user activity using GetLastInputInfo compares to 30 minutes. If there was recent activity, it captures the foreground window’s content as a screenshot and saves it as a JPEG file with a time-based name. https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 20 of 27 Figure Taking screen shots - sub_413896 The malware encrypt its configuration with customized RC4 algorithm. The malware stores the configuration in the .bss section and the The format of the configuration is: [Key length][RC4 key][Encrypted data] . So we used m4n0w4r’s to decrypt the configuration. You can see the code in the jupyter notebook in my github from here # Refs: https://stackoverflow.com/questions/9433541/movsx-in-python def SIGNEXT(x, b): m = (1 << (b -1)) x = x & ((1 << b) -1) return ((x ^ m) - m) # This routine is responsible for decrypting the stored C2. def rc4_customized_decryptor(data, key): idx = 0 counter1 = 0 counter2 = 0 # Initialize RC4 S-box rc4Sbox = list(range(256)) # Modify RC4 S-box for i in range(256): counter2 += (rc4Sbox[i] + key[i%250]) counter2 = counter2 & 0x000000FF rc4Sbox[i] ^= rc4Sbox[counter2] rc4Sbox[counter2 & 0xFF] ^= rc4Sbox[counter1 & 0xFF] rc4Sbox[counter1 & 0xFF] ^= rc4Sbox[counter2 & 0xFF] counter1 = i+1 # Decrypt data counter1 = 0 counter2 = 0 j = 0 decrypted = [] while(idx < len(data)): counter1 = j + 1 k = (j+1) rc4Sbox_value1 = rc4Sbox[k] counter2 += (SIGNEXT(rc4Sbox_value1, 8) & 0xFFFFFFFF) rc4Sbox_value1_ = (SIGNEXT(rc4Sbox_value1, 8) & 0xFFFFFFFF) rc4Sbox_value2 = rc4Sbox[counter2 & 0x000000FF] rc4Sbox[k] = rc4Sbox_value2 rc4Sbox[(counter2 & 0x000000FF)] = rc4Sbox_value1 https://muha2xmad.github.io/malware-analysis/warzonerat/ Page 21 of 27 tmp1 = rc4Sbox[((0x20 * counter1) ^ (counter2 >> 3)) & 0x000000FF] tmp2 = rc4Sbox[((0x20 * counter2) ^ (counter1 >> 3)) & 0x000000FF] tmp3 = rc4Sbox[((tmp1 + tmp2) & 0x000000FF) ^ 0xAA] tmp4 = rc4Sbox[(rc4Sbox_value2 + rc4Sbox_value1_) & 0x000000FF] tmp5 = (tmp3 + tmp4) & 0x000000FF tmp6 = rc4Sbox[(counter2 + rc4Sbox_value2) & 0x000000FF] decrypted.append(data[idx] ^ (tmp5 ^ tmp6)) counter1 += 1 j = counter1 idx += 1 return bytes(decrypted) # def unicode_strings(buf, n=4): # This function makes problems when i upload it in github. So you need to got from OALABS # Get unicode_strings function from https://research.openanalysis.net/warzone/malware/config/2021/05/31/warzone_ import pefile import struct # Load the PE file using pefile pe = pefile.PE(r"") # Put your file path # Initialize variable to store .bss section data bss_section_data = None # Iterate through sections to find the .bss section for section in pe.sections: section_name = section.Name if section_name.startswith(b'.bss'): bss_section_data = section.get_data() # Extract the key size and key from the .bss section key_size = struct.unpack('