Cozy Bear (aka Nobelium, APT29, The Dukes) is a well-resourced, highly dedicated and organized cyberespionage group that is believed to work in support of the decision-making process of Russian government since at least 2008. Nobelium primarily targets western governments and related organizations, with a particular focus on government, diplomat, political and think tank sectors. Recently we analyzed several spear-phishing campaigns linked with this adversary that involve the usage of a side-loaded DLL through signed software (like Adobe suite) and legitimate webservices (like Dropbox) as communication vector for Command and Control (C&C). The misuse of legitimate webservices is in attempt to evade the detection from automatic analysis software. Recently, third-party researchers have also reported it used Trello and its REST API to simulate a first-level Command & Control server. In addition to this evasion attempt, as we are going to discuss later, the side-loaded DLL tries to unhook the windows libraries loaded in the process memory to evade possible EDRs.
To maximize the chances of success, Nobelium,in at least two cases, sent spear-phishing emails from spoofed or compromised government addresses. As initial access we identified the following attack vectors:
The first approach involves the distribution of an IMG file which, when mounted, contains an LNK shortcut and the signed software with the other DLLsand a decoy PDF as hidden files. This attack vector lures the user through a masquerading technique by changing the LNK file icon to a folder icon in order to convince the user to click on it. In fact, once triggered, the cmd.exe utility is invoked to run the signed executable and to start the side-loading of the malicious DLL (i.e. AcroSup.dll).
The second approach involves the usage of the EnvyScout dropper that is basically an HTML file with an embedded JavaScript designed to decode and drop the next-stage payload (HTML Smuggling). In fact, once the HTML file is executed, the JavaScript code decodes a bytes array and saves the result under an archive in the Download directory. In this case, the user is responsible to unzip the archive (that contains the signed software, the relative DLL’s and the lure PDF) and to run manually the executable to start the chain (even if the JavaScript code contains unused snippet for automating the process).
The EnvyScout dropper was used by this threat actor in different campaigns. From mid-January 2022 Cluster25 internally reported differet Nobelium-linkedcampaigns against European entities that leveraged fairly complex kill-chain started with EnvyScout as well.
INSIGHTS
In the reported case, the signed executable is represented by WCChromeNativeMessagingHost.exe from the Adobe Create PDF module of the Adobe suite. It’s a plugin for Google Chrome. Since the malware bundle contains a local copy of vcruntime140.dll, once the abused software is executed, the local copy of this Windows library is loaded into the program memory from the PE import table. Analyzing the local copy of vcruntime140.dll, we noticed that the PE imports of this library have been modified: it contains an entry to the AcroSup.dll delivered through the malware bundle.
So, this import chain, leads to the side-loading of the malicious AcroSup.dll and the execution of its DllMain export before the execution of the signed Adobe executable. To evade possible debuggers the execution of the malicious AcroSup.dll starts with a thread hijacking by overwriting the thread context of the main thread (updating the RIP register) in the signed executable space. To avoid the DLL execution in suspected processes, before the thread context overwriting the malware checks for the process image name is currently matching with the name of the signed expected executable, through the K32GetProcessImageFileNameA API.
After that the malware iterates on the loaded Windows DLLs through the K32EnumProcessModules APIs to unhook each DLL and evade active EDRs on the system. Basically, for each loaded DLL, the .text section of each of them is freshly mapped to the virtual address of the possible hooked DLL.
From this point the malware enters a pseudo-infinite loop where, each second, goes to contact the Dropbox service to communicate the victim identifier and receive next-stage payloads.
First of all, the api.dropbox.com endpoint is contacted at the /oauth2/token/ URI through an HTTP POST request to receive a refresh token, necessary to contact the Dropbox APIs.
For this request the following combination of API key and API secret are used to represent the Dropbox account used by the threat actor:
API key: fm09ogco339u0a9
API secret: scqekoaqqj98sze
In addition, for all the network-related requests the malware uses a fixed user-agent:
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 AtContent/91.5.2444.45
If the refresh token is received from the Dropbox APIs and successfully parsed, the implant proceeds with the integration of some masquerading and persistence techniques. More in details, a new subprocessis created to open the lure PDF document (an empty PDF) contained in the bundle and used to make the user think that he has opened the legit Adobe Acrobat application.
In the meanwhile, all the files involved in the bundle (signed software and relative DLL’s) are copied under the %APPDATA%\AcroSup\ directory and a new registry key under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\ is created to achieve persistence.
The lure PDF document is not copied under the above mentioned directory so this document will not be opened again after a restart of the victim system. To register the victim entry on Dropbox, a victim identifier is created through the hex-encoded combination of the current usernameand current computer name (e.g., john::windows10). The communication of the new victim is then completed through a push of a new .mp3 file(named Rock_[VICTIM_ID].mp3) via the Dropbox APIs on /2/files/upload/ URI.
Interestingly, the pushed .MP3 files identifying the victims, contains always the following string that likely represents the malware family:
ME3.99.5UUUUUUUUUUU
Finally, another request is performed to the /2/files/download/ path of Dropbox APIs that tries to download a file named Rock_VICTIM_ID.mp3.backup. The response is parsed to determine if a next-stage payload exists for the current registered victim. If one does, the malware will allocate a new heap space to store the downloaded payload and will execute it in the executable space by overwriting again the thread context of the main executable.
VICTIMOLOGY
In recent months Cluster25 had evidence of Cozy Bear‘s campaigns that potentially impacted at leastGreece, Italy, Turkey and Portugal especially in government and foreign affairs sectors.
CONCLUSIONS
NOBELIUM confirms its interest in government and foreign affairs by targeting organizations in Europe and possibly other parts of the world. The campaigns and the payloads analyzed over time show a strong focus on operating under the radar and lowering the detection rates. In this regard, even the use of legitimate services such as Trello and DropBox suggest the adversary’s will to operate for a long time within the victim environments remaining undetected. It is possible to foresee that this actor will also try to change TTPs (Technical and Tactical Procedures) in the near future in order to make any mitigation action aimed at its contrast more difficult. In this regard, we provide a wide set of detection rules useful for verifying potential malicious activities attributable to this threat actor (see DETECTION AND THREAT HUNTING SECTION).
ATT&CK MATRIX
TACTIC
TECHNIQUE
DESCRIPTION
Initial Access
T1566.001
Phishing: Spearphishing Attachment
Execution
T1204.001
User Execution: Malicious Link
Execution
T1204.002
User Execution: Malicious File
Execution
T1059.007
Command and Scripting Interpreter: JavaScript
Defense Evasion
T1036
Masquerading
Defense Evasion
T1622
Debugger Evasion
Defense Evasion
T1140
Deobfuscate/Decode Files or Information
Defense Evasion
T1027
Obfuscated Files or Information
Defense Evasion
T1055.003
Process Injection: Thread Execution Hijacking
Defense Evasion
T1553.002
Subvert Trust Controls: Code Signing
Defense Evasion
T1562.001
Impair Defenses: Disable or Modify Tools
Defense Evasion
T1112
Modify Registry
Defense Evasion
T1202
Indirect Command Execution
Defense Evasion
T1497
Virtualization/Sandbox Evasion
Defense Evasion
T1620
Reflective Code Loading
Discovery
T1082
System Information Discovery
Discovery
T1057
Process Discovery
Persistence
T1098
Account Manipulation
Persistence
T1547.001
Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder
NOTICE After additional reviews, the team at Cluster25 has determined that the code commonality identified in the two analyzed samples contained in this blog post was coincidental. The code they had in common is aligned with Microsoft standard libraries, and [...]
Cozy Bear (aka Nobelium, APT29, The Dukes) is a well-resourced, highly dedicated and organized cyberespionage group that is believed to work in support of the decision-making process of Russian government since at least 2008. Nobelium primarily targets western governments and related organizations, with a particular focus on government, diplomat, political and think tank sectors. Recently ...
NOTICE After additional reviews, the team at Cluster25 has determined that the code commonality identified in the two analyzed samples contained in this blog post was coincidental. The code they had in common is aligned with Microsoft standard libraries, and therefore common for use. In this blog post, Cluster25 outlines a code match between two ...