At the end of May, we discovered a campaign distributing Remote Access Trojans (RAT) — programs that enable attackers to remotely control an infected system.
The group we are examining is notable for not selecting a specific family of RATs for infection. Several trojans (all widely available) were observed in the attacks of this campaign. This characteristic reminded us of the rat king — a mythical creature consisting of rodents with intertwined tails.

The original source is from K. N. Rossikov's monograph “Mice and Murine Rodents of Economic Importance” (1908).
In honor of this creature, we named the group we are examining RATKing. In this post, we will provide detailed information on how the attackers conducted the attack, what tools they used, and we will share our thoughts on the attribution of this campaign.
Attack Process
All attacks in this campaign followed the next algorithm:
- The user received a phishing email with a link to Google Drive.
- By following the link, the victim downloaded a malicious VBS script that registered a DLL library to load the final payload into the Windows registry and launched PowerShell to execute it.
- The DLL library implanted the final payload — specifically, one of the RATs used by the attackers — into a system process and registered the VBS script for autostart, ensuring it remained on the infected machine.
- The final payload executed in the system process and gave the attacker the ability to control the infected computer.
This can be represented schematically as follows:

Next, we will focus on the first three stages, as we are specifically interested in the delivery mechanism of the malware. We will not go into detail about how the malware itself operates. It is readily available — either sold on specialized forums or even distributed as open-source projects — meaning it is not unique to the RATKing group.
Analysis of Attack Stages
Stage 1. Phishing Campaign
The attack began with the victim receiving a malicious email (attackers used various templates; one of the examples is shown in the screenshot below). The message contained a link to a legitimate storage drive.google.com, which supposedly led to a document download page in PDF format.

Example of a phishing email
However, instead of a PDF document, a VBS script was actually downloaded.
When clicking the link in the email shown in the screenshot above, a file was downloaded with the name Cargo Flight Details.vbs. In this case, the attackers didn't even try to disguise the file as a legitimate document.
At the same time, within this campaign, we found a script named Cargo Trip Detail.pdf.vbs. It could already pass for a legitimate PDF because Windows, by default, hides file extensions. However, in this case, its icon, which corresponded to a VBS script, could still raise suspicion.
At this point, the victim could recognize the deception: just take a moment to look at the downloaded files. However, in such phishing campaigns, attackers often rely on inattentive or rushed users.
Stage 2. Operation of the VBS script
The VBS script that the user might open accidentally wrote a DLL library to the Windows registry. The script was obfuscated: the lines were written in bytes separated by a random character.

Example of an obfuscated script
The deobfuscation algorithm is quite simple: every third character was removed from the obfuscated string, after which the result was decoded from base16 to the original string. For example, from the value 57Q53s63t72s69J70r74e2El53v68m65j6CH6Ct (highlighted in the screenshot above), the string WScript.Shell.
was obtained. For deobfuscating the strings, we used a function in Python:
def decode_str(data_enc):
return binascii.unhexlify(''.join([data_enc[i:i+2] for i in range(0, len(data_enc), 3)]))Below, in lines 9-10, the value is highlighted, whose deobfuscation produced a DLL file. It was this file that was launched in the next stage using PowerShell.
![]()
String with obfuscated DLL
Each function in the VBS script executed as the strings were deobfuscated.
After starting the script, the function was called wscript.sleep — which was used for delayed execution.
The script then interacted with the Windows registry. It utilized WMI technology for this purpose. Using this technology, a unique key was created, and the executable file's body was recorded in its parameter. Accessing the registry via WMI was performed using the following command:
GetObject(winmgmts {impersonationLevel=impersonate}!\.rootdefault:StdRegProv) 
The entry made in the registry by a VBS script
Step 3. DLL Library Operation
In the third step, the malicious DLL library loaded the final payload, injected it into the system process, and ensured the VBS script would run automatically when the user logged into the system.
Launching through PowerShell
The DLL library was executed using the following command in PowerShell:
[System.Threading.Thread]::GetDomain().Load((ItemProperty HKCU://Software///).);
[GUyyvmzVhebFCw]::EhwwK('WScript.ScriptFullName', 'rWZlgEtiZr', 'WScript.ScriptName'),0This command did the following:
- retrieved the registry value with the name
rnd_value_name— this data represented a DLL file written on the .Net platform; - loaded the obtained .Net module into the memory of the process
powershell.exeusing the function[System.Threading.Thread]::GetDomain().Load()(detailed description of the Load() function ); - executed the function
GUyyvmzVhebFCw]::EhwwK()— this marked the execution of the DLL library — with parametersvbsScriptPath,xorKey,vbsScriptName. The parameterxorKeyheld the key for decrypting the final payload, while the parametersvbsScriptPathandvbsScriptNamewere passed to facilitate the registration of the VBS script for auto-start.
Description of the DLL Library
In decompiled form, the loader looked like this:

The loader in decompiled form (the function from which the execution of the DLL library began is highlighted in red)
The loader is protected by the .Net Reactor protector. The utility de4dot effectively handles the removal of this protector.
This loader:
- performed an injection of the payload into the system process (in this case, it's
svchost.exe); - registered the VBS script for auto-start.
Payload Injection
Let's consider the function that was called by the PowerShell script.

The function called by the PowerShell script
This function performed the following actions:
- decrypted two data arrays (
arrayandarray2in the screenshot). Initially, they were compressed using gzip and encrypted with an XOR algorithm using the keyxorKey; - copied the data into allocated memory areas. The data from
array— into the memory area pointed to byintPtr(payload pointerin the screenshot); the data fromarray2— into the memory area pointed to byintPtr2(shellcode pointeron the screenshot); - called the function
CallWindowProcA( this function is available on the Microsoft site) with the following parameters (the names of the parameters are listed below, they appear in the same order on the screenshot, but with working values):lpPrevWndFunc— a pointer to data fromarray2;hWnd— a pointer to the string containing the path to the executable filesvchost.exe;Msg— a pointer to data fromarray;wParam,lParam— message parameters (in this case, these parameters were not used and had values of 0);
- created a file
%AppData%MicrosoftWindowsStart MenuProgramsStartup.url, where<name>— the first 4 characters of the parametervbsScriptName(on the screenshot, the code fragment for this action starts with the commandFile.Copy). Thus, the malware added the URL file to the list of files for autostart when the user logs into the system, thereby establishing persistence on the infected computer. The URL file contained a link to the script:
[InternetShortcut]
URL = file : /\/\/
To understand how the injection was carried out, we deciphered the data arrays. array and array2For this, we used the following function in Python:
def decrypt(data, key):
return gzip.decompress(
bytearray([data[i] ^ key[i % len(key)] for i in range(len(data))])[4:])
As a result, we determined that:
arrayit was a PE file — this is the final payload;array2it represented the shellcode necessary for the injection.
The shellcode from the array array2 was passed as a value to the function lpPrevWndFunc to the function CallWindowProcA. lpPrevWndFunc — the callback function, its prototype looks like this:
LRESULT WndFunc(
HWND hWnd,
UINT Msg,
WPARAM wParam,
LPARAM lParam
);
Thus, when the function is called CallWindowProcA with the parameters hWnd, Msg, wParam, lParam the shellcode from the array is executed array2 with the arguments hWnd and Msg. hWnd — this is a pointer to the string containing the path to the executable file svchost.exe, and Msg — a pointer to the final payload.
The shellcode obtained the addresses of the functions from kernel32.dll and ntdll32.dll by the hash values of their names and injected the final payload into the memory of the process svchost.exe, using the Process Hollowing technique (details about it can be read in this ). When injecting, the shellcode:
- created a process
svchost.exein a suspended state using the functionCreateProcessW; - then concealed the display of the section in the address space of the process
svchost.exeusing the functionNtUnmapViewOfSection. Thus, the program released the memory of the original processsvchost.exe, so that it could then allocate memory for the payload at this address; - allocated memory for the payload in the address space of the process
svchost.exeusing the functionVirtualAllocEx;

Beginning of the injection process
- wrote the payload content to the process's address space
svchost.exeusing the functionWriteProcessMemory(as shown in the screenshot below); - resumed the process
svchost.exeusing the functionResumeThread.

Ending the inject process
loaded malware
As a result of the actions described, one of several RAT-class malicious programs was installed in the infected system. The table below lists the malware used in the attack that we can confidently attribute to one group of attackers, as the samples connected to the same command server.
Malware name
First detected
SHA-256
C&C
The process into which the inject occurs
Darktrack
16-04-2020
ea64fe672c953adc19553ea3b9118ce4ee88a14d92fc7e75aa04972848472702
kimjoy007.dyndns[.]org:2017
svchost
Parallax
24-04-2020
b4ecd8dbbceaadd482f1b23b712bcddc5464bccaac11fe78ea5fd0ba932a4043
kimjoy007.dyndns[.]org:2019
svchost
WARZONE
18-05-2020
3786324ce3f8c1ea3784e5389f84234f81828658b22b8a502b7d48866f5aa3d3
kimjoy007.dyndns[.]org:9933
svchost
Netwire
20-05-2020
6dac218f741b022f5cad3b5ee01dbda80693f7045b42a0c70335d8a729002f2d
kimjoy007.dyndns[.]org:2000
svchost
Examples of malware distributed with the same command server
Two things are noteworthy here.
Firstly, the fact that the attackers used several different families of RATs. Such behavior is not typical for known cyber groups that often use a roughly identical set of their favorite tools.
Secondly, RATKing used malware that is either sold on specialized forums for a low price or is even open-source projects.
A more comprehensive list of the malware used in the campaign — with one important caveat — is provided at the end of the article.
About the group
We cannot attribute the described malicious campaign to any known attackers. For now, we believe that these attacks were carried out by a fundamentally new group. As we mentioned at the beginning, we called it RATKing.
To create the VBS script, the group likely used a tool similar to the utility from the developer . This is indicated by the similarity of the script created by this program to the attackers' script. In particular, both scripts:
- perform delayed execution using the function
Sleep; - use WMI;
- write the body of the executable file as a registry key parameter;
- execute this file using PowerShell in its own address space.
For clarity, compare the PowerShell command to run a file from the registry used in the script created with VBS-Crypter:
((Get-ItemProperty HKCU:Software NYANxCAT).NYANxCAT); $text = -join $text[-1..-$text.Length]; [AppDomain]::CurrentDomain.Load([Convert]::FromBase64String($text)).EntryPoint.Invoke($Null, $Null);with a similar command used by the attackers' script:
[System.Threading.Thread]::GetDomain().Load((ItemProperty HKCU://Software///).);
[GUyyvmzVhebFCw]::EhwwK('WScript.ScriptFullName', 'rWZlgEtiZr', 'WScript.ScriptName'),0
Note that as one of the payloads, the attackers used another utility from NYAN-x-CAT — .
The C&C server addresses indicate another distinctive feature of RATKing: the group prefers dynamic DNS services (see the list of C&C in the IoC table).
IoC
The table below presents a complete list of VBS scripts that are highly likely attributed to the described campaign. All these scripts are similar and perform roughly the same sequence of actions. They all inject RAT-class malware into trusted Windows processes. All of their C&C addresses are registered using Dynamic DNS services.
However, we cannot assert that all these scripts were distributed by the same attackers, except for the samples with the same C&C addresses (for example, kimjoy007.dyndns.org).
Malware name
SHA-256
C&C
The process into which the inject occurs
Parallax
b4ecd8dbbceaadd482f1b23b712bcddc5464bccaac11fe78ea5fd0ba932a4043
kimjoy007.dyndns.org
svchost
00edb8200dfeee3bdd0086c5e8e07c6056d322df913679a9f22a2b00b836fd72
hope.doomdns.org
svchost
504cbae901c4b3987aa9ba458a230944cb8bd96bbf778ceb54c773b781346146
kimjoy007.dyndns.org
svchost
1487017e087b75ad930baa8b017e8388d1e99c75d26b5d1deec8b80e9333f189
kimjoy007.dyndns.org
svchost
c4160ec3c8ad01539f1c16fb35ed9c8c5a53a8fda8877f0d5e044241ea805891
franco20.dvrdns.org
svchost
515249d6813bb2dde1723d35ee8eb6eeb8775014ca629ede017c3d83a77634ce
kimjoy007.dyndns.org
svchost
1b70f6fee760bcfe0c457f0a85ca451ed66e61f0e340d830f382c5d2f7ab803f
franco20.dvrdns.org
svchost
b2bdffa5853f29c881d7d9bff91b640bc1c90e996f85406be3b36b2500f61aa1
hope.doomdns.org
svchost
c9745a8f33b3841fe7bfafd21ad4678d46fe6ea6125a8fedfcd2d5aee13f1601
kimjoy007.dyndns.org
svchost
1dfc66968527fbd4c0df2ea34c577a7ce7a2ba9b54ba00be62120cc88035fa65
franco20.dvrdns.org
svchost
c6c05f21e16e488eed3001d0d9dd9c49366779559ad77fcd233de15b1773c981
kimjoy007.dyndns.org
cmd
3b785cdcd69a96902ee62499c25138a70e81f14b6b989a2f81d82239a19a3aed
hope.doomdns.org
svchost
4d71ceb9d6c53ac356c0f5bdfd1a5b28981061be87e38e077ee3a419e4c476f9
2004para.ddns.net
svchost
00185cc085f284ece264e3263c7771073a65783c250c5fd9afc7a85ed94acc77
hope.doomdns.org
svchost
0342107c0d2a069100e87ef5415e90fd86b1b1b1c975d0eb04ab1489e198fc78
franco20.dvrdns.org
svchost
de33b7a7b059599dc62337f92ceba644ac7b09f60d06324ecf6177fff06b8d10
kimjoy007.dyndns.org
svchost
80a8114d63606e225e620c64ad8e28c9996caaa9a9e87dd602c8f920c2197007
kimjoy007.dyndns.org
svchost
acb157ba5a48631e1f9f269e6282f042666098614b66129224d213e27c1149bb
hope.doomdns.org
cmd
bf608318018dc10016b438f851aab719ea0abe6afc166c8aea6b04f2320896d3
franco20.dvrdns.org
svchost
4d0c9b8ad097d35b447d715a815c67ff3d78638b305776cde4d90bfdcb368e38
hope.doomdns.org
svchost
e7c676f5be41d49296454cd6e4280d89e37f506d84d57b22f0be0d87625568ba
kimjoy007.dyndns.org
svchost
9375d54fcda9c7d65f861dfda698e25710fda75b5ebfc7a238599f4b0d34205f
franco20.dvrdns.org
svchost
128367797fdf3c952831c2472f7a308f345ca04aa67b3f82b945cfea2ae11ce5
kimjoy007.dyndns.org
svchost
09bd720880461cb6e996046c7d6a1c937aa1c99bd19582a562053782600da79d
hope.doomdns.org
svchost
0a176164d2e1d5e2288881cc2e2d88800801001d03caedd524db365513e11276
paradickhead.homeip.net
svchost
0af5194950187fd7cbd75b1b39aab6e1e78dae7c216d08512755849c6a0d1cbe
hope.doomdns.org
svchost
Warzone
3786324ce3f8c1ea3784e5389f84234f81828658b22b8a502b7d48866f5aa3d3
kimjoy007.dyndns.org
svchost
db0d5a67a0ced6b2de3ee7d7fc845a34b9d6ca608e5fead7f16c9a640fa659eb
kimjoy007.dyndns.org
svchost
Netwire
6dac218f741b022f5cad3b5ee01dbda80693f7045b42a0c70335d8a729002f2d
kimjoy007.dyndns.org
svchost
Darktrack
ea64fe672c953adc19553ea3b9118ce4ee88a14d92fc7e75aa04972848472702
kimjoy007.dyndns.org
svchost
WSH RAT
d410ced15c848825dcf75d30808cde7784e5b208f9a57b0896e828f890faea0e
anekesolution.linkpc.net
RegAsm
Lime
896604d27d88c75a475b28e88e54104e66f480bcab89cc75b6cdc6b29f8e438b
softmy.duckdns.org
RegAsm
QuasarRAT
bd1e29e9d17edbab41c3634649da5c5d20375f055ccf968c022811cd9624be57
darkhate-23030.portmap.io
RegAsm
12044aa527742282ad5154a4de24e55c9e1fae42ef844ed6f2f890296122153b
darkhate-23030.portmap.io
RegAsm
be93cc77d864dafd7d8c21317722879b65cfbb3297416bde6ca6edbfd8166572
darkhate-23030.portmap.io
RegAsm
933a136f8969707a84a61f711018cd21ee891d5793216e063ac961b5d165f6c0
darkhate-23030.portmap.io
RegAsm
71dea554d93728cce8074dbdb4f63ceb072d4bb644f0718420f780398dafd943
chrom1.myq-see.com
RegAsm
0d344e8d72d752c06dc6a7f3abf2ff7678925fde872756bf78713027e1e332d5
darkhate-23030.portmap.io
RegAsm
0ed7f282fd242c3f2de949650c9253373265e9152c034c7df3f5f91769c6a4eb
darkhate-23030.portmap.io
RegAsm
aabb6759ce408ebfa2cc57702b14adaec933d8e4821abceaef0c1af3263b1bfa
darkhate-23030.portmap.io
RegAsm
1699a37ddcf4769111daf33b7d313cf376f47e92f6b92b2119bd0c860539f745
darkhate-23030.portmap.io
RegAsm
3472597945f3bbf84e735a778fd75c57855bb86aca9b0a4d0e4049817b508c8c
darkhate-23030.portmap.io
RegAsm
809010d8823da84cdbb2c8e6b70be725a6023c381041ebda8b125d1a6a71e9b1
darkhate-23030.portmap.io
RegAsm
4217a2da69f663f1ab42ebac61978014ec4f562501efb2e040db7ebb223a7dff
darkhate-23030.portmap.io
RegAsm
08f34b3088af792a95c49bcb9aa016d4660609409663bf1b51f4c331b87bae00
darkhate-23030.portmap.io
RegAsm
79b4efcce84e9e7a2e85df7b0327406bee0b359ad1445b4f08e390309ea0c90d
darkhate-23030.portmap.io
RegAsm
12ea7ce04e0177a71a551e6d61e4a7916b1709729b2d3e9daf7b1bdd0785f63a
darkhate-23030.portmap.io
RegAsm
d7b8eb42ae35e9cc46744f1285557423f24666db1bde92bf7679f0ce7b389af9
darkhate-23030.portmap.io
RegAsm
def09b0fed3360c457257266cb851fffd8c844bc04a623c210a2efafdf000d5c
darkhate-23030.portmap.io
RegAsm
50119497c5f919a7e816a37178d28906fb3171b07fc869961ef92601ceca4c1c
darkhate-23030.portmap.io
RegAsm
ade5a2f25f603bf4502efa800d3cf5d19d1f0d69499b0f2e9ec7c85c6dd49621
darkhate-23030.portmap.io
RegAsm
189d5813c931889190881ee34749d390e3baa80b2c67b426b10b3666c3cc64b7
darkhate-23030.portmap.io
RegAsm
c3193dd67650723753289a4aebf97d4c72a1afe73c7135bee91c77bdf1517f21
darkhate-23030.portmap.io
RegAsm
a6f814f14698141753fc6fb7850ead9af2ebcb0e32ab99236a733ddb03b9eec2
darkhate-23030.portmap.io
RegAsm
a55116253624641544175a30c956dbd0638b714ff97b9de0e24145720dcfdf74
darkhate-23030.portmap.io
RegAsm
d6e0f0fb460d9108397850169112bd90a372f66d87b028e522184682a825d213
darkhate-23030.portmap.io
RegAsm
522ba6a242c35e2bf8303e99f03a85d867496bbb0572226e226af48cc1461a86
darkhate-23030.portmap.io
RegAsm
fabfdc209b02fe522f81356680db89f8861583da89984c20273904e0cf9f4a02
darkhate-23030.portmap.io
RegAsm
08ec13b7da6e0d645e4508b19ba616e4cf4e0421aa8e26ac7f69e13dc8796691
darkhate-23030.portmap.io
RegAsm
8433c75730578f963556ec99fbc8d97fa63a522cef71933f260f385c76a8ee8d
darkhate-23030.portmap.io
RegAsm
99f6bfd9edb9bf108b11c149dd59346484c7418fc4c455401c15c8ac74b70c74
darkhate-23030.portmap.io
RegAsm
d13520e48f0ff745e31a1dfd6f15ab56c9faecb51f3d5d3d87f6f2e1abe6b5cf
darkhate-23030.portmap.io
RegAsm
9e6978b16bd52fcd9c331839545c943adc87e0fbd7b3f947bab22ffdd309f747
darkhate-23030.portmap.io
RegAsm
Source: habr.com
