Operation DarkCasino: In-Depth Analysis of Attacks by APT Group Evilnum (Part 2)

Operation DarkCasino: In-Depth Analysis of Attacks by APT Group Evilnum (Part 2)

September 20, 2022 | Adeline Zhang

Operation DarkCasino: In-Depth Analysis of Attacks by APT Group Evilnum (Part 1)


Evilnum mainly used a new customized trojan in this operation. NSFOCUS Security Labs named it DarkMe based on the particular string in the trojan program.

NSFOCUS Security Labs also discovered another new trojan program that had a close connection to this operation and named it PikoloRAT, also based on the particular string in the program.

1. DarkMe

DarkMe is a VisualBasic spy trojan developed by Evilnum attackers and is used in various attack flows. The initial version of DarkMe appeared on September 25, 2021, and five iteration versions have been released so far.

The communication ability of DarkMe is implemented through the public module WinSock32 (http://leandroascierto.com/blog/winsock32/). This module creates a window named SOCKET_WINDOW to implement socket communication with the server.

On the basis of this module, a significant number of functional codes are gradually added to DarkMe, allowing it to evolve from a downloader trojan into a stub spy trojan.

  • Functions

Different versions of DarkMe have different functional codes. Here, we will describe the trojan program version 5, ShellRunDllVb.dll, that appeared in this operation.

After ShellRunDllVb.dll is executed, it will collect host information and send it to the C&C server. DarkMe collects the following host information, including the geolocation abbreviation, country name, computer name, user name, antivirus software list, trojan mark, and the title of the foreground window. These items are separated by a fixed separator 0x3F, and prepended with a fixed string “92”. The resulting register information is then sent to the C&C server.

Register traffic of DarkMe

DarkMe has multiple modules to support different espionage functions. clsfile is a major module used to implement file operations under C&C control. The C&C instruction is contained in the first six bytes of the communication content. The function of each instruction is described as follows:

Description of DarkMe instructions

In addition, DarkMe has been integrated with a set of public codes to achieve the screenshot function.

Screenshot function implemented by DarkMe (right) and public code (left)

DarkMe also provides persistence and self-updating functions as well as the keylogging function in some versions.

  • Versions

With a deeper look at samples in the wild, NSFOCUS Security Labs found DarkMe had a history of more than half a year, and was already available in multiple versions. The version iteration timeline of DarkMe is as follows:

Version iteration of DarkMe

It can be seen that during its lifecycle, DarkMe has evolved from a loader trojan to a spy trojan, and then to a stub payload integrated into complex attack flows. DarkMe version 4 and DarkMe version 5 both have complete code functions and can be used as a primary stealing tool or as a loader for other tools, so they were widely adopted by Evilnum attackers in recent attacks.

2. PikoloRAT

NSFOCUS discovered another new remote control trojan, PikoloRAT, during the in-depth analysis of the relevant information of this operation. PikoloRAT comes with typical remote control functions and can use built-in components to implement more complex control operations.

Since the built-in C&C addresses of PikoloRAT were found to coincide with the addresses used in this operation and PikoloRAT could complement the above-mentioned DarkMe, NSFOCUS Security Labs believed that PikoloRAT was used as an extension component by Evilnum attackers in the later stage of this operation.

The discovered cases demonstrated that PikoloRAT was delivered via a downloader trojan or packaged as a compressed file.

  • Functions

PikoloRAT is a typical RAT trojan program written in C#.

Main frame of PikoloRAT

After PikoloRAT runs, it first collects and uploads the host information. The collected contents include the trojan mark, user name, computer name, geolocation, operating system version, trojan running time, trojan version, and antivirus software information. PikoloRAT uses a “|” to separate the preceding items, prepends them with a fixed string “654321”, and then sends it to the C&C server.

Online traffic of PikoloRAT

It can be seen that the content and format of the online traffic of PikoloRAT are similar to those of the above-mentioned DarkMe.

Then PikoloRAT enters the controlled state to control host behaviors by obtaining instructions from C&C servers. The supported remote control instructions are as follows:

Description of PikoloRAT instructions

In addition to basic remote control functions, PikoloRAT can perform more sophisticated remote control by dropping the built-in PEGASUS HVNC module, a recently leaked hVNC tool.

Techniques and Tactics

Overwriting Files While Sideloading

In attack flow A, Evilnum attackers delivered a malicious file python39.dll and sideloaded it through a legitimate file python.exe. Different from common sideloading build logics, python39.dll was obtained by directly overwriting the original python39.dll. Evilnum attackers directly wrote a piece of shellcode to the location of the function PyImport_AddModuleObject of the original python39.dll so that the shellcode was started when python39.dll was loaded.

The benefits of this design are:

  • Easy to operate. It is not required to compile a separate DLL program to implement the export.
  • Wide applicability. In theory, any legitimate DLL file can be overwritten in a similar way to build a sideloading shellcode attack chain.
  • Strong concealment. The new DLL file is so similar to the original DLL file that it is not easy to locate.
Overwritten PyImport_AddModuleObject function in python39.dll

Shellcode Framework

In attack flow A, Evilnum attackers used different shellcodes at different stages. Since these shellcodes had similar code implementation logic, NSFOCUS Security Labs believed that they originated from the same shellcode programming framework. The overall composition and code complexity in this operation were improved compared to previous Evilnum activities.

ntdll Mapping

In the shellcode used in this operation, Evilnum attackers still adopted two modules, kernel32 and ntdll, to build the main attack flow. To avoid API detection for such behaviors, the attackers used the following method to map the ntdll file and use the API of the mapped file.

Mapping logic of the ntdll module in the shellcode

In the implementation, the attacker reloaded the ntdll module through file mapping, and obtained the API base address of the mapped API by calculating the offset of the base address of the API in the original ntdll file. Then the shellcode used the mapped API to implement corresponding behaviors, thus avoiding original API call behaviors and preventing key parameters from being monitored and recorded.


In attack flow A, Evilnum attackers used X64call to call key APIs while injecting cmd.exe.

The injected shellcode firstly detected the process environment and the host CPU model. If the requirements were satisfied, it would call their 64-bit implementations while using key injection APIs such as NtAllocateVirtualMemory and NtWriteVirtualMemory.

X64call calling logic in the shellcode injection code
X64call calling code

This technique can also bypass API detection.

Image Steganography

Evilnum attackers used two types of steganographic images in this operation.

In attack flow B, the image IMG.jpg used redundant steganography that deposited the malicious code at the end of the file and used a fixed string ($HEH$E) as the separator.

Steganographic information in IMG.jpg.

In attack flow A, the image carrying the payload used the RGB color image steganography scheme that deposited the malicious code in the R color pixel.

RGB values in the steganographic image sKr93I.png (right) and extracted compressed data content (left)

This construction could make blue-green dots show in white areas and red dots show in black areas in the steganographic image.

Appearance of the steganographic image sKr93I.png
Appearance of the steganographic image Fruit.png

Socket Window

In this operation, the trojan DarkMe used SOCKET_WINDOW communication, an old VisualBasic socket programming technique that hooks winsock messages through a SOCKET_WINDOW window and handles event messages passed by WSAAsyncSelect in the window callback function. For the original framework, refer to here.

COM Component Execution

Some DarkMe trojans were delivered as COM components in this operation. Evilnum attackers wrote the registry operation logic to the preloaded trojan payload, allowing it to generate and execute the file Register.reg that contained the following contents.

Contents of Register.reg

Then the preloaded trojan payload started DarkMe via a cmd command in the form like rundll /sta [CLSID] ‘Hello’. This could avoid direct calls to DarkMe, reducing exposure risks to a certain extent.


Operation DarkCasino is a series of ongoing APT attacks targeting cash flows in online trading. The Evilnum group adopted a variety of ever-improving attack techniques and tools, demonstrating its keen sense of confrontation.

The analysis showed that the attack scope of Operation DarkCasino was not limited to Europe. Under the operation of the Evilnum attackers, this attack was extended to some Asian countries, which may cause unexpected damage.

To effectively prevent this operation, online financial platform users should pay special attention to files of LNK, PIF, SCR, and COM types transmitted through various channels and be more vigilant of files with keywords such as offer, visa, and casino to avoid Evilnum attacks, which may cause direct economic losses.

Indicators of Compromise (IoCs)

Decoy files of attack flow A

43eda4ff53eef4513716a5b773e6798653ee29544b44a9ae16aa7af160a996f2offer deal visa 2022.lnk

Decoy files of attack flow B

5fb252474237a4ca96cc0433451c7d7a847732305d95ceeaeb10693ecef2eeeeScatters Casino offers Daily Promotions.pif
8e4a4c5e04ff7ebacb5fe8ff6b27129c13e91a1acc829dbb3001110c84dc8633new casino crypto.com
d0899cb4b94e66cb8623e823887d87aa7561db0e9cf4028ae3f46a7b599692b9Promo CPL CPA Traffic.com

Decoy files of attack flow C

3329f5e3a67d13bd602dca5bbe8e2d0b5d3b5cb7cb308965fb2599a66668c207offer crypto casino.scr
8a49a7f6c95fade72ef86455794cdedfca9129aa0f5281e09929dfebfb3417c4DOCUMENTATION AGREEMENTS S CONSULTING INTEGRATION.pif

Downloader Trojan


PikoloRAT Trojan


DarkMe Trojan




Darkme C&C


PikoloRAT C&C