Blog de Zscaler

Reciba en su bandeja de entrada las últimas actualizaciones del blog de Zscaler

Security Research

Technical Analysis of kkRAT

image
MUHAMMED IRFAN V A
September 10, 2025 - 15 Min de lectura

Introduction

Zscaler ThreatLabz has identified a malware campaign targeting Chinese-speaking users, which has been active since early May 2025. The campaign delivers three types of malware: ValleyRAT, FatalRAT, and a new Remote Access Trojan (RAT) that ThreatLabz named kkRAT. The latter shares code similarities with both Ghost RAT and Big Bad Wolf (大灰狼), a RAT typically leveraged by China-based cybercriminals. 

In this blog post, ThreatLabz examines the attack chain used in the malware campaign and provides a technical analysis of the kkRAT including its core features, network communication protocol, commands, and plugins.

Key Takeaways

  • Zscaler ThreatLabz identified a malware campaign targeting Chinese-speaking users in early May 2025.
  • The campaign uses fake installer pages mimicking popular software to deliver three different RATs as the final payload in various instances.
  • kkRAT employs a network communication protocol similar to Ghost RAT, with an added encryption layer after data compression. The RAT’s features include clipboard manipulation to replace cryptocurrency addresses and the deployment of remote monitoring tools (i.e. Sunlogin, GotoHTTP).
  • The campaign uses the Bring Your Own Vulnerable Driver (BYOVD) technique to remove registered callbacks from antivirus (AV) and endpoint detection and response (EDR) drivers.

Technical Analysis

Attack chain

In early May 2025, ThreatLabz identified a malware campaign delivering multiple RATs as the final payload. The attack chain for this campaign is shown in the figure below. 

Attack chain for a malware campaign delivering several RATs.

Figure 1: Attack chain for a malware campaign delivering several RATs.

The threat actor uses GitHub Pages to host phishing sites impersonating popular software installers. These installer packages are ZIP archives that contain a malicious executable file. The figure below highlights an example phishing page used in the campaign.

Example phishing page impersonating Ding Talk that ultimately delivers various RATs.

Figure 2: Example phishing page impersonating Ding Talk that ultimately delivers various RATs.

First stage

During the initial stage of the campaign, the malware employs two distinct methods to identify sandbox environments and virtual machines (VMs):

Time stability analysis 

Using QueryPerformanceCounter, the malware measures the time for a repetitive operation, compares the average (expected 300 ms) to a threshold (0.0008), and identifies sandboxes/VMs if the deviation exceeds this limit.

Hardware configuration 

The malware assesses disk space (minimum 50 GB) and CPU cores (minimum two). If these thresholds aren’t met, the malware initiates evasive actions, including altering the Process Environment Block (PEB) structure:

  • ProcessParameters->ImagePathName and ProcessParameters->CommandLine are altered to mimic %WINDIR%\explorer.exe.
  • The malware also traverses InLoadOrderModuleList. If any entry’s BaseDllName matches the current process name, both BaseDllName and FullDllName are rewritten to %WINDIR%\explorer.exe.

These modifications corrupt the final process snapshot taken by sandboxes and will result in the malware terminating execution.

After completing the sandbox and VM checks, the malware performs the following anti-analysis/obfuscation methods.

  • API resolution: The malware dynamically loads required Windows API functions by performing single-byte XOR (key: 0x4) operations on stack strings.
  • Next-stage file decryption: The malware applies single-byte XOR operations (key: 0x1) to extract decryption keys for the next-stage files.

Memory is allocated for next-stage shellcodes, which are decrypted, written, and directly executed by the first stage. All shellcodes utilized in the campaign employ pe_to_shellcode transformation logic. 

Second stage

To bypass AV software and EDR systems, the malware employs several techniques. The first technique is verifying administrator privileges. If the malware does not have sufficient privileges, a message is displayed in Mandarin prompting the user for elevated access and exits. If the malware has administrator privileges, the malware enumerates all active network adapters and temporarily disables them, severing AV/EDR communication with the corresponding vendor’s servers.

Following this, the malware scans the system for the presence of specific AV and EDR processes predominantly associated with China-based cybersecurity vendors. These vendors include:

  • 360 Total Security
  • QQ电脑管家
  • HeroBravo System Diagnostics suite
  • Kingsoft Internet Security
  • 360 Internet Security suite

If targeted processes are detected, the malware uses a known vulnerable driver (RTCore64.sys) to disable AV/EDR functionalities. This is achieved by comparing the name of the AV/EDR driver that registered each callback. The complete list of targeted drivers can be found in the ThreatLabz GitHub repository.

The malware incorporates code borrowed from the RealBlindingEDR project to remove registered system callbacks, targeting three specific types of callbacks for elimination:

  • ObRegister callback: Monitors, blocks, or modifies how the system creates and duplicates handles using callback routines.
  • MiniFilter callback: Allows minifilter drivers to filter specific file Input/Output (I/O) operations.
  • CmRegister callback: Monitors, blocks, or modifies Windows registry operations via callback routines.

After disabling callbacks, the malware terminates and deletes files of specific AV/EDR processes at the user level. The malware also creates a scheduled task to run with SYSTEM privileges to execute a batch script on every user logon to ensure the processes are repeatedly killed.

Next, the malware modifies registry keys associated with the 360 Total Security program:

  • The NetCheck registry value is set to 0 in HKLM\SOFTWARE\WOW6432Node\360Safe\360Scan (presumably to disable network checks).
  • Adds random data to a null value name under the registry key located at HKU\360SPDM\CC2FCASH\speedmem2\x\b5e3891842b605bf7917ba84.

Following these registry changes, the malware re-enables the previously disabled network adapters to restore the system's network connectivity. Thereafter, the first-stage shellcode executes the third-stage shellcode, which functions as a downloader to facilitate the next phase of the attack.

Third stage

The malware retrieves and executes a shellcode file named 2025.bin from a hardcoded URL by utilizing the EnumDateFormatsA API callback. The shellcode, heavily obfuscated with junk code, downloads a Base64-encoded file named output.log, which is decoded to reveal structured data for subsequent attack stages. An example is shown below.

Hexdump of the decoded data used to download various RATs.

Figure 3: Hexdump of the decoded data used to download various RATs. 

The decoded data is structured using the delimiters 0xA1 0xF9 that act as a field separator, dividing individual fields within a record, while 0xA1 0xF6 serves as a record terminator, marking the end of each record. The decoded data consists of 62 records, each record starts with an index ranging from 0 to 61. In each record, the second field contains two URLs, and these URLs are used to download two archive files:

  • trx38.zip: When unzipped, trx38.zip includes a legitimate executable file and a malicious DLL.
  • *.zip: (Where * represents a wildcard) This ZIP archive contains a file named longlq.cl, which holds the encrypted final payload.

The malware selects a record based on the last letter of the current process's filename. For example, if the filename was setup.exe, the file p.zip would be downloaded. The malware then will create a shortcut for the legitimate executable extracted from trx38.zip, add this shortcut to the startup folder for persistence, and execute the legitimate executable to sideload the malicious DLL.

The malicious DLL decrypts and executes the final payload from the file longlq.cl using a 6-byte XOR key at offset 0xD3000, with encrypted data at 0xD3006. The final payload of the campaign varies based on the second ZIP archive that is downloaded. This campaign delivers three different RATs: ValleyRAT, FatalRAT, and kkRAT. 

Final payload

Since ValleyRAT and FatalRAT are already extensively documented, they will not be analyzed in this section. However, kkRAT is a previously unknown malware family that incorporates elements from both Ghost RAT and Big Bad Wolf. These shared similarities are outlined below:

  • Ghost RAT: kkRAT shares similarities with Ghost RAT’s network communication protocols, but introduces an added layer of encryption applied after data compression. kkRAT also borrows several network commands from Ghost RAT, such as COMMAND_ACTIVED, COMMAND_KEYBOARD, and COMMAND_LIST_DRIVE.
  • Big Bad Wolf: kkRAT adopts specific DLL exports from Big Bad Wolf’s primary plugin DLL, including DllShell and DllScreen.

Encrypted configuration

kkRAT’s configuration, such as the C2 server IP and port, version, and group identifier, are stored as encrypted strings and sent in the registration message. A Python script for decrypting this configuration is available in the ThreatLabz GitHub repository.

Device fingerprinting

After establishing a socket connection, kkRAT gathers system information for device fingerprinting. The collected data is sent to the C2 server in a registration message with the structure below.

struct REGISTRATIONINFO
{
BYTE Token; // 0x66 hardcoded value
OSVERSIONINFOEXA OsVerInfoEx; // OS version information
DWORD CPUClockMhz; // CPU frequency
int CPUNumber; // Number of processors
IN_ADDR IPAddress; // Host local IP
char HostName[50]; // Host name
bool IsWebCam; // Is there a web camera connected?
DWORD socketTime; // Time since the socket was established
DWORD Speed; // Internet speed in mbps
DWORD MemSize; // Total physical memory size
DWORD DriverSize; // Hard disk capacity
char Group[50]; // RAT Group - set to Default
char UpTime[32]; // System uptime
char Version[32]; // RAT Version - set to Enterprise
BOOL Is64; // 32-bit or 64-bit; 1 is 64 while 0 is 32
char AV[80]; // List of AV's installed
DWORD isIdle; // Is idle for more than 3 min?
char TG[40]; // Is Telegram present on the system?
char WC[40]; // Is WeChat present on the system?
char QQ[80]; // QQ number
BOOL IsAdmin;// Is Administrator
char UserName[50]; // Account username
};


Network communication protocol

kkRAT's network communication protocol closely resembles that of Ghost RAT, with an added layer of encryption applied after data compression. Each packet exchanged between kkRAT and the C2 server is sent via TCP and follows a specific structure, as illustrated in the figure below.

kkRAT packet structure.

Figure 4: kkRAT packet structure.

The original data is first compressed using zlib and then encrypted using an XOR-based algorithm with a key embedded in the malware binary. The Python script provided in the ThreatLabz GitHub repository can be used to decrypt the network data captured.

Plugins

kkRAT retrieves its main plugin and saves it on disk in an encrypted format. When a specific command calls for a plugin export, the encrypted plugin is read from disk, decrypted, loaded into memory, and the requested export is executed. The Python code in the ThreatLabz GitHub repository can be used to decrypt the encrypted plugin. The encryption algorithm is similar to the XOR-based algorithm used to protect network communications. 

The table below outlines the plugins and exports for kkRAT.

Plugin Name

Export Name

Description

 

 

 

 

 

 

 

 

 

 

 

 

 Main Plugin

(Plugin32.dll)

DLLScreen

Provides basic remote desktop screen management, primarily used for screen capturing and simulating user inputs such as keyboard and mouse actions.

DLLScreee

An extended version of DLLScreen that includes additional capabilities, such as retrieving and modifying clipboard data.

DLLScreeh

Enables concealed remote management through virtual desktops, with added functionalities such as launching web browsers and terminating active processes.

DllScreer 

Functions as a view-only screen monitor, supporting only screen monitoring without features such as input simulation.

DllShell

Facilitates remote command execution via a shell interface.

DllWindows

Enables management of windows on the screen, offering features such as listing, enabling, disabling, or closing windows.

DllProgress

Provides process management capabilities, including listing active processes and terminating them as needed.

DllGetNetState

Generates a list of active network connections (similar to netstat), along with their associated processes, and allows for the termination of processes based on this data.

DllApp

Offers application management functionalities, including listing installed software and uninstalling selected programs.

DllQDXGL

Enumerates and retrieves the list of values stored in the autorun registry key located at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.

fnProxy

Serves as a proxy, facilitating communication between a client and a server by relaying the data.

PlugProxy.dll

ConnSocks

Functions as a proxy between a client and server, utilizing a Go binary. It implements the SOCKS5 protocol using the go-socks5 library.

Table 1: Plugins supported by kkRAT.

Note that kkRAT's main plugin, Plugin32.dll, was uncovered alongside the source code of an older version on VirusTotal, which served as the basis for the RAT's name.

After receiving the registration message, the C2 server issues a series of commands for kkRAT to execute. kkRAT supports an extensive range of commands, integrating functionality from its plugin DLL exports. While the known command IDs associated with Ghost RAT are excluded, the table below provides the command IDs for the plugin DLL exports discussed earlier and the new commands introduced in kkRAT.

Command ID

Description

0x4

Downloads the main plugin DLL (Plugin32.dll).

0x8

Removes Internet Explorer browsing data.

0x9

Removes Skype local storage data.

0xA

Removes Telegram tdata.

0xB

Removes QQ browser user data.

0xC

Removes Firefox profiles data.

0xD

Removes Google Chrome user data.

0xE

Removes Sogou Explorer cache data.

0xF

Removes 360 Speed Browser user data.

0x10

Removes 360 Secure Browser user data.

0x15

Calls DllScreen export from Plugin32.dll.

0x1F

Calls DllScreee export from Plugin32.dll.

0x29

Calls DlScreeh export from Plugin32.dll.

0x2A

Calls DllScreer export from Plugin32.dll.

0x34

Calls DllWindows export from Plugin32.dll.

0x35

Calls DllProgress export from Plugin32.dll.

0x36

Calls DllGetNetState export from Plugin32.dll.

0x37

Calls DllApp export from Plugin32.dll.

0x38

Calls DllQDXGL export from Plugin32.dll.

0x4A

Establishes persistence on the victim's system. The RAT server provides the sub-command ID and name needed for key/task as parameters to specify the method for persistence. The sub-commands are listed below:

  • Achieve persistence using the startup folder.
  • Achieve persistence using autorun key.
  • Achieve persistence using logon script (HKCU\Environment\UserInitMprLogonScript).
  • Achieve persistence using scheduled tasks.

0x4B

Checks for the presence of the GotoHTTP remote monitoring and management (RMM) tool on the victim's system. If GotoHTTP is detected, the command retrieves the name and tmp values from the gotohttp.ini configuration file. If GotoHTTP is not present, the command installs the tool on the system. The GotoHTTP tool (file content) is provided by the C2 as a parameter for the command.

0x4C

Verifies whether the Sunlogin RMM tool is installed on the victim's system. If Sunlogin is present, the command retrieves the fastcode and password values from the config.ini file. If Sunlogin is not found, the command installs the tool on the system. The Sunlogin RMM tool (file content) is provided by the C2 as a parameter for the command.

0x4D

Scans the clipboard for cryptocurrency wallet addresses associated with Tether, Bitcoin, or Ethereum. Identified wallet addresses are replaced with the attacker’s wallet addresses. The attacker’s wallet addresses are provided as parameters for this command.

0x4E

Same as 0x4D.

0x4F

Stops the replacement of Tether, Bitcoin, and Ethereum wallet addresses in the clipboard with the attacker’s wallet addresses, effectively disabling the crypto hijacking behavior.

0x51

Attempts to elevate privileges on the victim's system using the runas verb once.

0x55

Invokes the DllShell export from the Plugin32.dll plugin to execute its associated functionality.

0x5C

Calls the fnProxy export from the Plugin32.dll plugin. This command supports multiple sub-commands, with the first parameter determining the specific operation to be executed. The sub-commands are listed below:

  • 0x5E: Establishes a TCP connection to a remote IP and port specified by the attacker. Additional parameters include a unique ID to identify the TCP socket, the target remote IP address, and the target remote port number.
  • 0x5F: Terminates the TCP connection associated with the specified ID, which is provided as an additional parameter.
  • 0x60: Sends data through the proxy. Additional parameters include the ID of the associated TCP socket and the data to be transmitted.

0x5D

Calls the ConnSocks export from the PlugProxy.dll plugin. Along with this command, the DLL content of PlugProxy.dll is provided as a parameter for this command.

Table 2: Commands implemented by kkRAT.

Conclusion

ThreatLabz has identified a new malware family that we have named kkRAT, which is one of several RATs deployed via a malware campaign targeting Chinese-speakers. kkRAT’s network communication protocol resembles that of Ghost RAT, but includes an added encryption layer after data compression. kkRAT’s commands and plugins enable features such as clipboard hijacking to replace cryptocurrency wallet addresses, installing RMM tools like Sunlogin and GotoHTTP, and relaying network traffic that can be used to bypass firewalls and VPNs.

Zscaler Coverage

Zscaler’s multilayered cloud security platform detects indicators related to this campaign at various levels. The figure below depicts the Zscaler Cloud Sandbox, showing detection details for the campaign.

Zscaler Cloud Sandbox report for kkRAT.

Figure 5: Zscaler Cloud Sandbox report for kkRAT.

In addition to sandbox detections, Zscaler’s multilayered cloud security platform detects indicators related to the campaign at various levels with the following threat names:

Indicators Of Compromise (IOCs)

Host indicators

SHA256

Description

02cce1811ed8ac074b211717e404fbadffa91b0881627e090da97769f616c434

 

 

 

 

 

First-stage EXE file responsible for detecting and avoiding sandbox and VM environments. 

140426a92c3444d8dc5096c99fa605fd46cb788393c6522c65336d93cb53c633

181b04d6aea27f4e981e22b66a4b1ac778c5a84d48160f7f5d7c75dffd5157f8

35385ab772ebcc9df30507fd3f2a544117fb6f446437c948e84a4fdf707f8029

36e8f765c56b00c21edcd249c96e83eb6029bc9af885176eaca9893ebad5d9bd

3e5efe81a43d46c937ba27027caa2a7dc0072c8964bf8df5c1c19ed5626c1fe1

003998d12e3269286df1933c1d9f8c95ab07c74fa34e31ce563b524e22bb7401

Second-stage shellcode designed to bypass AV and EDR systems. 

71ca5dd59e90ec83518f9b33b2a8cdb6a0d6ad4c87293b27885fa2a8e8e07f1c

 

Third-stage shellcode that functions as a downloader.

80b7c8193f287b332b0a3b17369eb7495d737b0e0b4e82c78a69fa587a6bcf91

a0f70c9350092b31ae77fc0d66efa007ccacbbc4b9355c877c1f64b29012178c

Malicious DLL sideloaded in the third stage to decrypt the final payload.

f557a90c1873eeb7f269ae802432f72cc18d5272e13f86784fdc3c38cbaca019

kkRAT payload.

 

Network indicators

IP/URL

Description

https://github[.]com/sw124456

GitHub account used to deploy the phishing pages.

https://youdaoselw[.]icu

A phishing URL designed to mimic the installer page of popular software.

https://kmhhla[.]top/

A phishing URL designed to mimic the installer page of popular software.

http://key2025.oss-cn-hongkong.aliyuncs.com/2025.bin

The URL that hosts the 2025.bin file in the third stage.

http://key2025.oss-cn-hongkong.aliyuncs.com/output.log

The URL that hosts the output.log file, which contains the Base64-encoded URLs used in the third stage.

http://key2025.oss-cn-hongkong.aliyuncs.com/trx38.zip

The URL that hosts the ZIP archive which contains the malicious DLL used to decrypt the final payload.

154.44.30.27:8250

kkRAT C2.

156.238.238.111:8111

ValleyRAT C2.

103.199.101.3:8081

FatalRAT C2.


MITRE ATT&CK Techniques

Tactic

ID

Technique Name

Initial Access

T1566

Phishing

Execution

T1204.002

User Execution: Malicious File

 

 

 

 

 

Defense Evasion

T1497

Virtualization/Sandbox Evasion

T1562.001

Impair Defenses: Disable or Modify Tools

T1140

Deobfuscate/Decode Files or Information

 

 

 

 

 

Persistence

T1053.005

Scheduled Task

T1547.001

Registry Run Keys / Startup Folder

T1037.001

Boot or Logon Initialization Scripts: Logon Script (Windows)

 

 

 

 

 

 

Discovery

T1010

Application Window Discovery

T1057

Process Discovery

T1082

System Information Discovery

T1083

File and Directory Discovery

 

 

 

Collection

T1056.001

Input Capture: Keylogging

T1113

Screen Capture

T1115

Clipboard Data

 

 

 

 

 

Command and Control

T1219

Remote Access Tools

T1090

Proxy

T1573

Encrypted Channel

Exfiltration

T1041

Exfiltration Over C2 Channel

Impact

T1529

System Shutdown/Reboot

form submtited
Gracias por leer

¿Este post ha sido útil?

Descargo de responsabilidad: Esta entrada de blog ha sido creada por Zscaler con fines únicamente informativos y se proporciona "tal cual" sin ninguna garantía de exactitud, integridad o fiabilidad. Zscaler no asume ninguna responsabilidad por cualquier error u omisión o por cualquier acción tomada en base a la información proporcionada. Cualquier sitio web de terceros o recursos vinculados en esta entrada del blog se proporcionan solo por conveniencia, y Zscaler no es responsable de su contenido o prácticas. Todo el contenido está sujeto a cambios sin previo aviso. Al acceder a este blog, usted acepta estos términos y reconoce su exclusiva responsabilidad de verificar y utilizar la información según convenga a sus necesidades.

Reciba en su bandeja de entrada las últimas actualizaciones del blog de Zscaler

Al enviar el formulario, acepta nuestra política de privacidad.