CRIL identified a campaign utilizing malicious .LNK files masquerading as a PDF document. Upon execution, the .LNK file loads and displays a human rights seminar invitation as a lure document, suggesting that the threat actor targets individuals with a background or interest in human rights issues.
We have also encountered a similar file used in this campaign, showing a public advisory as a lure document purportedly from the Philippine Statistics Authority. A security researcher made this discovery and shared it on Twitter.
Figure 1 – Similar file shared in Twitter
When targeted individuals mistakenly believe this to be a legitimate invitation or advisory and open it, they could inadvertently install a tiny backdoor into their system. This backdoor possesses remote control functionalities, allowing it to receive commands from a Command and Control (C&C) server and execute them as directed by the TA.
The attack sequence begins with a malicious .LNK file archived within a ZIP file, potentially distributed to users via phishing emails. When a user executes the .LNK file, it triggers the execution of a PowerShell script embedded within it. The PowerShell script is designed to execute a sequence of operations, including reading the content of the .LNK file and writing it into three distinct files in the %temp% location. These files include a lure PDF, encrypted data, and a custom MSBuild project.
Additionally, the PowerShell script executes the MSBuild project using “MSBuild.exe” and opens the lure document. This MSBuild project contains code to decrypt the encrypted data, which is then saved in a %temp% location with the .log extension. Subsequently, this .log file, also an MSBuild project, is scheduled to be executed using “MSBuild.exe” through Task Scheduler to carry out backdoor activities. The figure below shows the infection chain.
Figure 2 – infection chain
Upon execution of the disguised “Official_Invitation_Final_202406.lnk” file, a PowerShell command is triggered. This command extracts embedded data from the LNK file by reading specific hardcoded offsets and creates three distinct files in the %temp% location using the following names.
The file named “Official_Invitation_Final_202406.pdf” functions as a lure document, while “PK81yqIm8o” contains encrypted content. Additionally, “NqPCpRtWzcn” is identified as an MSBuild project.
The below image shows the embedded PowerShell script present in the malicious .LNK file.
Figure 3 – Embedded PowerShell script
After dropping these files in %temp% location, The PowerShell script opens the lure document, which is an invitation letter for a forthcoming seminar titled “Human Rights: A Global Perspective,” organized by a non-governmental organization (NGO). The image below displays the deceptive PDF file.
Figure 4 – Lure pdf
While opening the lure PDF file, the PowerShell Script silently executes the MSBuild project “NqPCpRtWzcn” using “MSBuild.exe.” MSBuild is a development tool for building applications, particularly useful in environments where Visual Studio is not installed. It operates using XML project files that contain project compilation specifications. Within the configuration file, the “UsingTask” element defines tasks that MSBuild will compile.
Additionally, MSBuild features an inline task capability, allowing code to be specified and compiled by MSBuild. This code can then be executed in memory during project builds. This ability to execute code in memory enables TAs to utilize MSBuild in fileless attacks. The figure below shows the MSBuild project file.
Figure 5 – MSBuild Project File – NqPCpRtWzcn
The malicious project file specifies a new class named “ClassExample” as an inline task, which is programmed to execute automatically when the project is built. The image below shows the content of the inline task.
Figure 6 – Contents of inline task
The inline task incorporates various functionalities to be executed:
1. It retrieves the encrypted content from the file “PK81yqIm8o” by utilizing the File.ReadAllText() method.
2. Using the rijndael algorithm, it decrypts the retrieved encrypted content.
Figure 7 – Using Rijndael algorithm for Decryption
3. The decrypted content is subsequently written to a new file named “nJUFcFfUF.log“. The image below displays the decrypted content, which is another MSBuild project file used to execute the final malicious inline task.
Figure 8 – Decrypted content
4. It creates a scheduled task to execute the newly generated log file using “MSBuild.exe” in the background every 20 minutes.
Figure 9 – Task Scheduler Entry to Execute log file (final backdoor payload)
When the scheduled task is triggered, it executes the decrypted MSBuild project file “nJUFcFfUF.log” using MSBuild.exe, which subsequently runs the inline task present within the project file directly in memory when the project is built.
The core functionality of this inline task begins with the “Execute” function. The image below shows the content of the “Execute” method.
Figure 10 – Code snippet showcasing the ‘Execute’ () functionalities
The Execute() method’s functionality involves creating two threads:
The first thread continuously monitors the running processes in the victim’s machine for any process main window title contains “MSBuild.exe” and hides if detected. This is an effort by TAs to conceal their activities from the user. The below image shows the code to hide the MSBuild.exe window from victims.
Figure 11 – Function to hide MSBuild.exe window
Before creating the second thread, the Execute() function generates a unique identifier (ID) by combining the domain name, username, and current process ID retrieved from the victim’s machine. This ID is used to uniquely identify the infected machine to the C&C server for further communications. The image below shows the code responsible for generating this unique ID.
Figure 12 – Generating unique ID
After generating the ID, the Execute() function starts the second thread, which is responsible for fetching and executing commands from the C&C server.
The C&C server “ies[.]inquirer[.]com[.]ph” identified in this campaign is a compromised website associated with The Philippine Daily newspaper. The image below displays the open directory of this compromised website serving as a storage space for TAs to store their payloads and other files.
Figure 13 – Open directory found in the compromised website
Using the generated ID, the thread initiates an HTTP request to the aforementioned compromised website (C&C) by utilizing the hardcoded URL present in the code:
The HTTP request also includes additional data, such as the previously generated unique identifier and other information. The image below shows this thread forming an HTTP POST request.
Figure 14 – HTTP POST request
Once the HTTP request is formed, the thread sends the request to the C&C server and verifies the response status code. If the response indicates an unsuccessful attempt, the thread terminates. If the response code indicates success, the thread reads the content of the response, which is enclosed within “[{” and “}]” and proceeds to execute the operations assigned by the TAs. The image below shows the various operations to be executed based on the response received from the C&C server.
Figure 15 – Commands
The backdoor manages its operations through the utilization of multiple threads, each designed to execute specific tasks:
Figure 16 – Executing shell commands
Figure 17 – Downloading other files from C&C
Figure 18 – Sending data to C&C
Figure 19 – Executing Powershell script
By coordinating these diverse operations, the backdoor functions as a versatile tool for TAs. It allows them to carry out subsequent malicious activities while avoiding detection and enhancing their control over compromised systems.
The tactics employed by the TAs in this campaign underscore the evolving landscape of cyber threats and the limitations of traditional antivirus solutions in combating them. Based on the lure document, it’s evident that the group has targeted individuals within the Philippines.
By leveraging legitimate applications such as MSBuild and exploiting inherent functionalities within operating systems, attackers can easily bypass conventional security measures. Through the deployment of this tiny backdoor on the victim’s system, TAs gain unfettered access to execute commands and launch subsequent operations seamlessly. Organizations must adopt a holistic security posture that integrates these various layers to effectively mitigate the risks posed by advanced adversaries.
We have listed some essential cybersecurity best practices that create the first line of control against attackers. We recommend that our readers follow the best practices given below:
Tactic | Technique | Procedure |
Execution (TA0002) | User Execution (T1203) | User opens the malicious Shortcut file |
Defense Evasion (TA0005) | Masquerading (T1036) | .LNK file masqueraded as a PDF document. |
Defense Evasion (TA0005) | Deobfuscate/Decode Files or Information (T1140) | Deobfuscate/Decode Files or Information |
Defense Evasion (TA0005) | Trusted Developer Utilities Proxy Execution (T1127.001) | MSBuild used to execute the malicious inline task. |
Persistence (TA0003) | Scheduled Task/Job (T1053.005) | Adds task schedular entry for persistence. |
C&C(TA0011) | Application Layer Protocol (T1071) | Backdoor communications with C&C server. |
Exfiltration (TA0036v) | Exfiltration Over C2 Channel (T1646) | Sending exfiltrated data over C&C server |
Indicators | Indicator Type | Description |
b4db8e598741193ea9e04c2111d0c15ba79b2fa098efc3680a63ef457e60dbd9 | Sha256 | Archive file ( Probably email attachment) |
6829ab9c4c8a9a0212740f46bf93b1cbe5d4256fb4ff66d65a3a6eb6c55758a1 | Sha256 | Malicious .LNK file |
8c97df4ca1a5995e22c2c4887bea2945269d6f5f158def98d5ebdd5311bb20c4 | Sha256 | Malicious MSBuild Project File ( final payload) |
76629afb86bd9024c3ea6759eeea197ba6c8c780e0041d1f8182d206cf3bd1b4 | Sha256 | Decoy PDF |
hxxps://ies[.]inquirer[.]com[.]ph | Domain | C&C |
c2618fb013135485f9f9aa27983df3371dfdcb7beecde86d02cee0c258d5ed7f | Sha256 | Zip file |
cac4d4364d20fa343bf681f6544b31995a57d8f69ee606c4675db60be5ae8775 | Sha256 | .LNK |
rule Tiny Backdoor{
meta:
author = "Cyble Research and Intelligence Labs"
description = "Detects Malicious MSBuild Project file used in this campaign"
date = "2024-05-20"
os = "Windows"
strings:
$a1 = "[<shell>]" ascii wide
$a2 = "[<sleep>]" ascii wide
$a3 = "[<upload>]" ascii wide
$a4 = "[<download>]" ascii wide
$a5 = "?m=c&id=" ascii wide fullword
condition:
all of them
}
https://blog.talosintelligence.com/tinyturla-next-generation
https://blog.talosintelligence.com/tinyturla