An APT hacking group known as “Dragon Breath”, “Golden Eye Dog” or “APT-Q-27” is exhibiting a new trend of using various complex variations of the classic DLL sideloading technique to evade detection.
These attack variants start with an initial actor leveraging a clean application, most often Telegram, which transfers a secondary, sometimes clean, payload that in turn transfers a malware DLL.
The lure for victims is Trojanized Telegram, LetsVPN or WhatsApp apps for Android, iOS or Windows purportedly targeted for people in China. Trojan applications are believed to be promoted using BlackSEO or malvertizing.
According to Sophos analysts who have been monitoring the recent attacks, the targeting scope of this campaign is focused on Windows users in China, Japan, Taiwan, Singapore, Hong Kong and the Philippines.
Double DLL sideloading
DLL sideloading is a technique that attackers have been exploiting since 2010, exploiting the way Windows loads Dynamic Link Library (DLL) files required by an application.
The attacker places a malicious DLL with the same name as the legitimate, required DLL in an application's directory. When the user launches the executable, Windows prioritizes the local malicious DLL over the one in the system folders.
The attacker's DLL contains malicious code that is loaded at this point, giving the attacker privileges or executing commands on the host, exploiting the trusted, signed application that loads it.
Victims run the installer of the mentioned apps, which creates a shortcut on the surface.
If the victim attempts to launch the desktop shortcut, which is the expected first step, instead of launching the application, the following command is executed on the system.
The command runs a version of 'regsvr32.exe' ('appR.exe') to run a version of 'scrobj.dll' ('appR.dll') and provides a DAT file ('appR.dat') as input . The DAT contains JavaScript code to be executed by the script execution engine library ('appR.dll').
The JavaScript code launches the Telegram app's user interface in the foreground, while installing various parallel loading components in the background.
It then loads an application using a clean dependency ('libexpat.dll') to load a second clean application as an intermediate attack stage.
In a variation of the attack, the clean application “XLGame.exe” is renamed to “Application.exe” and the loader is also a clean executable, signed by Beijing Baidu Netcom Science and Technology Co., Ltd.
In another variant, the clean loader is “KingdomTwoCrowns.exe”, which is not digitally signed and Sophos was unable to determine what benefit it offers other than obfuscating the execution chain.
In a third variant of the attack, the loader is the clean executable “d3dim9.exe”, digitally signed by HP Inc.
The final payload
In all observed attack variants, the final DLL payload is decrypted from a txt file (“templateX.txt”) and executed on the system.
This payload is a backdoor that supports various commands such as rebooting the system, modifying registry keys, recovering files, stealing content, running commands in a hidden CMD window, and more.
The backdoor also targets Chrome's MetaMask extension for the MetaMask cryptocurrency wallet, aiming to steal digital assets from victims.
In summary, DLL sideloading remains an effective attack method for hackers, and one that Microsoft and developers have failed to address for over a decade.
In the latest APT-Q-27 attack, analysts observed sideloading DLL variants that are difficult to detect.
